[kde-doc-english] [kde-runtime] kurifilter-plugins/ikws: New web shortcut. Copy link from clipboard.
Maarten De Meyer
de.meyer.maarten at gmail.com
Thu May 2 11:53:37 UTC 2013
Git commit 53a352fb4f8b9604eb454e1b15cd560c8518f3e6 by Maarten De Meyer.
Committed on 02/05/2013 at 13:38.
Pushed by demeyer into branch 'master'.
New web shortcut. Copy link from clipboard.
When making a new web shortcut check the clipboard, if it's a url put
it in the query line edit to save time.
BUG: 146880
FIXED-IN: 4.11
REVIEW: 110247
GUI: If the user has a link on his clipboard it will be copied to the
query text box.
M +10 -0 kurifilter-plugins/ikws/searchproviderdlg.cpp
http://commits.kde.org/kde-runtime/53a352fb4f8b9604eb454e1b15cd560c8518f3e6
diff --git a/kurifilter-plugins/ikws/searchproviderdlg.cpp b/kurifilter-plugins/ikws/searchproviderdlg.cpp
index 2bb2852..eb4b31d 100644
--- a/kurifilter-plugins/ikws/searchproviderdlg.cpp
+++ b/kurifilter-plugins/ikws/searchproviderdlg.cpp
@@ -19,6 +19,8 @@
#include "searchproviderdlg.h"
#include "searchprovider.h"
+#include <QClipboard>
+
#include <kapplication.h>
#include <kcharsets.h>
#include <kmessagebox.h>
@@ -60,6 +62,14 @@ SearchProviderDialog::SearchProviderDialog(SearchProvider *provider, QList<Searc
{
setPlainCaption(i18n("New Web Shortcut"));
m_dlg.leName->setFocus();
+
+ //If the clipboard contains a url copy it to the query lineedit
+ const QClipboard *clipboard = QApplication::clipboard();
+ const QString url = clipboard->text();
+
+ if (!KUrl(url).host().isEmpty())
+ m_dlg.leQuery->setText(url);
+
enableButton(Ok, false);
}
}
More information about the kde-doc-english
mailing list