1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
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,
|