When opening the "Add URL" dialog, check the clipboard selection & clipboard proper to see if either contains a URL, magnet link, or info hash code. If it has any of those things, put that in the dialog's entry field as the default action. Patch by cantabile.
QByteArray toBase64( ) const;
QString readableName( ) const;
+
+ public:
+
+ static bool isSupported( const QString& str ) { return AddData(str).type != NONE; }
};
#endif
#include <libtransmission/version.h>
#include "about.h"
+#include "add-data.h"
#include "app.h"
#include "details.h"
#include "filterbar.h"
void
TrMainWindow :: openURL( )
{
- QString tmp;
- openURL( tmp );
+ QString str = QApplication::clipboard()->text( QClipboard::Selection );
+
+ if( !AddData::isSupported( str ) )
+ str = QApplication::clipboard()->text( QClipboard::Clipboard );
+
+ if( !AddData::isSupported( str ) )
+ str.clear();
+
+ openURL( str );
}
void