Changeset 10717
- Timestamp:
- Jun 3, 2010, 7:53:01 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gtk/tr-core-dbus.xml
r8669 r10717 5 5 <arg type="b" name="handled" direction="out"/> 6 6 <arg type="s" name="metainfo" direction="in"/> 7 <arg type="s" name="filename" direction="in"/> 7 8 </method> 8 9 <method name="PresentWindow"> -
trunk/gtk/tr-core.c
r10644 r10717 959 959 tr_core_add_metainfo( TrCore * core, 960 960 const char * payload, 961 const char * filename, 961 962 gboolean * setme_handled, 962 963 GError ** gerr UNUSED ) … … 973 974 *setme_handled = TRUE; 974 975 } 975 else /* base64-encoded metainfo */ 976 { 977 int file_length; 976 else 977 { 978 978 tr_ctor * ctor; 979 char * file_contents; 980 gboolean do_prompt = pref_flag_get( PREF_KEY_OPTIONS_PROMPT ); 981 979 gboolean has_metainfo = FALSE; 980 const gboolean do_prompt = pref_flag_get( PREF_KEY_OPTIONS_PROMPT ); 981 982 /* create the constructor */ 982 983 ctor = tr_ctorNew( session ); 983 984 tr_core_apply_defaults( ctor ); 984 985 985 file_contents = tr_base64_decode( payload, -1, &file_length ); 986 tr_ctorSetMetainfo( ctor, (const uint8_t*)file_contents, file_length ); 987 add_ctor( core, ctor, do_prompt, TRUE ); 988 989 tr_free( file_contents ); 990 tr_core_torrents_added( core ); 991 *setme_handled = TRUE; 986 if( !has_metainfo && g_file_test( filename, G_FILE_TEST_IS_REGULAR ) ) 987 { 988 /* set the metainfo from a local file */ 989 has_metainfo = !tr_ctorSetMetainfoFromFile( ctor, filename ); 990 } 991 992 if( !has_metainfo ) 993 { 994 /* base64-encoded metainfo */ 995 int file_length; 996 char * file_contents = tr_base64_decode( payload, -1, &file_length ); 997 has_metainfo = !tr_ctorSetMetainfo( ctor, (const uint8_t*)file_contents, file_length ); 998 tr_free( file_contents ); 999 } 1000 1001 if( has_metainfo ) 1002 { 1003 add_ctor( core, ctor, do_prompt, TRUE ); 1004 tr_core_torrents_added( core ); 1005 } 1006 1007 *setme_handled = has_metainfo; 992 1008 } 993 1009 -
trunk/gtk/tr-core.h
r10550 r10717 134 134 /** @brief Add a torrent. */ 135 135 gboolean tr_core_add_metainfo( TrCore * core, 136 const char * base64_metainfo, 136 const char * payload, 137 const char * optional_filename, 137 138 gboolean * setme_success, 138 139 GError ** err ); -
trunk/gtk/util.c
r10698 r10717 564 564 dbus_g_proxy_call( proxy, "AddMetainfo", &err, 565 565 G_TYPE_STRING, payload, 566 G_TYPE_STRING, filename, 566 567 G_TYPE_INVALID, 567 568 G_TYPE_BOOLEAN, &handled, -
trunk/qt/dbus-adaptor.cc
r10532 r10717 11 11 */ 12 12 13 #include <QFile> 13 14 #include "app.h" 14 15 #include "dbus-adaptor.h" … … 28 29 29 30 bool 30 TrDBusAdaptor :: AddMetainfo( const QString& str)31 TrDBusAdaptor :: AddMetainfo( const QString& payload, const QString& filename ) 31 32 { 32 myApp->addTorrent( str);33 myApp->addTorrent( QFile(filename).exists() ? filename : payload ); 33 34 return true; 34 35 } -
trunk/qt/dbus-adaptor.h
r10532 r10717 32 32 public slots: 33 33 bool PresentWindow(); 34 bool AddMetainfo( const QString& );34 bool AddMetainfo( const QString& payload, const QString& filename ); 35 35 }; 36 36
Note: See TracChangeset
for help on using the changeset viewer.