[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/4.2/kdepim/akregator/src
From:       Frank Osterfeld <frank.osterfeld () kdemail ! net>
Date:       2009-04-17 16:44:42
Message-ID: 1239986682.343977.4836.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 955441 by osterfeld:

backport:

r951974 | osterfeld | 2009-04-10 19:04:17 +0200 (Fri, 10 Apr 2009) | 3 lines

Paste clipboard contents in add feed dlg if it is a valid URL
Patch by Jordi De Groof, jordi.degroof at gmail.com
CCBUG:111214



 M  +14 -1     createfeedcommand.cpp  


--- branches/KDE/4.2/kdepim/akregator/src/createfeedcommand.cpp #955440:955441
@@ -36,6 +36,7 @@
 
 #include <QPointer>
 #include <QTimer>
+#include <QClipboard>
 
 #include <cassert>
 
@@ -75,8 +76,20 @@
 
     QPointer<AddFeedDialog> afd = new AddFeedDialog( q->parentWidget(), "add_feed" );
 
-    afd->setUrl( KUrl::fromPercentEncoding( m_url.toLatin1() ) );
+    QString url = m_url;
 
+    if( url.isEmpty() )
+    {
+        const QClipboard* const clipboard = QApplication::clipboard();
+        assert( clipboard );
+        const QString clipboardText = clipboard->text();
+        // Check for the hostname, since the isValid method is not strict enough
+        if( !KUrl( clipboardText ).isEmpty() )
+            url = clipboardText;
+    }
+
+    afd->setUrl( KUrl::fromPercentEncoding( url.toLatin1() ) );
+
     QPointer<QObject> thisPointer( q );
 
     if ( m_autoexec )
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic