Changeset 11744


Ignore:
Timestamp:
Jan 21, 2011, 9:51:50 PM (11 years ago)
Author:
jordan
Message:

(trunk qt) #3930 - "Add URL" - auto-copy links from the clipboard

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.

Location:
trunk/qt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/qt/add-data.h

    r11092 r11744  
    4141
    4242        QString readableName( ) const;
     43
     44    public:
     45
     46        static bool isSupported( const QString& str ) { return AddData(str).type != NONE; }
    4347};
    4448
  • trunk/qt/mainwin.cc

    r11723 r11744  
    2121
    2222#include "about.h"
     23#include "add-data.h"
    2324#include "app.h"
    2425#include "details.h"
     
    10481049TrMainWindow :: openURL( )
    10491050{
    1050     QString tmp;
    1051     openURL( tmp );
     1051    QString str = QApplication::clipboard()->text( QClipboard::Selection );
     1052
     1053    if( !AddData::isSupported( str ) )
     1054        str = QApplication::clipboard()->text( QClipboard::Clipboard );
     1055
     1056    if( !AddData::isSupported( str ) )
     1057        str.clear();
     1058
     1059    openURL( str );
    10521060}
    10531061
Note: See TracChangeset for help on using the changeset viewer.