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

List:       kde-commits
Subject:    KDE/kdebase/workspace/plasma/applets/kickoff
From:       Ivan Čukić <ivan.cukic+kde () gmail ! com>
Date:       2009-09-01 15:37:44
Message-ID: 1251819464.982791.10271.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1018343 by ivan:

Initial KRunner support in Kickoff

 M  +1 -0      CMakeLists.txt  
 M  +13 -0     core/models.cpp  
 M  +3 -1      core/models.h  
 M  +4 -2      ui/contextmenufactory.cpp  
 M  +1 -1      ui/itemdelegate.cpp  
 M  +10 -6     ui/launcher.cpp  


--- trunk/KDE/kdebase/workspace/plasma/applets/kickoff/CMakeLists.txt \
#1018342:1018343 @@ -18,6 +18,7 @@
     core/recentapplications.cpp
     core/recentlyusedmodel.cpp
     core/searchmodel.cpp
+    core/krunnermodel.cpp
     core/systemmodel.cpp
     core/urlitemlauncher.cpp
     core/itemhandlers.cpp
--- trunk/KDE/kdebase/workspace/plasma/applets/kickoff/core/models.cpp \
#1018342:1018343 @@ -125,6 +125,19 @@
     }
 }
 
+QStandardItem *StandardItemFactory::createItem(const QIcon & icon, const QString & \
title, +        const QString & description, const QString & url)
+{
+    QStandardItem *appItem = new QStandardItem;
+
+    appItem->setText(title);
+    appItem->setIcon(icon);
+    appItem->setData(description, Kickoff::SubTitleRole);
+    appItem->setData(url, Kickoff::UrlRole);
+
+    return appItem;
+}
+
 QStandardItem *StandardItemFactory::createItemForService(KService::Ptr service, \
DisplayOrder displayOrder)  {
     QStandardItem *appItem = new QStandardItem;
--- trunk/KDE/kdebase/workspace/plasma/applets/kickoff/core/models.h #1018342:1018343
@@ -77,7 +77,7 @@
 };
 
 /**
- * This enum describes the policy for displaying 
+ * This enum describes the policy for displaying
  * Name of Application - Description
  * Description - Name of Application
  */
@@ -96,6 +96,8 @@
     static QStandardItem *createItemForUrl(const QString& url, DisplayOrder \
displayOrder);  static QStandardItem *createItemForService(KService::Ptr service,
                                                DisplayOrder displayOrder);
+    static QStandardItem *createItem(const QIcon & icon, const QString & title,
+        const QString & description, const QString & url);
 
 private:
     static void setSpecialUrlProperties(const KUrl& url, QStandardItem *item);
--- trunk/KDE/kdebase/workspace/plasma/applets/kickoff/ui/contextmenufactory.cpp \
#1018342:1018343 @@ -132,7 +132,8 @@
             favoriteAction->setIcon(KIcon("list-remove"));
             actions << favoriteAction;
             //exclude stuff in the leave tab
-        } else if (KUrl(url).protocol() != "leave") {
+        } else if (KUrl(url).protocol() != "leave" &&
+                   KUrl(url).protocol() != "krunner") {
             favoriteAction->setText(i18n("Add to Favorites"));
             favoriteAction->setIcon(KIcon("bookmark-new"));
             actions << favoriteAction;
@@ -150,7 +151,8 @@
     //### TODO : do not forget to remove (kurl.scheme() != "leave") and kurl \
declaration  //when proper action for such case will be provided
     KUrl kurl(url);
-    if ((d->applet) && (kurl.scheme() != "leave")) {
+    if ((d->applet) && (kurl.scheme() != "leave") &&
+       (d->applet) && (kurl.scheme() != "krunner")) {
         Plasma::Containment *containment = d->applet->containment();
 
         // There might be relative paths for .desktop installed in
--- trunk/KDE/kdebase/workspace/plasma/applets/kickoff/ui/itemdelegate.cpp \
#1018342:1018343 @@ -96,7 +96,7 @@
 
 bool ItemDelegate::isVisible(const QModelIndex& index) const
 {
-    Q_ASSERT(index.isValid());
+    if (!index.isValid()) return false;
 
     if (index.model()->hasChildren(index)) {
         const int childCount = index.model()->rowCount(index);
--- trunk/KDE/kdebase/workspace/plasma/applets/kickoff/ui/launcher.cpp \
#1018342:1018343 @@ -49,7 +49,8 @@
 #include "core/applicationmodel.h"
 #include "core/leavemodel.h"
 #include "core/itemhandlers.h"
-#include "core/searchmodel.h"
+//#include "core/searchmodel.h"
+#include "core/krunnermodel.h"
 #include "core/systemmodel.h"
 
 #include "ui/itemdelegate.h"
@@ -172,11 +173,11 @@
         view->setItemStateProvider(delegate);
         addView(i18n("Favorites"), KIcon("bookmarks"), favoritesModel, view);
 
-        QAction *sortAscendingAction = new QAction(KIcon("view-sort-ascending"), 
+        QAction *sortAscendingAction = new QAction(KIcon("view-sort-ascending"),
                                                    i18n("Sort Alphabetically (A to \
Z)"), q);  
-        QAction *sortDescendingAction = new QAction(KIcon("view-sort-descending"), 
-                                                    i18n("Sort Alphabetically (Z to \
A)"), q);   +        QAction *sortDescendingAction = new \
QAction(KIcon("view-sort-descending"), +                                              \
i18n("Sort Alphabetically (Z to A)"), q);  
 
         connect(favoritesModel, SIGNAL(rowsInserted(QModelIndex, int, int)), q, \
SLOT(focusFavoritesView())); @@ -239,7 +240,8 @@
 
     void setupSearchView()
     {
-        searchModel = new SearchModel(q);
+        // searchModel = new SearchModel(q);
+        searchModel = new KRunnerModel(q);
         UrlItemView *view = new UrlItemView();
         ItemDelegate *delegate = new ItemDelegate(q);
         delegate->setRoleMapping(Plasma::Delegate::SubTitleRole, SubTitleRole);
@@ -269,6 +271,7 @@
     {
         UrlItemLauncher::addGlobalHandler(UrlItemLauncher::ExtensionHandler, \
                "desktop", new ServiceItemHandler);
         UrlItemLauncher::addGlobalHandler(UrlItemLauncher::ProtocolHandler, "leave", \
new LeaveItemHandler); +        \
UrlItemLauncher::addGlobalHandler(UrlItemLauncher::ProtocolHandler, "krunner", new \
KRunnerItemHandler);  }
 
     QIcon systemIcon()
@@ -441,7 +444,8 @@
     FavoritesModel *favoritesModel;
     ApplicationModel  *applicationModel;
     RecentlyUsedModel *recentlyUsedModel;
-    SearchModel *searchModel;
+    KRunnerModel *searchModel;
+    // SearchModel *searchModel;
     LeaveModel *leaveModel;
     SearchBar *searchBar;
     QWidget *footer;


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

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