summaryrefslogtreecommitdiff
path: root/core
Unidiff
Diffstat (limited to 'core') (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/multikeyapplet/multikey.cpp2
-rw-r--r--core/apps/taboapp/main.cpp4
-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
-rw-r--r--core/multimedia/opieplayer/mediaplayerstate.cpp2
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp2
-rw-r--r--core/multimedia/opieplayer/videowidget.cpp2
-rw-r--r--core/opie-login/main.cpp2
-rw-r--r--core/settings/launcher/menusettings.cpp4
-rw-r--r--core/settings/launcher/taskbarsettings.cpp4
-rw-r--r--core/settings/security/multiauthconfig.cpp8
-rw-r--r--core/tools/quicklauncher/dropins.h4
14 files changed, 26 insertions, 26 deletions
diff --git a/core/applets/multikeyapplet/multikey.cpp b/core/applets/multikeyapplet/multikey.cpp
index 195d8a4..8cb9083 100644
--- a/core/applets/multikeyapplet/multikey.cpp
+++ b/core/applets/multikeyapplet/multikey.cpp
@@ -1,142 +1,142 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2004 Anton Kachalov mouse@altlinux.ru 2** Copyright (C) 2004 Anton Kachalov mouse@altlinux.ru
3** All rights reserved. 3** All rights reserved.
4** 4**
5** This file may be distributed and/or modified under the terms of the 5** This file may be distributed and/or modified under the terms of the
6** GNU General Public License version 2 as published by the Free Software 6** GNU General Public License version 2 as published by the Free Software
7** Foundation and appearing in the file LICENSE.GPL included in the 7** Foundation and appearing in the file LICENSE.GPL included in the
8** packaging of this file. 8** packaging of this file.
9** 9**
10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12** 12**
13**********************************************************************/ 13**********************************************************************/
14 14
15#include "multikey.h" 15#include "multikey.h"
16 16
17/* OPIE */ 17/* OPIE */
18#include <opie2/otaskbarapplet.h> 18#include <opie2/otaskbarapplet.h>
19#include <qpe/qcopenvelope_qws.h> 19#include <qpe/qcopenvelope_qws.h>
20#include <qpe/qpeapplication.h> 20#include <qpe/qpeapplication.h>
21 21
22/* QT */ 22/* QT */
23#include <qdir.h> 23#include <qdir.h>
24 24
25using namespace Opie::Ui; 25using namespace Opie::Ui;
26Multikey::Multikey(QWidget *parent) : QLabel(parent), popupMenu(this), current("EN") 26Multikey::Multikey(QWidget *parent) : QLabel(parent), popupMenu(this), current("EN")
27{ 27{
28 QCopChannel* swChannel = new QCopChannel("MultiKey/Switcher", this); 28 QCopChannel* swChannel = new QCopChannel("MultiKey/Switcher", this);
29 connect( swChannel, SIGNAL(received(const QCString&,const QByteArray&)), 29 connect( swChannel, SIGNAL(received(const QCString&,const QByteArray&)),
30 this, SLOT(message(const QCString&,const QByteArray&))); 30 this, SLOT(message(const QCString&,const QByteArray&)));
31 31
32 setFont( QFont( "Helvetica", 10, QFont::Normal ) ); 32 setFont( QFont( "Helvetica", 10, QFont::Normal ) );
33 QPEApplication::setStylusOperation(this, QPEApplication::RightOnHold); 33 QPEApplication::setStylusOperation(this, QPEApplication::RightOnHold);
34 lang = 0; 34 lang = 0;
35 QCopEnvelope e("MultiKey/Keyboard", "getmultikey()"); 35 QCopEnvelope e("MultiKey/Keyboard", "getmultikey()");
36 setText("EN"); 36 setText("EN");
37 popupMenu.insertItem("EN", 0); 37 popupMenu.insertItem("EN", 0);
38 show(); 38 show();
39} 39}
40 40
41void Multikey::mousePressEvent(QMouseEvent *ev) 41void Multikey::mousePressEvent(QMouseEvent *ev)
42{ 42{
43 if (!sw_maps.count()) 43 if (!sw_maps.count())
44 return; 44 return;
45 45
46 if (ev->button() == RightButton) { 46 if (ev->button() == RightButton) {
47 47
48 QPoint p = mapToGlobal(QPoint(0, 0)); 48 QPoint p = mapToGlobal(QPoint(0, 0));
49 QSize s = popupMenu.sizeHint(); 49 QSize s = popupMenu.sizeHint();
50 int opt = popupMenu.exec(QPoint(p.x() + (width() / 2) - (s.width() / 2), 50 int opt = popupMenu.exec(QPoint(p.x() + (width() / 2) - (s.width() / 2),
51 p.y() - s.height()), 0); 51 p.y() - s.height()), 0);
52 52
53 if (opt == -1) 53 if (opt == -1)
54 return; 54 return;
55 lang = opt; 55 lang = opt;
56 56
57 QCopEnvelope e("MultiKey/Keyboard", "setmultikey(QString)"); 57 QCopEnvelope e("MultiKey/Keyboard", "setmultikey(QString)");
58 e << sw_maps[lang]; 58 e << sw_maps[lang];
59 setText(labels[lang]); 59 setText(labels[lang]);
60 } 60 }
61 QWidget::mousePressEvent(ev); 61 QWidget::mousePressEvent(ev);
62} 62}
63 63
64void Multikey::mouseReleaseEvent(QMouseEvent *ev) 64void Multikey::mouseReleaseEvent(QMouseEvent *ev)
65{ 65{
66 if (!sw_maps.count()) 66 if (!sw_maps.count())
67 return; 67 return;
68 68
69 lang = lang < sw_maps.count()-1 ? lang+1 : 0; 69 lang = lang < sw_maps.count()-1 ? lang+1 : 0;
70 QCopEnvelope e("MultiKey/Keyboard", "setmultikey(QString)"); 70 QCopEnvelope e("MultiKey/Keyboard", "setmultikey(QString)");
71 //odebug << "Lang=" << lang << ", count=" << sw_maps.count() << ", lab=" << labels[lang].ascii() << "" << oendl; 71 //odebug << "Lang=" << lang << ", count=" << sw_maps.count() << ", lab=" << labels[lang].ascii() << "" << oendl;
72 e << sw_maps[lang]; 72 e << sw_maps[lang];
73 setText(labels[lang]); 73 setText(labels[lang]);
74} 74}
75 75
76void Multikey::message(const QCString &message, const QByteArray &data) 76void Multikey::message(const QCString &message, const QByteArray &data)
77{ 77{
78 if ( message == "setsw(QString,QString)" ) { 78 if ( message == "setsw(QString,QString)" ) {
79 79
80 QDataStream stream(data, IO_ReadOnly); 80 QDataStream stream(data, IO_ReadOnly);
81 QString maps, current_map; 81 QString maps, current_map;
82 stream >> maps >> current_map; 82 stream >> maps >> current_map;
83 QStringList sw = QStringList::split(QChar('|'), maps); 83 QStringList sw = QStringList::split(QChar('|'), maps);
84 sw.append(current_map); 84 sw.append(current_map);
85 85
86 QDir map_dir(QPEApplication::qpeDir() + "/share/multikey/", "*.keymap"); 86 QDir map_dir(QPEApplication::qpeDir() + "share/multikey/", "*.keymap");
87 lang = 0; 87 lang = 0;
88 labels.clear(); 88 labels.clear();
89 sw_maps.clear(); 89 sw_maps.clear();
90 popupMenu.clear(); 90 popupMenu.clear();
91 91
92 for (uint i = 0; i < sw.count(); ++i) { 92 for (uint i = 0; i < sw.count(); ++i) {
93 QString keymap_map; 93 QString keymap_map;
94 if (sw[i][0] != '/') { 94 if (sw[i][0] != '/') {
95 95
96 keymap_map = map_dir.absPath() + "/" + sw[i]; 96 keymap_map = map_dir.absPath() + "/" + sw[i];
97 } else { 97 } else {
98 98
99 if ((map_dir.exists(QFileInfo(sw[i]).fileName(), false) 99 if ((map_dir.exists(QFileInfo(sw[i]).fileName(), false)
100 && i != sw.count()-1) || !QFile::exists(sw[i])) { 100 && i != sw.count()-1) || !QFile::exists(sw[i])) {
101 continue; 101 continue;
102 } 102 }
103 keymap_map = sw[i]; 103 keymap_map = sw[i];
104 } 104 }
105 105
106 QFile map(keymap_map); 106 QFile map(keymap_map);
107 if (map.open(IO_ReadOnly)) { 107 if (map.open(IO_ReadOnly)) {
108 QString line; 108 QString line;
109 109
110 map.readLine(line, 1024); 110 map.readLine(line, 1024);
111 while (!map.atEnd()) { 111 while (!map.atEnd()) {
112 112
113 if (line.find(QRegExp("^sw\\s*=\\s*")) != -1) { 113 if (line.find(QRegExp("^sw\\s*=\\s*")) != -1) {
114 114
115 if (i != sw.count()-1) { 115 if (i != sw.count()-1) {
116 if (keymap_map == current_map) { 116 if (keymap_map == current_map) {
117 lang = i; 117 lang = i;
118 } 118 }
119 sw_maps.append(keymap_map); 119 sw_maps.append(keymap_map);
120 labels.append(line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace()); 120 labels.append(line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace());
121 popupMenu.insertItem(labels[labels.count()-1], labels.count()-1); 121 popupMenu.insertItem(labels[labels.count()-1], labels.count()-1);
122 } else { 122 } else {
123 current = line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace(); 123 current = line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace();
124 } 124 }
125 break; 125 break;
126 } 126 }
127 map.readLine(line, 1024); 127 map.readLine(line, 1024);
128 } 128 }
129 map.close(); 129 map.close();
130 } 130 }
131 } 131 }
132 132
133 setText(current); 133 setText(current);
134 } 134 }
135} 135}
136 136
137int Multikey::position() 137int Multikey::position()
138{ 138{
139 return 10; 139 return 10;
140} 140}
141 141
142EXPORT_OPIE_APPLET_v1( Multikey ) 142EXPORT_OPIE_APPLET_v1( Multikey )
diff --git a/core/apps/taboapp/main.cpp b/core/apps/taboapp/main.cpp
index e43f118..e999803 100644
--- a/core/apps/taboapp/main.cpp
+++ b/core/apps/taboapp/main.cpp
@@ -1,57 +1,57 @@
1/* OPIE */ 1/* OPIE */
2#include <oappinterface.h> 2#include <oappinterface.h>
3#include <oappplugin.h> 3#include <oappplugin.h>
4#include <opie2/odebug.h> 4#include <opie2/odebug.h>
5#include <opie2/otabwidget.h> 5#include <opie2/otabwidget.h>
6#include <qpe/qpeapplication.h> 6#include <qpe/qpeapplication.h>
7#include <qpe/qlibrary.h> 7#include <qpe/qlibrary.h>
8using namespace Opie::Core; 8using namespace Opie::Core;
9using namespace Opie::Ui; 9using namespace Opie::Ui;
10 10
11/* QT */ 11/* QT */
12#include <qdir.h> 12#include <qdir.h>
13 13
14int main( int argc, char **argv ) 14int main( int argc, char **argv )
15{ 15{
16 QPEApplication a( argc, argv ); 16 QPEApplication a( argc, argv );
17 17
18 OTabWidget *tabwidget = new OTabWidget(0, "tab widget"); 18 OTabWidget *tabwidget = new OTabWidget(0, "tab widget");
19 19
20 QString path = QPEApplication::qpeDir() + "/plugins/app"; 20 QString path = QPEApplication::qpeDir() + "plugins/app";
21 QDir dir( path, "lib*.so" ); 21 QDir dir( path, "lib*.so" );
22 22
23 QStringList list = dir.entryList(); 23 QStringList list = dir.entryList();
24 QStringList::Iterator it; 24 QStringList::Iterator it;
25 25
26 QInterfacePtr<OAppInterface> iface; 26 QInterfacePtr<OAppInterface> iface;
27 for ( it = list.begin(); it != list.end(); ++it ) { 27 for ( it = list.begin(); it != list.end(); ++it ) {
28 QLibrary *lib = new QLibrary( path + "/" + *it ); 28 QLibrary *lib = new QLibrary( path + "/" + *it );
29 29
30 odebug << "querying: " << QString( path + "/" + *it ) << "" << oendl; 30 odebug << "querying: " << QString( path + "/" + *it ) << "" << oendl;
31 if ( lib->queryInterface( IID_OAppInterface, (QUnknownInterface**)&iface ) == QS_OK ) { 31 if ( lib->queryInterface( IID_OAppInterface, (QUnknownInterface**)&iface ) == QS_OK ) {
32 odebug << "accepted: " << QString( path + "/" + *it ) << "" << oendl; 32 odebug << "accepted: " << QString( path + "/" + *it ) << "" << oendl;
33 33
34 QList<QWidget> list = iface->widgets(); 34 QList<QWidget> list = iface->widgets();
35 QWidget *widget; 35 QWidget *widget;
36 for ( widget = list.first(); widget != 0; widget = list.next() ) 36 for ( widget = list.first(); widget != 0; widget = list.next() )
37 tabwidget->addTab(widget, QString(*it), QString(*it)); 37 tabwidget->addTab(widget, QString(*it), QString(*it));
38 38
39 QString lang = getenv( "LANG" ); 39 QString lang = getenv( "LANG" );
40 if (lang.isNull()) 40 if (lang.isNull())
41 lang = "en"; 41 lang = "en";
42 QTranslator *trans = new QTranslator(qApp); 42 QTranslator *trans = new QTranslator(qApp);
43 QString type = (*it).left( (*it).find(".") ); 43 QString type = (*it).left( (*it).find(".") );
44 if (type.left(3) == "lib") 44 if (type.left(3) == "lib")
45 type = type.mid(3); 45 type = type.mid(3);
46 type = type.right( type.find("lib") ); 46 type = type.right( type.find("lib") );
47 QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; 47 QString tfn = QPEApplication::qpeDir()+"i18n/"+lang+"/"+type+".qm";
48 if ( trans->load( tfn )) 48 if ( trans->load( tfn ))
49 qApp->installTranslator( trans ); 49 qApp->installTranslator( trans );
50 else 50 else
51 delete trans; 51 delete trans;
52 } 52 }
53 } 53 }
54 54
55 a.showMainDocumentWidget(tabwidget); 55 a.showMainDocumentWidget(tabwidget);
56 return a.exec(); 56 return a.exec();
57} 57}
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
diff --git a/core/multimedia/opieplayer/mediaplayerstate.cpp b/core/multimedia/opieplayer/mediaplayerstate.cpp
index b700cd1..8b0fbbc 100644
--- a/core/multimedia/opieplayer/mediaplayerstate.cpp
+++ b/core/multimedia/opieplayer/mediaplayerstate.cpp
@@ -46,152 +46,152 @@ MediaPlayerState::MediaPlayerState( QObject *parent, const char *name )
46 : QObject( parent, name ), decoder( NULL ), libmpeg3decoder( NULL ) { 46 : QObject( parent, name ), decoder( NULL ), libmpeg3decoder( NULL ) {
47 Config cfg( "OpiePlayer" ); 47 Config cfg( "OpiePlayer" );
48 readConfig( cfg ); 48 readConfig( cfg );
49 loadPlugins(); 49 loadPlugins();
50} 50}
51 51
52 52
53MediaPlayerState::~MediaPlayerState() { 53MediaPlayerState::~MediaPlayerState() {
54 Config cfg( "OpiePlayer" ); 54 Config cfg( "OpiePlayer" );
55 writeConfig( cfg ); 55 writeConfig( cfg );
56} 56}
57 57
58 58
59void MediaPlayerState::readConfig( Config& cfg ) { 59void MediaPlayerState::readConfig( Config& cfg ) {
60 cfg.setGroup("Options"); 60 cfg.setGroup("Options");
61 isFullscreen = cfg.readBoolEntry( "FullScreen" ); 61 isFullscreen = cfg.readBoolEntry( "FullScreen" );
62 isScaled = cfg.readBoolEntry( "Scaling" ); 62 isScaled = cfg.readBoolEntry( "Scaling" );
63 isLooping = cfg.readBoolEntry( "Looping" ); 63 isLooping = cfg.readBoolEntry( "Looping" );
64 isShuffled = cfg.readBoolEntry( "Shuffle" ); 64 isShuffled = cfg.readBoolEntry( "Shuffle" );
65 usePlaylist = cfg.readBoolEntry( "UsePlayList" ); 65 usePlaylist = cfg.readBoolEntry( "UsePlayList" );
66 usePlaylist = TRUE; 66 usePlaylist = TRUE;
67 isPlaying = FALSE; 67 isPlaying = FALSE;
68 isPaused = FALSE; 68 isPaused = FALSE;
69 curPosition = 0; 69 curPosition = 0;
70 curLength = 0; 70 curLength = 0;
71 curView = 'l'; 71 curView = 'l';
72} 72}
73 73
74 74
75void MediaPlayerState::writeConfig( Config& cfg ) const { 75void MediaPlayerState::writeConfig( Config& cfg ) const {
76 cfg.setGroup("Options"); 76 cfg.setGroup("Options");
77 cfg.writeEntry("FullScreen", isFullscreen ); 77 cfg.writeEntry("FullScreen", isFullscreen );
78 cfg.writeEntry("Scaling", isScaled ); 78 cfg.writeEntry("Scaling", isScaled );
79 cfg.writeEntry("Looping", isLooping ); 79 cfg.writeEntry("Looping", isLooping );
80 cfg.writeEntry("Shuffle", isShuffled ); 80 cfg.writeEntry("Shuffle", isShuffled );
81 cfg.writeEntry("UsePlayList", usePlaylist ); 81 cfg.writeEntry("UsePlayList", usePlaylist );
82} 82}
83 83
84 84
85struct MediaPlayerPlugin { 85struct MediaPlayerPlugin {
86#ifndef QT_NO_COMPONENT 86#ifndef QT_NO_COMPONENT
87 QLibrary *library; 87 QLibrary *library;
88#endif 88#endif
89 MediaPlayerPluginInterface *iface; 89 MediaPlayerPluginInterface *iface;
90 MediaPlayerDecoder *decoder; 90 MediaPlayerDecoder *decoder;
91 MediaPlayerEncoder *encoder; 91 MediaPlayerEncoder *encoder;
92}; 92};
93 93
94 94
95static QValueList<MediaPlayerPlugin> pluginList; 95static QValueList<MediaPlayerPlugin> pluginList;
96 96
97 97
98// Find the first decoder which supports this type of file 98// Find the first decoder which supports this type of file
99MediaPlayerDecoder *MediaPlayerState::newDecoder( const QString& file ) { 99MediaPlayerDecoder *MediaPlayerState::newDecoder( const QString& file ) {
100 MediaPlayerDecoder *tmpDecoder = NULL; 100 MediaPlayerDecoder *tmpDecoder = NULL;
101 QValueList<MediaPlayerPlugin>::Iterator it; 101 QValueList<MediaPlayerPlugin>::Iterator it;
102 for ( it = pluginList.begin(); it != pluginList.end(); ++it ) { 102 for ( it = pluginList.begin(); it != pluginList.end(); ++it ) {
103 if ( (*it).decoder->isFileSupported( file ) ) { 103 if ( (*it).decoder->isFileSupported( file ) ) {
104 tmpDecoder = (*it).decoder; 104 tmpDecoder = (*it).decoder;
105 break; 105 break;
106 } 106 }
107 } 107 }
108 if(file.left(4)=="http") 108 if(file.left(4)=="http")
109 isStreaming = TRUE; 109 isStreaming = TRUE;
110 else 110 else
111 isStreaming = FALSE; 111 isStreaming = FALSE;
112 return decoder = tmpDecoder; 112 return decoder = tmpDecoder;
113} 113}
114 114
115 115
116MediaPlayerDecoder *MediaPlayerState::curDecoder() { 116MediaPlayerDecoder *MediaPlayerState::curDecoder() {
117 return decoder; 117 return decoder;
118} 118}
119 119
120 120
121// ### hack to get true sample count 121// ### hack to get true sample count
122MediaPlayerDecoder *MediaPlayerState::libMpeg3Decoder() { 122MediaPlayerDecoder *MediaPlayerState::libMpeg3Decoder() {
123 return libmpeg3decoder; 123 return libmpeg3decoder;
124} 124}
125 125
126// ### hack to get true sample count 126// ### hack to get true sample count
127// MediaPlayerDecoder *MediaPlayerState::libWavDecoder() { 127// MediaPlayerDecoder *MediaPlayerState::libWavDecoder() {
128// return libwavdecoder; 128// return libwavdecoder;
129// } 129// }
130 130
131void MediaPlayerState::loadPlugins() { 131void MediaPlayerState::loadPlugins() {
132 // odebug << "load plugins" << oendl; 132 // odebug << "load plugins" << oendl;
133#ifndef QT_NO_COMPONENT 133#ifndef QT_NO_COMPONENT
134 QValueList<MediaPlayerPlugin>::Iterator mit; 134 QValueList<MediaPlayerPlugin>::Iterator mit;
135 for ( mit = pluginList.begin(); mit != pluginList.end(); ++mit ) { 135 for ( mit = pluginList.begin(); mit != pluginList.end(); ++mit ) {
136 (*mit).iface->release(); 136 (*mit).iface->release();
137 (*mit).library->unload(); 137 (*mit).library->unload();
138 delete (*mit).library; 138 delete (*mit).library;
139 } 139 }
140 pluginList.clear(); 140 pluginList.clear();
141 141
142 QString path = QPEApplication::qpeDir() + "/plugins/codecs"; 142 QString path = QPEApplication::qpeDir() + "plugins/codecs";
143 QDir dir( path, "lib*.so" ); 143 QDir dir( path, "lib*.so" );
144 QStringList list = dir.entryList(); 144 QStringList list = dir.entryList();
145 QStringList::Iterator it; 145 QStringList::Iterator it;
146 for ( it = list.begin(); it != list.end(); ++it ) { 146 for ( it = list.begin(); it != list.end(); ++it ) {
147 MediaPlayerPluginInterface *iface = 0; 147 MediaPlayerPluginInterface *iface = 0;
148 QLibrary *lib = new QLibrary( path + "/" + *it ); 148 QLibrary *lib = new QLibrary( path + "/" + *it );
149// odebug << "querying: " << QString( path + "/" + *it ) << "" << oendl; 149// odebug << "querying: " << QString( path + "/" + *it ) << "" << oendl;
150 150
151 if ( lib->queryInterface( IID_MediaPlayerPlugin, (QUnknownInterface**)&iface ) == QS_OK ) { 151 if ( lib->queryInterface( IID_MediaPlayerPlugin, (QUnknownInterface**)&iface ) == QS_OK ) {
152 152
153// odebug << "loading: " << QString( path + "/" + *it ) << "" << oendl; 153// odebug << "loading: " << QString( path + "/" + *it ) << "" << oendl;
154 154
155 MediaPlayerPlugin plugin; 155 MediaPlayerPlugin plugin;
156 plugin.library = lib; 156 plugin.library = lib;
157 plugin.iface = iface; 157 plugin.iface = iface;
158 plugin.decoder = plugin.iface->decoder(); 158 plugin.decoder = plugin.iface->decoder();
159 plugin.encoder = plugin.iface->encoder(); 159 plugin.encoder = plugin.iface->encoder();
160 pluginList.append( plugin ); 160 pluginList.append( plugin );
161 161
162 // ### hack to get true sample count 162 // ### hack to get true sample count
163 if ( plugin.decoder->pluginName() == QString("LibMpeg3Plugin") ) 163 if ( plugin.decoder->pluginName() == QString("LibMpeg3Plugin") )
164 libmpeg3decoder = plugin.decoder; 164 libmpeg3decoder = plugin.decoder;
165 165
166 } else { 166 } else {
167 delete lib; 167 delete lib;
168 } 168 }
169 } 169 }
170#else 170#else
171 pluginList.clear(); 171 pluginList.clear();
172 172
173 MediaPlayerPlugin plugin0; 173 MediaPlayerPlugin plugin0;
174 plugin0.iface = new LibMpeg3PluginImpl; 174 plugin0.iface = new LibMpeg3PluginImpl;
175 plugin0.decoder = plugin0.iface->decoder(); 175 plugin0.decoder = plugin0.iface->decoder();
176 plugin0.encoder = plugin0.iface->encoder(); 176 plugin0.encoder = plugin0.iface->encoder();
177 pluginList.append( plugin0 ); 177 pluginList.append( plugin0 );
178 178
179 MediaPlayerPlugin plugin1; 179 MediaPlayerPlugin plugin1;
180 plugin1.iface = new LibMadPluginImpl; 180 plugin1.iface = new LibMadPluginImpl;
181 plugin1.decoder = plugin1.iface->decoder(); 181 plugin1.decoder = plugin1.iface->decoder();
182 plugin1.encoder = plugin1.iface->encoder(); 182 plugin1.encoder = plugin1.iface->encoder();
183 pluginList.append( plugin1 ); 183 pluginList.append( plugin1 );
184 184
185 MediaPlayerPlugin plugin2; 185 MediaPlayerPlugin plugin2;
186 plugin2.iface = new WavPluginImpl; 186 plugin2.iface = new WavPluginImpl;
187 plugin2.decoder = plugin2.iface->decoder(); 187 plugin2.decoder = plugin2.iface->decoder();
188 plugin2.encoder = plugin2.iface->encoder(); 188 plugin2.encoder = plugin2.iface->encoder();
189 pluginList.append( plugin2 ); 189 pluginList.append( plugin2 );
190#endif 190#endif
191 191
192 if ( pluginList.count() ) 192 if ( pluginList.count() )
193 MediaPlayerDebug(( "%i decoders found", pluginList.count() )); 193 MediaPlayerDebug(( "%i decoders found", pluginList.count() ));
194 else 194 else
195 MediaPlayerDebug(( "No decoders found" )); 195 MediaPlayerDebug(( "No decoders found" ));
196} 196}
197 197
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index 46aeff2..db2bf1b 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -1289,171 +1289,171 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e)
1289 case Key_Q: //add to playlist 1289 case Key_Q: //add to playlist
1290 addSelected(); 1290 addSelected();
1291 break; 1291 break;
1292 case Key_R: //remove from playlist 1292 case Key_R: //remove from playlist
1293 removeSelected(); 1293 removeSelected();
1294 break; 1294 break;
1295// case Key_P: //play 1295// case Key_P: //play
1296// odebug << "Play" << oendl; 1296// odebug << "Play" << oendl;
1297// playSelected(); 1297// playSelected();
1298// break; 1298// break;
1299 case Key_Space: 1299 case Key_Space:
1300// playSelected(); puh 1300// playSelected(); puh
1301 break; 1301 break;
1302 case Key_1: 1302 case Key_1:
1303 tabWidget->setCurrentPage(0); 1303 tabWidget->setCurrentPage(0);
1304 break; 1304 break;
1305 case Key_2: 1305 case Key_2:
1306 tabWidget->setCurrentPage(1); 1306 tabWidget->setCurrentPage(1);
1307 break; 1307 break;
1308 case Key_3: 1308 case Key_3:
1309 tabWidget->setCurrentPage(2); 1309 tabWidget->setCurrentPage(2);
1310 break; 1310 break;
1311 case Key_4: 1311 case Key_4:
1312 tabWidget->setCurrentPage(3); 1312 tabWidget->setCurrentPage(3);
1313 break; 1313 break;
1314 case Key_Down: 1314 case Key_Down:
1315 if ( !d->selectedFiles->next() ) 1315 if ( !d->selectedFiles->next() )
1316 d->selectedFiles->first(); 1316 d->selectedFiles->first();
1317 1317
1318 break; 1318 break;
1319 case Key_Up: 1319 case Key_Up:
1320 if ( !d->selectedFiles->prev() ) 1320 if ( !d->selectedFiles->prev() )
1321 // d->selectedFiles->last(); 1321 // d->selectedFiles->last();
1322 1322
1323 break; 1323 break;
1324 1324
1325 } 1325 }
1326} 1326}
1327 1327
1328void PlayListWidget::keyPressEvent( QKeyEvent *) 1328void PlayListWidget::keyPressEvent( QKeyEvent *)
1329{ 1329{
1330// odebug << "Key press" << oendl; 1330// odebug << "Key press" << oendl;
1331// switch ( e->key() ) { 1331// switch ( e->key() ) {
1332// ////////////////////////////// Zaurus keys 1332// ////////////////////////////// Zaurus keys
1333// case Key_A: //add to playlist 1333// case Key_A: //add to playlist
1334// odebug << "Add" << oendl; 1334// odebug << "Add" << oendl;
1335// addSelected(); 1335// addSelected();
1336// break; 1336// break;
1337// case Key_R: //remove from playlist 1337// case Key_R: //remove from playlist
1338// removeSelected(); 1338// removeSelected();
1339// break; 1339// break;
1340// case Key_P: //play 1340// case Key_P: //play
1341// odebug << "Play" << oendl; 1341// odebug << "Play" << oendl;
1342// playSelected(); 1342// playSelected();
1343// break; 1343// break;
1344// case Key_Space: 1344// case Key_Space:
1345// odebug << "Play" << oendl; 1345// odebug << "Play" << oendl;
1346// playSelected(); 1346// playSelected();
1347// break; 1347// break;
1348// } 1348// }
1349} 1349}
1350 1350
1351void PlayListWidget::doBlank() { 1351void PlayListWidget::doBlank() {
1352 // odebug << "do blanking" << oendl; 1352 // odebug << "do blanking" << oendl;
1353#ifdef QT_QWS_DEVFS 1353#ifdef QT_QWS_DEVFS
1354 fd=open("/dev/fb/0",O_RDWR); 1354 fd=open("/dev/fb/0",O_RDWR);
1355#else 1355#else
1356 fd=open("/dev/fb0",O_RDWR); 1356 fd=open("/dev/fb0",O_RDWR);
1357#endif 1357#endif
1358 if (fd != -1) { 1358 if (fd != -1) {
1359 ioctl(fd,FBIOBLANK,1); 1359 ioctl(fd,FBIOBLANK,1);
1360 // close(fd); 1360 // close(fd);
1361 } 1361 }
1362} 1362}
1363 1363
1364void PlayListWidget::doUnblank() { 1364void PlayListWidget::doUnblank() {
1365 // this crashes opieplayer with a segfault 1365 // this crashes opieplayer with a segfault
1366 // int fd; 1366 // int fd;
1367 // fd=open("/dev/fb0",O_RDWR); 1367 // fd=open("/dev/fb0",O_RDWR);
1368 // odebug << "do unblanking" << oendl; 1368 // odebug << "do unblanking" << oendl;
1369 if (fd != -1) { 1369 if (fd != -1) {
1370 ioctl(fd,FBIOBLANK,0); 1370 ioctl(fd,FBIOBLANK,0);
1371 close(fd); 1371 close(fd);
1372 } 1372 }
1373 QCopEnvelope h("QPE/System", "setBacklight(int)"); 1373 QCopEnvelope h("QPE/System", "setBacklight(int)");
1374 h <<-3;// v[1]; // -3 Force on 1374 h <<-3;// v[1]; // -3 Force on
1375} 1375}
1376 1376
1377void PlayListWidget::populateSkinsMenu() { 1377void PlayListWidget::populateSkinsMenu() {
1378 int item = 0; 1378 int item = 0;
1379 defaultSkinIndex = 0; 1379 defaultSkinIndex = 0;
1380 QString skinName; 1380 QString skinName;
1381 Config cfg( "OpiePlayer" ); 1381 Config cfg( "OpiePlayer" );
1382 cfg.setGroup("Options" ); 1382 cfg.setGroup("Options" );
1383 QString skin = cfg.readEntry( "Skin", "default" ); 1383 QString skin = cfg.readEntry( "Skin", "default" );
1384 1384
1385 QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" ); 1385 QDir skinsDir( QPEApplication::qpeDir() + "pics/opieplayer2/skins" );
1386 skinsDir.setFilter( QDir::Dirs ); 1386 skinsDir.setFilter( QDir::Dirs );
1387 skinsDir.setSorting(QDir::Name ); 1387 skinsDir.setSorting(QDir::Name );
1388 const QFileInfoList *skinslist = skinsDir.entryInfoList(); 1388 const QFileInfoList *skinslist = skinsDir.entryInfoList();
1389 QFileInfoListIterator it( *skinslist ); 1389 QFileInfoListIterator it( *skinslist );
1390 QFileInfo *fi; 1390 QFileInfo *fi;
1391 while ( ( fi = it.current() ) ) { 1391 while ( ( fi = it.current() ) ) {
1392 skinName = fi->fileName(); 1392 skinName = fi->fileName();
1393 // odebug << fi->fileName() << oendl; 1393 // odebug << fi->fileName() << oendl;
1394 if( skinName != "." && skinName != ".." && skinName !="CVS" ) { 1394 if( skinName != "." && skinName != ".." && skinName !="CVS" ) {
1395 item = skinsMenu->insertItem( fi->fileName() ) ; 1395 item = skinsMenu->insertItem( fi->fileName() ) ;
1396 } 1396 }
1397 if( skinName == "default" ) { 1397 if( skinName == "default" ) {
1398 defaultSkinIndex = item; 1398 defaultSkinIndex = item;
1399 } 1399 }
1400 if( skinName == skin ) { 1400 if( skinName == skin ) {
1401 skinsMenu->setItemChecked( item, TRUE ); 1401 skinsMenu->setItemChecked( item, TRUE );
1402 } 1402 }
1403 ++it; 1403 ++it;
1404 } 1404 }
1405} 1405}
1406 1406
1407void PlayListWidget::skinsMenuActivated( int item ) { 1407void PlayListWidget::skinsMenuActivated( int item ) {
1408 for( int i = defaultSkinIndex; i > defaultSkinIndex - static_cast<int>(skinsMenu->count()); i-- ) { 1408 for( int i = defaultSkinIndex; i > defaultSkinIndex - static_cast<int>(skinsMenu->count()); i-- ) {
1409 skinsMenu->setItemChecked( i, FALSE ); 1409 skinsMenu->setItemChecked( i, FALSE );
1410 } 1410 }
1411 skinsMenu->setItemChecked( item, TRUE ); 1411 skinsMenu->setItemChecked( item, TRUE );
1412 1412
1413 Config cfg( "OpiePlayer" ); 1413 Config cfg( "OpiePlayer" );
1414 cfg.setGroup("Options"); 1414 cfg.setGroup("Options");
1415 cfg.writeEntry("Skin", skinsMenu->text( item ) ); 1415 cfg.writeEntry("Skin", skinsMenu->text( item ) );
1416} 1416}
1417 1417
1418void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) { 1418void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) {
1419 // odebug << "qcop message "+msg << oendl; 1419 // odebug << "qcop message "+msg << oendl;
1420 QDataStream stream ( data, IO_ReadOnly ); 1420 QDataStream stream ( data, IO_ReadOnly );
1421 if ( msg == "play()" ) { //plays current selection 1421 if ( msg == "play()" ) { //plays current selection
1422 btnPlay( true); 1422 btnPlay( true);
1423 } else if ( msg == "stop()" ) { 1423 } else if ( msg == "stop()" ) {
1424 mediaPlayerState->setPlaying( false); 1424 mediaPlayerState->setPlaying( false);
1425 } else if ( msg == "togglePause()" ) { 1425 } else if ( msg == "togglePause()" ) {
1426 mediaPlayerState->togglePaused(); 1426 mediaPlayerState->togglePaused();
1427 } else if ( msg == "next()" ) { //select next in lis 1427 } else if ( msg == "next()" ) { //select next in lis
1428 mediaPlayerState->setNext(); 1428 mediaPlayerState->setNext();
1429 } else if ( msg == "prev()" ) { //select previous in list 1429 } else if ( msg == "prev()" ) { //select previous in list
1430 mediaPlayerState->setPrev(); 1430 mediaPlayerState->setPrev();
1431 } else if ( msg == "toggleLooping()" ) { //loop or not loop 1431 } else if ( msg == "toggleLooping()" ) { //loop or not loop
1432 mediaPlayerState->toggleLooping(); 1432 mediaPlayerState->toggleLooping();
1433 } else if ( msg == "toggleShuffled()" ) { //shuffled or not shuffled 1433 } else if ( msg == "toggleShuffled()" ) { //shuffled or not shuffled
1434 mediaPlayerState->toggleShuffled(); 1434 mediaPlayerState->toggleShuffled();
1435 } else if ( msg == "volUp()" ) { //volume more 1435 } else if ( msg == "volUp()" ) { //volume more
1436 // emit moreClicked(); 1436 // emit moreClicked();
1437 // emit moreReleased(); 1437 // emit moreReleased();
1438 } else if ( msg == "volDown()" ) { //volume less 1438 } else if ( msg == "volDown()" ) { //volume less
1439 // emit lessClicked(); 1439 // emit lessClicked();
1440 // emit lessReleased(); 1440 // emit lessReleased();
1441 } else if ( msg == "play(QString)" ) { //play this now 1441 } else if ( msg == "play(QString)" ) { //play this now
1442 QString file; 1442 QString file;
1443 stream >> file; 1443 stream >> file;
1444 setDocumentEx( (const QString &) file); 1444 setDocumentEx( (const QString &) file);
1445 } else if ( msg == "add(QString)" ) { //add to playlist 1445 } else if ( msg == "add(QString)" ) { //add to playlist
1446 QString file; 1446 QString file;
1447 stream >> file; 1447 stream >> file;
1448 QFileInfo fileInfo(file); 1448 QFileInfo fileInfo(file);
1449 DocLnk lnk; 1449 DocLnk lnk;
1450 lnk.setName( fileInfo.baseName() ); //sets name 1450 lnk.setName( fileInfo.baseName() ); //sets name
1451 lnk.setFile( file ); //sets file name 1451 lnk.setFile( file ); //sets file name
1452 addToSelection( lnk ); 1452 addToSelection( lnk );
1453 } else if ( msg == "rem(QString)" ) { //remove from playlist 1453 } else if ( msg == "rem(QString)" ) { //remove from playlist
1454 QString file; 1454 QString file;
1455 stream >> file; 1455 stream >> file;
1456 } else if ( msg == "setDocument(QString)" ) { //loop or not loop 1456 } else if ( msg == "setDocument(QString)" ) { //loop or not loop
1457 QCopEnvelope h("QPE/Application/opieplayer", "raise()"); 1457 QCopEnvelope h("QPE/Application/opieplayer", "raise()");
1458 } 1458 }
1459} 1459}
diff --git a/core/multimedia/opieplayer/videowidget.cpp b/core/multimedia/opieplayer/videowidget.cpp
index 2396ed5..c545511 100644
--- a/core/multimedia/opieplayer/videowidget.cpp
+++ b/core/multimedia/opieplayer/videowidget.cpp
@@ -5,193 +5,193 @@
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 "videowidget.h" 21#include "videowidget.h"
22#include "mediaplayerstate.h" 22#include "mediaplayerstate.h"
23 23
24/* OPIE */ 24/* OPIE */
25#include <qpe/resource.h> 25#include <qpe/resource.h>
26#include <qpe/mediaplayerplugininterface.h> 26#include <qpe/mediaplayerplugininterface.h>
27#include <qpe/config.h> 27#include <qpe/config.h>
28#include <qpe/qpeapplication.h> 28#include <qpe/qpeapplication.h>
29#include <opie2/odebug.h> 29#include <opie2/odebug.h>
30 30
31/* QT */ 31/* QT */
32#include <qdir.h> 32#include <qdir.h>
33#include <qslider.h> 33#include <qslider.h>
34 34
35 35
36#ifdef Q_WS_QWS 36#ifdef Q_WS_QWS
37# define USE_DIRECT_PAINTER 37# define USE_DIRECT_PAINTER
38# include <qdirectpainter_qws.h> 38# include <qdirectpainter_qws.h>
39# include <qgfxraster_qws.h> 39# include <qgfxraster_qws.h>
40#endif 40#endif
41 41
42 42
43extern MediaPlayerState *mediaPlayerState; 43extern MediaPlayerState *mediaPlayerState;
44 44
45 45
46static const int xo = 2; // movable x offset 46static const int xo = 2; // movable x offset
47static const int yo = 0; // movable y offset 47static const int yo = 0; // movable y offset
48 48
49 49
50struct MediaButton { 50struct MediaButton {
51// int xPos, yPos; 51// int xPos, yPos;
52 bool isToggle, isHeld, isDown; 52 bool isToggle, isHeld, isDown;
53// int controlType; 53// int controlType;
54}; 54};
55 55
56 56
57// Layout information for the videoButtons (and if it is a toggle button or not) 57// Layout information for the videoButtons (and if it is a toggle button or not)
58MediaButton videoButtons[] = { 58MediaButton videoButtons[] = {
59 { FALSE, FALSE, FALSE }, // stop 59 { FALSE, FALSE, FALSE }, // stop
60 { FALSE, FALSE, FALSE }, // play 60 { FALSE, FALSE, FALSE }, // play
61 { FALSE, FALSE, FALSE }, // previous 61 { FALSE, FALSE, FALSE }, // previous
62 { FALSE, FALSE, FALSE }, // next 62 { FALSE, FALSE, FALSE }, // next
63 { FALSE, FALSE, FALSE }, // volUp 63 { FALSE, FALSE, FALSE }, // volUp
64 { FALSE, FALSE, FALSE }, // volDown 64 { FALSE, FALSE, FALSE }, // volDown
65 { TRUE, FALSE, FALSE } // fullscreen 65 { TRUE, FALSE, FALSE } // fullscreen
66}; 66};
67 67
68//static const int numButtons = (sizeof(videoButtons)/sizeof(MediaButton)); 68//static const int numButtons = (sizeof(videoButtons)/sizeof(MediaButton));
69 69
70const char *skinV_mask_file_names[7] = { 70const char *skinV_mask_file_names[7] = {
71 "stop","play","back","fwd","up","down","full" 71 "stop","play","back","fwd","up","down","full"
72}; 72};
73 73
74static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton)); 74static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton));
75 75
76VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : 76VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) :
77 QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) 77 QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 )
78{ 78{
79 setCaption( tr("OpiePlayer") ); 79 setCaption( tr("OpiePlayer") );
80 Config cfg("OpiePlayer"); 80 Config cfg("OpiePlayer");
81 81
82 cfg.setGroup("Options"); 82 cfg.setGroup("Options");
83 skin = cfg.readEntry("Skin","default"); 83 skin = cfg.readEntry("Skin","default");
84 84
85 QString skinPath; 85 QString skinPath;
86 skinPath = "opieplayer2/skins/" + skin; 86 skinPath = "opieplayer2/skins/" + skin;
87 if(!QDir(QString(getenv("OPIEDIR")) +"/pics/"+skinPath).exists()) 87 if(!QDir(QString(getenv("OPIEDIR")) +"/pics/"+skinPath).exists())
88 skinPath = "opieplayer2/skins/default"; 88 skinPath = "opieplayer2/skins/default";
89 89
90 90
91// QString skinPath = "opieplayer2/skins/" + skin; 91// QString skinPath = "opieplayer2/skins/" + skin;
92 92
93 pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); 93 pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
94 imgUp = new QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); 94 imgUp = new QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) );
95 imgDn = new QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); 95 imgDn = new QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) );
96 96
97 imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); 97 imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 );
98 imgButtonMask->fill( 0 ); 98 imgButtonMask->fill( 0 );
99 99
100 for ( int i = 0; i < 7; i++ ) { 100 for ( int i = 0; i < 7; i++ ) {
101 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + 101 QString filename = QString( QPEApplication::qpeDir() + "pics/" + skinPath +
102 "/skinV_mask_" + skinV_mask_file_names[i] + ".png" ); 102 "/skinV_mask_" + skinV_mask_file_names[i] + ".png" );
103 // odebug << "loading "+filename << oendl; 103 // odebug << "loading "+filename << oendl;
104 masks[i] = new QBitmap( filename ); 104 masks[i] = new QBitmap( filename );
105 105
106 if ( !masks[i]->isNull() ) { 106 if ( !masks[i]->isNull() ) {
107 QImage imgMask = masks[i]->convertToImage(); 107 QImage imgMask = masks[i]->convertToImage();
108 uchar **dest = imgButtonMask->jumpTable(); 108 uchar **dest = imgButtonMask->jumpTable();
109 for ( int y = 0; y < imgUp->height(); y++ ) { 109 for ( int y = 0; y < imgUp->height(); y++ ) {
110 uchar *line = dest[y]; 110 uchar *line = dest[y];
111 for ( int x = 0; x < imgUp->width(); x++ ) { 111 for ( int x = 0; x < imgUp->width(); x++ ) {
112 if ( !qRed( imgMask.pixel( x, y ) ) ) 112 if ( !qRed( imgMask.pixel( x, y ) ) )
113 line[x] = i + 1; 113 line[x] = i + 1;
114 } 114 }
115 } 115 }
116 } 116 }
117 } 117 }
118 for ( int i = 0; i < 7; i++ ) { 118 for ( int i = 0; i < 7; i++ ) {
119 buttonPixUp[i] = NULL; 119 buttonPixUp[i] = NULL;
120 buttonPixDown[i] = NULL; 120 buttonPixDown[i] = NULL;
121 } 121 }
122 122
123 QWidget *d = QApplication::desktop(); 123 QWidget *d = QApplication::desktop();
124 int width = d->width(); 124 int width = d->width();
125 int height = d->height(); 125 int height = d->height();
126 126
127 if( (width != pixBg->width() ) || (height != pixBg->height() ) ) { 127 if( (width != pixBg->width() ) || (height != pixBg->height() ) ) {
128 QImage img; 128 QImage img;
129 img = pixBg->convertToImage(); 129 img = pixBg->convertToImage();
130 pixBg->convertFromImage( img.smoothScale( width, height)); 130 pixBg->convertFromImage( img.smoothScale( width, height));
131 } 131 }
132 132
133 setBackgroundPixmap( *pixBg ); 133 setBackgroundPixmap( *pixBg );
134 currentFrame = new QImage( 220 + 2, 160, (QPixmap::defaultDepth() == 16) ? 16 : 32 ); 134 currentFrame = new QImage( 220 + 2, 160, (QPixmap::defaultDepth() == 16) ? 16 : 32 );
135 slider = new QSlider( Qt::Horizontal, this ); 135 slider = new QSlider( Qt::Horizontal, this );
136 slider->setMinValue( 0 ); 136 slider->setMinValue( 0 );
137 slider->setMaxValue( 1 ); 137 slider->setMaxValue( 1 );
138 138
139 slider->setBackgroundPixmap( *pixBg ); 139 slider->setBackgroundPixmap( *pixBg );
140 slider->setFocusPolicy( QWidget::NoFocus ); 140 slider->setFocusPolicy( QWidget::NoFocus );
141// slider->setGeometry( QRect( 7, 250, 220, 20 ) ); 141// slider->setGeometry( QRect( 7, 250, 220, 20 ) );
142 142
143 connect(slider,SIGNAL(sliderPressed()),this,SLOT(sliderPressed())); 143 connect(slider,SIGNAL(sliderPressed()),this,SLOT(sliderPressed()));
144 connect(slider,SIGNAL(sliderReleased()),this,SLOT(sliderReleased())); 144 connect(slider,SIGNAL(sliderReleased()),this,SLOT(sliderReleased()));
145 145
146 connect(mediaPlayerState,SIGNAL(lengthChanged(long)),this,SLOT(setLength(long))); 146 connect(mediaPlayerState,SIGNAL(lengthChanged(long)),this,SLOT(setLength(long)));
147 connect(mediaPlayerState,SIGNAL(positionChanged(long)),this,SLOT(setPosition(long))); 147 connect(mediaPlayerState,SIGNAL(positionChanged(long)),this,SLOT(setPosition(long)));
148 connect(mediaPlayerState,SIGNAL(positionUpdated(long)),this,SLOT(setPosition(long))); 148 connect(mediaPlayerState,SIGNAL(positionUpdated(long)),this,SLOT(setPosition(long)));
149 connect(mediaPlayerState,SIGNAL(viewChanged(char)),this,SLOT(setView(char))); 149 connect(mediaPlayerState,SIGNAL(viewChanged(char)),this,SLOT(setView(char)));
150// connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); 150// connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) );
151 connect(mediaPlayerState,SIGNAL(playingToggled(bool)),this,SLOT(setPlaying(bool))); 151 connect(mediaPlayerState,SIGNAL(playingToggled(bool)),this,SLOT(setPlaying(bool)));
152 152
153 // Intialise state 153 // Intialise state
154 setLength( mediaPlayerState->length() ); 154 setLength( mediaPlayerState->length() );
155 setPosition( mediaPlayerState->position() ); 155 setPosition( mediaPlayerState->position() );
156 setFullscreen( mediaPlayerState->fullscreen() ); 156 setFullscreen( mediaPlayerState->fullscreen() );
157// setPlaying( mediaPlayerState->playing() ); 157// setPlaying( mediaPlayerState->playing() );
158 // if(this->x() < 0 || this->y() < 0) 158 // if(this->x() < 0 || this->y() < 0)
159 // this->move(0,0); 159 // this->move(0,0);
160} 160}
161 161
162 162
163VideoWidget::~VideoWidget() { 163VideoWidget::~VideoWidget() {
164 164
165 for ( int i = 0; i < 7; i++ ) 165 for ( int i = 0; i < 7; i++ )
166 { 166 {
167 delete buttonPixUp[i]; 167 delete buttonPixUp[i];
168 delete buttonPixDown[i]; 168 delete buttonPixDown[i];
169 } 169 }
170 170
171 delete pixBg; 171 delete pixBg;
172 delete imgUp; 172 delete imgUp;
173 delete imgDn; 173 delete imgDn;
174 delete imgButtonMask; 174 delete imgButtonMask;
175 for ( int i = 0; i < 7; i++ ) 175 for ( int i = 0; i < 7; i++ )
176 { 176 {
177 delete masks[i]; 177 delete masks[i];
178 } 178 }
179 179
180// for ( int i = 0; i < 3; i++ ) 180// for ( int i = 0; i < 3; i++ )
181// delete pixmaps[i]; 181// delete pixmaps[i];
182// delete currentFrame; 182// delete currentFrame;
183} 183}
184 184
185 185
186static bool videoSliderBeingMoved = FALSE; 186static bool videoSliderBeingMoved = FALSE;
187 187
188QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { 188QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) {
189 QPixmap pix( img.width(), img.height() ); 189 QPixmap pix( img.width(), img.height() );
190 QPainter p( &pix ); 190 QPainter p( &pix );
191 p.drawTiledPixmap( pix.rect(), bg, offset ); 191 p.drawTiledPixmap( pix.rect(), bg, offset );
192 p.drawImage( 0, 0, img ); 192 p.drawImage( 0, 0, img );
193 return new QPixmap( pix ); 193 return new QPixmap( pix );
194} 194}
195 195
196QPixmap *maskVPixToMask( QPixmap pix, QBitmap mask ) { 196QPixmap *maskVPixToMask( QPixmap pix, QBitmap mask ) {
197 QPixmap *pixmap = new QPixmap( pix ); 197 QPixmap *pixmap = new QPixmap( pix );
diff --git a/core/opie-login/main.cpp b/core/opie-login/main.cpp
index f0a8ba2..0699d0a 100644
--- a/core/opie-login/main.cpp
+++ b/core/opie-login/main.cpp
@@ -87,193 +87,193 @@ int main ( int argc, char **argv )
87 switch ( c ) { 87 switch ( c ) {
88 case 'a': 88 case 'a':
89 autolog = optarg; 89 autolog = optarg;
90 break; 90 break;
91 default: 91 default:
92 ::fprintf ( stderr, "Usage: %s [-a|--autologin=<user>]\n", argv [0] ); 92 ::fprintf ( stderr, "Usage: %s [-a|--autologin=<user>]\n", argv [0] );
93 return 2; 93 return 2;
94 } 94 }
95 } 95 }
96 96
97 //struct rlimit rl; 97 //struct rlimit rl;
98 //::getrlimit ( RLIMIT_NOFILE, &rl ); 98 //::getrlimit ( RLIMIT_NOFILE, &rl );
99 99
100 //for ( unsigned int i = 0; i < rl. rlim_cur; i++ ) 100 //for ( unsigned int i = 0; i < rl. rlim_cur; i++ )
101 // ::close ( i ); 101 // ::close ( i );
102 102
103 ::setpgid ( 0, 0 ); 103 ::setpgid ( 0, 0 );
104 ::setsid ( ); 104 ::setsid ( );
105 105
106 ::signal ( SIGTERM, sigterm ); 106 ::signal ( SIGTERM, sigterm );
107 ::signal ( SIGINT, sigterm ); 107 ::signal ( SIGINT, sigterm );
108 108
109 ::openlog ( "opie-login", LOG_CONS, LOG_AUTHPRIV ); 109 ::openlog ( "opie-login", LOG_CONS, LOG_AUTHPRIV );
110 ::atexit ( exit_closelog ); 110 ::atexit ( exit_closelog );
111 111
112 while ( true ) { 112 while ( true ) {
113 pid_t child = ::fork ( ); 113 pid_t child = ::fork ( );
114 114
115 if ( child < 0 ) { 115 if ( child < 0 ) {
116 ::syslog ( LOG_ERR, "Could not fork GUI process\n" ); 116 ::syslog ( LOG_ERR, "Could not fork GUI process\n" );
117 break; 117 break;
118 } 118 }
119 else if ( child > 0 ) { 119 else if ( child > 0 ) {
120 int status = 0; 120 int status = 0;
121 time_t started = ::time ( 0 ); 121 time_t started = ::time ( 0 );
122 122
123 while ( ::waitpid ( child, &status, 0 ) < 0 ) { } 123 while ( ::waitpid ( child, &status, 0 ) < 0 ) { }
124 124
125 LoginApplication::logout ( ); 125 LoginApplication::logout ( );
126 126
127 if (( ::time ( 0 ) - started ) < 3 ) { 127 if (( ::time ( 0 ) - started ) < 3 ) {
128 if ( autolog ) { 128 if ( autolog ) {
129 ::syslog ( LOG_ERR, "Respawning too fast -- disabling auto-login\n" ); 129 ::syslog ( LOG_ERR, "Respawning too fast -- disabling auto-login\n" );
130 autolog = 0; 130 autolog = 0;
131 } 131 }
132 else { 132 else {
133 ::syslog ( LOG_ERR, "Respawning too fast -- going down\n" ); 133 ::syslog ( LOG_ERR, "Respawning too fast -- going down\n" );
134 break; 134 break;
135 } 135 }
136 } 136 }
137 int killedbysig = 0; 137 int killedbysig = 0;
138 userExited=0; 138 userExited=0;
139 if (WIFEXITED(status)!=0 ) { 139 if (WIFEXITED(status)!=0 ) {
140 if (WEXITSTATUS(status)==137) { 140 if (WEXITSTATUS(status)==137) {
141 userExited=1; 141 userExited=1;
142 } 142 }
143 } 143 }
144 144
145 if ( WIFSIGNALED( status )) { 145 if ( WIFSIGNALED( status )) {
146 switch ( WTERMSIG( status )) { 146 switch ( WTERMSIG( status )) {
147 case SIGTERM: 147 case SIGTERM:
148 case SIGINT : 148 case SIGINT :
149 case SIGKILL: 149 case SIGKILL:
150 break; 150 break;
151 151
152 default : 152 default :
153 killedbysig = WTERMSIG( status ); 153 killedbysig = WTERMSIG( status );
154 break; 154 break;
155 } 155 }
156 } 156 }
157 if ( killedbysig ) { // qpe was killed by an uncaught signal 157 if ( killedbysig ) { // qpe was killed by an uncaught signal
158 qApp = 0; 158 qApp = 0;
159 159
160 ::syslog ( LOG_ERR, "Opie was killed by a signal #%d", killedbysig ); 160 ::syslog ( LOG_ERR, "Opie was killed by a signal #%d", killedbysig );
161 161
162 QWSServer::setDesktopBackground ( QImage ( )); 162 QWSServer::setDesktopBackground ( QImage ( ));
163 QApplication *app = new QApplication ( argc, argv, QApplication::GuiServer ); 163 QApplication *app = new QApplication ( argc, argv, QApplication::GuiServer );
164 app-> setFont ( QFont ( "Helvetica", 10 )); 164 app-> setFont ( QFont ( "Helvetica", 10 ));
165 app-> setStyle ( new QPEStyle ( )); 165 app-> setStyle ( new QPEStyle ( ));
166 166
167 // const char *sig = ::strsignal ( killedbysig ); 167 // const char *sig = ::strsignal ( killedbysig );
168 const char *sig = ::sys_siglist[killedbysig]; 168 const char *sig = ::sys_siglist[killedbysig];
169 QLabel *l = new QLabel ( 0, "sig", Qt::WStyle_Customize | Qt::WStyle_NoBorder | Qt::WStyle_Tool ); 169 QLabel *l = new QLabel ( 0, "sig", Qt::WStyle_Customize | Qt::WStyle_NoBorder | Qt::WStyle_Tool );
170 l-> setText ( LoginWindowImpl::tr( "Opie was terminated\nby an uncaught signal\n(%1)\n" ). arg ( sig )); 170 l-> setText ( LoginWindowImpl::tr( "Opie was terminated\nby an uncaught signal\n(%1)\n" ). arg ( sig ));
171 l-> setAlignment ( Qt::AlignCenter ); 171 l-> setAlignment ( Qt::AlignCenter );
172 l-> move ( 0, 0 ); 172 l-> move ( 0, 0 );
173 l-> resize ( app-> desktop ( )-> width ( ), app-> desktop ( )-> height ( )); 173 l-> resize ( app-> desktop ( )-> width ( ), app-> desktop ( )-> height ( ));
174 l-> show ( ); 174 l-> show ( );
175 QTimer::singleShot ( 3000, app, SLOT( quit())); 175 QTimer::singleShot ( 3000, app, SLOT( quit()));
176 app-> exec ( ); 176 app-> exec ( );
177 delete app; 177 delete app;
178 qApp = 0; 178 qApp = 0;
179 } 179 }
180 } 180 }
181 else { 181 else {
182 if ( !autolog ) { 182 if ( !autolog ) {
183 QString confFile=QPEApplication::qpeDir() + "/etc/opie-login.conf"; 183 QString confFile=QPEApplication::qpeDir() + "etc/opie-login.conf";
184 Config cfg ( confFile, Config::File ); 184 Config cfg ( confFile, Config::File );
185 cfg. setGroup ( "General" ); 185 cfg. setGroup ( "General" );
186 QString user = cfg. readEntry ( "AutoLogin" ); 186 QString user = cfg. readEntry ( "AutoLogin" );
187 187
188 if ( !user. isEmpty ( )) 188 if ( !user. isEmpty ( ))
189 autolog = ::strdup ( user. latin1 ( )); 189 autolog = ::strdup ( user. latin1 ( ));
190 } 190 }
191 191
192 if ( autolog && !userExited ) { 192 if ( autolog && !userExited ) {
193 193
194 QWSServer::setDesktopBackground( QImage() ); 194 QWSServer::setDesktopBackground( QImage() );
195 ODevice::inst ( )-> setDisplayStatus ( true ); 195 ODevice::inst ( )-> setDisplayStatus ( true );
196 ODevice::inst ( )-> setSoftSuspend ( false ); 196 ODevice::inst ( )-> setSoftSuspend ( false );
197 LoginApplication *app = new LoginApplication ( argc, argv, ppid ); 197 LoginApplication *app = new LoginApplication ( argc, argv, ppid );
198 LoginApplication::setLoginAs ( autolog ); 198 LoginApplication::setLoginAs ( autolog );
199 199
200 200
201 if ( LoginApplication::changeIdentity ( )) 201 if ( LoginApplication::changeIdentity ( ))
202 ::exit ( LoginApplication::login ( )); 202 ::exit ( LoginApplication::login ( ));
203 else 203 else
204 ::exit ( 0 ); 204 ::exit ( 0 );
205 } 205 }
206 else { 206 else {
207 ::exit ( login_main ( argc, argv, ppid )); 207 ::exit ( login_main ( argc, argv, ppid ));
208 } 208 }
209 } 209 }
210 } 210 }
211 return 0; 211 return 0;
212} 212}
213 213
214void sigterm ( int /*sig*/ ) 214void sigterm ( int /*sig*/ )
215{ 215{
216 ::exit ( 0 ); 216 ::exit ( 0 );
217} 217}
218 218
219 219
220void exit_closelog ( ) 220void exit_closelog ( )
221{ 221{
222 ::closelog ( ); 222 ::closelog ( );
223} 223}
224 224
225 225
226class LoginScreenSaver : public QWSScreenSaver 226class LoginScreenSaver : public QWSScreenSaver
227{ 227{
228public: 228public:
229 LoginScreenSaver ( ) 229 LoginScreenSaver ( )
230 { 230 {
231 m_lcd_status = true; 231 m_lcd_status = true;
232 232
233 m_backlight_bright = -1; 233 m_backlight_bright = -1;
234 m_backlight_forcedoff = false; 234 m_backlight_forcedoff = false;
235 235
236 // Make sure the LCD is in fact on, (if opie was killed while the LCD is off it would still be off) 236 // Make sure the LCD is in fact on, (if opie was killed while the LCD is off it would still be off)
237 ODevice::inst ( )-> setDisplayStatus ( true ); 237 ODevice::inst ( )-> setDisplayStatus ( true );
238 } 238 }
239 void restore() 239 void restore()
240 { 240 {
241 if ( !m_lcd_status ) // We must have turned it off 241 if ( !m_lcd_status ) // We must have turned it off
242 ODevice::inst ( ) -> setDisplayStatus ( true ); 242 ODevice::inst ( ) -> setDisplayStatus ( true );
243 243
244 setBacklight ( -3 ); 244 setBacklight ( -3 );
245 } 245 }
246 bool save( int level ) 246 bool save( int level )
247 { 247 {
248 switch ( level ) { 248 switch ( level ) {
249 case 0: 249 case 0:
250 if ( backlight() > 1 ) 250 if ( backlight() > 1 )
251 setBacklight( 1 ); // lowest non-off 251 setBacklight( 1 ); // lowest non-off
252 return true; 252 return true;
253 break; 253 break;
254 case 1: 254 case 1:
255 setBacklight( 0 ); // off 255 setBacklight( 0 ); // off
256 return true; 256 return true;
257 break; 257 break;
258 case 2: 258 case 2:
259 // We're going to suspend the whole machine 259 // We're going to suspend the whole machine
260 if ( PowerStatusManager::readStatus().acStatus() != PowerStatus::Online ) { 260 if ( PowerStatusManager::readStatus().acStatus() != PowerStatus::Online ) {
261 QWSServer::sendKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE ); 261 QWSServer::sendKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE );
262 return true; 262 return true;
263 } 263 }
264 break; 264 break;
265 } 265 }
266 return false; 266 return false;
267 } 267 }
268 268
269private: 269private:
270public: 270public:
271 void setIntervals( int i1 = 30, int i2 = 20, int i3 = 60 ) 271 void setIntervals( int i1 = 30, int i2 = 20, int i3 = 60 )
272 { 272 {
273 int v [4]; 273 int v [4];
274 274
275 v [ 0 ] = QMAX( 1000 * i1, 100 ); 275 v [ 0 ] = QMAX( 1000 * i1, 100 );
276 v [ 1 ] = QMAX( 1000 * i2, 100 ); 276 v [ 1 ] = QMAX( 1000 * i2, 100 );
277 v [ 2 ] = QMAX( 1000 * i3, 100 ); 277 v [ 2 ] = QMAX( 1000 * i3, 100 );
278 v [ 3 ] = 0; 278 v [ 3 ] = 0;
279 279
diff --git a/core/settings/launcher/menusettings.cpp b/core/settings/launcher/menusettings.cpp
index 2b64c47..55bf358 100644
--- a/core/settings/launcher/menusettings.cpp
+++ b/core/settings/launcher/menusettings.cpp
@@ -1,178 +1,178 @@
1/* 1/*
2                This file is part of the OPIE Project 2                This file is part of the OPIE Project
3 =. Copyright (c) 2002 Trolltech AS <info@trolltech.com> 3 =. Copyright (c) 2002 Trolltech AS <info@trolltech.com>
4             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> 4             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
5           .>+-= 5           .>+-=
6 _;:,     .>    :=|. This file is free software; you can 6 _;:,     .>    :=|. This file is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under 7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU General Public 8:`=1 )Y*s>-.--   : the terms of the GNU General Public
9.="- .-=="i,     .._ License as published by the Free Software 9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; either version 2 of the License, 10 - .   .-<_>     .<> Foundation; either version 2 of the License,
11     ._= =}       : or (at your option) any later version. 11     ._= =}       : or (at your option) any later version.
12    .%`+i>       _;_. 12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This file is distributed in the hope that 13    .i_,=:_.      -<s. This file is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of 15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.=       =       ; Public License for more details. 18..}^=.=       =       ; Public License for more details.
19++=   -.     .`     .: 19++=   -.     .`     .:
20 :     =  ...= . :.=- You should have received a copy of the GNU 20 :     =  ...= . :.=- You should have received a copy of the GNU
21 -.   .:....=;==+<; General Public License along with this file; 21 -.   .:....=;==+<; General Public License along with this file;
22  -_. . .   )=.  = see the file COPYING. If not, write to the 22  -_. . .   )=.  = see the file COPYING. If not, write to the
23    --        :-=` Free Software Foundation, Inc., 23    --        :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330, 24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#include "menusettings.h" 29#include "menusettings.h"
30 30
31#include <qpe/config.h> 31#include <qpe/config.h>
32#include <qpe/qlibrary.h> 32#include <qpe/qlibrary.h>
33#include <qpe/qpeapplication.h> 33#include <qpe/qpeapplication.h>
34#include <qpe/menuappletinterface.h> 34#include <qpe/menuappletinterface.h>
35#include <qpe/qcopenvelope_qws.h> 35#include <qpe/qcopenvelope_qws.h>
36 36
37#include <qdir.h> 37#include <qdir.h>
38#include <qlistview.h> 38#include <qlistview.h>
39#include <qcheckbox.h> 39#include <qcheckbox.h>
40#include <qheader.h> 40#include <qheader.h>
41#include <qlayout.h> 41#include <qlayout.h>
42#include <qlabel.h> 42#include <qlabel.h>
43#include <qwhatsthis.h> 43#include <qwhatsthis.h>
44 44
45#include <stdlib.h> 45#include <stdlib.h>
46 46
47 47
48MenuSettings::MenuSettings ( QWidget *parent, const char *name ) 48MenuSettings::MenuSettings ( QWidget *parent, const char *name )
49 : QWidget ( parent, name ) 49 : QWidget ( parent, name )
50{ 50{
51 m_applets_changed = false; 51 m_applets_changed = false;
52 52
53 QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); 53 QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 );
54 54
55 QLabel *l = new QLabel ( tr( "Load applets in O-Menu:" ), this ); 55 QLabel *l = new QLabel ( tr( "Load applets in O-Menu:" ), this );
56 lay-> addWidget ( l ); 56 lay-> addWidget ( l );
57 57
58 m_list = new QListView ( this ); 58 m_list = new QListView ( this );
59 m_list-> addColumn ( "foobar" ); 59 m_list-> addColumn ( "foobar" );
60 m_list-> header ( )-> hide ( ); 60 m_list-> header ( )-> hide ( );
61 61
62 lay-> addWidget ( m_list ); 62 lay-> addWidget ( m_list );
63 63
64 m_menutabs = new QCheckBox ( tr( "Show Launcher tabs in O-Menu" ), this ); 64 m_menutabs = new QCheckBox ( tr( "Show Launcher tabs in O-Menu" ), this );
65 lay-> addWidget ( m_menutabs ); 65 lay-> addWidget ( m_menutabs );
66 66
67 m_menusubpopup = new QCheckBox ( tr( "Show Applications in Subpopups" ), this ); 67 m_menusubpopup = new QCheckBox ( tr( "Show Applications in Subpopups" ), this );
68 lay-> addWidget ( m_menusubpopup ); 68 lay-> addWidget ( m_menusubpopup );
69 69
70 QWhatsThis::add ( m_list, tr( "Check the applets that you want to have included in the O-Menu." )); 70 QWhatsThis::add ( m_list, tr( "Check the applets that you want to have included in the O-Menu." ));
71 QWhatsThis::add ( m_menutabs, tr( "Adds the contents of the Launcher Tabs as menus in the O-Menu." )); 71 QWhatsThis::add ( m_menutabs, tr( "Adds the contents of the Launcher Tabs as menus in the O-Menu." ));
72 72
73 connect ( m_list, SIGNAL( clicked(QListViewItem*)), this, SLOT( appletChanged())); 73 connect ( m_list, SIGNAL( clicked(QListViewItem*)), this, SLOT( appletChanged()));
74 74
75 init ( ); 75 init ( );
76} 76}
77 77
78void MenuSettings::init ( ) 78void MenuSettings::init ( )
79{ 79{
80 Config cfg ( "StartMenu" ); 80 Config cfg ( "StartMenu" );
81 cfg. setGroup ( "Applets" ); 81 cfg. setGroup ( "Applets" );
82 QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' ); 82 QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' );
83 83
84 QString path = QPEApplication::qpeDir ( ) + "/plugins/applets"; 84 QString path = QPEApplication::qpeDir ( ) + "plugins/applets";
85#ifdef Q_OS_MACX 85#ifdef Q_OS_MACX
86 QStringList list = QDir ( path, "lib*.dylib" ). entryList ( ); 86 QStringList list = QDir ( path, "lib*.dylib" ). entryList ( );
87#else 87#else
88 QStringList list = QDir ( path, "lib*.so" ). entryList ( ); 88 QStringList list = QDir ( path, "lib*.so" ). entryList ( );
89#endif /* Q_OS_MACX */ 89#endif /* Q_OS_MACX */
90 90
91 for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) { 91 for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) {
92 QString name; 92 QString name;
93 QPixmap icon; 93 QPixmap icon;
94 MenuAppletInterface *iface = 0; 94 MenuAppletInterface *iface = 0;
95 95
96 QLibrary *lib = new QLibrary ( path + "/" + *it ); 96 QLibrary *lib = new QLibrary ( path + "/" + *it );
97 lib-> queryInterface ( IID_MenuApplet, (QUnknownInterface**) &iface ); 97 lib-> queryInterface ( IID_MenuApplet, (QUnknownInterface**) &iface );
98 if ( iface ) { 98 if ( iface ) {
99 QString lang = getenv( "LANG" ); 99 QString lang = getenv( "LANG" );
100 QTranslator *trans = new QTranslator ( qApp ); 100 QTranslator *trans = new QTranslator ( qApp );
101 QString type = (*it). left ((*it). find (".")); 101 QString type = (*it). left ((*it). find ("."));
102 QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm"; 102 QString tfn = QPEApplication::qpeDir ( ) + "i18n/" + lang + "/" + type + ".qm";
103 if ( trans-> load ( tfn )) 103 if ( trans-> load ( tfn ))
104 qApp-> installTranslator ( trans ); 104 qApp-> installTranslator ( trans );
105 else 105 else
106 delete trans; 106 delete trans;
107 name = iface-> name ( ); 107 name = iface-> name ( );
108 icon = iface-> icon ( ). pixmap ( QIconSet::Small, QIconSet::Normal ); 108 icon = iface-> icon ( ). pixmap ( QIconSet::Small, QIconSet::Normal );
109 iface-> release ( ); 109 iface-> release ( );
110 lib-> unload ( ); 110 lib-> unload ( );
111 111
112 QCheckListItem *item; 112 QCheckListItem *item;
113 item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox ); 113 item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox );
114 if ( !icon. isNull ( )) 114 if ( !icon. isNull ( ))
115 item-> setPixmap ( 0, icon ); 115 item-> setPixmap ( 0, icon );
116 item-> setOn ( exclude. find ( *it ) == exclude. end ( )); 116 item-> setOn ( exclude. find ( *it ) == exclude. end ( ));
117 m_applets [*it] = item; 117 m_applets [*it] = item;
118 } else { 118 } else {
119 delete lib; 119 delete lib;
120 } 120 }
121 } 121 }
122 122
123 cfg. setGroup ( "Menu" ); 123 cfg. setGroup ( "Menu" );
124 m_menutabs->setChecked( cfg.readBoolEntry( "LauncherTabs", true ) ); 124 m_menutabs->setChecked( cfg.readBoolEntry( "LauncherTabs", true ) );
125 m_menusubpopup->setChecked( cfg.readBoolEntry( "LauncherSubPopup", true ) ); 125 m_menusubpopup->setChecked( cfg.readBoolEntry( "LauncherSubPopup", true ) );
126 m_menusubpopup->setEnabled( m_menutabs->isChecked() ); 126 m_menusubpopup->setEnabled( m_menutabs->isChecked() );
127 connect( m_menutabs, SIGNAL( stateChanged(int) ), m_menusubpopup, SLOT( setEnabled(bool) ) ); 127 connect( m_menutabs, SIGNAL( stateChanged(int) ), m_menusubpopup, SLOT( setEnabled(bool) ) );
128 128
129} 129}
130 130
131void MenuSettings::appletChanged() 131void MenuSettings::appletChanged()
132{ 132{
133 m_applets_changed = true; 133 m_applets_changed = true;
134} 134}
135 135
136void MenuSettings::accept ( ) 136void MenuSettings::accept ( )
137{ 137{
138 bool apps_changed = false; 138 bool apps_changed = false;
139 139
140 Config cfg ( "StartMenu" ); 140 Config cfg ( "StartMenu" );
141 cfg. setGroup ( "Applets" ); 141 cfg. setGroup ( "Applets" );
142 if ( m_applets_changed ) { 142 if ( m_applets_changed ) {
143 QStringList exclude; 143 QStringList exclude;
144 QMap <QString, QCheckListItem *>::Iterator it; 144 QMap <QString, QCheckListItem *>::Iterator it;
145 for ( it = m_applets. begin ( ); it != m_applets. end ( ); ++it ) { 145 for ( it = m_applets. begin ( ); it != m_applets. end ( ); ++it ) {
146 if ( !(*it)-> isOn ( )) 146 if ( !(*it)-> isOn ( ))
147 exclude << it. key ( ); 147 exclude << it. key ( );
148 } 148 }
149 cfg. writeEntry ( "ExcludeApplets", exclude, ',' ); 149 cfg. writeEntry ( "ExcludeApplets", exclude, ',' );
150 } 150 }
151 cfg. writeEntry ( "SafeMode", false ); 151 cfg. writeEntry ( "SafeMode", false );
152 152
153 cfg. setGroup ( "Menu" ); 153 cfg. setGroup ( "Menu" );
154 154
155 if ( m_menutabs-> isChecked ( ) != cfg. readBoolEntry ( "LauncherTabs", true )) { 155 if ( m_menutabs-> isChecked ( ) != cfg. readBoolEntry ( "LauncherTabs", true )) {
156 apps_changed = true; 156 apps_changed = true;
157 cfg. writeEntry ( "LauncherTabs", m_menutabs-> isChecked ( )); 157 cfg. writeEntry ( "LauncherTabs", m_menutabs-> isChecked ( ));
158 } 158 }
159 159
160 if ( m_menusubpopup-> isChecked ( ) != cfg. readBoolEntry ( "LauncherSubPopup", true )) { 160 if ( m_menusubpopup-> isChecked ( ) != cfg. readBoolEntry ( "LauncherSubPopup", true )) {
161 apps_changed = true; 161 apps_changed = true;
162 cfg. writeEntry ( "LauncherSubPopup", m_menusubpopup-> isChecked ( )); 162 cfg. writeEntry ( "LauncherSubPopup", m_menusubpopup-> isChecked ( ));
163 } 163 }
164 164
165 cfg. write ( ); 165 cfg. write ( );
166 166
167 if ( m_applets_changed ) { 167 if ( m_applets_changed ) {
168 QCopEnvelope ( "QPE/TaskBar", "reloadApplets()" ); 168 QCopEnvelope ( "QPE/TaskBar", "reloadApplets()" );
169 m_applets_changed = false; 169 m_applets_changed = false;
170 } 170 }
171 if ( apps_changed ) { 171 if ( apps_changed ) {
172 // currently use reloadApplets() since reloadApps is now used exclusive for server 172 // currently use reloadApplets() since reloadApps is now used exclusive for server
173 // to refresh the tabs. But what we want here is also a refresh of the startmenu entries 173 // to refresh the tabs. But what we want here is also a refresh of the startmenu entries
174 QCopEnvelope ( "QPE/TaskBar", "reloadApps()" ); 174 QCopEnvelope ( "QPE/TaskBar", "reloadApps()" );
175 QCopEnvelope ( "QPE/TaskBar", "reloadApplets()" ); 175 QCopEnvelope ( "QPE/TaskBar", "reloadApplets()" );
176 } 176 }
177} 177}
178 178
diff --git a/core/settings/launcher/taskbarsettings.cpp b/core/settings/launcher/taskbarsettings.cpp
index 8dd9e97..861ff3a 100644
--- a/core/settings/launcher/taskbarsettings.cpp
+++ b/core/settings/launcher/taskbarsettings.cpp
@@ -1,176 +1,176 @@
1/* 1/*
2                This file is part of the OPIE Project 2                This file is part of the OPIE Project
3 =. Copyright (c) 2002 Trolltech AS <info@trolltech.com> 3 =. Copyright (c) 2002 Trolltech AS <info@trolltech.com>
4             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> 4             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
5           .>+-= 5           .>+-=
6 _;:,     .>    :=|. This file is free software; you can 6 _;:,     .>    :=|. This file is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under 7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU General Public 8:`=1 )Y*s>-.--   : the terms of the GNU General Public
9.="- .-=="i,     .._ License as published by the Free Software 9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; either version 2 of the License, 10 - .   .-<_>     .<> Foundation; either version 2 of the License,
11     ._= =}       : or (at your option) any later version. 11     ._= =}       : or (at your option) any later version.
12    .%`+i>       _;_. 12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This file is distributed in the hope that 13    .i_,=:_.      -<s. This file is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of 15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.=       =       ; Public License for more details. 18..}^=.=       =       ; Public License for more details.
19++=   -.     .`     .: 19++=   -.     .`     .:
20 :     =  ...= . :.=- You should have received a copy of the GNU 20 :     =  ...= . :.=- You should have received a copy of the GNU
21 -.   .:....=;==+<; General Public License along with this file; 21 -.   .:....=;==+<; General Public License along with this file;
22  -_. . .   )=.  = see the file COPYING. If not, write to the 22  -_. . .   )=.  = see the file COPYING. If not, write to the
23    --        :-=` Free Software Foundation, Inc., 23    --        :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330, 24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#include "taskbarsettings.h" 29#include "taskbarsettings.h"
30 30
31/* OPIE */ 31/* OPIE */
32#include <qpe/config.h> 32#include <qpe/config.h>
33#include <qpe/qlibrary.h> 33#include <qpe/qlibrary.h>
34#include <qpe/qpeapplication.h> 34#include <qpe/qpeapplication.h>
35#include <qpe/taskbarappletinterface.h> 35#include <qpe/taskbarappletinterface.h>
36#include <qpe/qcopenvelope_qws.h> 36#include <qpe/qcopenvelope_qws.h>
37#include <opie2/odebug.h> 37#include <opie2/odebug.h>
38 38
39/* QT */ 39/* QT */
40#include <qdir.h> 40#include <qdir.h>
41#include <qlistview.h> 41#include <qlistview.h>
42#include <qheader.h> 42#include <qheader.h>
43#include <qlayout.h> 43#include <qlayout.h>
44#include <qlabel.h> 44#include <qlabel.h>
45#include <qwhatsthis.h> 45#include <qwhatsthis.h>
46 46
47/* STD */ 47/* STD */
48#include <stdlib.h> 48#include <stdlib.h>
49 49
50 50
51TaskbarSettings::TaskbarSettings ( QWidget *parent, const char *name ) 51TaskbarSettings::TaskbarSettings ( QWidget *parent, const char *name )
52 : QWidget ( parent, name ) 52 : QWidget ( parent, name )
53{ 53{
54 m_applets_changed = false; 54 m_applets_changed = false;
55 55
56 QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); 56 QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 );
57 57
58 QLabel *l = new QLabel ( tr( "Load applets in Taskbar:" ), this ); 58 QLabel *l = new QLabel ( tr( "Load applets in Taskbar:" ), this );
59 lay-> addWidget ( l ); 59 lay-> addWidget ( l );
60 60
61 m_list = new QListView ( this ); 61 m_list = new QListView ( this );
62 m_list-> addColumn ( "foobar" ); 62 m_list-> addColumn ( "foobar" );
63 m_list-> header ( )-> hide ( ); 63 m_list-> header ( )-> hide ( );
64 64
65 lay-> addWidget ( m_list ); 65 lay-> addWidget ( m_list );
66 66
67 QWhatsThis::add ( m_list, tr( "Check the applets that you want displayed in the Taskbar." )); 67 QWhatsThis::add ( m_list, tr( "Check the applets that you want displayed in the Taskbar." ));
68 68
69 connect ( m_list, SIGNAL( clicked(QListViewItem*)), this, SLOT( appletChanged())); 69 connect ( m_list, SIGNAL( clicked(QListViewItem*)), this, SLOT( appletChanged()));
70 70
71 init ( ); 71 init ( );
72} 72}
73 73
74void TaskbarSettings::init ( ) 74void TaskbarSettings::init ( )
75{ 75{
76 Config cfg ( "Taskbar" ); 76 Config cfg ( "Taskbar" );
77 cfg. setGroup ( "Applets" ); 77 cfg. setGroup ( "Applets" );
78 QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' ); 78 QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' );
79 79
80 QString path = QPEApplication::qpeDir ( ) + "/plugins/applets"; 80 QString path = QPEApplication::qpeDir ( ) + "plugins/applets";
81#ifdef Q_OS_MACX 81#ifdef Q_OS_MACX
82 QStringList list = QDir ( path, "lib*.dylib" ). entryList ( ); 82 QStringList list = QDir ( path, "lib*.dylib" ). entryList ( );
83#else 83#else
84 QStringList list = QDir ( path, "lib*.so" ). entryList ( ); 84 QStringList list = QDir ( path, "lib*.so" ). entryList ( );
85#endif /* Q_OS_MACX */ 85#endif /* Q_OS_MACX */
86 86
87 for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) { 87 for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) {
88 QString name; 88 QString name;
89 QPixmap icon; 89 QPixmap icon;
90 TaskbarNamedAppletInterface *iface = 0; 90 TaskbarNamedAppletInterface *iface = 0;
91 91
92 owarn << "Load applet: " << (*it) << "" << oendl; 92 owarn << "Load applet: " << (*it) << "" << oendl;
93 QLibrary *lib = new QLibrary ( path + "/" + *it ); 93 QLibrary *lib = new QLibrary ( path + "/" + *it );
94 lib-> queryInterface ( IID_TaskbarNamedApplet, (QUnknownInterface**) &iface ); 94 lib-> queryInterface ( IID_TaskbarNamedApplet, (QUnknownInterface**) &iface );
95 owarn << "<1>" << oendl; 95 owarn << "<1>" << oendl;
96 if ( iface ) { 96 if ( iface ) {
97 owarn << "<2>" << oendl; 97 owarn << "<2>" << oendl;
98 QString lang = getenv( "LANG" ); 98 QString lang = getenv( "LANG" );
99 QTranslator *trans = new QTranslator ( qApp ); 99 QTranslator *trans = new QTranslator ( qApp );
100 QString type = (*it). left ((*it). find (".")); 100 QString type = (*it). left ((*it). find ("."));
101 QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm"; 101 QString tfn = QPEApplication::qpeDir ( ) + "i18n/" + lang + "/" + type + ".qm";
102 if ( trans-> load ( tfn )) 102 if ( trans-> load ( tfn ))
103 qApp-> installTranslator ( trans ); 103 qApp-> installTranslator ( trans );
104 else 104 else
105 delete trans; 105 delete trans;
106 name = iface-> name ( ); 106 name = iface-> name ( );
107 icon = iface-> icon ( ); 107 icon = iface-> icon ( );
108 iface-> release ( ); 108 iface-> release ( );
109 } 109 }
110 owarn << "<3>" << oendl; 110 owarn << "<3>" << oendl;
111 if ( !iface ) { 111 if ( !iface ) {
112 owarn << "<4>" << oendl; 112 owarn << "<4>" << oendl;
113 lib-> queryInterface ( IID_TaskbarApplet, (QUnknownInterface**) &iface ); 113 lib-> queryInterface ( IID_TaskbarApplet, (QUnknownInterface**) &iface );
114 114
115 if ( iface ) { 115 if ( iface ) {
116 owarn << "<5>" << oendl; 116 owarn << "<5>" << oendl;
117 name = (*it). mid ( 3 ); 117 name = (*it). mid ( 3 );
118 owarn << "Found applet: " << name << "" << oendl; 118 owarn << "Found applet: " << name << "" << oendl;
119#ifdef Q_OS_MACX 119#ifdef Q_OS_MACX
120 int sep = name. find( ".dylib" ); 120 int sep = name. find( ".dylib" );
121#else 121#else
122 int sep = name. find( ".so" ); 122 int sep = name. find( ".so" );
123#endif /* Q_OS_MACX */ 123#endif /* Q_OS_MACX */
124 if ( sep > 0 ) 124 if ( sep > 0 )
125 name. truncate ( sep ); 125 name. truncate ( sep );
126 sep = name. find ( "applet" ); 126 sep = name. find ( "applet" );
127 if ( sep == (int) name.length ( ) - 6 ) 127 if ( sep == (int) name.length ( ) - 6 )
128 name. truncate ( sep ); 128 name. truncate ( sep );
129 name[0] = name[0]. upper ( ); 129 name[0] = name[0]. upper ( );
130 iface-> release ( ); 130 iface-> release ( );
131 } 131 }
132 } 132 }
133 owarn << "<6>" << oendl; 133 owarn << "<6>" << oendl;
134 134
135 if ( iface ) { 135 if ( iface ) {
136 owarn << "<7>" << oendl; 136 owarn << "<7>" << oendl;
137 QCheckListItem *item; 137 QCheckListItem *item;
138 item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox ); 138 item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox );
139 if ( !icon. isNull ( )) 139 if ( !icon. isNull ( ))
140 item-> setPixmap ( 0, icon ); 140 item-> setPixmap ( 0, icon );
141 item-> setOn ( exclude. find ( *it ) == exclude. end ( )); 141 item-> setOn ( exclude. find ( *it ) == exclude. end ( ));
142 m_applets [*it] = item; 142 m_applets [*it] = item;
143 } 143 }
144 lib-> unload ( ); 144 lib-> unload ( );
145 delete lib; 145 delete lib;
146 } 146 }
147} 147}
148 148
149void TaskbarSettings::appletChanged() 149void TaskbarSettings::appletChanged()
150{ 150{
151 m_applets_changed = true; 151 m_applets_changed = true;
152} 152}
153 153
154void TaskbarSettings::accept ( ) 154void TaskbarSettings::accept ( )
155{ 155{
156 Config cfg ( "Taskbar" ); 156 Config cfg ( "Taskbar" );
157 cfg. setGroup ( "Applets" ); 157 cfg. setGroup ( "Applets" );
158 158
159 if ( m_applets_changed ) { 159 if ( m_applets_changed ) {
160 QStringList exclude; 160 QStringList exclude;
161 QMap <QString, QCheckListItem *>::Iterator it; 161 QMap <QString, QCheckListItem *>::Iterator it;
162 for ( it = m_applets. begin ( ); it != m_applets. end ( ); ++it ) { 162 for ( it = m_applets. begin ( ); it != m_applets. end ( ); ++it ) {
163 if ( !(*it)-> isOn ( )) 163 if ( !(*it)-> isOn ( ))
164 exclude << it. key ( ); 164 exclude << it. key ( );
165 } 165 }
166 cfg. writeEntry ( "ExcludeApplets", exclude, ',' ); 166 cfg. writeEntry ( "ExcludeApplets", exclude, ',' );
167 } 167 }
168 cfg. writeEntry ( "SafeMode", false ); 168 cfg. writeEntry ( "SafeMode", false );
169 cfg. write ( ); 169 cfg. write ( );
170 170
171 if ( m_applets_changed ) { 171 if ( m_applets_changed ) {
172 QCopEnvelope e ( "QPE/TaskBar", "reloadApplets()" ); 172 QCopEnvelope e ( "QPE/TaskBar", "reloadApplets()" );
173 m_applets_changed = false; 173 m_applets_changed = false;
174 } 174 }
175} 175}
176 176
diff --git a/core/settings/security/multiauthconfig.cpp b/core/settings/security/multiauthconfig.cpp
index e545e17..45d691b 100644
--- a/core/settings/security/multiauthconfig.cpp
+++ b/core/settings/security/multiauthconfig.cpp
@@ -61,193 +61,193 @@ class ToolButton : public QToolButton {
61: QWidget(parent, name), m_onStart(0), m_onResume(0), m_noProtectConfig(0), m_explanScreens(0), m_nbSuccessMin(0), m_tryButton(0) 61: QWidget(parent, name), m_onStart(0), m_onResume(0), m_noProtectConfig(0), m_explanScreens(0), m_nbSuccessMin(0), m_tryButton(0)
62{ 62{
63 // keep track of the MultiauthConfig parent in one of our attributes 63 // keep track of the MultiauthConfig parent in one of our attributes
64 m_parentConfig = parentConfig; 64 m_parentConfig = parentConfig;
65 QVBoxLayout *vb = new QVBoxLayout(this); 65 QVBoxLayout *vb = new QVBoxLayout(this);
66 vb->setSpacing(11); 66 vb->setSpacing(11);
67 vb->setMargin(11); 67 vb->setMargin(11);
68 vb->setAlignment( Qt::AlignTop ); 68 vb->setAlignment( Qt::AlignTop );
69 69
70 QGroupBox *lockBox = new QGroupBox(0, Qt::Vertical, tr("When to lock Opie"), this, "lock box"); 70 QGroupBox *lockBox = new QGroupBox(0, Qt::Vertical, tr("When to lock Opie"), this, "lock box");
71 vb->addWidget(lockBox); 71 vb->addWidget(lockBox);
72 QGridLayout *boxLayout = new QGridLayout( lockBox->layout() ); 72 QGridLayout *boxLayout = new QGridLayout( lockBox->layout() );
73 m_onStart = new QCheckBox( tr( "on Opie start" ), lockBox, "lock on opie start"); 73 m_onStart = new QCheckBox( tr( "on Opie start" ), lockBox, "lock on opie start");
74 m_onResume = new QCheckBox( tr( "on Opie resume" ), lockBox, "lock on opie resume"); 74 m_onResume = new QCheckBox( tr( "on Opie resume" ), lockBox, "lock on opie resume");
75 boxLayout->addWidget(m_onStart, 0, 0); 75 boxLayout->addWidget(m_onStart, 0, 0);
76 boxLayout->addWidget(m_onResume, 0, 1); 76 boxLayout->addWidget(m_onResume, 0, 1);
77 77
78 QGroupBox *nbBox = new QGroupBox(0, Qt::Vertical, tr("Multiple plugins authentication"), this, "nb box"); 78 QGroupBox *nbBox = new QGroupBox(0, Qt::Vertical, tr("Multiple plugins authentication"), this, "nb box");
79 vb->addWidget(nbBox); 79 vb->addWidget(nbBox);
80 QGridLayout *nbBoxLayout = new QGridLayout( nbBox->layout() ); 80 QGridLayout *nbBoxLayout = new QGridLayout( nbBox->layout() );
81 m_nbSuccessMin = new QSpinBox(nbBox); 81 m_nbSuccessMin = new QSpinBox(nbBox);
82 QLabel *lNbSuccessMin = new QLabel( tr( "Required successes" ), nbBox); 82 QLabel *lNbSuccessMin = new QLabel( tr( "Required successes" ), nbBox);
83 nbBoxLayout->addWidget(m_nbSuccessMin, 0, 0); 83 nbBoxLayout->addWidget(m_nbSuccessMin, 0, 0);
84 nbBoxLayout->addWidget(lNbSuccessMin, 0, 1); 84 nbBoxLayout->addWidget(lNbSuccessMin, 0, 1);
85 m_nbSuccessMin->setMinValue(1); // the max value is defined in MultiauthConfig constructor 85 m_nbSuccessMin->setMinValue(1); // the max value is defined in MultiauthConfig constructor
86 86
87 QGroupBox *devBox = new QGroupBox(0, Qt::Vertical, tr("Options"), this, "dev box"); 87 QGroupBox *devBox = new QGroupBox(0, Qt::Vertical, tr("Options"), this, "dev box");
88 vb->addWidget(devBox); 88 vb->addWidget(devBox);
89 QGridLayout *devBoxLayout = new QGridLayout( devBox->layout() ); 89 QGridLayout *devBoxLayout = new QGridLayout( devBox->layout() );
90 m_noProtectConfig = new QCheckBox( tr("Don't protect this config screen"), devBox, "don't protect config"); 90 m_noProtectConfig = new QCheckBox( tr("Don't protect this config screen"), devBox, "don't protect config");
91 m_explanScreens = new QCheckBox( tr("Show explanatory screens"), devBox, "Show explan. screens"); 91 m_explanScreens = new QCheckBox( tr("Show explanatory screens"), devBox, "Show explan. screens");
92 devBoxLayout->addWidget(m_noProtectConfig, 0, 0); 92 devBoxLayout->addWidget(m_noProtectConfig, 0, 0);
93 devBoxLayout->addWidget(m_explanScreens, 1, 0); 93 devBoxLayout->addWidget(m_explanScreens, 1, 0);
94 94
95 QVGroupBox *tryBox = new QVGroupBox(tr("Testing"), this, "try box"); 95 QVGroupBox *tryBox = new QVGroupBox(tr("Testing"), this, "try box");
96 vb->addWidget(tryBox); 96 vb->addWidget(tryBox);
97 m_tryButton = new QPushButton( tr("Test the authentication now"), tryBox, "try button"); 97 m_tryButton = new QPushButton( tr("Test the authentication now"), tryBox, "try button");
98 connect( m_tryButton, SIGNAL(clicked()), this, SLOT(tryAuth()) ); 98 connect( m_tryButton, SIGNAL(clicked()), this, SLOT(tryAuth()) );
99 99
100} 100}
101 101
102/// nothing to do 102/// nothing to do
103MultiauthGeneralConfig::~MultiauthGeneralConfig() 103MultiauthGeneralConfig::~MultiauthGeneralConfig()
104{} 104{}
105 105
106/// launches the authentication process, as configured, with the option to bypass it 106/// launches the authentication process, as configured, with the option to bypass it
107void MultiauthGeneralConfig::tryAuth() 107void MultiauthGeneralConfig::tryAuth()
108{ 108{
109 QMessageBox confirmSave( 109 QMessageBox confirmSave(
110 tr("Attention"), 110 tr("Attention"),
111 "<p>" + tr("You must save your current settings before trying to authenticate. Press OK to accept and launch a simulated authentication process.") + "</p><p><em>" + 111 "<p>" + tr("You must save your current settings before trying to authenticate. Press OK to accept and launch a simulated authentication process.") + "</p><p><em>" +
112 tr("If you don't like the result of this test, don't forget to change your settings before you exit the configuration application!") + "</em></p>", 112 tr("If you don't like the result of this test, don't forget to change your settings before you exit the configuration application!") + "</em></p>",
113 QMessageBox::Warning, 113 QMessageBox::Warning,
114 QMessageBox::Cancel, QMessageBox::Yes, QMessageBox::NoButton, 114 QMessageBox::Cancel, QMessageBox::Yes, QMessageBox::NoButton,
115 0, QString::null, TRUE, WStyle_StaysOnTop); 115 0, QString::null, TRUE, WStyle_StaysOnTop);
116 confirmSave.setButtonText(QMessageBox::Cancel, tr("Cancel")); 116 confirmSave.setButtonText(QMessageBox::Cancel, tr("Cancel"));
117 confirmSave.setButtonText(QMessageBox::Yes, tr("OK")); 117 confirmSave.setButtonText(QMessageBox::Yes, tr("OK"));
118 118
119 if ( confirmSave.exec() == QMessageBox::Yes) 119 if ( confirmSave.exec() == QMessageBox::Yes)
120 { 120 {
121 owarn << "writing config as user accepted" << oendl; 121 owarn << "writing config as user accepted" << oendl;
122 m_parentConfig->writeConfigs(); 122 m_parentConfig->writeConfigs();
123 owarn << "testing authentication" << oendl; 123 owarn << "testing authentication" << oendl;
124 // launch the authentication in testing mode 124 // launch the authentication in testing mode
125 Opie::Security::MultiauthPassword::authenticate(Opie::Security::TestNow); 125 Opie::Security::MultiauthPassword::authenticate(Opie::Security::TestNow);
126 } 126 }
127} 127}
128 128
129 129
130/// Builds and displays the Opie multi-authentication configuration dialog 130/// Builds and displays the Opie multi-authentication configuration dialog
131static void test_and_start() { 131static void test_and_start() {
132 Config pcfg("Security"); 132 Config pcfg("Security");
133 pcfg.setGroup( "Misc" ); 133 pcfg.setGroup( "Misc" );
134 bool protectConfigDialog = ! pcfg.readBoolEntry("noProtectConfig", true); 134 bool protectConfigDialog = ! pcfg.readBoolEntry("noProtectConfig", true);
135 135
136 if (protectConfigDialog && Opie::Security::Internal::runPlugins() != 0) { 136 if (protectConfigDialog && Opie::Security::Internal::runPlugins() != 0) {
137 owarn << "authentication failed, not showing opie-security" << oendl; 137 owarn << "authentication failed, not showing opie-security" << oendl;
138 exit( -1 ); 138 exit( -1 );
139 } 139 }
140} 140}
141 141
142 142
143 143
144 MultiauthConfig::MultiauthConfig(QWidget* par, const char* w = "MultiauthConfig dialog", WFlags f = 0) 144 MultiauthConfig::MultiauthConfig(QWidget* par, const char* w = "MultiauthConfig dialog", WFlags f = 0)
145: QDialog(par, w, TRUE, f), 145: QDialog(par, w, TRUE, f),
146 m_mainTW(0), m_pluginListView(0), m_pluginListWidget(0), 146 m_mainTW(0), m_pluginListView(0), m_pluginListWidget(0),
147 m_generalConfig(0), m_loginWidget(0), m_syncWidget(0), 147 m_generalConfig(0), m_loginWidget(0), m_syncWidget(0),
148 m_nbSuccessReq(0), m_plugins_changed(false) 148 m_nbSuccessReq(0), m_plugins_changed(false)
149{ 149{
150 /* Initializes the global configuration window 150 /* Initializes the global configuration window
151 */ 151 */
152 test_and_start(); 152 test_and_start();
153 153
154 /* Checks (and memorizes) if any authentication plugins are 154 /* Checks (and memorizes) if any authentication plugins are
155 * installed on the system 155 * installed on the system
156 */ 156 */
157 QString path = QPEApplication::qpeDir() + "/plugins/security"; 157 QString path = QPEApplication::qpeDir() + "plugins/security";
158 QDir dir( path, "lib*.so" ); 158 QDir dir( path, "lib*.so" );
159 QStringList list = dir.entryList(); 159 QStringList list = dir.entryList();
160 160
161 m_pluginsInstalled = ! list.isEmpty(); 161 m_pluginsInstalled = ! list.isEmpty();
162 if (m_pluginsInstalled == false) 162 if (m_pluginsInstalled == false)
163 owarn << "no authentication plugins installed! Talking about it in the last tab..." << oendl; 163 owarn << "no authentication plugins installed! Talking about it in the last tab..." << oendl;
164 164
165 setCaption( tr( "Security configuration" ) ); 165 setCaption( tr( "Security configuration" ) );
166 QVBoxLayout *layout = new QVBoxLayout( this ); 166 QVBoxLayout *layout = new QVBoxLayout( this );
167 m_mainTW = new Opie::Ui::OTabWidget( this, "main tab widget" ); 167 m_mainTW = new Opie::Ui::OTabWidget( this, "main tab widget" );
168 layout->addWidget(m_mainTW); 168 layout->addWidget(m_mainTW);
169 169
170 if (m_pluginsInstalled) 170 if (m_pluginsInstalled)
171 { 171 {
172 m_pluginListWidget = new QWidget(m_mainTW, "plugin list widget"); 172 m_pluginListWidget = new QWidget(m_mainTW, "plugin list widget");
173 QVBoxLayout * pluginListLayout = new QVBoxLayout(m_pluginListWidget); 173 QVBoxLayout * pluginListLayout = new QVBoxLayout(m_pluginListWidget);
174 pluginListLayout->setSpacing(6); 174 pluginListLayout->setSpacing(6);
175 pluginListLayout->setMargin(11); 175 pluginListLayout->setMargin(11);
176 QLabel * pluginListTitle = new QLabel( tr( "Load which plugins in what order:" ), m_pluginListWidget ); 176 QLabel * pluginListTitle = new QLabel( tr( "Load which plugins in what order:" ), m_pluginListWidget );
177 pluginListLayout->addWidget(pluginListTitle); 177 pluginListLayout->addWidget(pluginListTitle);
178 QHBox * pluginListHB = new QHBox(m_pluginListWidget); 178 QHBox * pluginListHB = new QHBox(m_pluginListWidget);
179 pluginListLayout->addWidget(pluginListHB); 179 pluginListLayout->addWidget(pluginListHB);
180 180
181 m_pluginListView = new QListView(pluginListHB); 181 m_pluginListView = new QListView(pluginListHB);
182 m_pluginListView->addColumn("PluginList"); 182 m_pluginListView->addColumn("PluginList");
183 m_pluginListView->header()->hide(); 183 m_pluginListView->header()->hide();
184 m_pluginListView->setSorting(-1); 184 m_pluginListView->setSorting(-1);
185 QWhatsThis::add(m_pluginListView, tr( "Check a checkbox to activate/deactivate a plugin or use the arrow buttons on the right to change the order they will appear in" )); 185 QWhatsThis::add(m_pluginListView, tr( "Check a checkbox to activate/deactivate a plugin or use the arrow buttons on the right to change the order they will appear in" ));
186 186
187 QVBox * pluginListVB = new QVBox(pluginListHB); 187 QVBox * pluginListVB = new QVBox(pluginListHB);
188 new ToolButton( pluginListVB, tr( "Move Up" ), "up", this , SLOT( moveSelectedUp() ) ); 188 new ToolButton( pluginListVB, tr( "Move Up" ), "up", this , SLOT( moveSelectedUp() ) );
189 new ToolButton( pluginListVB, tr( "Move Down" ), "down", this , SLOT( moveSelectedDown() ) ); 189 new ToolButton( pluginListVB, tr( "Move Down" ), "down", this , SLOT( moveSelectedDown() ) );
190 m_mainTW->addTab( m_pluginListWidget, "pass", tr( "plugins" ) ); 190 m_mainTW->addTab( m_pluginListWidget, "pass", tr( "plugins" ) );
191 191
192 connect ( m_pluginListView , SIGNAL( clicked ( QListViewItem * ) ), this, SLOT( pluginsChanged ( ) ) ); 192 connect ( m_pluginListView , SIGNAL( clicked ( QListViewItem * ) ), this, SLOT( pluginsChanged ( ) ) );
193 193
194 // general Opie multi-authentication configuration tab 194 // general Opie multi-authentication configuration tab
195 m_generalConfig = new MultiauthGeneralConfig(this, m_mainTW); 195 m_generalConfig = new MultiauthGeneralConfig(this, m_mainTW);
196 m_mainTW->addTab(m_generalConfig, "SettingsIcon", tr( "Authentication") ); 196 m_mainTW->addTab(m_generalConfig, "SettingsIcon", tr( "Authentication") );
197 197
198 } 198 }
199 // login settings page 199 // login settings page
200 m_loginWidget = new LoginBase(m_mainTW, "login config widget"); 200 m_loginWidget = new LoginBase(m_mainTW, "login config widget");
201 m_mainTW->addTab(m_loginWidget, "security/users", tr( "Login") ); 201 m_mainTW->addTab(m_loginWidget, "security/users", tr( "Login") );
202 202
203 // sync settings page 203 // sync settings page
204 m_syncWidget = new SyncBase( m_mainTW, "sync config widget" ); 204 m_syncWidget = new SyncBase( m_mainTW, "sync config widget" );
205 m_mainTW->addTab(m_syncWidget, "security/sync", tr( "Sync") ); 205 m_mainTW->addTab(m_syncWidget, "security/sync", tr( "Sync") );
206 206
207 // read the "Security" Config file and update our UI 207 // read the "Security" Config file and update our UI
208 readConfig(); 208 readConfig();
209 209
210 210
211 if (m_pluginsInstalled) 211 if (m_pluginsInstalled)
212 { 212 {
213 /* loads plugins configuration widgets in mainTW tabs and in pluginListView 213 /* loads plugins configuration widgets in mainTW tabs and in pluginListView
214 */ 214 */
215 215
216 loadPlugins(); 216 loadPlugins();
217 217
218 for ( int i = pluginList.count() - 1; i >= 0; i-- ) { 218 for ( int i = pluginList.count() - 1; i >= 0; i-- ) {
219 MultiauthPlugin plugin = pluginList[i]; 219 MultiauthPlugin plugin = pluginList[i];
220 220
221 // load the config widgets in the tabs 221 // load the config widgets in the tabs
222 // (configWidget will return 0l if there is no configuration GUI) 222 // (configWidget will return 0l if there is no configuration GUI)
223 MultiauthConfigWidget* widget = plugin.pluginObject->configWidget(m_mainTW); 223 MultiauthConfigWidget* widget = plugin.pluginObject->configWidget(m_mainTW);
224 if ( widget != 0l ) { 224 if ( widget != 0l ) {
225 odebug << "plugin " << plugin.name << " has a configuration widget" << oendl; 225 odebug << "plugin " << plugin.name << " has a configuration widget" << oendl;
226 configWidgetList.append(widget); 226 configWidgetList.append(widget);
227 m_mainTW->addTab( widget, plugin.pluginObject->pixmapNameConfig(), 227 m_mainTW->addTab( widget, plugin.pluginObject->pixmapNameConfig(),
228 plugin.pluginObject->pluginName() ); 228 plugin.pluginObject->pluginName() );
229 } 229 }
230 // set the order/activate tab 230 // set the order/activate tab
231 QPixmap icon = Resource::loadPixmap( plugin.pluginObject->pixmapNameWidget() ); 231 QPixmap icon = Resource::loadPixmap( plugin.pluginObject->pixmapNameWidget() );
232 QCheckListItem * item = new QCheckListItem(m_pluginListView, plugin.pluginObject->pluginName(), QCheckListItem::CheckBox ); 232 QCheckListItem * item = new QCheckListItem(m_pluginListView, plugin.pluginObject->pluginName(), QCheckListItem::CheckBox );
233 if ( !icon.isNull() ) { 233 if ( !icon.isNull() ) {
234 item->setPixmap( 0, icon ); 234 item->setPixmap( 0, icon );
235 } 235 }
236 if ( m_excludePlugins.find( plugin.name ) == m_excludePlugins.end() ) { 236 if ( m_excludePlugins.find( plugin.name ) == m_excludePlugins.end() ) {
237 item->setOn( TRUE ); 237 item->setOn( TRUE );
238 } 238 }
239 m_plugins[plugin.name] = item; 239 m_plugins[plugin.name] = item;
240 } 240 }
241 241
242 // set the first tab as default. 242 // set the first tab as default.
243 m_mainTW->setCurrentTab(m_pluginListWidget); 243 m_mainTW->setCurrentTab(m_pluginListWidget);
244 244
245 // put the number of plugins as the max number of req. auth. 245 // put the number of plugins as the max number of req. auth.
246 m_generalConfig->m_nbSuccessMin->setMaxValue( pluginList.count() ); 246 m_generalConfig->m_nbSuccessMin->setMaxValue( pluginList.count() );
247 } 247 }
248 else 248 else
249 { 249 {
250 /* we don't have any installed plugin there. Let's tell 250 /* we don't have any installed plugin there. Let's tell
251 * that to the user in a third tab, using the m_pluginListWidget widget 251 * that to the user in a third tab, using the m_pluginListWidget widget
252 */ 252 */
253 m_pluginListWidget = new QWidget(m_mainTW, "plugin list widget (no plugins warning)"); 253 m_pluginListWidget = new QWidget(m_mainTW, "plugin list widget (no plugins warning)");
@@ -281,328 +281,328 @@ void MultiauthConfig::writeConfigs() {
281 for ( confWidget = configWidgetList.first(); confWidget != 0; 281 for ( confWidget = configWidgetList.first(); confWidget != 0;
282 confWidget = configWidgetList.next() ) 282 confWidget = configWidgetList.next() )
283 confWidget->writeConfig(); 283 confWidget->writeConfig();
284} 284}
285 285
286/// on QDialog::accept, we save all the configurations and exit the QDialog normally 286/// on QDialog::accept, we save all the configurations and exit the QDialog normally
287void MultiauthConfig::accept() { 287void MultiauthConfig::accept() {
288 writeConfigs(); 288 writeConfigs();
289 QDialog::accept(); 289 QDialog::accept();
290} 290}
291 291
292void MultiauthConfig::done( int r ) { 292void MultiauthConfig::done( int r ) {
293 QDialog::done( r ); 293 QDialog::done( r );
294 close(); 294 close();
295} 295}
296 296
297/// moves up the selected plugin 297/// moves up the selected plugin
298void MultiauthConfig::moveSelectedUp() 298void MultiauthConfig::moveSelectedUp()
299{ 299{
300 QListViewItem *item = m_pluginListView->selectedItem(); 300 QListViewItem *item = m_pluginListView->selectedItem();
301 if ( item && item->itemAbove() ) { 301 if ( item && item->itemAbove() ) {
302 item->itemAbove()->moveItem( item ); 302 item->itemAbove()->moveItem( item );
303 } 303 }
304} 304}
305 305
306/// moves down the selected plugin 306/// moves down the selected plugin
307void MultiauthConfig::moveSelectedDown() 307void MultiauthConfig::moveSelectedDown()
308{ 308{
309 QListViewItem *item = m_pluginListView->selectedItem(); 309 QListViewItem *item = m_pluginListView->selectedItem();
310 if ( item && item->itemBelow() ) { 310 if ( item && item->itemBelow() ) {
311 item->moveItem( item->itemBelow() ); 311 item->moveItem( item->itemBelow() );
312 } 312 }
313} 313}
314 314
315/// reads the <code>Security.conf</code> Config file, and updates parts of the user interface 315/// reads the <code>Security.conf</code> Config file, and updates parts of the user interface
316void MultiauthConfig::readConfig() 316void MultiauthConfig::readConfig()
317{ 317{
318 // pointer, so we release this Config when we want 318 // pointer, so we release this Config when we want
319 Config* pcfg = new Config("Security"); 319 Config* pcfg = new Config("Security");
320 320
321 if (m_pluginsInstalled) 321 if (m_pluginsInstalled)
322 { 322 {
323 pcfg->setGroup( "Misc" ); 323 pcfg->setGroup( "Misc" );
324 m_generalConfig->m_onStart->setChecked( pcfg->readBoolEntry( "onStart", false ) ); 324 m_generalConfig->m_onStart->setChecked( pcfg->readBoolEntry( "onStart", false ) );
325 m_generalConfig->m_onResume->setChecked( pcfg->readBoolEntry( "onResume", false ) ); 325 m_generalConfig->m_onResume->setChecked( pcfg->readBoolEntry( "onResume", false ) );
326 m_generalConfig->m_nbSuccessMin->setValue( pcfg->readNumEntry( "nbSuccessMin", 1 ) ); 326 m_generalConfig->m_nbSuccessMin->setValue( pcfg->readNumEntry( "nbSuccessMin", 1 ) );
327 m_generalConfig->m_noProtectConfig->setChecked( pcfg->readBoolEntry( "noProtectConfig", true) ); 327 m_generalConfig->m_noProtectConfig->setChecked( pcfg->readBoolEntry( "noProtectConfig", true) );
328 m_generalConfig->m_explanScreens->setChecked( pcfg->readBoolEntry( "explanScreens", true ) ); 328 m_generalConfig->m_explanScreens->setChecked( pcfg->readBoolEntry( "explanScreens", true ) );
329 329
330 pcfg->setGroup( "Plugins" ); 330 pcfg->setGroup( "Plugins" );
331 m_excludePlugins = pcfg->readListEntry( "ExcludePlugins", ',' ); 331 m_excludePlugins = pcfg->readListEntry( "ExcludePlugins", ',' );
332 m_allPlugins = pcfg->readListEntry( "AllPlugins", ',' ); 332 m_allPlugins = pcfg->readListEntry( "AllPlugins", ',' );
333 } 333 }
334 334
335 /* Login and Sync stuff */ 335 /* Login and Sync stuff */
336 pcfg->setGroup("Sync"); 336 pcfg->setGroup("Sync");
337 int auth_peer = pcfg->readNumEntry("auth_peer",0xc0a88100);//new default 192.168.129.0/24 337 int auth_peer = pcfg->readNumEntry("auth_peer",0xc0a88100);//new default 192.168.129.0/24
338 int auth_peer_bits = pcfg->readNumEntry("auth_peer_bits",24); 338 int auth_peer_bits = pcfg->readNumEntry("auth_peer_bits",24);
339 339
340 pcfg->setGroup("SyncMode"); 340 pcfg->setGroup("SyncMode");
341 int mode = pcfg->readNumEntry("Mode",2); // Default to Sharp 341 int mode = pcfg->readNumEntry("Mode",2); // Default to Sharp
342 switch( mode ) { 342 switch( mode ) {
343 case 0x01: 343 case 0x01:
344 m_syncWidget->syncModeCombo->setCurrentItem( 0 ); 344 m_syncWidget->syncModeCombo->setCurrentItem( 0 );
345 break; 345 break;
346 case 0x02: 346 case 0x02:
347 default: 347 default:
348 m_syncWidget->syncModeCombo->setCurrentItem( 1 ); 348 m_syncWidget->syncModeCombo->setCurrentItem( 1 );
349 break; 349 break;
350 case 0x04: 350 case 0x04:
351 m_syncWidget->syncModeCombo->setCurrentItem( 2 ); 351 m_syncWidget->syncModeCombo->setCurrentItem( 2 );
352 break; 352 break;
353 } 353 }
354 /* 354 /*
355 cfg.setGroup("Remote"); 355 cfg.setGroup("Remote");
356 if ( telnetAvailable() ) 356 if ( telnetAvailable() )
357 telnet->setChecked(cfg.readEntry("allow_telnet")); 357 telnet->setChecked(cfg.readEntry("allow_telnet"));
358 else 358 else
359 telnet->hide(); 359 telnet->hide();
360 360
361 if ( sshAvailable() ) 361 if ( sshAvailable() )
362 ssh->setChecked(cfg.readEntry("allow_ssh")); 362 ssh->setChecked(cfg.readEntry("allow_ssh"));
363 else 363 else
364 ssh->hide(); 364 ssh->hide();
365 */ 365 */
366 366
367 // release the Config handler 367 // release the Config handler
368 delete pcfg; 368 delete pcfg;
369 // indeed, selectNet will open the config file... 369 // indeed, selectNet will open the config file...
370 selectNet(auth_peer,auth_peer_bits,TRUE); 370 selectNet(auth_peer,auth_peer_bits,TRUE);
371 371
372 connect( m_syncWidget->syncnet, SIGNAL(textChanged(const QString&)), 372 connect( m_syncWidget->syncnet, SIGNAL(textChanged(const QString&)),
373 this, SLOT(setSyncNet(const QString&))); 373 this, SLOT(setSyncNet(const QString&)));
374 374
375 375
376 376
377 QString configFile = QPEApplication::qpeDir() + "/etc/opie-login.conf"; 377 QString configFile = QPEApplication::qpeDir() + "etc/opie-login.conf";
378 Config loginCfg(configFile,Config::File); 378 Config loginCfg(configFile,Config::File);
379 379
380 loginCfg.setGroup("General"); 380 loginCfg.setGroup("General");
381 autoLoginName=loginCfg.readEntry("AutoLogin",""); 381 autoLoginName=loginCfg.readEntry("AutoLogin","");
382 382
383 if (autoLoginName.stripWhiteSpace().isEmpty()) { 383 if (autoLoginName.stripWhiteSpace().isEmpty()) {
384 autoLogin=false; 384 autoLogin=false;
385 } else { 385 } else {
386 autoLogin=true; 386 autoLogin=true;
387 } 387 }
388 388
389 389
390 connect(m_loginWidget->autologinToggle, SIGNAL(toggled(bool)), this, SLOT(toggleAutoLogin(bool))); 390 connect(m_loginWidget->autologinToggle, SIGNAL(toggled(bool)), this, SLOT(toggleAutoLogin(bool)));
391 connect(m_loginWidget->userlist, SIGNAL(activated(int)), this, SLOT(changeLoginName(int))); 391 connect(m_loginWidget->userlist, SIGNAL(activated(int)), this, SLOT(changeLoginName(int)));
392 connect(m_syncWidget->restoredefaults,SIGNAL(clicked()), this, SLOT(restoreDefaults())); 392 connect(m_syncWidget->restoredefaults,SIGNAL(clicked()), this, SLOT(restoreDefaults()));
393 connect(m_syncWidget->deleteentry,SIGNAL(clicked()), this, SLOT(deleteListEntry())); 393 connect(m_syncWidget->deleteentry,SIGNAL(clicked()), this, SLOT(deleteListEntry()));
394 394
395 loadUsers(); 395 loadUsers();
396 updateGUI(); 396 updateGUI();
397 397
398} 398}
399 399
400void MultiauthConfig::writeConfig() 400void MultiauthConfig::writeConfig()
401{ 401{
402 Config* pcfg = new Config("Security"); 402 Config* pcfg = new Config("Security");
403 403
404 if (m_pluginsInstalled) 404 if (m_pluginsInstalled)
405 { 405 {
406 pcfg->setGroup( "Plugins" ); 406 pcfg->setGroup( "Plugins" );
407 QStringList exclude; 407 QStringList exclude;
408 QStringList include; 408 QStringList include;
409 QStringList allPlugins; 409 QStringList allPlugins;
410 410
411 QListViewItemIterator list_it( m_pluginListView ); 411 QListViewItemIterator list_it( m_pluginListView );
412 412
413 // this makes sure the names get saved in the order selected 413 // this makes sure the names get saved in the order selected
414 for ( ; list_it.current(); ++list_it ) { 414 for ( ; list_it.current(); ++list_it ) {
415 QMap <QString, QCheckListItem *>::Iterator it; 415 QMap <QString, QCheckListItem *>::Iterator it;
416 for ( it = m_plugins.begin(); it != m_plugins. end (); ++it ) { 416 for ( it = m_plugins.begin(); it != m_plugins. end (); ++it ) {
417 if ( list_it.current() == (*it) && !(*it)-> isOn () ) { 417 if ( list_it.current() == (*it) && !(*it)-> isOn () ) {
418 exclude << it.key(); 418 exclude << it.key();
419 } else if ( list_it.current() == (*it) && (*it)-> isOn () ){ 419 } else if ( list_it.current() == (*it) && (*it)-> isOn () ){
420 include << it.key(); 420 include << it.key();
421 } 421 }
422 if ( list_it.current() == (*it) ) { 422 if ( list_it.current() == (*it) ) {
423 allPlugins << it.key(); 423 allPlugins << it.key();
424 } 424 }
425 } 425 }
426 } 426 }
427 pcfg->writeEntry( "ExcludePlugins", exclude, ',' ); 427 pcfg->writeEntry( "ExcludePlugins", exclude, ',' );
428 pcfg->writeEntry( "IncludePlugins", include, ',' ); 428 pcfg->writeEntry( "IncludePlugins", include, ',' );
429 pcfg->writeEntry( "AllPlugins", allPlugins, ',' ); 429 pcfg->writeEntry( "AllPlugins", allPlugins, ',' );
430 430
431 pcfg->setGroup( "Misc" ); 431 pcfg->setGroup( "Misc" );
432 pcfg->writeEntry( "onStart", m_generalConfig->m_onStart->isChecked() ); 432 pcfg->writeEntry( "onStart", m_generalConfig->m_onStart->isChecked() );
433 pcfg->writeEntry( "onResume", m_generalConfig->m_onResume->isChecked() ); 433 pcfg->writeEntry( "onResume", m_generalConfig->m_onResume->isChecked() );
434 pcfg->writeEntry( "nbSuccessMin", m_generalConfig->m_nbSuccessMin->text() ); 434 pcfg->writeEntry( "nbSuccessMin", m_generalConfig->m_nbSuccessMin->text() );
435 pcfg->writeEntry( "noProtectConfig", m_generalConfig->m_noProtectConfig->isChecked() ); 435 pcfg->writeEntry( "noProtectConfig", m_generalConfig->m_noProtectConfig->isChecked() );
436 pcfg->writeEntry( "explanScreens", m_generalConfig->m_explanScreens->isChecked() ); 436 pcfg->writeEntry( "explanScreens", m_generalConfig->m_explanScreens->isChecked() );
437 } 437 }
438 438
439 /* Login and Sync stuff */ 439 /* Login and Sync stuff */
440 440
441 pcfg->setGroup("Sync"); 441 pcfg->setGroup("Sync");
442 int auth_peer=0; 442 int auth_peer=0;
443 int auth_peer_bits; 443 int auth_peer_bits;
444 QString sn = m_syncWidget->syncnet->currentText(); 444 QString sn = m_syncWidget->syncnet->currentText();
445 parseNet(sn,auth_peer,auth_peer_bits); 445 parseNet(sn,auth_peer,auth_peer_bits);
446 446
447 //this is the *selected* (active) net range 447 //this is the *selected* (active) net range
448 pcfg->writeEntry("auth_peer",auth_peer); 448 pcfg->writeEntry("auth_peer",auth_peer);
449 pcfg->writeEntry("auth_peer_bits",auth_peer_bits); 449 pcfg->writeEntry("auth_peer_bits",auth_peer_bits);
450 450
451 //write back all other net ranges in *cleartext* 451 //write back all other net ranges in *cleartext*
452 for (int i=0; i<10; i++) { 452 for (int i=0; i<10; i++) {
453 QString target; 453 QString target;
454 target.sprintf("net%d", i); 454 target.sprintf("net%d", i);
455 if ( i < m_syncWidget->syncnet->count() ) 455 if ( i < m_syncWidget->syncnet->count() )
456 pcfg->writeEntry(target, m_syncWidget->syncnet->text(i)); 456 pcfg->writeEntry(target, m_syncWidget->syncnet->text(i));
457 else // no more entry in the syncnet list -> we clear the line 457 else // no more entry in the syncnet list -> we clear the line
458 pcfg->writeEntry(target, ""); 458 pcfg->writeEntry(target, "");
459 } 459 }
460 460
461#ifdef ODP 461#ifdef ODP
462#error "Use 0,1,2 and use Launcher" 462#error "Use 0,1,2 and use Launcher"
463#endif 463#endif
464 /* keep the old code so we don't use currentItem directly */ 464 /* keep the old code so we don't use currentItem directly */
465 int value = 0x02; 465 int value = 0x02;
466 switch( m_syncWidget->syncModeCombo->currentItem() ) { 466 switch( m_syncWidget->syncModeCombo->currentItem() ) {
467 case 0: 467 case 0:
468 value = 0x01; 468 value = 0x01;
469 break; 469 break;
470 case 1: 470 case 1:
471 value = 0x02; 471 value = 0x02;
472 break; 472 break;
473 case 2: 473 case 2:
474 value = 0x04; 474 value = 0x04;
475 break; 475 break;
476 } 476 }
477 pcfg->setGroup("SyncMode"); 477 pcfg->setGroup("SyncMode");
478 pcfg->writeEntry( "Mode", value ); 478 pcfg->writeEntry( "Mode", value );
479 479
480 /* 480 /*
481 pcfg->setGroup("Remote"); 481 pcfg->setGroup("Remote");
482 if ( telnetAvailable() ) 482 if ( telnetAvailable() )
483 pcfg->writeEntry("allow_telnet",telnet->isChecked()); 483 pcfg->writeEntry("allow_telnet",telnet->isChecked());
484 if ( sshAvailable() ) 484 if ( sshAvailable() )
485 pcfg->writeEntry("allow_ssh",ssh->isChecked()); 485 pcfg->writeEntry("allow_ssh",ssh->isChecked());
486 // ### write ssh/telnet sys config files 486 // ### write ssh/telnet sys config files
487 */ 487 */
488 488
489 //release the Config handler 489 //release the Config handler
490 delete pcfg; 490 delete pcfg;
491 491
492 QString configFile = QPEApplication::qpeDir() + "/etc/opie-login.conf"; 492 QString configFile = QPEApplication::qpeDir() + "etc/opie-login.conf";
493 Config loginCfg(configFile,Config::File); 493 Config loginCfg(configFile,Config::File);
494 loginCfg.setGroup("General"); 494 loginCfg.setGroup("General");
495 495
496 if (autoLogin) { 496 if (autoLogin) {
497 loginCfg.writeEntry("AutoLogin",autoLoginName); 497 loginCfg.writeEntry("AutoLogin",autoLoginName);
498 } else { 498 } else {
499 loginCfg.removeEntry("AutoLogin"); 499 loginCfg.removeEntry("AutoLogin");
500 } 500 }
501 501
502} 502}
503 503
504/// slot used to record the fact plugins order has been modified 504/// slot used to record the fact plugins order has been modified
505void MultiauthConfig::pluginsChanged() { 505void MultiauthConfig::pluginsChanged() {
506 m_plugins_changed = true; 506 m_plugins_changed = true;
507} 507}
508 508
509/// loads each multiauth plugin 509/// loads each multiauth plugin
510void MultiauthConfig::loadPlugins() { 510void MultiauthConfig::loadPlugins() {
511 511
512 QString path = QPEApplication::qpeDir() + "/plugins/security"; 512 QString path = QPEApplication::qpeDir() + "plugins/security";
513 QDir dir( path, "lib*.so" ); 513 QDir dir( path, "lib*.so" );
514 514
515 QStringList list = dir.entryList(); 515 QStringList list = dir.entryList();
516 QStringList::Iterator it; 516 QStringList::Iterator it;
517 517
518 // temporary list used to sort plugins 518 // temporary list used to sort plugins
519 QMap<QString, MultiauthPlugin> sortList; 519 QMap<QString, MultiauthPlugin> sortList;
520 520
521 for ( it = list.begin(); it != list.end(); ++it ) { 521 for ( it = list.begin(); it != list.end(); ++it ) {
522 QInterfacePtr<MultiauthPluginInterface> iface; 522 QInterfacePtr<MultiauthPluginInterface> iface;
523 QLibrary *lib = new QLibrary( path + "/" + *it ); 523 QLibrary *lib = new QLibrary( path + "/" + *it );
524 QString libPath(path + "/" + *it); 524 QString libPath(path + "/" + *it);
525 525
526 if ( lib->queryInterface( IID_MultiauthPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) { 526 if ( lib->queryInterface( IID_MultiauthPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) {
527 MultiauthPlugin plugin; 527 MultiauthPlugin plugin;
528 plugin.library = lib; 528 plugin.library = lib;
529 plugin.iface = iface; 529 plugin.iface = iface;
530 plugin.name = QString(*it); 530 plugin.name = QString(*it);
531 531
532 // find out if plugins should be launched 532 // find out if plugins should be launched
533 if ( m_excludePlugins.grep( *it ).isEmpty() ) { 533 if ( m_excludePlugins.grep( *it ).isEmpty() ) {
534 plugin.active = true; 534 plugin.active = true;
535 } else { 535 } else {
536 plugin.active = false; 536 plugin.active = false;
537 } 537 }
538 538
539 plugin.pluginObject = plugin.iface->plugin(); 539 plugin.pluginObject = plugin.iface->plugin();
540 540
541 // "prebuffer" it in one more list, to get the sorting done 541 // "prebuffer" it in one more list, to get the sorting done
542 sortList.insert( plugin.name, plugin ); 542 sortList.insert( plugin.name, plugin );
543 543
544 // on first start the list is off course empty 544 // on first start the list is off course empty
545 if ( m_allPlugins.isEmpty() ) { 545 if ( m_allPlugins.isEmpty() ) {
546 pluginList.append( plugin ); 546 pluginList.append( plugin );
547 } 547 }
548 // if plugin is not yet in the list, add it to the layout too 548 // if plugin is not yet in the list, add it to the layout too
549 else if ( !m_allPlugins.contains( plugin.name ) ) { 549 else if ( !m_allPlugins.contains( plugin.name ) ) {
550 pluginList.append( plugin ); 550 pluginList.append( plugin );
551 } 551 }
552 552
553 } else { 553 } else {
554 delete lib; 554 delete lib;
555 } 555 }
556 556
557 } // end for 557 } // end for
558 558
559 // put m_allPlugins tempPlugin objects into pluginList 559 // put m_allPlugins tempPlugin objects into pluginList
560 if ( !m_allPlugins.isEmpty() ) { 560 if ( !m_allPlugins.isEmpty() ) {
561 MultiauthPlugin tempPlugin; 561 MultiauthPlugin tempPlugin;
562 QStringList::Iterator stringit; 562 QStringList::Iterator stringit;
563 for( stringit = m_allPlugins.begin(); stringit != m_allPlugins.end(); ++stringit ) { 563 for( stringit = m_allPlugins.begin(); stringit != m_allPlugins.end(); ++stringit ) {
564 tempPlugin = ( sortList.find( *stringit ) ).data(); 564 tempPlugin = ( sortList.find( *stringit ) ).data();
565 if ( !( (tempPlugin.name).isEmpty() ) ) { 565 if ( !( (tempPlugin.name).isEmpty() ) ) {
566 pluginList.append( tempPlugin ); 566 pluginList.append( tempPlugin );
567 } 567 }
568 } 568 }
569 } 569 }
570 570
571} 571}
572 572
573void MultiauthConfig::deleteListEntry() 573void MultiauthConfig::deleteListEntry()
574{ 574{
575 m_syncWidget->syncnet->removeItem(m_syncWidget->syncnet->currentItem()); 575 m_syncWidget->syncnet->removeItem(m_syncWidget->syncnet->currentItem());
576} 576}
577 577
578void MultiauthConfig::restoreDefaults() 578void MultiauthConfig::restoreDefaults()
579{ 579{
580 QMessageBox unrecbox( 580 QMessageBox unrecbox(
581 tr("Attention"), 581 tr("Attention"),
582 "<p>" + tr("All user-defined net ranges will be lost.") + "</p>", 582 "<p>" + tr("All user-defined net ranges will be lost.") + "</p>",
583 QMessageBox::Warning, 583 QMessageBox::Warning,
584 QMessageBox::Cancel, QMessageBox::Yes, QMessageBox::NoButton, 584 QMessageBox::Cancel, QMessageBox::Yes, QMessageBox::NoButton,
585 0, QString::null, TRUE, WStyle_StaysOnTop); 585 0, QString::null, TRUE, WStyle_StaysOnTop);
586 unrecbox.setButtonText(QMessageBox::Cancel, tr("Cancel")); 586 unrecbox.setButtonText(QMessageBox::Cancel, tr("Cancel"));
587 unrecbox.setButtonText(QMessageBox::Yes, tr("OK")); 587 unrecbox.setButtonText(QMessageBox::Yes, tr("OK"));
588 588
589 if ( unrecbox.exec() == QMessageBox::Yes) 589 if ( unrecbox.exec() == QMessageBox::Yes)
590 { 590 {
591 m_syncWidget->syncnet->clear(); 591 m_syncWidget->syncnet->clear();
592 insertDefaultRanges(); 592 insertDefaultRanges();
593 } 593 }
594 m_syncWidget->syncModeCombo->setCurrentItem( 2 ); 594 m_syncWidget->syncModeCombo->setCurrentItem( 2 );
595} 595}
596 596
597void MultiauthConfig::insertDefaultRanges() 597void MultiauthConfig::insertDefaultRanges()
598{ 598{
599 m_syncWidget->syncnet->insertItem( "192.168.129.0/24" ); 599 m_syncWidget->syncnet->insertItem( "192.168.129.0/24" );
600 m_syncWidget->syncnet->insertItem( "192.168.1.0/24" ); 600 m_syncWidget->syncnet->insertItem( "192.168.1.0/24" );
601 m_syncWidget->syncnet->insertItem( "192.168.0.0/16" ); 601 m_syncWidget->syncnet->insertItem( "192.168.0.0/16" );
602 m_syncWidget->syncnet->insertItem( "172.16.0.0/12" ); 602 m_syncWidget->syncnet->insertItem( "172.16.0.0/12" );
603 m_syncWidget->syncnet->insertItem( "10.0.0.0/8" ); 603 m_syncWidget->syncnet->insertItem( "10.0.0.0/8" );
604 m_syncWidget->syncnet->insertItem( "1.0.0.0/8" ); 604 m_syncWidget->syncnet->insertItem( "1.0.0.0/8" );
605 m_syncWidget->syncnet->insertItem( tr( "Any" ) ); 605 m_syncWidget->syncnet->insertItem( tr( "Any" ) );
606 m_syncWidget->syncnet->insertItem( tr( "None" ) ); 606 m_syncWidget->syncnet->insertItem( tr( "None" ) );
607} 607}
608 608
diff --git a/core/tools/quicklauncher/dropins.h b/core/tools/quicklauncher/dropins.h
index a9664f8..df364ce 100644
--- a/core/tools/quicklauncher/dropins.h
+++ b/core/tools/quicklauncher/dropins.h
@@ -1,71 +1,71 @@
1/* OPIE */ 1/* OPIE */
2#include <opie2/owait.h> 2#include <opie2/owait.h>
3using namespace Opie::Ui; 3using namespace Opie::Ui;
4 4
5#include <qtopia/qcom.h> 5#include <qtopia/qcom.h>
6#include <qtopia/qlibrary.h> 6#include <qtopia/qlibrary.h>
7#include <qtopia/qpeapplication.h> 7#include <qtopia/qpeapplication.h>
8#include <qtopia/applicationinterface.h> 8#include <qtopia/applicationinterface.h>
9#include <qtopia/resource.h> 9#include <qtopia/resource.h>
10 10
11/* QT */ 11/* QT */
12#include <qmetaobject.h> 12#include <qmetaobject.h>
13#include <qmap.h> 13#include <qmap.h>
14#include <qstring.h> 14#include <qstring.h>
15 15
16namespace QuickPrivate { 16namespace QuickPrivate {
17 17
18 struct PluginLoader { 18 struct PluginLoader {
19 PluginLoader( const char* ) { 19 PluginLoader( const char* ) {
20 } 20 }
21 21
22 QRESULT queryInterface( const QString& app, const QUuid&, QUnknownInterface** ); 22 QRESULT queryInterface( const QString& app, const QUuid&, QUnknownInterface** );
23 void releaseInterface( QUnknownInterface* ); 23 void releaseInterface( QUnknownInterface* );
24 QMap<QUnknownInterface*, QLibrary*> libs; 24 QMap<QUnknownInterface*, QLibrary*> libs;
25 }; 25 };
26 26
27 /* 27 /*
28 * We can skip installing a Translator here because Opies QPEApplication 28 * We can skip installing a Translator here because Opies QPEApplication
29 * will do that in initApp for us as well 29 * will do that in initApp for us as well
30 */ 30 */
31 QRESULT PluginLoader::queryInterface( const QString& libFile, const QUuid& uuid, QUnknownInterface** iface ) { 31 QRESULT PluginLoader::queryInterface( const QString& libFile, const QUuid& uuid, QUnknownInterface** iface ) {
32 QRESULT res = QS_FALSE; 32 QRESULT res = QS_FALSE;
33 *iface = 0; 33 *iface = 0;
34 34
35 // This code is very platform specific.. We should find better 35 // This code is very platform specific.. We should find better
36 // solutions to handle names.. Maybe one central function would be 36 // solutions to handle names.. Maybe one central function would be
37 // better than checking this ".so" stuff all around in the sources.. 37 // better than checking this ".so" stuff all around in the sources..
38 // (eilers) 38 // (eilers)
39 39
40 // Below lines from TT then mine again 40 // Below lines from TT then mine again
41 QString name = libFile; 41 QString name = libFile;
42 if ( libFile.findRev(".so") == (int)libFile.length()-3 ) { 42 if ( libFile.findRev(".so") == (int)libFile.length()-3 ) {
43 name = libFile.left( libFile.length()-3 ); 43 name = libFile.left( libFile.length()-3 );
44 if ( name.find( "lib" ) == 0 ) 44 if ( name.find( "lib" ) == 0 )
45 name = name.mid( 3 ); 45 name = name.mid( 3 );
46 } 46 }
47#ifdef Q_OS_MACX 47#ifdef Q_OS_MACX
48 QString path = QPEApplication::qpeDir() + "/plugins/application/lib"+name+".dylib"; 48 QString path = QPEApplication::qpeDir() + "plugins/application/lib"+name+".dylib";
49#else 49#else
50 QString path = QPEApplication::qpeDir() + "/plugins/application/lib"+name+".so"; 50 QString path = QPEApplication::qpeDir() + "plugins/application/lib"+name+".so";
51#endif 51#endif
52 52
53 QLibrary *lib = new QLibrary( path ); 53 QLibrary *lib = new QLibrary( path );
54 if ( lib->queryInterface( uuid, iface ) == QS_OK && iface ) { 54 if ( lib->queryInterface( uuid, iface ) == QS_OK && iface ) {
55 libs.insert( *iface, lib ); 55 libs.insert( *iface, lib );
56 res = QS_OK; 56 res = QS_OK;
57 } 57 }
58 58
59 return res; 59 return res;
60 } 60 }
61 61
62 void PluginLoader::releaseInterface( QUnknownInterface* iface ) { 62 void PluginLoader::releaseInterface( QUnknownInterface* iface ) {
63 if ( libs.contains( iface ) ) { 63 if ( libs.contains( iface ) ) {
64 iface->release(); 64 iface->release();
65 delete libs[iface]; 65 delete libs[iface];
66 libs.remove( iface ); // we only handle pointers so even if the object is not valid the address-space is 66 libs.remove( iface ); // we only handle pointers so even if the object is not valid the address-space is
67 } 67 }
68 } 68 }
69 69
70} 70}
71 71