summaryrefslogtreecommitdiffstats
path: root/opensuse/core/tdebase/kmenu-search-slowdown-fix.diff
diff options
context:
space:
mode:
authorRobert Xu <robxu9@gmail.com>2011-11-10 18:04:39 -0500
committerRobert Xu <robxu9@gmail.com>2011-11-10 18:04:39 -0500
commit21fcfa3348213aa87f0e3aef62ca4720c6d31cb7 (patch)
tree2cfb64c59322628e613ed0895e3c3694d3abe6bd /opensuse/core/tdebase/kmenu-search-slowdown-fix.diff
parent8667643bff14a60d8571c599efd3e48bed3e3b12 (diff)
downloadtde-packaging-21fcfa3348213aa87f0e3aef62ca4720c6d31cb7.tar.gz
tde-packaging-21fcfa3348213aa87f0e3aef62ca4720c6d31cb7.zip
initial commit to suse branch: eclipse integration
Diffstat (limited to 'opensuse/core/tdebase/kmenu-search-slowdown-fix.diff')
-rw-r--r--opensuse/core/tdebase/kmenu-search-slowdown-fix.diff129
1 files changed, 129 insertions, 0 deletions
diff --git a/opensuse/core/tdebase/kmenu-search-slowdown-fix.diff b/opensuse/core/tdebase/kmenu-search-slowdown-fix.diff
new file mode 100644
index 000000000..83c771db2
--- /dev/null
+++ b/opensuse/core/tdebase/kmenu-search-slowdown-fix.diff
@@ -0,0 +1,129 @@
+Index: kicker/kicker/ui/k_mnu.cpp
+===================================================================
+--- kicker/kicker/ui/k_mnu.cpp.orig
++++ kicker/kicker/ui/k_mnu.cpp
+@@ -771,6 +771,7 @@ void PanelKMenu::updateRecent()
+ insertSeparator(RecentlyLaunchedApps::the().m_nNumMenuItems);
+ }
+ }
++ iconsLoaded_ = false;
+ }
+
+ void PanelKMenu::clearRecentMenuItems()
+Index: kicker/kicker/ui/service_mnu.cpp
+===================================================================
+--- kicker/kicker/ui/service_mnu.cpp.orig
++++ kicker/kicker/ui/service_mnu.cpp
+@@ -63,13 +63,20 @@ PanelServiceMenu::PanelServiceMenu(const
+ insertInlineHeader_( insertInlineHeader ),
+ clearOnClose_(false),
+ addmenumode_(addmenumode),
+- popupMenu_(0)
++ popupMenu_(0),
++ iconsLoaded_(false)
+ {
+ excludeNoDisplay_=true;
+
+ connect(KSycoca::self(), SIGNAL(databaseChanged()),
+ SLOT(slotClearOnClose()));
+ connect(this, SIGNAL(aboutToHide()), this, SLOT(slotClose()));
++
++ const int iconSize = KickerSettings::menuEntryHeight();
++ QPixmap pix(iconSize,iconSize);
++ QBitmap map(iconSize,iconSize,true);
++ pix.setMask(map);
++ emptyiconset = QIconSet(pix,pix);
+ }
+
+ PanelServiceMenu::~PanelServiceMenu()
+@@ -103,6 +110,7 @@ void PanelServiceMenu::initialize()
+ clearSubmenus();
+ searchSubMenuIDs.clear();
+ searchMenuItems.clear();
++ iconsLoaded_ = false;
+ doInitialize();
+ }
+
+@@ -289,15 +297,13 @@ void PanelServiceMenu::fillMenu(KService
+ newSubMenu(g->name(), g->relPath(), this, g->name().utf8(), inlineHeaderName);
+ m->setCaption(groupCaption);
+
+- QIconSet iconset = KickerLib::menuIconSet(g->icon());
+-
+ if (separatorNeeded)
+ {
+ insertSeparator();
+ separatorNeeded = false;
+ }
+
+- int newId = insertItem(iconset, groupCaption, m, id++);
++ int newId = insertItem(emptyiconset,groupCaption, m, id++);
+ entryMap_.insert(newId, static_cast<KSycocaEntry*>(g));
+ // This submenu will be searched when applying a search string
+ searchSubMenuIDs[m] = newId;
+@@ -392,6 +398,12 @@ void PanelServiceMenu::doInitialize()
+
+ void PanelServiceMenu::configChanged()
+ {
++ const int iconSize = KickerSettings::menuEntryHeight();
++ QPixmap pix(iconSize,iconSize);
++ QBitmap map(iconSize,iconSize,true);
++ pix.setMask(map);
++ emptyiconset = QIconSet(pix,pix);
++
+ deinitialize();
+ }
+
+@@ -456,9 +468,9 @@ void PanelServiceMenu::insertMenuItem(KS
+
+ int newId;
+ if ( label.isEmpty() )
+- newId = insertItem(KickerLib::menuIconSet(s->icon()), serviceName, nId, nIndex);
++ newId = insertItem(emptyiconset, serviceName, nId, nIndex);
+ else
+- newId = insertItem(KickerLib::menuIconSet(s->icon()), label, nId, nIndex);
++ newId = insertItem(emptyiconset, label, nId, nIndex);
+ entryMap_.insert(newId, static_cast<KSycocaEntry*>(s));
+ }
+
+@@ -1003,3 +1015,23 @@ bool PanelServiceMenu::hasSearchResults(
+ {
+ return hasSearchResults_;
+ }
++
++void PanelServiceMenu::slotAboutToShow()
++{
++ KPanelMenu::slotAboutToShow();
++
++ if (!iconsLoaded_) {
++ EntryMap::Iterator mapIt;
++ for ( mapIt = entryMap_.begin(); mapIt != entryMap_.end(); ++mapIt ) {
++ KService *s = dynamic_cast<KService *>(static_cast<KSycocaEntry*>(mapIt.data()));
++ if (s)
++ changeItem(mapIt.key(),KickerLib::menuIconSet(s->icon()),text(mapIt.key()));
++ else {
++ KServiceGroup *g = dynamic_cast<KServiceGroup *>(static_cast<KSycocaEntry*>(mapIt.data()));
++ if (g)
++ changeItem(mapIt.key(),KickerLib::menuIconSet(g->icon()),text(mapIt.key()));
++ }
++ }
++ iconsLoaded_ = true;
++ }
++}
+Index: kicker/kicker/ui/service_mnu.h
+===================================================================
+--- kicker/kicker/ui/service_mnu.h.orig
++++ kicker/kicker/ui/service_mnu.h
+@@ -124,9 +124,12 @@ protected:
+ PanelServiceMenuMap searchSubMenuIDs;
+ bool hasSearchResults_;
+ std::set<int> searchMenuItems;
++ QIconSet emptyiconset;
++ bool iconsLoaded_;
+
+ private slots:
+ void slotContextMenu(int);
++ void slotAboutToShow();
+
+ private:
+ enum ContextMenuEntry { AddItemToPanel, EditItem, AddMenuToPanel, EditMenu,