summaryrefslogtreecommitdiff
path: root/core/launcher
authorzecke <zecke>2003-08-28 14:47:24 (UTC)
committer zecke <zecke>2003-08-28 14:47:24 (UTC)
commite284d63306cd3b00baff8e464a8eaf2eb64ea49a (patch) (unidiff)
tree2898793040f5571455a3301d761383eed6efaee3 /core/launcher
parent285e7737f47c508ee816c5a96ebfc4207dc78438 (diff)
downloadopie-e284d63306cd3b00baff8e464a8eaf2eb64ea49a.zip
opie-e284d63306cd3b00baff8e464a8eaf2eb64ea49a.tar.gz
opie-e284d63306cd3b00baff8e464a8eaf2eb64ea49a.tar.bz2
Use real applets
Diffstat (limited to 'core/launcher') (more/less context) (show whitespace changes)
-rw-r--r--core/launcher/startmenu.cpp330
-rw-r--r--core/launcher/startmenu.h40
2 files changed, 147 insertions, 223 deletions
diff --git a/core/launcher/startmenu.cpp b/core/launcher/startmenu.cpp
index d75e8be..014418d 100644
--- a/core/launcher/startmenu.cpp
+++ b/core/launcher/startmenu.cpp
@@ -18,316 +18,243 @@
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#define INCLUDE_MENUITEM_DEF 21#define INCLUDE_MENUITEM_DEF
22 22
23#include "startmenu.h" 23#include "startmenu.h"
24#include "sidething.h" 24
25//#include "mrulist.h" 25#include <qtopia/qpeapplication.h>
26#include "info.h" 26#include <qtopia/config.h>
27 27#include <qtopia/applnk.h>
28#include <qpe/qpeapplication.h> 28#include <qtopia/global.h>
29#include <qpe/config.h> 29#include <qtopia/resource.h>
30#include <qpe/applnk.h> 30#include <qtopia/mimetype.h>
31#include <qpe/global.h> 31#include <qtopia/qlibrary.h>
32#include <qpe/resource.h> 32
33#include <qpe/qlibrary.h> 33#include <qdict.h>
34
35#include <qintdict.h>
36#include <qdir.h> 34#include <qdir.h>
35#include <qpainter.h>
37 36
38#include <stdlib.h> 37#include <stdlib.h>
39 38
40 39
41// #define USE_CONFIG_FILE 40void StartPopupMenu::keyPressEvent( QKeyEvent *e )
41{
42 if ( e->key() == Key_F33 || e->key() == Key_Space ) {
43 // "OK" button, little hacky
44 QKeyEvent ke(QEvent::KeyPress, Key_Enter, 13, 0);
45 QPopupMenu::keyPressEvent( &ke );
46 } else {
47 QPopupMenu::keyPressEvent( e );
48 }
49}
42 50
51//---------------------------------------------------------------------------
43 52
44StartMenu::StartMenu(QWidget *parent) : QLabel( parent ) 53StartMenu::StartMenu(QWidget *parent) : QLabel( parent )
45{ 54{
46 loadOptions(); 55 startButtonPixmap = "go"; // No tr
47 safety_tid = 1; // disable the timer... valgrind said it.. we don't use that option either -zecke
48 56
49 int sz = AppLnk::smallIconSize()+3; 57 int sz = AppLnk::smallIconSize()+3;
50 QPixmap pm; 58 QPixmap pm;
51 pm.convertFromImage(Resource::loadImage(startButtonPixmap).smoothScale(sz,sz)); 59 pm.convertFromImage(Resource::loadImage(startButtonPixmap).smoothScale(sz,sz));
52 setPixmap(pm); 60 setPixmap(pm);
53 setFocusPolicy( NoFocus ); 61 setFocusPolicy( NoFocus );
54 //setFlat( startButtonIsFlat );
55 62
56 apps = 0;
57 launchMenu = 0; 63 launchMenu = 0;
58 applets. setAutoDelete ( true ); 64 refreshMenu();
59 sepId = 0;
60
61 reloadApps ( );
62 reloadApplets ( );
63} 65}
64 66
65 67
66void StartMenu::mousePressEvent( QMouseEvent * ) 68void StartMenu::mousePressEvent( QMouseEvent * )
67{ 69{
68 launch(); 70 launch();
69 if (desktopInfo)
70 desktopInfo->menuClicked();
71} 71}
72 72
73 73
74StartMenu::~StartMenu() 74StartMenu::~StartMenu()
75{ 75{
76 delete apps; 76 clearApplets();
77}
78
79
80void StartMenu::loadOptions()
81{
82#ifdef USE_CONFIG_FILE
83 // Read configuration file
84 Config config("StartMenu");
85 config.setGroup( "StartMenu" );
86 QString tmpBoolString1 = config.readEntry( "UseWidePopupMenu", "FALSE" );
87 useWidePopupMenu = ( tmpBoolString1 == "TRUE" ) ? TRUE : FALSE;
88 QString tmpBoolString2 = config.readEntry( "StartButtonIsFlat", "TRUE" );
89 startButtonIsFlat = ( tmpBoolString2 == "TRUE" ) ? TRUE : FALSE;
90 QString tmpBoolString3 = config.readEntry( "UseMRUList", "TRUE" );
91 popupMenuSidePixmap = config.readEntry( "PopupMenuSidePixmap", "launcher/sidebar" );
92 startButtonPixmap = config.readEntry( "StartButtonPixmap", "go" );
93#else
94 // Basically just #include the .qpe_menu.conf file settings
95 useWidePopupMenu = FALSE;
96 popupMenuSidePixmap = "launcher/sidebar";
97 startButtonIsFlat = TRUE;
98 startButtonPixmap = "go"; // No tr
99#endif
100} 77}
101 78
102
103void StartMenu::createMenu() 79void StartMenu::createMenu()
104{ 80{
81 clearApplets();
105 delete launchMenu; 82 delete launchMenu;
106 if ( useWidePopupMenu )
107 launchMenu = new PopupWithLaunchSideThing( this, &popupMenuSidePixmap );
108 else
109 launchMenu = new StartPopupMenu( this );
110 83
111 loadMenu ( apps, launchMenu ); 84 launchMenu = new StartPopupMenu( this );
85 loadMenu( launchMenu );
112 loadApplets ( ); 86 loadApplets ( );
113 87
88 bool result = nother || ntabs || m_applets.count();
89 if ( result )
114 connect( launchMenu, SIGNAL(activated(int)), SLOT(itemSelected(int)) ); 90 connect( launchMenu, SIGNAL(activated(int)), SLOT(itemSelected(int)) );
91
115} 92}
116 93
117void StartMenu::reloadApps() 94void StartMenu::refreshMenu()
118{ 95{
119 Config cfg("StartMenu"); 96 Config cfg("Taskbar");
120 cfg.setGroup("Menu"); 97 cfg.setGroup("Menu");
121 bool ltabs = cfg.readBoolEntry("LauncherTabs",TRUE); 98 bool ltabs = cfg.readBoolEntry("LauncherTabs",TRUE);
122 bool lot = cfg.readBoolEntry("LauncherOther",TRUE); 99 bool lot = cfg.readBoolEntry("LauncherOther",TRUE);
123 bool lt = ltabs || lot; 100 bool lt = ltabs || lot;
124 if ( launchMenu && apps && !lt ) 101 if ( launchMenu && !lt )
125 return; // nothing to do 102 return; // nothing to do
126 103
127 if ( lt ) {
128 delete apps;
129 apps = new AppLnkSet( QPEApplication::qpeDir() + "apps" );
130 }
131 if ( launchMenu ) { 104 if ( launchMenu ) {
132 launchMenu-> hide ( ); 105 int i;
133 106 /* find the first entry we want to remove */
134 for ( QIntDictIterator<QPopupMenu> it ( tabdict ); it. current ( ); ++it ) { 107 for (i=0; i<(int)launchMenu->count(); i++) {
135 launchMenu-> removeItem ( it. currentKey ( )); 108 QMenuItem* item = launchMenu->findItem(launchMenu->idAt(i));
136 delete it.current ( ); 109 if ( item && item->id() >= 0 && item->id() < ntabs ) {
137 } 110 break;
138 tabdict. clear ( );
139 loadMenu(apps,launchMenu);
140 } else {
141 createMenu();
142 } 111 }
112 if ( item && item->isSeparator() ) {
113 i++;
114 break;
143} 115}
144
145void StartMenu::reloadApplets()
146{
147 if ( launchMenu ) {
148 clearApplets ( );
149 loadApplets ( );
150 } 116 }
151 else 117 /* remove them */
118 while (i<(int)launchMenu->count())
119 launchMenu->removeItemAt(i);
120 loadMenu(launchMenu);
121 addApplets(launchMenu);
122 } else {
152 createMenu ( ); 123 createMenu ( );
153} 124}
125}
154 126
155void StartMenu::itemSelected( int id ) 127void StartMenu::itemSelected( int id )
156{ 128{
157 const AppLnk *app = apps->find( id ); 129 if ( id >= 0 && id < ntabs ) {
158 if ( app ) 130 emit tabSelected(tabs[id]);
159 app->execute(); 131 } else if ( id >= 20 && id < 20+nother ) {
160 else { 132 other.at(id-20)->execute();
161 MenuApplet *applet = applets. find ( id ); 133 }else {
162 134 MenuApplet *applet = m_applets.find ( id );
163 if ( applet ) 135 if ( applet ) {
136 qWarning("activated");
164 applet-> iface-> activated ( ); 137 applet-> iface-> activated ( );
165 } 138 }
166} 139}
140}
167 141
168bool StartMenu::loadMenu( AppLnkSet *folder, QPopupMenu *menu ) 142bool StartMenu::loadMenu( QPopupMenu *menu )
169{ 143{
170 bool result = FALSE; 144 Config cfg("Taskbar");
171
172 Config cfg("StartMenu");
173 cfg.setGroup("Menu"); 145 cfg.setGroup("Menu");
174 146
175 bool ltabs = cfg.readBoolEntry("LauncherTabs",TRUE); 147 bool ltabs = cfg.readBoolEntry("LauncherTabs",TRUE);
176 bool lot = cfg.readBoolEntry("LauncherOther",TRUE); 148 bool lot = cfg.readBoolEntry("LauncherOther",TRUE);
149 bool sepfirst = !ltabs && !lot;
177 150
178 tabdict. clear ( ); 151 tabs.clear();
179 152 other.setAutoDelete(TRUE);
180 if ( sepId ) 153 other.clear();
181 menu-> removeItem ( sepId ); 154 ntabs = 0;
182 sepId = ( menu-> count ( )) ? menu-> insertSeparator ( 0 ) : 0; 155 nother = 0;
183 156
184 if ( ltabs || lot ) {
185 QDict<QPopupMenu> typpop;
186 QStringList typs = folder->types();
187 for (QStringList::Iterator tit=typs.fromLast(); ; --tit) {
188 if ( !(*tit).isEmpty() ) {
189 QPopupMenu *new_menu;
190 if ( ltabs ) {
191 new_menu = new StartPopupMenu( menu );
192 connect( new_menu, SIGNAL(activated(int)), SLOT(itemSelected(int)) );
193 int id = menu->insertItem( folder->typePixmap(*tit), folder->typeName(*tit), new_menu, -1, 0 );
194 tabdict. insert ( id, new_menu );
195 } else {
196 new_menu = (QPopupMenu*)1;
197 }
198 typpop.insert(*tit, new_menu);
199 }
200 if ( tit == typs. begin ( ))
201 break;
202 }
203 QListIterator<AppLnk> it( folder->children() );
204 bool f=TRUE; 157 bool f=TRUE;
205 for ( ; it.current(); ++it ) { 158 if ( ltabs || lot ) {
206 AppLnk *app = it.current(); 159 QDir dir( MimeType::appsFolderName(), QString::null, QDir::Name );
207 if ( app->type() == "Separator" ) { // No tr 160 for (int i=0; i<(int)dir.count(); i++) {
161 QString d = dir[i];
162 Config cfg(dir.path()+"/"+d+"/.directory",Config::File);
163 if ( cfg.isValid() ) {
164 QString nm = cfg.readEntry("Name");
165 QString ic = cfg.readEntry("Icon");
166 if ( !!nm && !!ic ) {
167 tabs.append(d);
168 menu->insertItem( Resource::loadIconSet(ic), nm, ntabs++ );
169 }
170 } else if ( lot && d.right(8)==".desktop") {
171 AppLnk* applnk = new AppLnk(dir.path()+"/"+d);
172 if ( applnk->isValid() ) {
173 if ( applnk->type() == "Separator" ) { // No tr
208 if ( lot ) { 174 if ( lot ) {
209 menu->insertSeparator(); 175 menu->insertSeparator();
176 sepfirst = f && !ltabs;
210 } 177 }
178 delete applnk;
211 } else { 179 } else {
212 f = FALSE; 180 f = FALSE;
213 QString t = app->type(); 181 other.append(applnk);
214 QPopupMenu* pmenu = typpop.find(t); 182 menu->insertItem( Resource::loadIconSet(applnk->icon()),
215 if ( ltabs ) { 183 applnk->name(), 20+nother++ );
216 if ( !pmenu && lot )
217 pmenu = menu;
218 } else {
219 if ( !pmenu )
220 pmenu = menu;
221 else
222 pmenu = 0;
223 }
224 if ( pmenu ) {
225 QString t = app->name();
226 t.replace(QRegExp("&"),"&&"); // escape shortcut character
227
228 int index = -1;
229
230 for ( index = 0; index < pmenu-> count ( ); index++ ) {
231 if ( pmenu-> text ( pmenu-> idAt ( index )). compare ( t ) > 0 )
232 break;
233 }
234
235 pmenu->insertItem( app->pixmap(), t, app->id(), index );
236 } 184 }
237 result=TRUE; 185 } else {
186 delete applnk;
238 } 187 }
239 } 188 }
240 } 189 }
241 190
242 if ( sepId && ( menu-> idAt ( 0 ) == sepId )) { // no tabs entries 191 if ( !menu->count() )
243 menu-> removeItem ( sepId ); 192 sepfirst = TRUE;
244 sepId = 0;
245 } 193 }
246 if ( !menu-> count ( )) // if we don't do this QPopupMenu will insert a dummy Separator, which won't go away later
247 sepId = menu-> insertSeparator ( );
248 194
249 return result; 195 launchMenu->setName(sepfirst ? "accessories" : "accessories_need_sep"); // No tr
196
197 return (nother || ntabs );
250} 198}
251 199
252 200
253void StartMenu::launch ( ) 201void StartMenu::launch ( )
254{ 202{
255 int y = mapToGlobal ( QPoint ( )). y ( ) - launchMenu-> sizeHint ( ). height ( ); 203 int y = mapToGlobal ( QPoint ( )). y ( ) - launchMenu-> sizeHint ( ). height ( );
256 204
257 if ( launchMenu-> isVisible ( )) { 205 if ( launchMenu->isVisible() )
258 launchMenu-> hide ( ); 206 launchMenu-> hide ( );
259 } 207 else
260 else {
261 QWidget *active = qApp-> activeWindow ( );
262 if ( active && active-> isPopup ( ))
263 active-> close ( );
264
265 launchMenu-> popup ( QPoint ( 1, y )); 208 launchMenu-> popup ( QPoint ( 1, y ));
266 } 209 }
267}
268 210
269const AppLnk* StartMenu::execToLink(const QString& appname)
270{
271 const AppLnk* a = apps->findExec( appname );
272 return a;
273}
274 211
275void StartPopupMenu::keyPressEvent( QKeyEvent *e ) 212
276{
277 if ( e->key() == Key_F33 || e->key() == Key_Space ) {
278 // "OK" button, little hacky
279 QKeyEvent ke(QEvent::KeyPress, Key_Enter, 13, 0);
280 QPopupMenu::keyPressEvent( &ke );
281 } else {
282 QPopupMenu::keyPressEvent( e );
283 }
284}
285 213
286static int compareAppletPositions(const void *a, const void *b) 214static int compareAppletPositions(const void *a, const void *b)
287{ 215{
288 const MenuApplet* aa = *(const MenuApplet**)a; 216 const MenuApplet* aa = *(const MenuApplet**)a;
289 const MenuApplet* ab = *(const MenuApplet**)b; 217 const MenuApplet* ab = *(const MenuApplet**)b;
290 int d = aa->iface->position() - ab->iface->position(); 218 int d = aa->iface->position() - ab->iface->position();
291 if ( d ) return d; 219 if ( d ) return d;
292 return QString::compare(aa->library->library(),ab->library->library()); 220 return QString::compare(aa->library->library(),ab->library->library());
293} 221}
294 222
295void StartMenu::clearApplets() 223void StartMenu::clearApplets()
296{ 224{
225 if (launchMenu )
297 launchMenu-> hide(); 226 launchMenu-> hide();
298 227
299 for ( QIntDictIterator<MenuApplet> it ( applets ); it. current ( ); ++it ) { 228 for ( QIntDictIterator<MenuApplet> it ( m_applets ); it. current ( ); ++it ) {
300 MenuApplet *applet = it. current ( ); 229 MenuApplet *applet = it. current ( );
301 if ( launchMenu ) { 230 if ( launchMenu ) {
302 launchMenu-> removeItem ( applet-> id ); 231 launchMenu-> removeItem ( applet-> id );
303 delete applet-> popup; 232 delete applet-> popup;
304 } 233 }
305 234
306 applet-> iface-> release(); 235 applet-> iface-> release();
307 applet-> library-> unload(); 236 applet-> library-> unload();
308 delete applet-> library; 237 delete applet-> library;
309 } 238 }
310 applets.clear(); 239 m_applets.clear();
311} 240}
312 241
313 242
314 243
244
315void StartMenu::loadApplets() 245void StartMenu::loadApplets()
316{ 246{
317 Config cfg( "StartMenu" ); 247 Config cfg( "StartMenu" );
318 cfg.setGroup( "Applets" ); 248 cfg.setGroup( "Applets" );
319 249
320 // SafeMode causes too much problems, so we disable it for now -- 250 // SafeMode causes too much problems, so we disable it for now --
321 // maybe we should reenable it for OPIE 1.0 - sandman 26.09.02 251 // maybe we should reenable it for OPIE 1.0 - sandman 26.09.02
252 // removed in the remerge PluginManager could handle it
253 // we don't currently use it -zecke
322 254
323 bool safe = false; //cfg.readBoolEntry("SafeMode",FALSE);
324 if ( safe && !safety_tid )
325 return;
326 cfg.writeEntry("SafeMode",TRUE);
327 cfg.write();
328 QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' ); 255 QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' );
329 256
330 QString lang = getenv( "LANG" ); 257 QString lang = getenv( "LANG" );
331 QString path = QPEApplication::qpeDir() + "/plugins/applets"; 258 QString path = QPEApplication::qpeDir() + "/plugins/applets";
332 QDir dir( path, "lib*.so" ); 259 QDir dir( path, "lib*.so" );
333 QStringList list = dir.entryList(); 260 QStringList list = dir.entryList();
@@ -355,47 +282,52 @@ void StartMenu::loadApplets()
355 } else { 282 } else {
356 exclude += *it; 283 exclude += *it;
357 delete lib; 284 delete lib;
358 } 285 }
359 } 286 }
360 cfg.writeEntry( "ExcludeApplets", exclude, ',' ); 287 cfg.writeEntry( "ExcludeApplets", exclude, ',' );
361 qsort(xapplets,napplets,sizeof(applets[0]),compareAppletPositions); 288 qsort(xapplets,napplets,sizeof(m_applets[0]),compareAppletPositions);
289
362 290
363 if ( sepId ) 291 int foo = ( launchMenu-> count ( )) ? launchMenu-> insertSeparator ( ) : 0;
364 launchMenu-> removeItem ( sepId );
365 sepId = ( launchMenu-> count ( )) ? launchMenu-> insertSeparator ( ) : 0;
366 292
367 while (napplets--) { 293 while (napplets--) {
368 MenuApplet *applet = xapplets[napplets]; 294 MenuApplet *applet = xapplets[napplets];
369 295
370 applet-> popup = applet-> iface-> popup ( this ); 296 applet-> popup = applet-> iface-> popup ( this );
371 297
372 if ( applet-> popup ) 298 if ( applet-> popup )
373 applet-> id = launchMenu-> insertItem ( applet-> iface-> icon ( ), applet-> iface-> text ( ), applet-> popup ); 299 applet-> id = launchMenu-> insertItem ( applet-> iface-> icon ( ), applet-> iface-> text ( ), applet-> popup );
374 else 300 else
375 applet-> id = launchMenu-> insertItem ( applet-> iface-> icon ( ), applet-> iface-> text ( ) ); 301 applet-> id = launchMenu-> insertItem ( applet-> iface-> icon ( ), applet-> iface-> text ( ) );
376 applets.insert ( applet-> id, new MenuApplet(*applet)); 302
303
304 m_applets.insert ( applet-> id, new MenuApplet(*applet));
377 } 305 }
378 delete [] xapplets; 306 delete [] xapplets;
379 307
380 if ( sepId && ( launchMenu-> idAt ( launchMenu-> count ( ) - 1 ) == sepId )) { // no applets
381 launchMenu-> removeItem ( sepId );
382 sepId = 0;
383 } 308 }
384 if ( !launchMenu-> count ( )) // if we don't do this QPopupMenu will insert a dummy Separator, which won't go away later
385 sepId = launchMenu-> insertSeparator ( );
386 309
387 if ( !safety_tid )
388 safety_tid = startTimer(2000); // TT has 5000, but this is a PITA for a developer ;) (sandman)
389}
390 310
391void StartMenu::timerEvent(QTimerEvent* e) 311/*
392{ 312 * Launcher calls loadMenu too often fix that
393 if ( e->timerId() == safety_tid ) { 313 */
394 Config cfg( "StartMenu" ); 314void StartMenu::addApplets(QPopupMenu* pop) {
395 cfg.setGroup( "Applets" ); 315 QIntDict<MenuApplet> dict;
396 cfg.writeEntry( "SafeMode", FALSE ); 316 if( pop-> count ( ))
397 killTimer(safety_tid); 317 pop-> insertSeparator ( );
398 safety_tid = 0; 318
319 for ( QIntDictIterator<MenuApplet> it ( m_applets ); it. current ( ); ++it ) {
320 MenuApplet *applet = it. current ( );
321 if ( applet-> popup )
322 applet-> id = pop-> insertItem ( applet-> iface-> icon ( ), applet-> iface-> text ( ), applet-> popup );
323 else
324 applet-> id = pop-> insertItem ( applet-> iface-> icon ( ), applet-> iface-> text ( ) );
325
326 dict.insert( applet->id, new MenuApplet(*applet) );
399 } 327 }
328 /* need to update the key */
329 m_applets.setAutoDelete( true );
330 m_applets.clear();
331 m_applets.setAutoDelete( false );
332 m_applets = dict;
400} 333}
401
diff --git a/core/launcher/startmenu.h b/core/launcher/startmenu.h
index 0a91bb8..99df0f0 100644
--- a/core/launcher/startmenu.h
+++ b/core/launcher/startmenu.h
@@ -18,86 +18,78 @@
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#ifndef __START_MENU_H__ 21#ifndef __START_MENU_H__
22#define __START_MENU_H__ 22#define __START_MENU_H__
23 23
24#include <qtopia/applnk.h>
25#include <qintdict.h>
24#include <qstring.h> 26#include <qstring.h>
25#include <qlist.h> 27#include <qlist.h>
26#include <qintdict.h>
27#include <qlabel.h> 28#include <qlabel.h>
28#include <qpopupmenu.h> 29#include <qpopupmenu.h>
29 30
30#include <qpe/menuappletinterface.h> 31#include <qtopia/menuappletinterface.h>
31
32class AppLnkSet;
33class AppLnk;
34 32
35class StartPopupMenu : public QPopupMenu 33class StartPopupMenu : public QPopupMenu
36{ 34{
37public: 35public:
38 StartPopupMenu( QWidget *parent ) : QPopupMenu( parent ) {} 36 StartPopupMenu( QWidget *parent ) : QPopupMenu( parent ) {}
39protected: 37protected:
40 void keyPressEvent( QKeyEvent *e ); 38 void keyPressEvent( QKeyEvent *e );
41}; 39};
42 40
43class QLibrary; 41class QLibrary;
44 42
45struct MenuApplet 43
46{ 44struct MenuApplet {
47#ifndef QT_NO_COMPONENT
48 QLibrary *library; 45 QLibrary *library;
49#endif
50 MenuAppletInterface *iface; 46 MenuAppletInterface *iface;
51 int id; 47 int id;
52 QPopupMenu *popup; 48 QPopupMenu *popup;
53}; 49};
54 50
55
56class StartMenu : public QLabel { 51class StartMenu : public QLabel {
57 Q_OBJECT 52 Q_OBJECT
58public: 53public:
59 StartMenu( QWidget * ); 54 StartMenu( QWidget * );
60 ~StartMenu(); 55 ~StartMenu();
61 56
62 const AppLnk* execToLink(const QString& appname); 57 void refreshMenu();
63 58
64public: 59public:
65 StartPopupMenu *launchMenu; 60 StartPopupMenu *launchMenu;
66 61
62signals:
63 void tabSelected(const QString&);
64
67public slots: 65public slots:
68 void launch( ); 66 void launch( );
69 void loadOptions( );
70 void createMenu( ); 67 void createMenu( );
71 void reloadApps( );
72 void reloadApplets( );
73 68
74protected slots: 69protected slots:
75 void itemSelected( int id ); 70 void itemSelected( int id );
76 71
77protected: 72protected:
78 virtual void mousePressEvent( QMouseEvent * ); 73 virtual void mousePressEvent( QMouseEvent * );
79 virtual void timerEvent ( QTimerEvent * );
80 74
81private: 75private:
82 bool loadMenu( AppLnkSet *folder, QPopupMenu *menu );
83 void loadApplets( ); 76 void loadApplets( );
84 void clearApplets( ); 77 void clearApplets( );
78 void addApplets( QPopupMenu* menu );
79 bool loadMenu( QPopupMenu *menu );
85 80
86private: 81private:
87 bool useWidePopupMenu; 82 bool useWidePopupMenu;
88 QString popupMenuSidePixmap; 83 QString popupMenuSidePixmap;
89 84
90 bool startButtonIsFlat; 85 bool startButtonIsFlat;
91 QString startButtonPixmap; 86 QString startButtonPixmap;
92 87
93 AppLnkSet *apps; 88 QStringList tabs;
94 89 QList<AppLnk> other;
95 QIntDict<MenuApplet> applets; 90 QIntDict<MenuApplet> m_applets;
96 QIntDict<QPopupMenu> tabdict; 91 int ntabs;
97 92 int nother;
98// QValueList<MenuApplet> appletList;
99 int safety_tid;
100 int sepId;
101}; 93};
102 94
103#endif // __START_MENU_H__ 95#endif // __START_MENU_H__