summaryrefslogtreecommitdiff
path: root/core/launcher
authorzecke <zecke>2004-10-16 00:01:01 (UTC)
committer zecke <zecke>2004-10-16 00:01:01 (UTC)
commitdf14f647ff1a60ca82e0fa9bd91458be146153b8 (patch) (unidiff)
tree4859961352851a4392e1442f2080c15bff8ad7bc /core/launcher
parent419f9710c488f56a7a117eb1529970d3371e0094 (diff)
downloadopie-df14f647ff1a60ca82e0fa9bd91458be146153b8.zip
opie-df14f647ff1a60ca82e0fa9bd91458be146153b8.tar.gz
opie-df14f647ff1a60ca82e0fa9bd91458be146153b8.tar.bz2
Replace QPEApplication::qpeDir() + "/ with
QPEApplication::qpeDir() + " as it is guranteed that qpeDir() will have '/' as the last charachter
Diffstat (limited to 'core/launcher') (more/less context) (show whitespace changes)
-rw-r--r--core/launcher/inputmethods.cpp6
-rw-r--r--core/launcher/irserver.cpp4
-rw-r--r--core/launcher/startmenu.cpp4
-rw-r--r--core/launcher/systray.cpp4
4 files changed, 9 insertions, 9 deletions
diff --git a/core/launcher/inputmethods.cpp b/core/launcher/inputmethods.cpp
index 586628b..24669ac 100644
--- a/core/launcher/inputmethods.cpp
+++ b/core/launcher/inputmethods.cpp
@@ -124,252 +124,252 @@ InputMethods::InputMethods( QWidget *parent ) :
124 124
125 125
126 imButton = new QWidgetStack( this ); // later a widget stack 126 imButton = new QWidgetStack( this ); // later a widget stack
127 imButton->setFocusPolicy(NoFocus); 127 imButton->setFocusPolicy(NoFocus);
128 if (parent->sizeHint().height() > 0) 128 if (parent->sizeHint().height() > 0)
129 imButton->setFixedHeight( parent->sizeHint().height() ); 129 imButton->setFixedHeight( parent->sizeHint().height() );
130 hbox->addWidget(imButton); 130 hbox->addWidget(imButton);
131 131
132 imChoice = new QToolButton( this ); 132 imChoice = new QToolButton( this );
133 imChoice->setFocusPolicy(NoFocus); 133 imChoice->setFocusPolicy(NoFocus);
134 imChoice->setPixmap( QPixmap( (const char **)tri_xpm ) ); 134 imChoice->setPixmap( QPixmap( (const char **)tri_xpm ) );
135 if (parent->sizeHint().height() > 0) 135 if (parent->sizeHint().height() > 0)
136 imChoice->setFixedHeight( parent->sizeHint().height() ); 136 imChoice->setFixedHeight( parent->sizeHint().height() );
137 imChoice->setFixedWidth( 13 ); 137 imChoice->setFixedWidth( 13 );
138 imChoice->setAutoRaise( TRUE ); 138 imChoice->setAutoRaise( TRUE );
139 hbox->addWidget( imChoice ); 139 hbox->addWidget( imChoice );
140 connect( imChoice, SIGNAL(clicked()), this, SLOT(chooseIm()) ); 140 connect( imChoice, SIGNAL(clicked()), this, SLOT(chooseIm()) );
141 141
142 loadInputMethods(); 142 loadInputMethods();
143 143
144 QCopChannel *channel = new QCopChannel( "QPE/IME", this ); 144 QCopChannel *channel = new QCopChannel( "QPE/IME", this );
145 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), 145 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
146 this, SLOT(qcopReceive(const QCString&,const QByteArray&)) ); 146 this, SLOT(qcopReceive(const QCString&,const QByteArray&)) );
147} 147}
148 148
149InputMethods::~InputMethods() 149InputMethods::~InputMethods()
150{ 150{
151 Config cfg("qpe"); 151 Config cfg("qpe");
152 cfg.setGroup("InputMethod"); 152 cfg.setGroup("InputMethod");
153 if (imethod) 153 if (imethod)
154 cfg.writeEntry("im", imethod->name() ); 154 cfg.writeEntry("im", imethod->name() );
155 if (mkeyboard) 155 if (mkeyboard)
156 cfg.writeEntry("current", mkeyboard->name() ); 156 cfg.writeEntry("current", mkeyboard->name() );
157 157
158 unloadInputMethods(); 158 unloadInputMethods();
159} 159}
160 160
161void InputMethods::hideInputMethod() 161void InputMethods::hideInputMethod()
162{ 162{
163 kbdButton->setOn( FALSE ); 163 kbdButton->setOn( FALSE );
164} 164}
165 165
166void InputMethods::showInputMethod() 166void InputMethods::showInputMethod()
167{ 167{
168 kbdButton->setOn( TRUE ); 168 kbdButton->setOn( TRUE );
169} 169}
170 170
171void InputMethods::showInputMethod(const QString& name) 171void InputMethods::showInputMethod(const QString& name)
172{ 172{
173 int i = 0; 173 int i = 0;
174 QValueList<InputMethod>::Iterator it; 174 QValueList<InputMethod>::Iterator it;
175 InputMethod *im = 0; 175 InputMethod *im = 0;
176 for ( it = inputMethodList.begin(); it != inputMethodList.end(); ++it, i++ ) { 176 for ( it = inputMethodList.begin(); it != inputMethodList.end(); ++it, i++ ) {
177 QString lname = (*it).libName.mid((*it).libName.findRev('/') + 1); 177 QString lname = (*it).libName.mid((*it).libName.findRev('/') + 1);
178 if ( (*it).name() == name || lname == name ) { 178 if ( (*it).name() == name || lname == name ) {
179 im = &(*it); 179 im = &(*it);
180 break; 180 break;
181 } 181 }
182 } 182 }
183 if ( im ) 183 if ( im )
184 chooseKeyboard(im); 184 chooseKeyboard(im);
185} 185}
186 186
187void InputMethods::resetStates() 187void InputMethods::resetStates()
188{ 188{
189 if ( mkeyboard && !mkeyboard->newIM ) 189 if ( mkeyboard && !mkeyboard->newIM )
190 mkeyboard->interface->resetState(); 190 mkeyboard->interface->resetState();
191} 191}
192 192
193QRect InputMethods::inputRect() const 193QRect InputMethods::inputRect() const
194{ 194{
195 if ( !mkeyboard || !mkeyboard->widget || !mkeyboard->widget->isVisible() ) 195 if ( !mkeyboard || !mkeyboard->widget || !mkeyboard->widget->isVisible() )
196 return QRect(); 196 return QRect();
197 else 197 else
198 return mkeyboard->widget->geometry(); 198 return mkeyboard->widget->geometry();
199} 199}
200 200
201void InputMethods::unloadInputMethods() 201void InputMethods::unloadInputMethods()
202{ 202{
203 unloadMethod( inputMethodList ); 203 unloadMethod( inputMethodList );
204 unloadMethod( inputModifierList ); 204 unloadMethod( inputModifierList );
205 inputMethodList.clear(); 205 inputMethodList.clear();
206 inputModifierList.clear(); 206 inputModifierList.clear();
207 207
208} 208}
209 209
210void InputMethods::unloadMethod( QValueList<InputMethod>& list ) { 210void InputMethods::unloadMethod( QValueList<InputMethod>& list ) {
211 QValueList<InputMethod>::Iterator it; 211 QValueList<InputMethod>::Iterator it;
212 212
213 for (it = list.begin(); it != list.end(); ++it ) 213 for (it = list.begin(); it != list.end(); ++it )
214 (*it).releaseInterface(); 214 (*it).releaseInterface();
215 215
216} 216}
217 217
218 218
219QStringList InputMethods::plugins()const { 219QStringList InputMethods::plugins()const {
220 QString path = QPEApplication::qpeDir() + "/plugins/inputmethods"; 220 QString path = QPEApplication::qpeDir() + "plugins/inputmethods";
221#ifdef Q_OS_MACX 221#ifdef Q_OS_MACX
222 QDir dir( path, "lib*.dylib" ); 222 QDir dir( path, "lib*.dylib" );
223#else 223#else
224 QDir dir( path, "lib*.so" ); 224 QDir dir( path, "lib*.so" );
225#endif /* Q_OS_MACX */ 225#endif /* Q_OS_MACX */
226 return dir.entryList(); 226 return dir.entryList();
227} 227}
228 228
229void InputMethods::installTranslator( const QString& type ) { 229void InputMethods::installTranslator( const QString& type ) {
230 QStringList langs = Global::languageList(); 230 QStringList langs = Global::languageList();
231 QStringList::ConstIterator lit; 231 QStringList::ConstIterator lit;
232 for ( lit= langs.begin(); lit!=langs.end(); ++lit) { 232 for ( lit= langs.begin(); lit!=langs.end(); ++lit) {
233 QString lang = *lit; 233 QString lang = *lit;
234 QTranslator * trans = new QTranslator(qApp); 234 QTranslator * trans = new QTranslator(qApp);
235 235
236 QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; 236 QString tfn = QPEApplication::qpeDir()+"i18n/"+lang+"/"+type+".qm";
237 237
238 if ( trans->load( tfn )) 238 if ( trans->load( tfn ))
239 qApp->installTranslator( trans ); 239 qApp->installTranslator( trans );
240 else 240 else
241 delete trans; 241 delete trans;
242 } 242 }
243} 243}
244 244
245void InputMethods::setPreferedHandlers() { 245void InputMethods::setPreferedHandlers() {
246 Config cfg("qpe"); 246 Config cfg("qpe");
247 cfg.setGroup("InputMethod"); 247 cfg.setGroup("InputMethod");
248 QString current = cfg.readEntry("current"); 248 QString current = cfg.readEntry("current");
249 QString im = cfg.readEntry("im"); 249 QString im = cfg.readEntry("im");
250 250
251 QValueList<InputMethod>::Iterator it; 251 QValueList<InputMethod>::Iterator it;
252 if (!inputModifierList.isEmpty() && !im.isEmpty() ) { 252 if (!inputModifierList.isEmpty() && !im.isEmpty() ) {
253 for (it = inputModifierList.begin(); it != inputModifierList.end(); ++it ) 253 for (it = inputModifierList.begin(); it != inputModifierList.end(); ++it )
254 if ( (*it).name() == im ) { 254 if ( (*it).name() == im ) {
255 imethod = &(*it); break; 255 imethod = &(*it); break;
256 } 256 }
257 257
258 } 258 }
259 if (!inputMethodList.isEmpty() && !current.isEmpty() ) { 259 if (!inputMethodList.isEmpty() && !current.isEmpty() ) {
260 for (it = inputMethodList.begin(); it != inputMethodList.end(); ++it ) 260 for (it = inputMethodList.begin(); it != inputMethodList.end(); ++it )
261 if ( (*it).name() == current ) { 261 if ( (*it).name() == current ) {
262 owarn << "preferred keyboard is " << current << "" << oendl; 262 owarn << "preferred keyboard is " << current << "" << oendl;
263 mkeyboard = &(*it); 263 mkeyboard = &(*it);
264 kbdButton->setPixmap( *mkeyboard->icon() ); 264 kbdButton->setPixmap( *mkeyboard->icon() );
265 break; 265 break;
266 } 266 }
267 } 267 }
268 268
269} 269}
270 270
271void InputMethods::loadInputMethods() 271void InputMethods::loadInputMethods()
272{ 272{
273#ifndef QT_NO_COMPONENT 273#ifndef QT_NO_COMPONENT
274 hideInputMethod(); 274 hideInputMethod();
275 mkeyboard = 0; 275 mkeyboard = 0;
276 276
277 unloadInputMethods(); 277 unloadInputMethods();
278 278
279 QString path = QPEApplication::qpeDir() + "/plugins/inputmethods"; 279 QString path = QPEApplication::qpeDir() + "plugins/inputmethods";
280 QStringList list = plugins(); 280 QStringList list = plugins();
281 QStringList::Iterator it; 281 QStringList::Iterator it;
282 for ( it = list.begin(); it != list.end(); ++it ) { 282 for ( it = list.begin(); it != list.end(); ++it ) {
283 InputMethodInterface *iface = 0; 283 InputMethodInterface *iface = 0;
284 ExtInputMethodInterface *eface = 0; 284 ExtInputMethodInterface *eface = 0;
285 QLibrary *lib = new QLibrary( path + "/" + *it ); 285 QLibrary *lib = new QLibrary( path + "/" + *it );
286 286
287 if ( lib->queryInterface( IID_InputMethod, (QUnknownInterface**)&iface ) == QS_OK ) { 287 if ( lib->queryInterface( IID_InputMethod, (QUnknownInterface**)&iface ) == QS_OK ) {
288 InputMethod input; 288 InputMethod input;
289 input.newIM = FALSE; 289 input.newIM = FALSE;
290 input.library = lib; 290 input.library = lib;
291 input.libName = *it; 291 input.libName = *it;
292 input.interface = iface; 292 input.interface = iface;
293 input.widget = input.interface->inputMethod( 0, inputWidgetStyle ); 293 input.widget = input.interface->inputMethod( 0, inputWidgetStyle );
294 input.interface->onKeyPress( this, SLOT(sendKey(ushort,ushort,ushort,bool,bool)) ); 294 input.interface->onKeyPress( this, SLOT(sendKey(ushort,ushort,ushort,bool,bool)) );
295 inputMethodList.append( input ); 295 inputMethodList.append( input );
296 } else if ( lib->queryInterface( IID_ExtInputMethod, (QUnknownInterface**)&eface ) == QS_OK ) { 296 } else if ( lib->queryInterface( IID_ExtInputMethod, (QUnknownInterface**)&eface ) == QS_OK ) {
297 InputMethod input; 297 InputMethod input;
298 input.newIM = TRUE; 298 input.newIM = TRUE;
299 input.library = lib; 299 input.library = lib;
300 input.libName = *it; 300 input.libName = *it;
301 input.extInterface = eface; 301 input.extInterface = eface;
302 input.widget = input.extInterface->keyboardWidget( 0, inputWidgetStyle ); 302 input.widget = input.extInterface->keyboardWidget( 0, inputWidgetStyle );
303 // may be either a simple, or advanced. 303 // may be either a simple, or advanced.
304 if (input.widget) { 304 if (input.widget) {
305 //odebug << "its a keyboard" << oendl; 305 //odebug << "its a keyboard" << oendl;
306 inputMethodList.append( input ); 306 inputMethodList.append( input );
307 } else { 307 } else {
308 //odebug << "its a real im" << oendl; 308 //odebug << "its a real im" << oendl;
309 input.widget = input.extInterface->statusWidget( 0, 0 ); 309 input.widget = input.extInterface->statusWidget( 0, 0 );
310 if (input.widget) { 310 if (input.widget) {
311 //odebug << "blah" << oendl; 311 //odebug << "blah" << oendl;
312 inputModifierList.append( input ); 312 inputModifierList.append( input );
313 imButton->addWidget(input.widget, inputModifierList.count()); 313 imButton->addWidget(input.widget, inputModifierList.count());
314 } 314 }
315 } 315 }
316 }else{ 316 }else{
317 delete lib; 317 delete lib;
318 lib = 0l; 318 lib = 0l;
319 } 319 }
320 installTranslator( (*it).left( (*it).find(".") ) ); 320 installTranslator( (*it).left( (*it).find(".") ) );
321 } 321 }
322 qHeapSort( inputMethodList ); 322 qHeapSort( inputMethodList );
323#endif /* killed BUILT in cause they would not compile */ 323#endif /* killed BUILT in cause they would not compile */
324 324
325 QWSServer::setCurrentInputMethod( 0 ); 325 QWSServer::setCurrentInputMethod( 0 );
326 326
327 /* set the prefered IM + handler */ 327 /* set the prefered IM + handler */
328 setPreferedHandlers(); 328 setPreferedHandlers();
329 if ( !inputModifierList.isEmpty() ) { 329 if ( !inputModifierList.isEmpty() ) {
330 if (!imethod) 330 if (!imethod)
331 imethod = &inputModifierList[0]; 331 imethod = &inputModifierList[0];
332 imButton->raiseWidget(imethod->widget); 332 imButton->raiseWidget(imethod->widget);
333 QWSServer::setCurrentInputMethod( imethod->extInterface->inputMethod() ); 333 QWSServer::setCurrentInputMethod( imethod->extInterface->inputMethod() );
334 } else { 334 } else {
335 imethod = 0; 335 imethod = 0;
336 } 336 }
337 337
338 // we need to update keyboards afterwards, as some of them may not be compatible with 338 // we need to update keyboards afterwards, as some of them may not be compatible with
339 // the current input method 339 // the current input method
340 updateKeyboards(imethod); 340 updateKeyboards(imethod);
341 341
342 if ( !inputModifierList.isEmpty() ) 342 if ( !inputModifierList.isEmpty() )
343 imButton->show(); 343 imButton->show();
344 else 344 else
345 imButton->hide(); 345 imButton->hide();
346 346
347 if ( inputModifierList.count() > 1 ) 347 if ( inputModifierList.count() > 1 )
348 imChoice->show(); 348 imChoice->show();
349 else 349 else
350 imChoice->hide(); 350 imChoice->hide();
351} 351}
352 352
353void InputMethods::chooseKbd() 353void InputMethods::chooseKbd()
354{ 354{
355 QPopupMenu pop( this ); 355 QPopupMenu pop( this );
356 pop.setFocusPolicy( NoFocus ); //don't reset IM 356 pop.setFocusPolicy( NoFocus ); //don't reset IM
357 357
358 QString imname; 358 QString imname;
359 if (imethod) 359 if (imethod)
360 imname = imethod->libName.mid(imethod->libName.findRev('/') + 1); 360 imname = imethod->libName.mid(imethod->libName.findRev('/') + 1);
361 361
362 int i = 0; 362 int i = 0;
363 int firstDepKbd = 0; 363 int firstDepKbd = 0;
364 364
365 QValueList<InputMethod>::Iterator it; 365 QValueList<InputMethod>::Iterator it;
366 for ( it = inputMethodList.begin(); it != inputMethodList.end(); ++it, i++ ) { 366 for ( it = inputMethodList.begin(); it != inputMethodList.end(); ++it, i++ ) {
367 // add empty new items, all old items. 367 // add empty new items, all old items.
368 if (!(*it).newIM || (*it).extInterface->compatible().count() == 0 ) { 368 if (!(*it).newIM || (*it).extInterface->compatible().count() == 0 ) {
369 pop.insertItem( (*it).name(), i, firstDepKbd); 369 pop.insertItem( (*it).name(), i, firstDepKbd);
370 if ( mkeyboard == &(*it) ) 370 if ( mkeyboard == &(*it) )
371 pop.setItemChecked( i, TRUE ); 371 pop.setItemChecked( i, TRUE );
372 372
373 firstDepKbd++; 373 firstDepKbd++;
374 } else if ( (*it).extInterface->compatible().contains(imname)) { 374 } else if ( (*it).extInterface->compatible().contains(imname)) {
375 // check if we need to insert a sep. 375 // check if we need to insert a sep.
diff --git a/core/launcher/irserver.cpp b/core/launcher/irserver.cpp
index 092eb0c..19cf904 100644
--- a/core/launcher/irserver.cpp
+++ b/core/launcher/irserver.cpp
@@ -1,76 +1,76 @@
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 "irserver.h" 21#include "irserver.h"
22#include "obexinterface.h" 22#include "obexinterface.h"
23 23
24/* OPIE */ 24/* OPIE */
25#include <opie2/odebug.h> 25#include <opie2/odebug.h>
26#include <qtopia/qlibrary.h> 26#include <qtopia/qlibrary.h>
27#include <qtopia/qpeapplication.h> 27#include <qtopia/qpeapplication.h>
28 28
29/* QT */ 29/* QT */
30#include <qdir.h> 30#include <qdir.h>
31 31
32IrServer::IrServer( QObject *parent, const char *name ) 32IrServer::IrServer( QObject *parent, const char *name )
33 : QObject( parent, name ), obexIface(0) 33 : QObject( parent, name ), obexIface(0)
34{ 34{
35 lib = 0; 35 lib = 0;
36 obexIface = 0; 36 obexIface = 0;
37 QString path = QPEApplication::qpeDir() + "/plugins/obex/"; 37 QString path = QPEApplication::qpeDir() + "plugins/obex/";
38#ifdef Q_OS_MACX 38#ifdef Q_OS_MACX
39 QDir dir( path, "lib*.dylib" ); 39 QDir dir( path, "lib*.dylib" );
40#else 40#else
41 QDir dir( path, "lib*.so" ); 41 QDir dir( path, "lib*.so" );
42#endif /* Q_OS_MACX */ 42#endif /* Q_OS_MACX */
43 QStringList list = dir.entryList(); 43 QStringList list = dir.entryList();
44 QStringList::Iterator it; 44 QStringList::Iterator it;
45 for ( it = list.begin(); it != list.end(); ++it ) { 45 for ( it = list.begin(); it != list.end(); ++it ) {
46 QLibrary *trylib = new QLibrary( path + *it ); 46 QLibrary *trylib = new QLibrary( path + *it );
47 //odebug << "trying lib " << (path + (*it)) << "" << oendl; 47 //odebug << "trying lib " << (path + (*it)) << "" << oendl;
48 if ( trylib->queryInterface( IID_ObexInterface, (QUnknownInterface**)&obexIface ) == QS_OK ) { 48 if ( trylib->queryInterface( IID_ObexInterface, (QUnknownInterface**)&obexIface ) == QS_OK ) {
49 lib = trylib; 49 lib = trylib;
50 //odebug << "found obex lib" << oendl; 50 //odebug << "found obex lib" << oendl;
51 QString lang = getenv( "LANG" ); 51 QString lang = getenv( "LANG" );
52 QTranslator * trans = new QTranslator(qApp); 52 QTranslator * trans = new QTranslator(qApp);
53 QString type = (*it).left( (*it).find(".") ); 53 QString type = (*it).left( (*it).find(".") );
54 QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; 54 QString tfn = QPEApplication::qpeDir()+"i18n/"+lang+"/"+type+".qm";
55 //odebug << "tr fpr obex: " << tfn << "" << oendl; 55 //odebug << "tr fpr obex: " << tfn << "" << oendl;
56 if ( trans->load( tfn )) 56 if ( trans->load( tfn ))
57 qApp->installTranslator( trans ); 57 qApp->installTranslator( trans );
58 else 58 else
59 delete trans; 59 delete trans;
60 60
61 break; 61 break;
62 } else { 62 } else {
63 delete lib; 63 delete lib;
64 } 64 }
65 } 65 }
66 if ( !lib ) 66 if ( !lib )
67 odebug << "could not load IR plugin" << oendl; 67 odebug << "could not load IR plugin" << oendl;
68} 68}
69 69
70IrServer::~IrServer() 70IrServer::~IrServer()
71{ 71{
72 if ( obexIface ) 72 if ( obexIface )
73 obexIface->release(); 73 obexIface->release();
74 delete lib; 74 delete lib;
75} 75}
76 76
diff --git a/core/launcher/startmenu.cpp b/core/launcher/startmenu.cpp
index f3a7651..66f665f 100644
--- a/core/launcher/startmenu.cpp
+++ b/core/launcher/startmenu.cpp
@@ -222,169 +222,169 @@ void StartMenu::createMenuEntries( QPopupMenu *menu, QDir dir, bool ltabs, bool
222 dirs.sort(); 222 dirs.sort();
223 223
224 for ( QStringList::Iterator it = dirs.begin(); it != dirs.end(); it++ ) { 224 for ( QStringList::Iterator it = dirs.begin(); it != dirs.end(); it++ ) {
225 createDirEntry( menu, dir, *it, lot ); 225 createDirEntry( menu, dir, *it, lot );
226 } 226 }
227 } 227 }
228} 228}
229 229
230bool StartMenu::loadMenu( QPopupMenu *menu ) 230bool StartMenu::loadMenu( QPopupMenu *menu )
231{ 231{
232 Config cfg("StartMenu"); 232 Config cfg("StartMenu");
233 cfg.setGroup("Menu"); 233 cfg.setGroup("Menu");
234 234
235 bool ltabs = cfg.readBoolEntry("LauncherTabs", TRUE); 235 bool ltabs = cfg.readBoolEntry("LauncherTabs", TRUE);
236 bool lot = cfg.readBoolEntry("LauncherOther", TRUE); 236 bool lot = cfg.readBoolEntry("LauncherOther", TRUE);
237 useWidePopupMenu = cfg.readBoolEntry( "LauncherSubPopup", TRUE ); 237 useWidePopupMenu = cfg.readBoolEntry( "LauncherSubPopup", TRUE );
238 bool sepfirst = !ltabs && !lot; 238 bool sepfirst = !ltabs && !lot;
239 239
240 currentItem = 0; 240 currentItem = 0;
241 launchMenu->clear(); 241 launchMenu->clear();
242 242
243 appLnks.setAutoDelete( true ); 243 appLnks.setAutoDelete( true );
244 tabNames.setAutoDelete( true ); 244 tabNames.setAutoDelete( true );
245 appLnks.clear(); 245 appLnks.clear();
246 tabNames.clear(); 246 tabNames.clear();
247 appLnks.setAutoDelete( false ); 247 appLnks.setAutoDelete( false );
248 tabNames.setAutoDelete( false ); 248 tabNames.setAutoDelete( false );
249 249
250 QDir dir( MimeType::appsFolderName(), QString::null, QDir::Name ); 250 QDir dir( MimeType::appsFolderName(), QString::null, QDir::Name );
251 createMenuEntries( menu, dir, ltabs, lot ); 251 createMenuEntries( menu, dir, ltabs, lot );
252 252
253 if ( !menu->count() ) sepfirst = TRUE; 253 if ( !menu->count() ) sepfirst = TRUE;
254 254
255 launchMenu->setName( sepfirst ? "accessories" : "accessories_need_sep" ); // No tr 255 launchMenu->setName( sepfirst ? "accessories" : "accessories_need_sep" ); // No tr
256 256
257 return currentItem; 257 return currentItem;
258} 258}
259 259
260 260
261void StartMenu::launch() 261void StartMenu::launch()
262{ 262{
263 int y = mapToGlobal( QPoint() ).y() - launchMenu->sizeHint().height(); 263 int y = mapToGlobal( QPoint() ).y() - launchMenu->sizeHint().height();
264 264
265 if ( launchMenu->isVisible() ) 265 if ( launchMenu->isVisible() )
266 launchMenu->hide(); 266 launchMenu->hide();
267 else 267 else
268 launchMenu->popup( QPoint( 1, y ) ); 268 launchMenu->popup( QPoint( 1, y ) );
269} 269}
270 270
271 271
272 272
273 273
274static int compareAppletPositions(const void *b, const void *a) 274static int compareAppletPositions(const void *b, const void *a)
275{ 275{
276 const MenuApplet* aa = *(const MenuApplet**)a; 276 const MenuApplet* aa = *(const MenuApplet**)a;
277 const MenuApplet* ab = *(const MenuApplet**)b; 277 const MenuApplet* ab = *(const MenuApplet**)b;
278 int d = aa->iface->position() - ab->iface->position(); 278 int d = aa->iface->position() - ab->iface->position();
279 if ( d ) return d; 279 if ( d ) return d;
280 return QString::compare(aa->library->library(),ab->library->library()); 280 return QString::compare(aa->library->library(),ab->library->library());
281} 281}
282 282
283void StartMenu::clearApplets() 283void StartMenu::clearApplets()
284{ 284{
285 if ( launchMenu ) 285 if ( launchMenu )
286 launchMenu-> hide(); 286 launchMenu-> hide();
287 287
288 for ( QIntDictIterator<MenuApplet> it( menuApplets ); it.current(); ++it ) { 288 for ( QIntDictIterator<MenuApplet> it( menuApplets ); it.current(); ++it ) {
289 MenuApplet *applet = it.current(); 289 MenuApplet *applet = it.current();
290 if ( launchMenu ) { 290 if ( launchMenu ) {
291 launchMenu->removeItem( applet-> id ); 291 launchMenu->removeItem( applet-> id );
292 delete applet->popup; 292 delete applet->popup;
293 } 293 }
294 294
295 applet->iface->release(); 295 applet->iface->release();
296 applet->library->unload(); 296 applet->library->unload();
297 delete applet-> library; 297 delete applet-> library;
298 } 298 }
299 menuApplets.clear(); 299 menuApplets.clear();
300} 300}
301 301
302 302
303 303
304 304
305void StartMenu::loadApplets() 305void StartMenu::loadApplets()
306{ 306{
307 Config cfg( "StartMenu" ); 307 Config cfg( "StartMenu" );
308 cfg.setGroup( "Applets" ); 308 cfg.setGroup( "Applets" );
309 309
310 // SafeMode causes too much problems, so we disable it for now -- 310 // SafeMode causes too much problems, so we disable it for now --
311 // maybe we should reenable it for OPIE 1.0 - sandman 26.09.02 311 // maybe we should reenable it for OPIE 1.0 - sandman 26.09.02
312 // removed in the remerge PluginManager could handle it 312 // removed in the remerge PluginManager could handle it
313 // we don't currently use it -zecke 313 // we don't currently use it -zecke
314 314
315 QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' ); 315 QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' );
316 316
317 QString lang = getenv( "LANG" ); 317 QString lang = getenv( "LANG" );
318 QString path = QPEApplication::qpeDir() + "/plugins/applets"; 318 QString path = QPEApplication::qpeDir() + "plugins/applets";
319 QDir dir( path, "lib*.so" ); 319 QDir dir( path, "lib*.so" );
320 QStringList list = dir.entryList(); 320 QStringList list = dir.entryList();
321 QStringList::Iterator it; 321 QStringList::Iterator it;
322 int napplets = 0; 322 int napplets = 0;
323 MenuApplet* *xapplets = new MenuApplet*[list.count()]; 323 MenuApplet* *xapplets = new MenuApplet*[list.count()];
324 for ( it = list.begin(); it != list.end(); ++it ) { 324 for ( it = list.begin(); it != list.end(); ++it ) {
325 if ( exclude.find( *it ) != exclude.end() ) 325 if ( exclude.find( *it ) != exclude.end() )
326 continue; 326 continue;
327 MenuAppletInterface *iface = 0; 327 MenuAppletInterface *iface = 0;
328 QLibrary *lib = new QLibrary( path + "/" + *it ); 328 QLibrary *lib = new QLibrary( path + "/" + *it );
329 if (( lib->queryInterface( IID_MenuApplet, (QUnknownInterface**)&iface ) == QS_OK ) && iface ) { 329 if (( lib->queryInterface( IID_MenuApplet, (QUnknownInterface**)&iface ) == QS_OK ) && iface ) {
330 MenuApplet *applet = new MenuApplet; 330 MenuApplet *applet = new MenuApplet;
331 xapplets[napplets++] = applet; 331 xapplets[napplets++] = applet;
332 applet->library = lib; 332 applet->library = lib;
333 applet->iface = iface; 333 applet->iface = iface;
334 334
335 QTranslator *trans = new QTranslator(qApp); 335 QTranslator *trans = new QTranslator(qApp);
336 QString type = (*it).left( (*it).find(".") ); 336 QString type = (*it).left( (*it).find(".") );
337 QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; 337 QString tfn = QPEApplication::qpeDir()+"i18n/"+lang+"/"+type+".qm";
338 if ( trans->load( tfn )) 338 if ( trans->load( tfn ))
339 qApp->installTranslator( trans ); 339 qApp->installTranslator( trans );
340 else 340 else
341 delete trans; 341 delete trans;
342 } else { 342 } else {
343 exclude += *it; 343 exclude += *it;
344 delete lib; 344 delete lib;
345 } 345 }
346 } 346 }
347 cfg.writeEntry( "ExcludeApplets", exclude, ',' ); 347 cfg.writeEntry( "ExcludeApplets", exclude, ',' );
348 qsort(xapplets, napplets, sizeof(menuApplets[0]), compareAppletPositions); 348 qsort(xapplets, napplets, sizeof(menuApplets[0]), compareAppletPositions);
349 349
350 350
351 while ( napplets-- ) { 351 while ( napplets-- ) {
352 MenuApplet *applet = xapplets[napplets]; 352 MenuApplet *applet = xapplets[napplets];
353 applet->popup = applet->iface->popup( this ); 353 applet->popup = applet->iface->popup( this );
354 354
355 // menuApplets got an id < -1 355 // menuApplets got an id < -1
356 menuApplets.insert( -( currentItem + 2 ), new MenuApplet( *applet ) ); 356 menuApplets.insert( -( currentItem + 2 ), new MenuApplet( *applet ) );
357 currentItem++; 357 currentItem++;
358 } 358 }
359 delete [] xapplets; 359 delete [] xapplets;
360 360
361 addApplets( launchMenu ); 361 addApplets( launchMenu );
362} 362}
363 363
364 364
365/* 365/*
366 * Launcher calls loadMenu too often fix that 366 * Launcher calls loadMenu too often fix that
367 */ 367 */
368void StartMenu::addApplets(QPopupMenu* pop) { 368void StartMenu::addApplets(QPopupMenu* pop) {
369 QIntDict<MenuApplet> dict; 369 QIntDict<MenuApplet> dict;
370 if( pop-> count ( )) 370 if( pop-> count ( ))
371 pop-> insertSeparator ( ); 371 pop-> insertSeparator ( );
372 372
373 for ( QIntDictIterator<MenuApplet> it( menuApplets ); it.current(); ++it ) { 373 for ( QIntDictIterator<MenuApplet> it( menuApplets ); it.current(); ++it ) {
374 MenuApplet *applet = it.current(); 374 MenuApplet *applet = it.current();
375 if ( applet->popup ) 375 if ( applet->popup )
376 applet->id = pop->insertItem( applet->iface->icon(), 376 applet->id = pop->insertItem( applet->iface->icon(),
377 applet->iface->text(), applet->popup ); 377 applet->iface->text(), applet->popup );
378 else 378 else
379 applet->id = pop->insertItem( applet->iface->icon(), 379 applet->id = pop->insertItem( applet->iface->icon(),
380 applet->iface->text() ); 380 applet->iface->text() );
381 381
382 382
383 dict.insert( applet->id, new MenuApplet( *applet ) ); 383 dict.insert( applet->id, new MenuApplet( *applet ) );
384 } 384 }
385 /* need to update the key */ 385 /* need to update the key */
386 menuApplets.setAutoDelete( true ); 386 menuApplets.setAutoDelete( true );
387 menuApplets.clear(); 387 menuApplets.clear();
388 menuApplets.setAutoDelete( false ); 388 menuApplets.setAutoDelete( false );
389 menuApplets = dict; 389 menuApplets = dict;
390} 390}
diff --git a/core/launcher/systray.cpp b/core/launcher/systray.cpp
index 3c72d25..d0f1808 100644
--- a/core/launcher/systray.cpp
+++ b/core/launcher/systray.cpp
@@ -4,147 +4,147 @@
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 "systray.h" 21#include "systray.h"
22 22
23/* OPIE */ 23/* OPIE */
24#include <opie2/odebug.h> 24#include <opie2/odebug.h>
25#include <qtopia/qpeapplication.h> 25#include <qtopia/qpeapplication.h>
26#include <qtopia/qlibrary.h> 26#include <qtopia/qlibrary.h>
27#include <qtopia/config.h> 27#include <qtopia/config.h>
28using namespace Opie::Core; 28using namespace Opie::Core;
29 29
30/* QT */ 30/* QT */
31#include <qlayout.h> 31#include <qlayout.h>
32#include <qdir.h> 32#include <qdir.h>
33 33
34/* STD */ 34/* STD */
35#include <stdlib.h> 35#include <stdlib.h>
36 36
37SysTray::SysTray( QWidget *parent ) : QFrame( parent ), layout(0) 37SysTray::SysTray( QWidget *parent ) : QFrame( parent ), layout(0)
38{ 38{
39 //setFrameStyle( QFrame::Panel | QFrame::Sunken ); 39 //setFrameStyle( QFrame::Panel | QFrame::Sunken );
40 loadApplets(); 40 loadApplets();
41} 41}
42 42
43SysTray::~SysTray() 43SysTray::~SysTray()
44{ 44{
45 clearApplets(); 45 clearApplets();
46} 46}
47 47
48static int compareAppletPositions(const void *a, const void *b) 48static int compareAppletPositions(const void *a, const void *b)
49{ 49{
50 const TaskbarApplet* aa = *(const TaskbarApplet**)a; 50 const TaskbarApplet* aa = *(const TaskbarApplet**)a;
51 const TaskbarApplet* ab = *(const TaskbarApplet**)b; 51 const TaskbarApplet* ab = *(const TaskbarApplet**)b;
52 int d = ab->iface->position() - aa->iface->position(); 52 int d = ab->iface->position() - aa->iface->position();
53 if ( d ) return d; 53 if ( d ) return d;
54 return QString::compare(ab->name,aa->name); 54 return QString::compare(ab->name,aa->name);
55} 55}
56 56
57void SysTray::loadApplets() 57void SysTray::loadApplets()
58{ 58{
59 hide(); 59 hide();
60 clearApplets(); 60 clearApplets();
61 addApplets(); 61 addApplets();
62} 62}
63 63
64void SysTray::clearApplets() 64void SysTray::clearApplets()
65{ 65{
66#ifndef QT_NO_COMPONENTS 66#ifndef QT_NO_COMPONENTS
67 67
68 /* 68 /*
69 * Note on clearing. SOme applets delete their 69 * Note on clearing. SOme applets delete their
70 * applets themselves some don't do it 70 * applets themselves some don't do it
71 * and on restart this can crash. If we delete it 71 * and on restart this can crash. If we delete it
72 * here we might end up in a double deletion. We could 72 * here we might end up in a double deletion. We could
73 * use QGuardedPtr but that would be one QOBject 73 * use QGuardedPtr but that would be one QOBject
74 * for every applet more but only useful for restart 74 * for every applet more but only useful for restart
75 */ 75 */
76 QValueList<TaskbarApplet>::Iterator mit; 76 QValueList<TaskbarApplet>::Iterator mit;
77 for ( mit = appletList.begin(); mit != appletList.end(); ++mit ) { 77 for ( mit = appletList.begin(); mit != appletList.end(); ++mit ) {
78 (*mit).iface->release(); 78 (*mit).iface->release();
79 (*mit).library->unload(); 79 (*mit).library->unload();
80 delete (*mit).library; 80 delete (*mit).library;
81 } 81 }
82 82
83#endif 83#endif
84 appletList.clear(); 84 appletList.clear();
85 if ( layout ) 85 if ( layout )
86 delete layout; 86 delete layout;
87 layout = new QHBoxLayout( this, 0, 1 ); 87 layout = new QHBoxLayout( this, 0, 1 );
88 layout->setAutoAdd(TRUE); 88 layout->setAutoAdd(TRUE);
89} 89}
90 90
91void SysTray::addApplets() 91void SysTray::addApplets()
92{ 92{
93 hide(); 93 hide();
94#ifndef QT_NO_COMPONENTS 94#ifndef QT_NO_COMPONENTS
95 Config cfg( "Taskbar" ); 95 Config cfg( "Taskbar" );
96 cfg.setGroup( "Applets" ); 96 cfg.setGroup( "Applets" );
97 QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' ); 97 QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' );
98 98
99 QString lang = getenv( "LANG" ); 99 QString lang = getenv( "LANG" );
100 QString path = QPEApplication::qpeDir() + "/plugins/applets"; 100 QString path = QPEApplication::qpeDir() + "plugins/applets";
101#ifdef Q_OS_MACX 101#ifdef Q_OS_MACX
102 QDir dir( path, "lib*.dylib" ); 102 QDir dir( path, "lib*.dylib" );
103#else 103#else
104 QDir dir( path, "lib*.so" ); 104 QDir dir( path, "lib*.so" );
105#endif /* Q_OS_MACX */ 105#endif /* Q_OS_MACX */
106 QStringList list = dir.entryList(); 106 QStringList list = dir.entryList();
107 QStringList::Iterator it; 107 QStringList::Iterator it;
108 int napplets=0; 108 int napplets=0;
109 TaskbarApplet* *applets = new TaskbarApplet*[list.count()]; 109 TaskbarApplet* *applets = new TaskbarApplet*[list.count()];
110 for ( it = list.begin(); it != list.end(); ++it ) { 110 for ( it = list.begin(); it != list.end(); ++it ) {
111 if ( exclude.find( *it ) != exclude.end() ) 111 if ( exclude.find( *it ) != exclude.end() )
112 continue; 112 continue;
113 owarn << "Found Applet: " << (*it) << "" << oendl; 113 owarn << "Found Applet: " << (*it) << "" << oendl;
114 TaskbarAppletInterface *iface = 0; 114 TaskbarAppletInterface *iface = 0;
115 QLibrary *lib = new QLibrary( path + "/" + *it ); 115 QLibrary *lib = new QLibrary( path + "/" + *it );
116 if (( lib->queryInterface( IID_TaskbarApplet, (QUnknownInterface**)&iface ) == QS_OK ) && iface ) { 116 if (( lib->queryInterface( IID_TaskbarApplet, (QUnknownInterface**)&iface ) == QS_OK ) && iface ) {
117 TaskbarApplet *applet = new TaskbarApplet; 117 TaskbarApplet *applet = new TaskbarApplet;
118 applets[napplets++] = applet; 118 applets[napplets++] = applet;
119 applet->library = lib; 119 applet->library = lib;
120 applet->iface = iface; 120 applet->iface = iface;
121 121
122 QTranslator *trans = new QTranslator(qApp); 122 QTranslator *trans = new QTranslator(qApp);
123 QString type = (*it).left( (*it).find(".") ); 123 QString type = (*it).left( (*it).find(".") );
124 QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; 124 QString tfn = QPEApplication::qpeDir()+"i18n/"+lang+"/"+type+".qm";
125 if ( trans->load( tfn )) 125 if ( trans->load( tfn ))
126 qApp->installTranslator( trans ); 126 qApp->installTranslator( trans );
127 else 127 else
128 delete trans; 128 delete trans;
129 } else { 129 } else {
130 exclude += *it; 130 exclude += *it;
131 delete lib; 131 delete lib;
132 } 132 }
133 } 133 }
134 cfg.writeEntry( "ExcludeApplets", exclude, ',' ); 134 cfg.writeEntry( "ExcludeApplets", exclude, ',' );
135 qsort(applets,napplets,sizeof(applets[0]),compareAppletPositions); 135 qsort(applets,napplets,sizeof(applets[0]),compareAppletPositions);
136 while (napplets--) { 136 while (napplets--) {
137 TaskbarApplet *applet = applets[napplets]; 137 TaskbarApplet *applet = applets[napplets];
138 applet->applet = applet->iface->applet( this ); 138 applet->applet = applet->iface->applet( this );
139 appletList.append(*applet); 139 appletList.append(*applet);
140 } 140 }
141 delete [] applets; 141 delete [] applets;
142#else /* ## FIXME single app */ 142#else /* ## FIXME single app */
143 TaskbarApplet * const applet = new TaskbarApplet(); 143 TaskbarApplet * const applet = new TaskbarApplet();
144 applet->iface = new ClockAppletImpl(); 144 applet->iface = new ClockAppletImpl();
145 applet->applet = applet->iface->applet( this ); 145 applet->applet = applet->iface->applet( this );
146 appletList.append( applet ); 146 appletList.append( applet );
147#endif 147#endif
148 show(); 148 show();
149} 149}
150 150