author | sandman <sandman> | 2002-10-02 22:06:33 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-10-02 22:06:33 (UTC) |
commit | b757807635fddb4824eabd87f72c96a0929c5cb1 (patch) (unidiff) | |
tree | 831e4870fe1562507540b386cbcbd1ea93ecb9a8 | |
parent | 2682a282dc87074bdc61d241d5b2d76e8533982c (diff) | |
download | opie-b757807635fddb4824eabd87f72c96a0929c5cb1.zip opie-b757807635fddb4824eabd87f72c96a0929c5cb1.tar.gz opie-b757807635fddb4824eabd87f72c96a0929c5cb1.tar.bz2 |
- Qtopia 1.6 launcher merge (again - should be finished soon)
- Support for O-Menu applets (similiar to Taskbar applets)
-rw-r--r-- | core/launcher/desktop.cpp | 18 | ||||
-rw-r--r-- | core/launcher/desktop.h | 2 | ||||
-rw-r--r-- | core/launcher/startmenu.cpp | 304 | ||||
-rw-r--r-- | core/launcher/startmenu.h | 31 | ||||
-rw-r--r-- | core/launcher/systray.cpp | 2 | ||||
-rw-r--r-- | core/launcher/taskbar.cpp | 19 |
6 files changed, 318 insertions, 58 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp index 68949e6..1a33b36 100644 --- a/core/launcher/desktop.cpp +++ b/core/launcher/desktop.cpp | |||
@@ -367,32 +367,35 @@ void DesktopApplication::desktopMessage( const QCString &msg, const QByteArray & | |||
367 | { | 367 | { |
368 | #ifdef Q_WS_QWS | 368 | #ifdef Q_WS_QWS |
369 | QDataStream stream( data, IO_ReadOnly ); | 369 | QDataStream stream( data, IO_ReadOnly ); |
370 | if ( msg == "keyRegister(int key, QString channel, QString message)" ) { | 370 | if ( msg == "keyRegister(int key, QString channel, QString message)" ) { |
371 | int k; | 371 | int k; |
372 | QString c, m; | 372 | QString c, m; |
373 | stream >> k; | 373 | stream >> k; |
374 | stream >> c; | 374 | stream >> c; |
375 | stream >> m; | 375 | stream >> m; |
376 | 376 | ||
377 | qWarning( "KeyRegisterReceived: %i, %s, %s", k, ( const char* ) c, ( const char * ) m ); | 377 | qWarning( "KeyRegisterReceived: %i, %s, %s", k, ( const char* ) c, ( const char * ) m ); |
378 | keyRegisterList.append( QCopKeyRegister( k, c, m ) ); | 378 | keyRegisterList.append( QCopKeyRegister( k, c, m ) ); |
379 | } | 379 | } |
380 | else if ( msg == "suspend()" ) { | 380 | else if ( msg == "suspend()" ) { |
381 | emit power(); | 381 | emit power(); |
382 | } | 382 | } |
383 | else if ( msg == "home()" ) { | ||
384 | qpedesktop-> home ( ); | ||
385 | } | ||
383 | #endif | 386 | #endif |
384 | } | 387 | } |
385 | 388 | ||
386 | 389 | ||
387 | void DesktopApplication::systemMessage( const QCString & msg, const QByteArray & data ) | 390 | void DesktopApplication::systemMessage( const QCString & msg, const QByteArray & data ) |
388 | { | 391 | { |
389 | #ifdef Q_WS_QWS | 392 | #ifdef Q_WS_QWS |
390 | QDataStream stream ( data, IO_ReadOnly ); | 393 | QDataStream stream ( data, IO_ReadOnly ); |
391 | 394 | ||
392 | if ( msg == "setScreenSaverInterval(int)" ) { | 395 | if ( msg == "setScreenSaverInterval(int)" ) { |
393 | int time; | 396 | int time; |
394 | stream >> time; | 397 | stream >> time; |
395 | m_screensaver-> setInterval( time ); | 398 | m_screensaver-> setInterval( time ); |
396 | } | 399 | } |
397 | else if ( msg == "setScreenSaverIntervals(int,int,int)" ) { | 400 | else if ( msg == "setScreenSaverIntervals(int,int,int)" ) { |
398 | int t1, t2, t3; | 401 | int t1, t2, t3; |
@@ -704,43 +707,48 @@ static bool hasVisibleWindow( const QString& clientname ) | |||
704 | const QList<QWSWindow> &list = qwsServer->clientWindows(); | 707 | const QList<QWSWindow> &list = qwsServer->clientWindows(); |
705 | QWSWindow* w; | 708 | QWSWindow* w; |
706 | for ( QListIterator<QWSWindow> it( list ); ( w = it.current() ); ++it ) { | 709 | for ( QListIterator<QWSWindow> it( list ); ( w = it.current() ); ++it ) { |
707 | if ( w->client() ->identity() == clientname && !w->isFullyObscured() ) | 710 | if ( w->client() ->identity() == clientname && !w->isFullyObscured() ) |
708 | return TRUE; | 711 | return TRUE; |
709 | } | 712 | } |
710 | return FALSE; | 713 | return FALSE; |
711 | } | 714 | } |
712 | 715 | ||
713 | void Desktop::raiseLauncher() | 716 | void Desktop::raiseLauncher() |
714 | { | 717 | { |
715 | Config cfg( "qpe" ); //F12 'Home' | 718 | Config cfg( "qpe" ); //F12 'Home' |
716 | cfg.setGroup( "AppsKey" ); | 719 | cfg.setGroup( "AppsKey" ); |
717 | QString tempItem; | 720 | QString tempItem; |
718 | tempItem = cfg.readEntry( "Middle", "Home" ); | 721 | tempItem = cfg.readEntry( "Middle", "Home" ); |
719 | if ( tempItem == "Home" || tempItem.isEmpty() ) { | 722 | if ( tempItem == "Home" || tempItem.isEmpty() ) { |
720 | if ( isVisibleWindow( launcher->winId() ) ) | 723 | home ( ); |
721 | launcher->nextView(); | ||
722 | else | ||
723 | launcher->raise(); | ||
724 | } | 724 | } |
725 | else { | 725 | else { |
726 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 726 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
727 | e << tempItem; | 727 | e << tempItem; |
728 | } | 728 | } |
729 | } | 729 | } |
730 | 730 | ||
731 | void Desktop::home ( ) | ||
732 | { | ||
733 | if ( isVisibleWindow( launcher->winId() ) ) | ||
734 | launcher->nextView(); | ||
735 | else | ||
736 | launcher->raise(); | ||
737 | } | ||
738 | |||
731 | void Desktop::executeOrModify( const QString& appLnkFile ) | 739 | void Desktop::executeOrModify( const QString& appLnkFile ) |
732 | { | 740 | { |
733 | AppLnk lnk( MimeType::appsFolderName() + "/" + appLnkFile ); | 741 | AppLnk lnk( MimeType::appsFolderName() + "/" + appLnkFile ); |
734 | if ( lnk.isValid() ) { | 742 | if ( lnk.isValid() ) { |
735 | QCString app = lnk.exec().utf8(); | 743 | QCString app = lnk.exec().utf8(); |
736 | Global::terminateBuiltin( "calibrate" ); | 744 | Global::terminateBuiltin( "calibrate" ); |
737 | if ( QCopChannel::isRegistered( "QPE/Application/" + app ) ) { | 745 | if ( QCopChannel::isRegistered( "QPE/Application/" + app ) ) { |
738 | // MRUList::addTask( &lnk ); | 746 | // MRUList::addTask( &lnk ); |
739 | if ( hasVisibleWindow( app ) ) | 747 | if ( hasVisibleWindow( app ) ) |
740 | QCopChannel::send( "QPE/Application/" + app, "nextView()" ); | 748 | QCopChannel::send( "QPE/Application/" + app, "nextView()" ); |
741 | else | 749 | else |
742 | QCopChannel::send( "QPE/Application/" + app, "raise()" ); | 750 | QCopChannel::send( "QPE/Application/" + app, "raise()" ); |
743 | } | 751 | } |
744 | else { | 752 | else { |
745 | lnk.execute(); | 753 | lnk.execute(); |
746 | } | 754 | } |
@@ -824,32 +832,34 @@ void Desktop::execAutoStart() | |||
824 | #include <qpe/config.h> | 832 | #include <qpe/config.h> |
825 | 833 | ||
826 | #include <sys/ioctl.h> | 834 | #include <sys/ioctl.h> |
827 | #include <sys/types.h> | 835 | #include <sys/types.h> |
828 | #include <fcntl.h> | 836 | #include <fcntl.h> |
829 | #include <unistd.h> | 837 | #include <unistd.h> |
830 | #include <errno.h> | 838 | #include <errno.h> |
831 | #include <linux/ioctl.h> | 839 | #include <linux/ioctl.h> |
832 | #include <time.h> | 840 | #include <time.h> |
833 | #endif | 841 | #endif |
834 | 842 | ||
835 | 843 | ||
836 | void Desktop::togglePower() | 844 | void Desktop::togglePower() |
837 | { | 845 | { |
838 | static bool excllock = false; | 846 | static bool excllock = false; |
839 | 847 | ||
848 | qDebug ( "togglePower (locked == %d)", excllock ? 1 : 0 ); | ||
849 | |||
840 | if ( excllock ) | 850 | if ( excllock ) |
841 | return ; | 851 | return ; |
842 | 852 | ||
843 | excllock = true; | 853 | excllock = true; |
844 | 854 | ||
845 | bool wasloggedin = loggedin; | 855 | bool wasloggedin = loggedin; |
846 | loggedin = 0; | 856 | loggedin = 0; |
847 | suspendTime = QDateTime::currentDateTime(); | 857 | suspendTime = QDateTime::currentDateTime(); |
848 | 858 | ||
849 | ODevice::inst ( ) -> suspend ( ); | 859 | ODevice::inst ( ) -> suspend ( ); |
850 | 860 | ||
851 | QWSServer::screenSaverActivate ( false ); | 861 | QWSServer::screenSaverActivate ( false ); |
852 | DesktopApplication::switchLCD ( true ); // force LCD on without slow qcop call | 862 | DesktopApplication::switchLCD ( true ); // force LCD on without slow qcop call |
853 | 863 | ||
854 | { | 864 | { |
855 | QCopEnvelope( "QPE/Card", "mtabChanged()" ); // might have changed while asleep | 865 | QCopEnvelope( "QPE/Card", "mtabChanged()" ); // might have changed while asleep |
diff --git a/core/launcher/desktop.h b/core/launcher/desktop.h index f7c3e3f..09ffe1c 100644 --- a/core/launcher/desktop.h +++ b/core/launcher/desktop.h | |||
@@ -105,32 +105,34 @@ public: | |||
105 | 105 | ||
106 | public slots: | 106 | public slots: |
107 | void raiseDatebook(); | 107 | void raiseDatebook(); |
108 | void raiseContacts(); | 108 | void raiseContacts(); |
109 | void raiseMenu(); | 109 | void raiseMenu(); |
110 | void raiseLauncher(); | 110 | void raiseLauncher(); |
111 | void raiseEmail(); | 111 | void raiseEmail(); |
112 | void execAutoStart(); | 112 | void execAutoStart(); |
113 | void togglePower(); | 113 | void togglePower(); |
114 | void toggleLight(); | 114 | void toggleLight(); |
115 | void toggleNumLockState(); | 115 | void toggleNumLockState(); |
116 | void toggleCapsLockState(); | 116 | void toggleCapsLockState(); |
117 | void toggleSymbolInput(); | 117 | void toggleSymbolInput(); |
118 | void terminateServers(); | 118 | void terminateServers(); |
119 | void rereadVolumes(); | 119 | void rereadVolumes(); |
120 | 120 | ||
121 | void home ( ); | ||
122 | |||
121 | protected: | 123 | protected: |
122 | void executeOrModify( const QString& appLnkFile ); | 124 | void executeOrModify( const QString& appLnkFile ); |
123 | void styleChange( QStyle & ); | 125 | void styleChange( QStyle & ); |
124 | void timerEvent( QTimerEvent *e ); | 126 | void timerEvent( QTimerEvent *e ); |
125 | 127 | ||
126 | QWidget *bg; | 128 | QWidget *bg; |
127 | Launcher *launcher; | 129 | Launcher *launcher; |
128 | TaskBar *tb; | 130 | TaskBar *tb; |
129 | 131 | ||
130 | private: | 132 | private: |
131 | void startTransferServer(); | 133 | void startTransferServer(); |
132 | bool recoverMemory(); | 134 | bool recoverMemory(); |
133 | 135 | ||
134 | QCopBridge *qcopBridge; | 136 | QCopBridge *qcopBridge; |
135 | TransferServer *transferServer; | 137 | TransferServer *transferServer; |
136 | PackageSlave *packageSlave; | 138 | PackageSlave *packageSlave; |
diff --git a/core/launcher/startmenu.cpp b/core/launcher/startmenu.cpp index b008a30..647d0f2 100644 --- a/core/launcher/startmenu.cpp +++ b/core/launcher/startmenu.cpp | |||
@@ -1,171 +1,385 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #define INCLUDE_MENUITEM_DEF | ||
22 | |||
21 | #include "startmenu.h" | 23 | #include "startmenu.h" |
22 | #include "sidething.h" | 24 | #include "sidething.h" |
23 | //#include "mrulist.h" | 25 | //#include "mrulist.h" |
24 | #include "info.h" | 26 | #include "info.h" |
25 | 27 | ||
26 | #include <qpe/qpeapplication.h> | 28 | #include <qpe/qpeapplication.h> |
27 | #include <qpe/config.h> | 29 | #include <qpe/config.h> |
28 | #include <qpe/applnk.h> | 30 | #include <qpe/applnk.h> |
29 | #include <qpe/global.h> | 31 | #include <qpe/global.h> |
30 | #include <qpe/resource.h> | 32 | #include <qpe/resource.h> |
33 | #include <qpe/qlibrary.h> | ||
31 | 34 | ||
32 | #include <qdict.h> | 35 | #include <qintdict.h> |
36 | #include <qdir.h> | ||
33 | 37 | ||
34 | #include <stdlib.h> | 38 | #include <stdlib.h> |
35 | 39 | ||
36 | 40 | ||
37 | // #define USE_CONFIG_FILE | 41 | // #define USE_CONFIG_FILE |
38 | 42 | ||
39 | 43 | ||
40 | StartMenu::StartMenu(QWidget *parent) : QLabel( parent ) | 44 | StartMenu::StartMenu(QWidget *parent) : QLabel( parent ) |
41 | { | 45 | { |
42 | loadOptions(); | 46 | loadOptions(); |
43 | 47 | ||
44 | setPixmap( Resource::loadPixmap( startButtonPixmap ) ); | 48 | int sz = AppLnk::smallIconSize()+3; |
49 | QPixmap pm; | ||
50 | pm.convertFromImage(Resource::loadImage(startButtonPixmap).smoothScale(sz,sz)); | ||
51 | setPixmap(pm); | ||
45 | setFocusPolicy( NoFocus ); | 52 | setFocusPolicy( NoFocus ); |
46 | //setFlat( startButtonIsFlat ); | 53 | //setFlat( startButtonIsFlat ); |
47 | 54 | ||
48 | apps = new AppLnkSet( QPEApplication::qpeDir() + "apps" ); | 55 | apps = 0; |
49 | 56 | launchMenu = 0; | |
50 | createMenu(); | 57 | applets. setAutoDelete ( true ); |
58 | sepId = 0; | ||
59 | |||
60 | reloadApps ( ); | ||
61 | reloadApplets ( ); | ||
51 | } | 62 | } |
52 | 63 | ||
53 | 64 | ||
54 | void StartMenu::mousePressEvent( QMouseEvent * ) | 65 | void StartMenu::mousePressEvent( QMouseEvent * ) |
55 | { | 66 | { |
56 | launch(); | 67 | launch(); |
57 | if (desktopInfo) | 68 | if (desktopInfo) |
58 | desktopInfo->menuClicked(); | 69 | desktopInfo->menuClicked(); |
59 | } | 70 | } |
60 | 71 | ||
61 | 72 | ||
62 | StartMenu::~StartMenu() | 73 | StartMenu::~StartMenu() |
63 | { | 74 | { |
64 | delete apps; | 75 | delete apps; |
65 | } | 76 | } |
66 | 77 | ||
67 | 78 | ||
68 | void StartMenu::loadOptions() | 79 | void StartMenu::loadOptions() |
69 | { | 80 | { |
70 | #ifdef USE_CONFIG_FILE | 81 | #ifdef USE_CONFIG_FILE |
71 | // Read configuration file | 82 | // Read configuration file |
72 | Config config("StartMenu"); | 83 | Config config("StartMenu"); |
73 | config.setGroup( "StartMenu" ); | 84 | config.setGroup( "StartMenu" ); |
74 | QString tmpBoolString1 = config.readEntry( "UseWidePopupMenu", "FALSE" ); | 85 | QString tmpBoolString1 = config.readEntry( "UseWidePopupMenu", "FALSE" ); |
75 | useWidePopupMenu = ( tmpBoolString1 == "TRUE" ) ? TRUE : FALSE; | 86 | useWidePopupMenu = ( tmpBoolString1 == "TRUE" ) ? TRUE : FALSE; |
76 | QString tmpBoolString2 = config.readEntry( "StartButtonIsFlat", "TRUE" ); | 87 | QString tmpBoolString2 = config.readEntry( "StartButtonIsFlat", "TRUE" ); |
77 | startButtonIsFlat = ( tmpBoolString2 == "TRUE" ) ? TRUE : FALSE; | 88 | startButtonIsFlat = ( tmpBoolString2 == "TRUE" ) ? TRUE : FALSE; |
78 | // QString tmpBoolString3 = config.readEntry( "UseMRUList", "TRUE" ); | 89 | QString tmpBoolString3 = config.readEntry( "UseMRUList", "TRUE" ); |
79 | popupMenuSidePixmap = config.readEntry( "PopupMenuSidePixmap", "launcher/sidebar" ); | 90 | popupMenuSidePixmap = config.readEntry( "PopupMenuSidePixmap", "launcher/sidebar" ); |
80 | startButtonPixmap = config.readEntry( "StartButtonPixmap", "go" ); | 91 | startButtonPixmap = config.readEntry( "StartButtonPixmap", "launcher/start_button" ); |
81 | #else | 92 | #else |
82 | // Basically just #include the .qpe_menu.conf file settings | 93 | // Basically just #include the .qpe_menu.conf file settings |
83 | useWidePopupMenu = FALSE; | 94 | useWidePopupMenu = FALSE; |
84 | popupMenuSidePixmap = "launcher/sidebar"; | 95 | popupMenuSidePixmap = "launcher/sidebar"; |
85 | startButtonIsFlat = TRUE; | 96 | startButtonIsFlat = TRUE; |
86 | startButtonPixmap = "launcher/start_button"; | 97 | startButtonPixmap = "launcher/start_button"; // No tr |
87 | #endif | 98 | #endif |
88 | } | 99 | } |
89 | 100 | ||
90 | 101 | ||
91 | void StartMenu::createMenu() | 102 | void StartMenu::createMenu() |
92 | { | 103 | { |
104 | delete launchMenu; | ||
93 | if ( useWidePopupMenu ) | 105 | if ( useWidePopupMenu ) |
94 | launchMenu = new PopupWithLaunchSideThing( this, &popupMenuSidePixmap ); | 106 | launchMenu = new PopupWithLaunchSideThing( this, &popupMenuSidePixmap ); |
95 | else | 107 | else |
96 | launchMenu = new StartPopupMenu( this ); | 108 | launchMenu = new StartPopupMenu( this ); |
97 | 109 | ||
98 | loadMenu( apps, launchMenu ); | 110 | loadMenu ( apps, launchMenu ); |
111 | loadApplets ( ); | ||
112 | |||
113 | connect( launchMenu, SIGNAL(activated(int)), SLOT(itemSelected(int)) ); | ||
114 | } | ||
99 | 115 | ||
116 | void StartMenu::reloadApps() | ||
117 | { | ||
118 | Config cfg("StartMenu"); | ||
119 | cfg.setGroup("Menu"); | ||
120 | bool ltabs = cfg.readBoolEntry("LauncherTabs",TRUE); | ||
121 | bool lot = cfg.readBoolEntry("LauncherOther",TRUE); | ||
122 | bool lt = ltabs || lot; | ||
123 | if ( launchMenu && apps && !lt ) | ||
124 | return; // nothing to do | ||
125 | |||
126 | if ( lt ) { | ||
127 | delete apps; | ||
128 | apps = new AppLnkSet( QPEApplication::qpeDir() + "apps" ); | ||
129 | } | ||
130 | if ( launchMenu ) { | ||
131 | launchMenu-> hide ( ); | ||
132 | |||
133 | for ( QIntDictIterator<QPopupMenu> it ( tabdict ); it. current ( ); ++it ) { | ||
134 | launchMenu-> removeItem ( it. currentKey ( )); | ||
135 | delete it.current ( ); | ||
136 | } | ||
137 | tabdict. clear ( ); | ||
138 | loadMenu(apps,launchMenu); | ||
139 | } else { | ||
140 | createMenu(); | ||
141 | } | ||
142 | } | ||
143 | |||
144 | void StartMenu::reloadApplets() | ||
145 | { | ||
146 | if ( launchMenu ) { | ||
147 | clearApplets ( ); | ||
148 | loadApplets ( ); | ||
149 | } | ||
150 | else | ||
151 | createMenu ( ); | ||
100 | } | 152 | } |
101 | 153 | ||
102 | void StartMenu::itemSelected( int id ) | 154 | void StartMenu::itemSelected( int id ) |
103 | { | 155 | { |
104 | const AppLnk *app = apps->find( id ); | 156 | const AppLnk *app = apps->find( id ); |
105 | if ( app ) | 157 | if ( app ) |
106 | app->execute(); | 158 | app->execute(); |
159 | else { | ||
160 | MenuApplet *applet = applets. find ( id ); | ||
161 | |||
162 | if ( applet ) | ||
163 | applet-> iface-> activated ( ); | ||
164 | } | ||
107 | } | 165 | } |
108 | 166 | ||
109 | bool StartMenu::loadMenu( AppLnkSet *folder, QPopupMenu *menu ) | 167 | bool StartMenu::loadMenu( AppLnkSet *folder, QPopupMenu *menu ) |
110 | { | 168 | { |
111 | bool result = FALSE; | 169 | bool result = FALSE; |
112 | 170 | ||
113 | QStringList typs = folder->types(); | 171 | Config cfg("StartMenu"); |
114 | QDict<QPopupMenu> typpop; | 172 | cfg.setGroup("Menu"); |
115 | for (QStringList::Iterator tit=typs.begin(); tit!=typs.end(); ++tit) { | 173 | |
116 | if ( !(*tit).isEmpty() ) { | 174 | bool ltabs = cfg.readBoolEntry("LauncherTabs",TRUE); |
117 | QPopupMenu *new_menu = new StartPopupMenu( menu ); | 175 | bool lot = cfg.readBoolEntry("LauncherOther",TRUE); |
118 | typpop.insert(*tit, new_menu); | 176 | |
119 | connect( new_menu, SIGNAL(activated(int)), SLOT(itemSelected(int)) ); | 177 | tabdict. clear ( ); |
120 | menu->insertItem( folder->typePixmap(*tit), folder->typeName(*tit), new_menu ); | 178 | |
121 | } | 179 | if ( sepId ) |
122 | } | 180 | menu-> removeItem ( sepId ); |
123 | 181 | sepId = ( menu-> count ( )) ? menu-> insertSeparator ( 0 ) : 0; | |
124 | QListIterator<AppLnk> it( folder->children() ); | 182 | |
125 | for ( ; it.current(); ++it ) { | 183 | if ( ltabs || lot ) { |
126 | AppLnk *app = it.current(); | 184 | QDict<QPopupMenu> typpop; |
127 | if ( app->type() == "Separator" ) { | 185 | QStringList typs = folder->types(); |
128 | menu->insertSeparator(); | 186 | for (QStringList::Iterator tit=typs.fromLast(); ; --tit) { |
129 | } else { | 187 | if ( !(*tit).isEmpty() ) { |
130 | QString t = app->type(); | 188 | QPopupMenu *new_menu; |
131 | QPopupMenu* pmenu = typpop.find(t); | 189 | if ( ltabs ) { |
132 | if ( !pmenu ) | 190 | new_menu = new StartPopupMenu( menu ); |
133 | pmenu = menu; | 191 | connect( new_menu, SIGNAL(activated(int)), SLOT(itemSelected(int)) ); |
134 | pmenu->insertItem( app->pixmap(), app->name(), app->id() ); | 192 | int id = menu->insertItem( folder->typePixmap(*tit), folder->typeName(*tit), new_menu, -1, 0 ); |
135 | result=TRUE; | 193 | tabdict. insert ( id, new_menu ); |
136 | } | 194 | } else { |
195 | new_menu = (QPopupMenu*)1; | ||
196 | } | ||
197 | typpop.insert(*tit, new_menu); | ||
198 | } | ||
199 | if ( tit == typs. begin ( )) | ||
200 | break; | ||
201 | } | ||
202 | QListIterator<AppLnk> it( folder->children() ); | ||
203 | bool f=TRUE; | ||
204 | for ( ; it.current(); ++it ) { | ||
205 | AppLnk *app = it.current(); | ||
206 | if ( app->type() == "Separator" ) { // No tr | ||
207 | if ( lot ) { | ||
208 | menu->insertSeparator(); | ||
209 | } | ||
210 | } else { | ||
211 | f = FALSE; | ||
212 | QString t = app->type(); | ||
213 | QPopupMenu* pmenu = typpop.find(t); | ||
214 | if ( ltabs ) { | ||
215 | if ( !pmenu && lot ) | ||
216 | pmenu = menu; | ||
217 | } else { | ||
218 | if ( !pmenu ) | ||
219 | pmenu = menu; | ||
220 | else | ||
221 | pmenu = 0; | ||
222 | } | ||
223 | if ( pmenu ) { | ||
224 | QString t = app->name(); | ||
225 | t.replace(QRegExp("&"),"&&"); // escape shortcut character | ||
226 | pmenu->insertItem( app->pixmap(), t, app->id() ); | ||
227 | } | ||
228 | result=TRUE; | ||
229 | } | ||
230 | } | ||
137 | } | 231 | } |
138 | 232 | ||
139 | if ( result ) | 233 | if ( sepId && ( menu-> idAt ( 0 ) == sepId )) { // no tabs entries |
140 | connect( menu, SIGNAL(activated(int)), SLOT(itemSelected(int)) ); | 234 | menu-> removeItem ( sepId ); |
141 | 235 | sepId = 0; | |
236 | } | ||
237 | if ( !menu-> count ( )) // if we don't do this QPopupMenu will insert a dummy Separator, which won't go away later | ||
238 | sepId = menu-> insertSeparator ( ); | ||
239 | |||
142 | return result; | 240 | return result; |
143 | } | 241 | } |
144 | 242 | ||
145 | 243 | ||
146 | void StartMenu::launch() | 244 | void StartMenu::launch() |
147 | { | 245 | { |
148 | int y = mapToGlobal( QPoint() ).y() - launchMenu->sizeHint().height(); | 246 | int y = mapToGlobal( QPoint() ).y() - launchMenu->sizeHint().height(); |
149 | 247 | ||
150 | if ( launchMenu->isVisible() ) | 248 | if ( launchMenu->isVisible() ) |
151 | launchMenu->hide(); | 249 | launchMenu->hide(); |
152 | else | 250 | else |
153 | launchMenu->popup( QPoint( 1, y ) ); | 251 | launchMenu->popup( QPoint( 1, y ) ); |
154 | } | 252 | } |
155 | 253 | ||
156 | const AppLnk* StartMenu::execToLink(const QString& appname) | 254 | const AppLnk* StartMenu::execToLink(const QString& appname) |
157 | { | 255 | { |
158 | const AppLnk* a = apps->findExec( appname ); | 256 | const AppLnk* a = apps->findExec( appname ); |
159 | return a; | 257 | return a; |
160 | } | 258 | } |
161 | 259 | ||
162 | void StartPopupMenu::keyPressEvent( QKeyEvent *e ) | 260 | void StartPopupMenu::keyPressEvent( QKeyEvent *e ) |
163 | { | 261 | { |
164 | if ( e->key() == Key_F33 || e->key() == Key_Space ) { | 262 | if ( e->key() == Key_F33 || e->key() == Key_Space ) { |
165 | // "OK" button, little hacky | 263 | // "OK" button, little hacky |
166 | QKeyEvent ke(QEvent::KeyPress, Key_Enter, 13, 0); | 264 | QKeyEvent ke(QEvent::KeyPress, Key_Enter, 13, 0); |
167 | QPopupMenu::keyPressEvent( &ke ); | 265 | QPopupMenu::keyPressEvent( &ke ); |
168 | } else { | 266 | } else { |
169 | QPopupMenu::keyPressEvent( e ); | 267 | QPopupMenu::keyPressEvent( e ); |
170 | } | 268 | } |
171 | } | 269 | } |
270 | |||
271 | static int compareAppletPositions(const void *a, const void *b) | ||
272 | { | ||
273 | const MenuApplet* aa = *(const MenuApplet**)a; | ||
274 | const MenuApplet* ab = *(const MenuApplet**)b; | ||
275 | int d = ab->iface->position() - aa->iface->position(); | ||
276 | if ( d ) return d; | ||
277 | return QString::compare(ab->library->library(),aa->library->library()); | ||
278 | } | ||
279 | |||
280 | void StartMenu::clearApplets() | ||
281 | { | ||
282 | launchMenu-> hide(); | ||
283 | |||
284 | for ( QIntDictIterator<MenuApplet> it ( applets ); it. current ( ); ++it ) { | ||
285 | MenuApplet *applet = it. current ( ); | ||
286 | if ( launchMenu ) { | ||
287 | launchMenu-> removeItem ( applet-> id ); | ||
288 | delete applet-> popup; | ||
289 | } | ||
290 | |||
291 | applet-> iface-> release(); | ||
292 | applet-> library-> unload(); | ||
293 | delete applet-> library; | ||
294 | } | ||
295 | applets.clear(); | ||
296 | } | ||
297 | |||
298 | |||
299 | |||
300 | void StartMenu::loadApplets() | ||
301 | { | ||
302 | Config cfg( "StartMenu" ); | ||
303 | cfg.setGroup( "Applets" ); | ||
304 | |||
305 | // SafeMode causes too much problems, so we disable it for now -- | ||
306 | // maybe we should reenable it for OPIE 1.0 - sandman 26.09.02 | ||
307 | |||
308 | bool safe = false; //cfg.readBoolEntry("SafeMode",FALSE); | ||
309 | if ( safe && !safety_tid ) | ||
310 | return; | ||
311 | cfg.writeEntry("SafeMode",TRUE); | ||
312 | cfg.write(); | ||
313 | QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' ); | ||
314 | |||
315 | QString path = QPEApplication::qpeDir() + "/plugins/applets"; | ||
316 | QDir dir( path, "lib*.so" ); | ||
317 | QStringList list = dir.entryList(); | ||
318 | QStringList::Iterator it; | ||
319 | int napplets=0; | ||
320 | MenuApplet* *xapplets = new MenuApplet*[list.count()]; | ||
321 | for ( it = list.begin(); it != list.end(); ++it ) { | ||
322 | if ( exclude.find( *it ) != exclude.end() ) | ||
323 | continue; | ||
324 | MenuAppletInterface *iface = 0; | ||
325 | QLibrary *lib = new QLibrary( path + "/" + *it ); | ||
326 | if (( lib->queryInterface( IID_MenuApplet, (QUnknownInterface**)&iface ) == QS_OK ) && iface ) { | ||
327 | MenuApplet *applet = new MenuApplet; | ||
328 | xapplets[napplets++] = applet; | ||
329 | applet->library = lib; | ||
330 | applet->iface = iface; | ||
331 | } else { | ||
332 | exclude += *it; | ||
333 | delete lib; | ||
334 | } | ||
335 | } | ||
336 | cfg.writeEntry( "ExcludeApplets", exclude, ',' ); | ||
337 | qsort(xapplets,napplets,sizeof(applets[0]),compareAppletPositions); | ||
338 | |||
339 | if ( sepId ) | ||
340 | launchMenu-> removeItem ( sepId ); | ||
341 | sepId = ( launchMenu-> count ( )) ? launchMenu-> insertSeparator ( ) : 0; | ||
342 | |||
343 | while (napplets--) { | ||
344 | MenuApplet *applet = xapplets[napplets]; | ||
345 | QString lang = getenv( "LANG" ); | ||
346 | QTranslator * trans = new QTranslator(qApp); | ||
347 | QString type = (*it).left( (*it).find(".") ); | ||
348 | QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; | ||
349 | if ( trans->load( tfn )) | ||
350 | qApp->installTranslator( trans ); | ||
351 | else | ||
352 | delete trans; | ||
353 | |||
354 | applet-> popup = applet-> iface-> popup ( this ); | ||
355 | |||
356 | if ( applet-> popup ) | ||
357 | applet-> id = launchMenu-> insertItem ( applet-> iface-> icon ( ), applet-> iface-> text ( ), applet-> popup ); | ||
358 | else | ||
359 | applet-> id = launchMenu-> insertItem ( applet-> iface-> icon ( ), applet-> iface-> text ( ) ); | ||
360 | applets.insert ( applet-> id, new MenuApplet(*applet)); | ||
361 | } | ||
362 | delete xapplets; | ||
363 | |||
364 | if ( sepId && ( launchMenu-> idAt ( launchMenu-> count ( ) - 1 ) == sepId )) { // no applets | ||
365 | launchMenu-> removeItem ( sepId ); | ||
366 | sepId = 0; | ||
367 | } | ||
368 | if ( !launchMenu-> count ( )) // if we don't do this QPopupMenu will insert a dummy Separator, which won't go away later | ||
369 | sepId = launchMenu-> insertSeparator ( ); | ||
370 | |||
371 | if ( !safety_tid ) | ||
372 | safety_tid = startTimer(2000); // TT has 5000, but this is a PITA for a developer ;) (sandman) | ||
373 | } | ||
374 | |||
375 | void StartMenu::timerEvent(QTimerEvent* e) | ||
376 | { | ||
377 | if ( e->timerId() == safety_tid ) { | ||
378 | Config cfg( "StartMenu" ); | ||
379 | cfg.setGroup( "Applets" ); | ||
380 | cfg.writeEntry( "SafeMode", FALSE ); | ||
381 | killTimer(safety_tid); | ||
382 | safety_tid = 0; | ||
383 | } | ||
384 | } | ||
385 | |||
diff --git a/core/launcher/startmenu.h b/core/launcher/startmenu.h index a02f39e..0a91bb8 100644 --- a/core/launcher/startmenu.h +++ b/core/launcher/startmenu.h | |||
@@ -1,76 +1,103 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
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 <qstring.h> | 24 | #include <qstring.h> |
25 | #include <qlist.h> | 25 | #include <qlist.h> |
26 | #include <qintdict.h> | ||
26 | #include <qlabel.h> | 27 | #include <qlabel.h> |
27 | #include <qpopupmenu.h> | 28 | #include <qpopupmenu.h> |
28 | 29 | ||
30 | #include <qpe/menuappletinterface.h> | ||
29 | 31 | ||
30 | class AppLnkSet; | 32 | class AppLnkSet; |
31 | class AppLnk; | 33 | class AppLnk; |
32 | 34 | ||
33 | class StartPopupMenu : public QPopupMenu | 35 | class StartPopupMenu : public QPopupMenu |
34 | { | 36 | { |
35 | public: | 37 | public: |
36 | StartPopupMenu( QWidget *parent ) : QPopupMenu( parent ) {} | 38 | StartPopupMenu( QWidget *parent ) : QPopupMenu( parent ) {} |
37 | protected: | 39 | protected: |
38 | void keyPressEvent( QKeyEvent *e ); | 40 | void keyPressEvent( QKeyEvent *e ); |
39 | }; | 41 | }; |
40 | 42 | ||
43 | class QLibrary; | ||
44 | |||
45 | struct MenuApplet | ||
46 | { | ||
47 | #ifndef QT_NO_COMPONENT | ||
48 | QLibrary *library; | ||
49 | #endif | ||
50 | MenuAppletInterface *iface; | ||
51 | int id; | ||
52 | QPopupMenu *popup; | ||
53 | }; | ||
54 | |||
55 | |||
41 | class StartMenu : public QLabel { | 56 | class StartMenu : public QLabel { |
42 | Q_OBJECT | 57 | Q_OBJECT |
43 | public: | 58 | public: |
44 | StartMenu( QWidget * ); | 59 | StartMenu( QWidget * ); |
45 | ~StartMenu(); | 60 | ~StartMenu(); |
46 | 61 | ||
47 | const AppLnk* execToLink(const QString& appname); | 62 | const AppLnk* execToLink(const QString& appname); |
48 | 63 | ||
49 | public: | 64 | public: |
50 | StartPopupMenu *launchMenu; | 65 | StartPopupMenu *launchMenu; |
51 | 66 | ||
52 | public slots: | 67 | public slots: |
53 | void launch( ); | 68 | void launch( ); |
54 | void loadOptions( ); | 69 | void loadOptions( ); |
55 | void createMenu( ); | 70 | void createMenu( ); |
71 | void reloadApps( ); | ||
72 | void reloadApplets( ); | ||
56 | 73 | ||
57 | protected slots: | 74 | protected slots: |
58 | void itemSelected( int id ); | 75 | void itemSelected( int id ); |
59 | 76 | ||
60 | protected: | 77 | protected: |
61 | virtual void mousePressEvent( QMouseEvent * ); | 78 | virtual void mousePressEvent( QMouseEvent * ); |
79 | virtual void timerEvent ( QTimerEvent * ); | ||
62 | 80 | ||
63 | private: | 81 | private: |
64 | bool loadMenu( AppLnkSet *folder, QPopupMenu *menu ); | 82 | bool loadMenu( AppLnkSet *folder, QPopupMenu *menu ); |
83 | void loadApplets( ); | ||
84 | void clearApplets( ); | ||
65 | 85 | ||
66 | private: | 86 | private: |
67 | bool useWidePopupMenu; | 87 | bool useWidePopupMenu; |
68 | QString popupMenuSidePixmap; | 88 | QString popupMenuSidePixmap; |
69 | 89 | ||
70 | bool startButtonIsFlat; | 90 | bool startButtonIsFlat; |
71 | QString startButtonPixmap; | 91 | QString startButtonPixmap; |
72 | 92 | ||
73 | AppLnkSet *apps; | 93 | AppLnkSet *apps; |
94 | |||
95 | QIntDict<MenuApplet> applets; | ||
96 | QIntDict<QPopupMenu> tabdict; | ||
97 | |||
98 | // QValueList<MenuApplet> appletList; | ||
99 | int safety_tid; | ||
100 | int sepId; | ||
74 | }; | 101 | }; |
75 | 102 | ||
76 | #endif // __START_MENU_H__ | 103 | #endif // __START_MENU_H__ |
diff --git a/core/launcher/systray.cpp b/core/launcher/systray.cpp index 697971d..406c662 100644 --- a/core/launcher/systray.cpp +++ b/core/launcher/systray.cpp | |||
@@ -89,33 +89,33 @@ void SysTray::addApplets() | |||
89 | return; | 89 | return; |
90 | cfg.writeEntry("SafeMode",TRUE); | 90 | cfg.writeEntry("SafeMode",TRUE); |
91 | cfg.write(); | 91 | cfg.write(); |
92 | QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' ); | 92 | QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' ); |
93 | 93 | ||
94 | QString path = QPEApplication::qpeDir() + "/plugins/applets"; | 94 | QString path = QPEApplication::qpeDir() + "/plugins/applets"; |
95 | QDir dir( path, "lib*.so" ); | 95 | QDir dir( path, "lib*.so" ); |
96 | QStringList list = dir.entryList(); | 96 | QStringList list = dir.entryList(); |
97 | QStringList::Iterator it; | 97 | QStringList::Iterator it; |
98 | int napplets=0; | 98 | int napplets=0; |
99 | TaskbarApplet* *applets = new TaskbarApplet*[list.count()]; | 99 | TaskbarApplet* *applets = new TaskbarApplet*[list.count()]; |
100 | for ( it = list.begin(); it != list.end(); ++it ) { | 100 | for ( it = list.begin(); it != list.end(); ++it ) { |
101 | if ( exclude.find( *it ) != exclude.end() ) | 101 | if ( exclude.find( *it ) != exclude.end() ) |
102 | continue; | 102 | continue; |
103 | TaskbarAppletInterface *iface = 0; | 103 | TaskbarAppletInterface *iface = 0; |
104 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 104 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
105 | if ( lib->queryInterface( IID_TaskbarApplet, (QUnknownInterface**)&iface ) == QS_OK ) { | 105 | if (( lib->queryInterface( IID_TaskbarApplet, (QUnknownInterface**)&iface ) == QS_OK ) && iface ) { |
106 | TaskbarApplet *applet = new TaskbarApplet; | 106 | TaskbarApplet *applet = new TaskbarApplet; |
107 | applets[napplets++] = applet; | 107 | applets[napplets++] = applet; |
108 | applet->library = lib; | 108 | applet->library = lib; |
109 | applet->iface = iface; | 109 | applet->iface = iface; |
110 | } else { | 110 | } else { |
111 | exclude += *it; | 111 | exclude += *it; |
112 | delete lib; | 112 | delete lib; |
113 | } | 113 | } |
114 | } | 114 | } |
115 | cfg.writeEntry( "ExcludeApplets", exclude, ',' ); | 115 | cfg.writeEntry( "ExcludeApplets", exclude, ',' ); |
116 | qsort(applets,napplets,sizeof(applets[0]),compareAppletPositions); | 116 | qsort(applets,napplets,sizeof(applets[0]),compareAppletPositions); |
117 | while (napplets--) { | 117 | while (napplets--) { |
118 | TaskbarApplet *applet = applets[napplets]; | 118 | TaskbarApplet *applet = applets[napplets]; |
119 | applet->applet = applet->iface->applet( this ); | 119 | applet->applet = applet->iface->applet( this ); |
120 | appletList.append(*applet); | 120 | appletList.append(*applet); |
121 | QString lang = getenv( "LANG" ); | 121 | QString lang = getenv( "LANG" ); |
diff --git a/core/launcher/taskbar.cpp b/core/launcher/taskbar.cpp index 46bcdb3..7d1aaf1 100644 --- a/core/launcher/taskbar.cpp +++ b/core/launcher/taskbar.cpp | |||
@@ -178,54 +178,58 @@ TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOn | |||
178 | #if defined(Q_WS_QWS) | 178 | #if defined(Q_WS_QWS) |
179 | #if !defined(QT_NO_COP) | 179 | #if !defined(QT_NO_COP) |
180 | QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this ); | 180 | QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this ); |
181 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 181 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), |
182 | this, SLOT(receive(const QCString&, const QByteArray&)) ); | 182 | this, SLOT(receive(const QCString&, const QByteArray&)) ); |
183 | #endif | 183 | #endif |
184 | #endif | 184 | #endif |
185 | waitTimer = new QTimer( this ); | 185 | waitTimer = new QTimer( this ); |
186 | connect( waitTimer, SIGNAL( timeout() ), this, SLOT( stopWait() ) ); | 186 | connect( waitTimer, SIGNAL( timeout() ), this, SLOT( stopWait() ) ); |
187 | clearer = new QTimer( this ); | 187 | clearer = new QTimer( this ); |
188 | QObject::connect(clearer, SIGNAL(timeout()), SLOT(clearStatusBar())); | 188 | QObject::connect(clearer, SIGNAL(timeout()), SLOT(clearStatusBar())); |
189 | QObject::connect(clearer, SIGNAL(timeout()), sysTray, SLOT(show())); | 189 | QObject::connect(clearer, SIGNAL(timeout()), sysTray, SLOT(show())); |
190 | } | 190 | } |
191 | 191 | ||
192 | void TaskBar::setStatusMessage( const QString &text ) | 192 | void TaskBar::setStatusMessage( const QString &text ) |
193 | { | 193 | { |
194 | label->setText( text ); | 194 | if ( !text.isEmpty() ) { |
195 | stack->raiseWidget( label ); | 195 | label->setText( text ); |
196 | if ( sysTray && ( label->fontMetrics().width( text ) > label->width() ) ) | 196 | stack->raiseWidget( label ); |
197 | sysTray->hide(); | 197 | if ( sysTray && ( label->fontMetrics().width( text ) > label->width() ) ) |
198 | clearer->start( 3000 ); | 198 | sysTray->hide(); |
199 | clearer->start( 3000, TRUE ); | ||
200 | } else { | ||
201 | clearStatusBar(); | ||
202 | } | ||
199 | } | 203 | } |
200 | 204 | ||
201 | void TaskBar::clearStatusBar() | 205 | void TaskBar::clearStatusBar() |
202 | { | 206 | { |
203 | label->clear(); | 207 | label->clear(); |
204 | stack->raiseWidget(runningAppBar); | 208 | stack->raiseWidget(runningAppBar); |
205 | // stack->raiseWidget( mru ); | 209 | // stack->raiseWidget( mru ); |
206 | } | 210 | } |
207 | 211 | ||
208 | void TaskBar::startWait() | 212 | void TaskBar::startWait() |
209 | { | 213 | { |
210 | waitIcon->setWaiting( true ); | 214 | waitIcon->setWaiting( true ); |
211 | // a catchall stop after 10 seconds... | 215 | // a catchall stop after 10 seconds... |
212 | waitTimer->start( 10 * 1000, true ); | 216 | waitTimer->start( 10 * 1000, true ); |
213 | } | 217 | } |
214 | 218 | ||
215 | void TaskBar::stopWait(const QString& app) | 219 | void TaskBar::stopWait(const QString& /*app*/) |
216 | { | 220 | { |
217 | waitTimer->stop(); | 221 | waitTimer->stop(); |
218 | //mru->addTask(sm->execToLink(app)); | 222 | //mru->addTask(sm->execToLink(app)); |
219 | waitIcon->setWaiting( false ); | 223 | waitIcon->setWaiting( false ); |
220 | } | 224 | } |
221 | 225 | ||
222 | void TaskBar::stopWait() | 226 | void TaskBar::stopWait() |
223 | { | 227 | { |
224 | waitTimer->stop(); | 228 | waitTimer->stop(); |
225 | 229 | ||
226 | waitIcon->setWaiting( false ); | 230 | waitIcon->setWaiting( false ); |
227 | } | 231 | } |
228 | 232 | ||
229 | void TaskBar::resizeEvent( QResizeEvent *e ) | 233 | void TaskBar::resizeEvent( QResizeEvent *e ) |
230 | { | 234 | { |
231 | QHBox::resizeEvent( e ); | 235 | QHBox::resizeEvent( e ); |
@@ -260,35 +264,38 @@ void TaskBar::calcMaxWindowRect() | |||
260 | #endif | 264 | #endif |
261 | } | 265 | } |
262 | 266 | ||
263 | void TaskBar::receive( const QCString &msg, const QByteArray &data ) | 267 | void TaskBar::receive( const QCString &msg, const QByteArray &data ) |
264 | { | 268 | { |
265 | QDataStream stream( data, IO_ReadOnly ); | 269 | QDataStream stream( data, IO_ReadOnly ); |
266 | if ( msg == "message(QString)" ) { | 270 | if ( msg == "message(QString)" ) { |
267 | QString text; | 271 | QString text; |
268 | stream >> text; | 272 | stream >> text; |
269 | setStatusMessage( text ); | 273 | setStatusMessage( text ); |
270 | } else if ( msg == "hideInputMethod()" ) { | 274 | } else if ( msg == "hideInputMethod()" ) { |
271 | inputMethods->hideInputMethod(); | 275 | inputMethods->hideInputMethod(); |
272 | } else if ( msg == "showInputMethod()" ) { | 276 | } else if ( msg == "showInputMethod()" ) { |
273 | inputMethods->showInputMethod(); | 277 | inputMethods->showInputMethod(); |
274 | } else if ( msg == "reloadInputMethods()" ) { | 278 | } else if ( msg == "reloadInputMethods()" ) { |
275 | inputMethods->loadInputMethods(); | 279 | inputMethods->loadInputMethods(); |
280 | } else if ( msg == "reloadApps()" ) { | ||
281 | sm->reloadApps(); | ||
276 | } else if ( msg == "reloadApplets()" ) { | 282 | } else if ( msg == "reloadApplets()" ) { |
277 | sysTray->clearApplets(); | 283 | sysTray->clearApplets(); |
278 | sysTray->addApplets(); | 284 | sysTray->addApplets(); |
285 | sm->reloadApplets(); | ||
279 | } else if ( msg == "soundAlarm()" ) { | 286 | } else if ( msg == "soundAlarm()" ) { |
280 | Desktop::soundAlarm(); | 287 | Desktop::soundAlarm(); |
281 | } | 288 | } |
282 | else if ( msg == "setLed(int,bool)" ) { | 289 | else if ( msg == "setLed(int,bool)" ) { |
283 | int led, status; | 290 | int led, status; |
284 | stream >> led >> status; | 291 | stream >> led >> status; |
285 | 292 | ||
286 | QValueList <OLed> ll = ODevice::inst ( )-> ledList ( ); | 293 | QValueList <OLed> ll = ODevice::inst ( )-> ledList ( ); |
287 | if ( ll. count ( )){ | 294 | if ( ll. count ( )){ |
288 | OLed l = ll. contains ( Led_Mail ) ? Led_Mail : ll [0]; | 295 | OLed l = ll. contains ( Led_Mail ) ? Led_Mail : ll [0]; |
289 | bool canblink = ODevice::inst ( )-> ledStateList ( l ). contains ( Led_BlinkSlow ); | 296 | bool canblink = ODevice::inst ( )-> ledStateList ( l ). contains ( Led_BlinkSlow ); |
290 | 297 | ||
291 | ODevice::inst ( )-> setLedState ( l, status ? ( canblink ? Led_BlinkSlow : Led_On ) : Led_Off ); | 298 | ODevice::inst ( )-> setLedState ( l, status ? ( canblink ? Led_BlinkSlow : Led_On ) : Led_Off ); |
292 | } | 299 | } |
293 | } | 300 | } |
294 | } | 301 | } |