author | sandman <sandman> | 2002-09-25 23:24:31 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-09-25 23:24:31 (UTC) |
commit | c73cc2b7f4417b7cb168b3d801b00f34f3c3b7eb (patch) (unidiff) | |
tree | caf691893d0e59e8e8396ef12a1d2cf774f7c9b0 | |
parent | 489bc02ad26767dc45b81bf122a09ef55ac20249 (diff) | |
download | opie-c73cc2b7f4417b7cb168b3d801b00f34f3c3b7eb.zip opie-c73cc2b7f4417b7cb168b3d801b00f34f3c3b7eb.tar.gz opie-c73cc2b7f4417b7cb168b3d801b00f34f3c3b7eb.tar.bz2 |
Disable SafeMode for now, since it can't be turned off easily once it gets
activated.
-rw-r--r-- | core/launcher/systray.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/core/launcher/systray.cpp b/core/launcher/systray.cpp index 4767150..697971d 100644 --- a/core/launcher/systray.cpp +++ b/core/launcher/systray.cpp | |||
@@ -1,148 +1,152 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the 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 | #include <qpe/qpeapplication.h> | 21 | #include <qpe/qpeapplication.h> |
22 | #include <qpe/qlibrary.h> | 22 | #include <qpe/qlibrary.h> |
23 | #include <qpe/config.h> | 23 | #include <qpe/config.h> |
24 | 24 | ||
25 | #include <qlayout.h> | 25 | #include <qlayout.h> |
26 | #include <qdir.h> | 26 | #include <qdir.h> |
27 | #include <qtranslator.h> | 27 | #include <qtranslator.h> |
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 | ||
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 | safety_tid = 0; |
41 | //setFrameStyle( QFrame::Panel | QFrame::Sunken ); | 41 | //setFrameStyle( QFrame::Panel | QFrame::Sunken ); |
42 | loadApplets(); | 42 | loadApplets(); |
43 | } | 43 | } |
44 | 44 | ||
45 | static int compareAppletPositions(const void *a, const void *b) | 45 | static int compareAppletPositions(const void *a, const void *b) |
46 | { | 46 | { |
47 | const TaskbarApplet* aa = *(const TaskbarApplet**)a; | 47 | const TaskbarApplet* aa = *(const TaskbarApplet**)a; |
48 | const TaskbarApplet* ab = *(const TaskbarApplet**)b; | 48 | const TaskbarApplet* ab = *(const TaskbarApplet**)b; |
49 | int d = ab->iface->position() - aa->iface->position(); | 49 | int d = ab->iface->position() - aa->iface->position(); |
50 | if ( d ) return d; | 50 | if ( d ) return d; |
51 | return QString::compare(ab->library->library(),aa->library->library()); | 51 | return QString::compare(ab->library->library(),aa->library->library()); |
52 | } | 52 | } |
53 | 53 | ||
54 | void SysTray::loadApplets() | 54 | void SysTray::loadApplets() |
55 | { | 55 | { |
56 | clearApplets(); | 56 | clearApplets(); |
57 | addApplets(); | 57 | addApplets(); |
58 | } | 58 | } |
59 | 59 | ||
60 | void SysTray::clearApplets() | 60 | void SysTray::clearApplets() |
61 | { | 61 | { |
62 | hide(); | 62 | hide(); |
63 | #ifndef SINGLE_APP | 63 | #ifndef SINGLE_APP |
64 | QValueList<TaskbarApplet>::Iterator mit; | 64 | QValueList<TaskbarApplet>::Iterator mit; |
65 | for ( mit = appletList.begin(); mit != appletList.end(); ++mit ) { | 65 | for ( mit = appletList.begin(); mit != appletList.end(); ++mit ) { |
66 | (*mit).iface->release(); | 66 | (*mit).iface->release(); |
67 | (*mit).library->unload(); | 67 | (*mit).library->unload(); |
68 | delete (*mit).library; | 68 | delete (*mit).library; |
69 | } | 69 | } |
70 | #endif | 70 | #endif |
71 | appletList.clear(); | 71 | appletList.clear(); |
72 | if ( layout ) | 72 | if ( layout ) |
73 | delete layout; | 73 | delete layout; |
74 | layout = new QHBoxLayout( this, 0, 1 ); | 74 | layout = new QHBoxLayout( this, 0, 1 ); |
75 | layout->setAutoAdd(TRUE); | 75 | layout->setAutoAdd(TRUE); |
76 | } | 76 | } |
77 | 77 | ||
78 | void SysTray::addApplets() | 78 | void SysTray::addApplets() |
79 | { | 79 | { |
80 | #ifndef SINGLE_APP | 80 | #ifndef SINGLE_APP |
81 | Config cfg( "Taskbar" ); | 81 | Config cfg( "Taskbar" ); |
82 | cfg.setGroup( "Applets" ); | 82 | cfg.setGroup( "Applets" ); |
83 | bool safe = cfg.readBoolEntry("SafeMode",FALSE); | 83 | |
84 | // SafeMode causes too much problems, so we disable it for now -- | ||
85 | // maybe we should reenable it for OPIE 1.0 - sandman 26.09.02 | ||
86 | |||
87 | bool safe = false; //cfg.readBoolEntry("SafeMode",FALSE); | ||
84 | if ( safe && !safety_tid ) | 88 | if ( safe && !safety_tid ) |
85 | return; | 89 | return; |
86 | cfg.writeEntry("SafeMode",TRUE); | 90 | cfg.writeEntry("SafeMode",TRUE); |
87 | cfg.write(); | 91 | cfg.write(); |
88 | QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' ); | 92 | QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' ); |
89 | 93 | ||
90 | QString path = QPEApplication::qpeDir() + "/plugins/applets"; | 94 | QString path = QPEApplication::qpeDir() + "/plugins/applets"; |
91 | QDir dir( path, "lib*.so" ); | 95 | QDir dir( path, "lib*.so" ); |
92 | QStringList list = dir.entryList(); | 96 | QStringList list = dir.entryList(); |
93 | QStringList::Iterator it; | 97 | QStringList::Iterator it; |
94 | int napplets=0; | 98 | int napplets=0; |
95 | TaskbarApplet* *applets = new TaskbarApplet*[list.count()]; | 99 | TaskbarApplet* *applets = new TaskbarApplet*[list.count()]; |
96 | for ( it = list.begin(); it != list.end(); ++it ) { | 100 | for ( it = list.begin(); it != list.end(); ++it ) { |
97 | if ( exclude.find( *it ) != exclude.end() ) | 101 | if ( exclude.find( *it ) != exclude.end() ) |
98 | continue; | 102 | continue; |
99 | TaskbarAppletInterface *iface = 0; | 103 | TaskbarAppletInterface *iface = 0; |
100 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 104 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
101 | if ( lib->queryInterface( IID_TaskbarApplet, (QUnknownInterface**)&iface ) == QS_OK ) { | 105 | if ( lib->queryInterface( IID_TaskbarApplet, (QUnknownInterface**)&iface ) == QS_OK ) { |
102 | TaskbarApplet *applet = new TaskbarApplet; | 106 | TaskbarApplet *applet = new TaskbarApplet; |
103 | applets[napplets++] = applet; | 107 | applets[napplets++] = applet; |
104 | applet->library = lib; | 108 | applet->library = lib; |
105 | applet->iface = iface; | 109 | applet->iface = iface; |
106 | } else { | 110 | } else { |
107 | exclude += *it; | 111 | exclude += *it; |
108 | delete lib; | 112 | delete lib; |
109 | } | 113 | } |
110 | } | 114 | } |
111 | cfg.writeEntry( "ExcludeApplets", exclude, ',' ); | 115 | cfg.writeEntry( "ExcludeApplets", exclude, ',' ); |
112 | qsort(applets,napplets,sizeof(applets[0]),compareAppletPositions); | 116 | qsort(applets,napplets,sizeof(applets[0]),compareAppletPositions); |
113 | while (napplets--) { | 117 | while (napplets--) { |
114 | TaskbarApplet *applet = applets[napplets]; | 118 | TaskbarApplet *applet = applets[napplets]; |
115 | applet->applet = applet->iface->applet( this ); | 119 | applet->applet = applet->iface->applet( this ); |
116 | appletList.append(*applet); | 120 | appletList.append(*applet); |
117 | QString lang = getenv( "LANG" ); | 121 | QString lang = getenv( "LANG" ); |
118 | QTranslator * trans = new QTranslator(qApp); | 122 | QTranslator * trans = new QTranslator(qApp); |
119 | QString type = (*it).left( (*it).find(".") ); | 123 | QString type = (*it).left( (*it).find(".") ); |
120 | QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; | 124 | QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; |
121 | if ( trans->load( tfn )) | 125 | if ( trans->load( tfn )) |
122 | qApp->installTranslator( trans ); | 126 | qApp->installTranslator( trans ); |
123 | else | 127 | else |
124 | delete trans; | 128 | delete trans; |
125 | } | 129 | } |
126 | delete applets; | 130 | delete applets; |
127 | #else | 131 | #else |
128 | TaskbarApplet applet; | 132 | TaskbarApplet applet; |
129 | applet.iface = new ClockAppletImpl(); | 133 | applet.iface = new ClockAppletImpl(); |
130 | applet.applet = applet.iface->applet( this ); | 134 | applet.applet = applet.iface->applet( this ); |
131 | appletList.append( a ); | 135 | appletList.append( a ); |
132 | #endif | 136 | #endif |
133 | show(); | 137 | show(); |
134 | 138 | ||
135 | if ( !safety_tid ) | 139 | if ( !safety_tid ) |
136 | safety_tid = startTimer(2000); // TT has 5000, but this is a PITA for a developer ;) (sandman) | 140 | safety_tid = startTimer(2000); // TT has 5000, but this is a PITA for a developer ;) (sandman) |
137 | } | 141 | } |
138 | 142 | ||
139 | void SysTray::timerEvent(QTimerEvent* e) | 143 | void SysTray::timerEvent(QTimerEvent* e) |
140 | { | 144 | { |
141 | if ( e->timerId() == safety_tid ) { | 145 | if ( e->timerId() == safety_tid ) { |
142 | Config cfg( "Taskbar" ); | 146 | Config cfg( "Taskbar" ); |
143 | cfg.setGroup( "Applets" ); | 147 | cfg.setGroup( "Applets" ); |
144 | cfg.writeEntry( "SafeMode", FALSE ); | 148 | cfg.writeEntry( "SafeMode", FALSE ); |
145 | killTimer(safety_tid); | 149 | killTimer(safety_tid); |
146 | safety_tid = 0; | 150 | safety_tid = 0; |
147 | } | 151 | } |
148 | } | 152 | } |