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

List:       kde-commits
Subject:    KDE/kdebase/workspace/plasma/generic/runners/locations
From:       Aaron J. Seigo <aseigo () kde ! org>
Date:       2010-08-31 21:50:17
Message-ID: 20100831215017.BDC79AC857 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1170437 by aseigo:

implement mimeDataForMatch


 M  +19 -0     locationrunner.cpp  
 M  +3 -1      locationrunner.h  


--- trunk/KDE/kdebase/workspace/plasma/generic/runners/locations/locationrunner.cpp #1170436:1170437
@@ -19,6 +19,7 @@
 #include "locationrunner.h"
 
 #include <QDir>
+#include <QMimeData>
 
 #include <KDebug>
 #include <KRun>
@@ -76,6 +77,7 @@
         match.setText(i18n("Open %1", term));
         match.setIcon(KIcon("system-file-manager"));
         match.setRelevance(1);
+        match.setData(term);
         match.setType(Plasma::QueryMatch::ExactMatch);
 
         if (type == Plasma::RunnerContext::Directory) {
@@ -164,4 +166,21 @@
     new KRun(urlToRun, 0);
 }
 
+QMimeData * LocationsRunner::mimeDataForMatch(const Plasma::QueryMatch *match)
+{
+    const QString data = match->data().toString();
+    if (!data.isEmpty()) {
+        KUrl url(data);
+        QList<QUrl> list;
+        list << url;
+        QMimeData *result = new QMimeData();
+        result->setUrls(list);
+        result->setText(data);
+        return result;
+    }
+
+    return 0;
+}
+
+
 #include "locationrunner.moc"
--- trunk/KDE/kdebase/workspace/plasma/generic/runners/locations/locationrunner.h #1170436:1170437
@@ -21,7 +21,6 @@
 
 #include <Plasma/AbstractRunner>
 
-
 class LocationsRunner : public Plasma::AbstractRunner
 {
     Q_OBJECT
@@ -32,6 +31,9 @@
 
         void match(Plasma::RunnerContext &context);
         void run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &action);
+
+    protected Q_SLOTS:
+        QMimeData * mimeDataForMatch(const Plasma::QueryMatch *match);
 };
 
 K_EXPORT_PLASMA_RUNNER(locations, LocationsRunner)
[prev in list] [next in list] [prev in thread] [next in thread] 

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