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

List:       kde-commits
Subject:    KDE/kdebase/workspace/libs/taskmanager
From:       Anton Kreuzkamp <akreuzkamp () web ! de>
Date:       2010-11-21 16:01:08
Message-ID: 20101121160108.51C6FAC8A4 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1199326 by akreuzkamp:

fills LauncherItem::addMimeData() with content + some polishing

 M  +5 -7      groupmanager.cpp  
 M  +6 -3      launcheritem.cpp  
 M  +9 -2      launcheritem.h  
 M  +9 -5      taskactions.cpp  


--- trunk/KDE/kdebase/workspace/libs/taskmanager/groupmanager.cpp #1199325:1199326
@@ -409,8 +409,7 @@
     currentActivity = newActivity;
 
     foreach (AbstractGroupableItem *item, launcherAssociations.values()) {
-        if (item->itemType() == LauncherItemType)
-        {
+        if (item->itemType() == LauncherItemType) {
             rootGroups[currentActivity][currentDesktop]->add(item);
         }
     }
@@ -450,8 +449,7 @@
     currentDesktop = newDesktop;
 
 	foreach (AbstractGroupableItem *item, launcherAssociations.values()) {
-        if (item->itemType() == LauncherItemType)
-        {
+        if (item->itemType() == LauncherItemType) {
             rootGroups[currentActivity][currentDesktop]->add(item);
         }
 	}
@@ -574,7 +572,7 @@
 
 LauncherItem *GroupManager::addLauncher(const KUrl &url, QIcon icon, QString name, \
QString genericName, bool emitSignal)  {
-    LauncherItem *launcher = findLauncher(name.toLower()); // Do not insert \
launchers twice +    LauncherItem *launcher = findLauncher(name); // Do not insert \
launchers twice  if (!launcher) {
         launcher = new LauncherItem(d->currentRootGroup(), url);
         if (!icon.isNull()) {
@@ -675,8 +673,8 @@
 
 LauncherItem *GroupManager::findLauncher(const QString& name)
 {
-    if (!d->launcherAssociations.values(name).isEmpty()) {
-        return qobject_cast< LauncherItem* \
>(d->launcherAssociations.values(name).last()); +    if \
> (!d->launcherAssociations.values(name.toLower()).isEmpty()) {
+        return qobject_cast< LauncherItem* \
>(d->launcherAssociations.values(name.toLower()).last());  } else {
         return 0;
     }
--- trunk/KDE/kdebase/workspace/libs/taskmanager/launcheritem.cpp #1199325:1199326
@@ -25,6 +25,7 @@
 
 #include <KDesktopFile>
 #include <KMimeType>
+#include <QMimeData>
 #include <KRun>
 #include "taskgroup.h"
 
@@ -140,6 +141,11 @@
     new KRun(d->url, 0);
 }
 
+void LauncherItem::addMimeData(QMimeData* mimeData ) const
+{
+    mimeData->setData("text/uri-list", d->url.url().toAscii());
+}
+
 //BEGIN reimplemented pure virtual methods from abstractgroupableitem
 bool LauncherItem::demandsAttention() const
 {
@@ -189,9 +195,6 @@
 {
     return 0;
 }
-void LauncherItem::addMimeData(QMimeData* ) const
-{
-}
 
 void LauncherItem::setAlwaysOnTop(bool )
 {
--- trunk/KDE/kdebase/workspace/libs/taskmanager/launcheritem.h #1199325:1199326
@@ -34,11 +34,18 @@
 namespace TaskManager
 {
 
+/** 
+ * An item shown in the taskmanager, in order to use it to launch the application \
(or file) the launcher is linked to. + * If the Application is running the launcher \
gets hidden, in order to not waste space. + */
 class TASKMANAGER_EXPORT LauncherItem : public AbstractGroupableItem
 {
     Q_OBJECT
 public:
-    /** Creates a LauncherItem for a executable*/
+    /** 
+     * Creates a LauncherItem for a executable
+     * @param url the URL to the application or file the launcher gets linked to
+     */
     LauncherItem(QObject *parent, const KUrl &url);
     ~LauncherItem();
 
@@ -71,7 +78,7 @@
     bool isActionSupported(NET::Action) const;
     bool isActive() const;
     bool demandsAttention() const;
-    void addMimeData(QMimeData *) const;
+    void addMimeData(QMimeData *mimeData) const;
 
 public Q_SLOTS:
     void toDesktop(int);
--- trunk/KDE/kdebase/workspace/libs/taskmanager/taskactions.cpp #1199325:1199326
@@ -310,14 +310,17 @@
     : QAction(parent), m_abstractItem(item), m_groupingStrategy(strategy), m_url()
 {
     connect(this, SIGNAL(triggered()), this, SLOT(toggleLauncher()));
-    setText(i18n("&Pin Task"));
-    setCheckable(true);
     if (item->itemType() == TaskItemType) {
         m_name = qobject_cast< TaskItem* >(item)->task()->classClass();
     } else {
         m_name = item->name();
     }
-    setChecked(m_groupingStrategy->findLauncher(m_name.toLower()));
+    if (item->itemType() == LauncherItemType) {
+        setText(i18n("Remove this Launcher"));
+    } else {
+        setText(i18n("&Pin Task"));
+        setCheckable(true);
+        setChecked(m_groupingStrategy->findLauncher(m_name));
     if (!m_groupingStrategy->findLauncher(m_name)) {
         // Search for applications which are executable and case-insensitively match \
                the windowclass of the task and
         // See http://techbase.kde.org/Development/Tutorials/Services/Traders#The_KTrader_Query_Language
 @@ -337,11 +340,12 @@
         }
     }
 }
+}
 
 void ToggleLauncherActionImpl::toggleLauncher()
 {
-    if (m_groupingStrategy->findLauncher(m_name.toLower())) {
-        m_groupingStrategy->removeLauncher(m_groupingStrategy->findLauncher(m_name.toLower()));
 +    if (m_groupingStrategy->findLauncher(m_name)) {
+        m_groupingStrategy->removeLauncher(m_groupingStrategy->findLauncher(m_name));
  } else if (m_url.isValid()) {
         if (m_url.isLocalFile() && KDesktopFile::isDesktopFile(m_url.toLocalFile())) \
{  m_groupingStrategy->addLauncher(m_url);


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

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