author | sandman <sandman> | 2002-09-12 01:16:41 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-09-12 01:16:41 (UTC) |
commit | 151987f8e0b7a179cf45032cc2ec5b4360023890 (patch) (unidiff) | |
tree | ea750ecfe96f7a30759d9bee7151602f02dec8cf /core/launcher | |
parent | b89a7559465274c3efb0a8258cecf22a185b123f (diff) | |
download | opie-151987f8e0b7a179cf45032cc2ec5b4360023890.zip opie-151987f8e0b7a179cf45032cc2ec5b4360023890.tar.gz opie-151987f8e0b7a179cf45032cc2ec5b4360023890.tar.bz2 |
- really remove mrulist
- new version of systray, which supports the Exclude list to hide applets
-rw-r--r-- | core/launcher/launcher.pro | 2 | ||||
-rw-r--r-- | core/launcher/main.cpp | 2 | ||||
-rw-r--r-- | core/launcher/systray.cpp | 103 | ||||
-rw-r--r-- | core/launcher/systray.h | 13 | ||||
-rw-r--r-- | core/launcher/taskbar.cpp | 4 |
5 files changed, 83 insertions, 41 deletions
diff --git a/core/launcher/launcher.pro b/core/launcher/launcher.pro index 0e557aa..dbe3820 100644 --- a/core/launcher/launcher.pro +++ b/core/launcher/launcher.pro | |||
@@ -6,13 +6,12 @@ HEADERS = background.h \ | |||
6 | qprocess.h \ | 6 | qprocess.h \ |
7 | mediummountgui.h \ | 7 | mediummountgui.h \ |
8 | info.h \ | 8 | info.h \ |
9 | appicons.h \ | 9 | appicons.h \ |
10 | taskbar.h \ | 10 | taskbar.h \ |
11 | sidething.h \ | 11 | sidething.h \ |
12 | mrulist.h \ | ||
13 | runningappbar.h \ | 12 | runningappbar.h \ |
14 | stabmon.h \ | 13 | stabmon.h \ |
15 | inputmethods.h \ | 14 | inputmethods.h \ |
16 | systray.h \ | 15 | systray.h \ |
17 | wait.h \ | 16 | wait.h \ |
18 | shutdownimpl.h \ | 17 | shutdownimpl.h \ |
@@ -48,13 +47,12 @@ SOURCES = background.cpp \ | |||
48 | mediummountgui.cpp \ | 47 | mediummountgui.cpp \ |
49 | qprocess.cpp qprocess_unix.cpp \ | 48 | qprocess.cpp qprocess_unix.cpp \ |
50 | info.cpp \ | 49 | info.cpp \ |
51 | appicons.cpp \ | 50 | appicons.cpp \ |
52 | taskbar.cpp \ | 51 | taskbar.cpp \ |
53 | sidething.cpp \ | 52 | sidething.cpp \ |
54 | mrulist.cpp \ | ||
55 | runningappbar.cpp \ | 53 | runningappbar.cpp \ |
56 | stabmon.cpp \ | 54 | stabmon.cpp \ |
57 | inputmethods.cpp \ | 55 | inputmethods.cpp \ |
58 | systray.cpp \ | 56 | systray.cpp \ |
59 | wait.cpp \ | 57 | wait.cpp \ |
60 | shutdownimpl.cpp \ | 58 | shutdownimpl.cpp \ |
diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp index ca0bbe4..490af39 100644 --- a/core/launcher/main.cpp +++ b/core/launcher/main.cpp | |||
@@ -239,13 +239,13 @@ void handle_sigterm ( int /* sig */ ) | |||
239 | if ( qApp ) | 239 | if ( qApp ) |
240 | qApp-> quit ( ); | 240 | qApp-> quit ( ); |
241 | } | 241 | } |
242 | 242 | ||
243 | int main( int argc, char ** argv ) | 243 | int main( int argc, char ** argv ) |
244 | { | 244 | { |
245 | ::signal( SIGCHLD, SIG_IGN ); | 245 | ::signal ( SIGCHLD, SIG_IGN ); |
246 | 246 | ||
247 | ::signal ( SIGTERM, handle_sigterm ); | 247 | ::signal ( SIGTERM, handle_sigterm ); |
248 | ::signal ( SIGINT, handle_sigterm ); | 248 | ::signal ( SIGINT, handle_sigterm ); |
249 | 249 | ||
250 | ::setsid ( ); | 250 | ::setsid ( ); |
251 | ::setpgid ( 0, 0 ); | 251 | ::setpgid ( 0, 0 ); |
diff --git a/core/launcher/systray.cpp b/core/launcher/systray.cpp index ad1553f..4767150 100644 --- a/core/launcher/systray.cpp +++ b/core/launcher/systray.cpp | |||
@@ -1,10 +1,10 @@ | |||
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 | ** |
@@ -34,74 +34,115 @@ | |||
34 | #ifdef SINGLE_APP | 34 | #ifdef SINGLE_APP |
35 | #include "clockappletimpl.h" | 35 | #include "clockappletimpl.h" |
36 | #endif | 36 | #endif |
37 | 37 | ||
38 | SysTray::SysTray( QWidget *parent ) : QFrame( parent ), layout(0) | 38 | SysTray::SysTray( QWidget *parent ) : QFrame( parent ), layout(0) |
39 | { | 39 | { |
40 | safety_tid = 0; | ||
40 | //setFrameStyle( QFrame::Panel | QFrame::Sunken ); | 41 | //setFrameStyle( QFrame::Panel | QFrame::Sunken ); |
41 | loadApplets(); | 42 | loadApplets(); |
42 | } | 43 | } |
43 | 44 | ||
45 | static int compareAppletPositions(const void *a, const void *b) | ||
46 | { | ||
47 | const TaskbarApplet* aa = *(const TaskbarApplet**)a; | ||
48 | const TaskbarApplet* ab = *(const TaskbarApplet**)b; | ||
49 | int d = ab->iface->position() - aa->iface->position(); | ||
50 | if ( d ) return d; | ||
51 | return QString::compare(ab->library->library(),aa->library->library()); | ||
52 | } | ||
53 | |||
44 | void SysTray::loadApplets() | 54 | void SysTray::loadApplets() |
45 | { | 55 | { |
56 | clearApplets(); | ||
57 | addApplets(); | ||
58 | } | ||
59 | |||
60 | void SysTray::clearApplets() | ||
61 | { | ||
62 | hide(); | ||
46 | #ifndef SINGLE_APP | 63 | #ifndef SINGLE_APP |
47 | QValueList<TaskbarApplet>::Iterator mit; | 64 | QValueList<TaskbarApplet>::Iterator mit; |
48 | for ( mit = appletList.begin(); mit != appletList.end(); ++mit ) { | 65 | for ( mit = appletList.begin(); mit != appletList.end(); ++mit ) { |
49 | (*mit).iface->release(); | 66 | (*mit).iface->release(); |
50 | (*mit).library->unload(); | 67 | (*mit).library->unload(); |
51 | delete (*mit).library; | 68 | delete (*mit).library; |
52 | } | 69 | } |
70 | #endif | ||
53 | appletList.clear(); | 71 | appletList.clear(); |
54 | if ( layout ) | 72 | if ( layout ) |
55 | delete layout; | 73 | delete layout; |
56 | layout = new QHBoxLayout( this ); | 74 | layout = new QHBoxLayout( this, 0, 1 ); |
75 | layout->setAutoAdd(TRUE); | ||
76 | } | ||
77 | |||
78 | void SysTray::addApplets() | ||
79 | { | ||
80 | #ifndef SINGLE_APP | ||
81 | Config cfg( "Taskbar" ); | ||
82 | cfg.setGroup( "Applets" ); | ||
83 | bool safe = cfg.readBoolEntry("SafeMode",FALSE); | ||
84 | if ( safe && !safety_tid ) | ||
85 | return; | ||
86 | cfg.writeEntry("SafeMode",TRUE); | ||
87 | cfg.write(); | ||
88 | QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' ); | ||
57 | 89 | ||
58 | QString path = QPEApplication::qpeDir() + "/plugins/applets"; | 90 | QString path = QPEApplication::qpeDir() + "/plugins/applets"; |
59 | QDir dir( path, "lib*.so" ); | 91 | QDir dir( path, "lib*.so" ); |
60 | QStringList list = dir.entryList(); | 92 | QStringList list = dir.entryList(); |
61 | QStringList::Iterator it; | 93 | QStringList::Iterator it; |
94 | int napplets=0; | ||
95 | TaskbarApplet* *applets = new TaskbarApplet*[list.count()]; | ||
62 | for ( it = list.begin(); it != list.end(); ++it ) { | 96 | for ( it = list.begin(); it != list.end(); ++it ) { |
97 | if ( exclude.find( *it ) != exclude.end() ) | ||
98 | continue; | ||
63 | TaskbarAppletInterface *iface = 0; | 99 | TaskbarAppletInterface *iface = 0; |
64 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 100 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
65 | if ( lib->queryInterface( IID_TaskbarApplet, (QUnknownInterface**)&iface ) == QS_OK ) { | 101 | if ( lib->queryInterface( IID_TaskbarApplet, (QUnknownInterface**)&iface ) == QS_OK ) { |
66 | TaskbarApplet applet; | 102 | TaskbarApplet *applet = new TaskbarApplet; |
67 | applet.library = lib; | 103 | applets[napplets++] = applet; |
68 | applet.iface = iface; | 104 | applet->library = lib; |
69 | applet.applet = applet.iface->applet( this ); | 105 | applet->iface = iface; |
70 | positionApplet( applet ); | ||
71 | QString lang = getenv( "LANG" ); | ||
72 | QTranslator * trans = new QTranslator(qApp); | ||
73 | QString type = (*it).left( (*it).find(".") ); | ||
74 | QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; | ||
75 | qDebug("tr fpr sysapplet: %s", tfn.latin1() ); | ||
76 | if ( trans->load( tfn )) | ||
77 | qApp->installTranslator( trans ); | ||
78 | else | ||
79 | delete trans; | ||
80 | } else { | 106 | } else { |
107 | exclude += *it; | ||
81 | delete lib; | 108 | delete lib; |
82 | } | 109 | } |
83 | } | 110 | } |
111 | cfg.writeEntry( "ExcludeApplets", exclude, ',' ); | ||
112 | qsort(applets,napplets,sizeof(applets[0]),compareAppletPositions); | ||
113 | while (napplets--) { | ||
114 | TaskbarApplet *applet = applets[napplets]; | ||
115 | applet->applet = applet->iface->applet( this ); | ||
116 | appletList.append(*applet); | ||
117 | QString lang = getenv( "LANG" ); | ||
118 | QTranslator * trans = new QTranslator(qApp); | ||
119 | QString type = (*it).left( (*it).find(".") ); | ||
120 | QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; | ||
121 | if ( trans->load( tfn )) | ||
122 | qApp->installTranslator( trans ); | ||
123 | else | ||
124 | delete trans; | ||
125 | } | ||
126 | delete applets; | ||
84 | #else | 127 | #else |
85 | layout = new QHBoxLayout( this ); | ||
86 | TaskbarApplet applet; | 128 | TaskbarApplet applet; |
87 | applet.iface = new ClockAppletImpl(); | 129 | applet.iface = new ClockAppletImpl(); |
88 | applet.applet = applet.iface->applet( this ); | 130 | applet.applet = applet.iface->applet( this ); |
89 | positionApplet( applet ); | 131 | appletList.append( a ); |
90 | #endif | 132 | #endif |
133 | show(); | ||
134 | |||
135 | if ( !safety_tid ) | ||
136 | safety_tid = startTimer(2000); // TT has 5000, but this is a PITA for a developer ;) (sandman) | ||
91 | } | 137 | } |
92 | 138 | ||
93 | void SysTray::positionApplet( const TaskbarApplet &a ) | 139 | void SysTray::timerEvent(QTimerEvent* e) |
94 | { | 140 | { |
95 | int p = 0; | 141 | if ( e->timerId() == safety_tid ) { |
96 | QValueList<TaskbarApplet>::Iterator it; | 142 | Config cfg( "Taskbar" ); |
97 | for ( it = appletList.begin(); it != appletList.end(); ++it ) { | 143 | cfg.setGroup( "Applets" ); |
98 | if ( (*it).iface->position() > a.iface->position() ) | 144 | cfg.writeEntry( "SafeMode", FALSE ); |
99 | break; | 145 | killTimer(safety_tid); |
100 | p += 2; | 146 | safety_tid = 0; |
101 | } | 147 | } |
102 | |||
103 | appletList.insert( it, a ); | ||
104 | layout->insertWidget( p, a.applet ); | ||
105 | layout->insertSpacing( p, 1 ); | ||
106 | } | 148 | } |
107 | |||
diff --git a/core/launcher/systray.h b/core/launcher/systray.h index 0aed348..5a6849a 100644 --- a/core/launcher/systray.h +++ b/core/launcher/systray.h | |||
@@ -1,10 +1,10 @@ | |||
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 | ** |
@@ -40,18 +40,21 @@ struct TaskbarApplet | |||
40 | 40 | ||
41 | class SysTray : public QFrame { | 41 | class SysTray : public QFrame { |
42 | Q_OBJECT | 42 | Q_OBJECT |
43 | public: | 43 | public: |
44 | SysTray( QWidget *parent ); | 44 | SysTray( QWidget *parent ); |
45 | 45 | ||
46 | void loadApplets(); | 46 | void clearApplets(); |
47 | void addApplets(); | ||
47 | 48 | ||
48 | private: | 49 | protected: |
49 | void positionApplet( const TaskbarApplet &a ); | 50 | void timerEvent(QTimerEvent* e); |
50 | 51 | ||
51 | private: | 52 | private: |
53 | void loadApplets(); | ||
54 | int safety_tid; | ||
52 | QHBoxLayout *layout; | 55 | QHBoxLayout *layout; |
53 | QValueList<TaskbarApplet> appletList; | 56 | QValueList<TaskbarApplet> appletList; |
54 | }; | 57 | }; |
55 | 58 | ||
56 | 59 | ||
57 | #endif // __SYSTRAY_H__ | 60 | #endif // __SYSTRAY_H__ |
diff --git a/core/launcher/taskbar.cpp b/core/launcher/taskbar.cpp index 988d072..1feae4a 100644 --- a/core/launcher/taskbar.cpp +++ b/core/launcher/taskbar.cpp | |||
@@ -17,13 +17,12 @@ | |||
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | *********************************************************************/ | 19 | *********************************************************************/ |
20 | 20 | ||
21 | #include "startmenu.h" | 21 | #include "startmenu.h" |
22 | #include "inputmethods.h" | 22 | #include "inputmethods.h" |
23 | #include "mrulist.h" | ||
24 | #include "runningappbar.h" | 23 | #include "runningappbar.h" |
25 | #include "systray.h" | 24 | #include "systray.h" |
26 | #include "calibrate.h" | 25 | #include "calibrate.h" |
27 | #include "wait.h" | 26 | #include "wait.h" |
28 | #include "appicons.h" | 27 | #include "appicons.h" |
29 | 28 | ||
@@ -270,13 +269,14 @@ void TaskBar::receive( const QCString &msg, const QByteArray &data ) | |||
270 | inputMethods->hideInputMethod(); | 269 | inputMethods->hideInputMethod(); |
271 | } else if ( msg == "showInputMethod()" ) { | 270 | } else if ( msg == "showInputMethod()" ) { |
272 | inputMethods->showInputMethod(); | 271 | inputMethods->showInputMethod(); |
273 | } else if ( msg == "reloadInputMethods()" ) { | 272 | } else if ( msg == "reloadInputMethods()" ) { |
274 | inputMethods->loadInputMethods(); | 273 | inputMethods->loadInputMethods(); |
275 | } else if ( msg == "reloadApplets()" ) { | 274 | } else if ( msg == "reloadApplets()" ) { |
276 | sysTray->loadApplets(); | 275 | sysTray->clearApplets(); |
276 | sysTray->addApplets(); | ||
277 | } else if ( msg == "soundAlarm()" ) { | 277 | } else if ( msg == "soundAlarm()" ) { |
278 | Desktop::soundAlarm(); | 278 | Desktop::soundAlarm(); |
279 | } | 279 | } |
280 | else if ( msg == "setLed(int,bool)" ) { | 280 | else if ( msg == "setLed(int,bool)" ) { |
281 | int led, status; | 281 | int led, status; |
282 | stream >> led >> status; | 282 | stream >> led >> status; |