summaryrefslogtreecommitdiff
authorsandman <sandman>2002-09-12 01:16:41 (UTC)
committer sandman <sandman>2002-09-12 01:16:41 (UTC)
commit151987f8e0b7a179cf45032cc2ec5b4360023890 (patch) (unidiff)
treeea750ecfe96f7a30759d9bee7151602f02dec8cf
parentb89a7559465274c3efb0a8258cecf22a185b123f (diff)
downloadopie-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
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcher.pro2
-rw-r--r--core/launcher/main.cpp2
-rw-r--r--core/launcher/systray.cpp103
-rw-r--r--core/launcher/systray.h13
-rw-r--r--core/launcher/taskbar.cpp4
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
@@ -1,24 +1,23 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 CONFIG = qt warn_on release 2 CONFIG = qt warn_on release
3 DESTDIR = ../../bin 3 DESTDIR = ../../bin
4 HEADERS = background.h \ 4 HEADERS = background.h \
5 desktop.h \ 5 desktop.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 \
19 launcher.h \ 18 launcher.h \
20 launcherview.h \ 19 launcherview.h \
21 ../../core/apps/calibrate/calibrate.h \ 20 ../../core/apps/calibrate/calibrate.h \
22 startmenu.h \ 21 startmenu.h \
23 transferserver.h \ 22 transferserver.h \
24 qcopbridge.h \ 23 qcopbridge.h \
@@ -42,25 +41,24 @@ HEADERS = background.h \
42 ../../rsync/whole.h \ 41 ../../rsync/whole.h \
43 ../../rsync/config_rsync.h \ 42 ../../rsync/config_rsync.h \
44 ../../rsync/qrsync.h 43 ../../rsync/qrsync.h
45 # quicklauncher.h \ 44 # quicklauncher.h \
46 SOURCES = background.cpp \ 45 SOURCES = background.cpp \
47 desktop.cpp \ 46 desktop.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 \
61 launcher.cpp \ 59 launcher.cpp \
62 launcherview.cpp \ 60 launcherview.cpp \
63 ../../core/apps/calibrate/calibrate.cpp \ 61 ../../core/apps/calibrate/calibrate.cpp \
64 transferserver.cpp \ 62 transferserver.cpp \
65 packageslave.cpp \ 63 packageslave.cpp \
66 irserver.cpp \ 64 irserver.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
@@ -233,25 +233,25 @@ void remove_pidfile ( )
233{ 233{
234 ::unlink ( pidfile_path ); 234 ::unlink ( pidfile_path );
235} 235}
236 236
237void handle_sigterm ( int /* sig */ ) 237void handle_sigterm ( int /* sig */ )
238{ 238{
239 if ( qApp ) 239 if ( qApp )
240 qApp-> quit ( ); 240 qApp-> quit ( );
241} 241}
242 242
243int main( int argc, char ** argv ) 243int 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 );
252 252
253 ::atexit ( remove_pidfile ); 253 ::atexit ( remove_pidfile );
254 create_pidfile ( ); 254 create_pidfile ( );
255 255
256 int retVal = initApplication ( argc, argv ); 256 int retVal = initApplication ( argc, argv );
257 257
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,16 +1,16 @@
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
@@ -28,80 +28,121 @@
28 28
29#include "quicklauncher.h" 29#include "quicklauncher.h"
30#include "systray.h" 30#include "systray.h"
31 31
32#include <stdlib.h> 32#include <stdlib.h>
33 33
34#ifdef SINGLE_APP 34#ifdef SINGLE_APP
35#include "clockappletimpl.h" 35#include "clockappletimpl.h"
36#endif 36#endif
37 37
38SysTray::SysTray( QWidget *parent ) : QFrame( parent ), layout(0) 38SysTray::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
45static 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
44void SysTray::loadApplets() 54void SysTray::loadApplets()
45{ 55{
56 clearApplets();
57 addApplets();
58}
59
60void 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
78void 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
93void SysTray::positionApplet( const TaskbarApplet &a ) 139void 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,16 +1,16 @@
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
@@ -34,25 +34,28 @@ struct TaskbarApplet
34#ifndef QT_NO_COMPONENT 34#ifndef QT_NO_COMPONENT
35 QLibrary *library; 35 QLibrary *library;
36#endif 36#endif
37 TaskbarAppletInterface *iface; 37 TaskbarAppletInterface *iface;
38 QWidget *applet; 38 QWidget *applet;
39}; 39};
40 40
41class SysTray : public QFrame { 41class SysTray : public QFrame {
42 Q_OBJECT 42 Q_OBJECT
43public: 43public:
44 SysTray( QWidget *parent ); 44 SysTray( QWidget *parent );
45 45
46 void loadApplets(); 46 void clearApplets();
47 void addApplets();
47 48
48private: 49protected:
49 void positionApplet( const TaskbarApplet &a ); 50 void timerEvent(QTimerEvent* e);
50 51
51private: 52private:
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__
58 61
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
@@ -11,25 +11,24 @@
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#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
30#include "taskbar.h" 29#include "taskbar.h"
31#include "desktop.h" 30#include "desktop.h"
32 31
33#include <qpe/qpeapplication.h> 32#include <qpe/qpeapplication.h>
34#include <qpe/qcopenvelope_qws.h> 33#include <qpe/qcopenvelope_qws.h>
35#include <qpe/global.h> 34#include <qpe/global.h>
@@ -264,25 +263,26 @@ void TaskBar::receive( const QCString &msg, const QByteArray &data )
264 QDataStream stream( data, IO_ReadOnly ); 263 QDataStream stream( data, IO_ReadOnly );
265 if ( msg == "message(QString)" ) { 264 if ( msg == "message(QString)" ) {
266 QString text; 265 QString text;
267 stream >> text; 266 stream >> text;
268 setStatusMessage( text ); 267 setStatusMessage( text );
269 } else if ( msg == "hideInputMethod()" ) { 268 } else if ( msg == "hideInputMethod()" ) {
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;
283 283
284 ODevice::inst ( )-> setLed ( led, status ? OLED_BlinkSlow : OLED_Off ); 284 ODevice::inst ( )-> setLed ( led, status ? OLED_BlinkSlow : OLED_Off );
285 } 285 }
286} 286}
287 287
288QWidget *TaskBar::calibrate(bool) 288QWidget *TaskBar::calibrate(bool)