summaryrefslogtreecommitdiff
authorzecke <zecke>2002-10-16 01:09:22 (UTC)
committer zecke <zecke>2002-10-16 01:09:22 (UTC)
commit543e54de7170c606b6883ac4152567e7faf13182 (patch) (unidiff)
tree8a7d623e96cab0135a2f7cb11aa9f7491bfda9a2
parent3e973543b77631d053a9616b5540966dbe51ab47 (diff)
downloadopie-543e54de7170c606b6883ac4152567e7faf13182.zip
opie-543e54de7170c606b6883ac4152567e7faf13182.tar.gz
opie-543e54de7170c606b6883ac4152567e7faf13182.tar.bz2
Remove #ifdef QWS HELL
a Platform which is not supporting IPC compatible to QCopChannel/Envelope is not of much use nowadays.. so be sure your platform is supporting it
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/alarmserver.cpp2
-rw-r--r--library/applnk.cpp4
-rw-r--r--library/fileselector.cpp2
-rw-r--r--library/fontdatabase.cpp2
-rw-r--r--library/fontmanager.cpp2
-rw-r--r--library/global.cpp28
-rw-r--r--library/ir.cpp2
-rw-r--r--library/lnkproperties.cpp2
-rw-r--r--library/network.cpp2
-rw-r--r--library/networkinterface.cpp2
-rw-r--r--library/password.cpp2
-rw-r--r--library/qpedecoration_qws.cpp2
-rw-r--r--library/tzselect.cpp4
13 files changed, 11 insertions, 45 deletions
diff --git a/library/alarmserver.cpp b/library/alarmserver.cpp
index 177a0cb..02bca3d 100644
--- a/library/alarmserver.cpp
+++ b/library/alarmserver.cpp
@@ -1,81 +1,79 @@
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 <qdir.h> 21#include <qdir.h>
22#include <qfile.h> 22#include <qfile.h>
23#include <qmessagebox.h> 23#include <qmessagebox.h>
24#include <qtextstream.h> 24#include <qtextstream.h>
25 25
26 26
27#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
28#include "global.h" 28#include "global.h"
29#include "resource.h" 29#include "resource.h"
30 30
31#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
32#include <qpe/qcopenvelope_qws.h> 31#include <qpe/qcopenvelope_qws.h>
33#endif
34#include "alarmserver.h" 32#include "alarmserver.h"
35#include <qpe/timeconversion.h> 33#include <qpe/timeconversion.h>
36 34
37#include <sys/types.h> 35#include <sys/types.h>
38#include <sys/stat.h> 36#include <sys/stat.h>
39 37
40#include <stdlib.h> 38#include <stdlib.h>
41#include <unistd.h> 39#include <unistd.h>
42 40
43struct timerEventItem { 41struct timerEventItem {
44 time_t UTCtime; 42 time_t UTCtime;
45 QCString channel, message; 43 QCString channel, message;
46 int data; 44 int data;
47 bool operator==( const timerEventItem &right ) const 45 bool operator==( const timerEventItem &right ) const
48 { 46 {
49 return ( UTCtime == right.UTCtime 47 return ( UTCtime == right.UTCtime
50 && channel == right.channel 48 && channel == right.channel
51 && message == right.message 49 && message == right.message
52 && data == right.data ); 50 && data == right.data );
53 } 51 }
54}; 52};
55 53
56class TimerReceiverObject : public QObject 54class TimerReceiverObject : public QObject
57{ 55{
58public: 56public:
59 TimerReceiverObject() { } 57 TimerReceiverObject() { }
60 ~TimerReceiverObject() { } 58 ~TimerReceiverObject() { }
61 void resetTimer(); 59 void resetTimer();
62 void setTimerEventItem(); 60 void setTimerEventItem();
63 void deleteTimer(); 61 void deleteTimer();
64protected: 62protected:
65 void timerEvent( QTimerEvent *te ); 63 void timerEvent( QTimerEvent *te );
66private: 64private:
67 QString atfilename; 65 QString atfilename;
68}; 66};
69 67
70TimerReceiverObject *timerEventReceiver = NULL; 68TimerReceiverObject *timerEventReceiver = NULL;
71QList<timerEventItem> timerEventList; 69QList<timerEventItem> timerEventList;
72timerEventItem *nearestTimerEvent = NULL; 70timerEventItem *nearestTimerEvent = NULL;
73 71
74 72
75// set the timer to go off on the next event in the list 73// set the timer to go off on the next event in the list
76void setNearestTimerEvent() 74void setNearestTimerEvent()
77{ 75{
78 nearestTimerEvent = NULL; 76 nearestTimerEvent = NULL;
79 QListIterator<timerEventItem> it( timerEventList ); 77 QListIterator<timerEventItem> it( timerEventList );
80 if ( *it ) 78 if ( *it )
81 nearestTimerEvent = *it; 79 nearestTimerEvent = *it;
diff --git a/library/applnk.cpp b/library/applnk.cpp
index a56da5d..5763c62 100644
--- a/library/applnk.cpp
+++ b/library/applnk.cpp
@@ -1,93 +1,89 @@
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#define QTOPIA_INTERNAL_MIMEEXT 21#define QTOPIA_INTERNAL_MIMEEXT
22#define QTOPIA_INTERNAL_PRELOADACCESS 22#define QTOPIA_INTERNAL_PRELOADACCESS
23#define QTOPIA_INTERNAL_APPLNKASSIGN 23#define QTOPIA_INTERNAL_APPLNKASSIGN
24 24
25#include "applnk.h" 25#include "applnk.h"
26 26
27#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
28#include <qpe/categories.h> 28#include <qpe/categories.h>
29#include <qpe/categoryselect.h> 29#include <qpe/categoryselect.h>
30#ifdef QWS
31#include <qpe/qcopenvelope_qws.h> 30#include <qpe/qcopenvelope_qws.h>
32#endif
33#include <qpe/global.h> 31#include <qpe/global.h>
34#include <qpe/mimetype.h> 32#include <qpe/mimetype.h>
35#include <qpe/config.h> 33#include <qpe/config.h>
36#include <qpe/storage.h> 34#include <qpe/storage.h>
37#include <qpe/resource.h> 35#include <qpe/resource.h>
38 36
39#include <qdict.h> 37#include <qdict.h>
40#include <qdir.h> 38#include <qdir.h>
41#include <qregexp.h> 39#include <qregexp.h>
42 40
43#ifdef Q_WS_QWS
44#include <qgfx_qws.h> 41#include <qgfx_qws.h>
45#endif
46 42
47#include <stdlib.h> 43#include <stdlib.h>
48 44
49int AppLnk::lastId = 5000; 45int AppLnk::lastId = 5000;
50 46
51static int smallSize = 14; 47static int smallSize = 14;
52static int bigSize = 32; 48static int bigSize = 32;
53 49
54static QString safeFileName(const QString& n) 50static QString safeFileName(const QString& n)
55{ 51{
56 QString safename=n; 52 QString safename=n;
57 safename.replace(QRegExp("[^0-9A-Za-z.]"),"_"); 53 safename.replace(QRegExp("[^0-9A-Za-z.]"),"_");
58 safename.replace(QRegExp("^[^A-Za-z]*"),""); 54 safename.replace(QRegExp("^[^A-Za-z]*"),"");
59 if ( safename.isEmpty() ) 55 if ( safename.isEmpty() )
60 safename = "_"; 56 safename = "_";
61 return safename; 57 return safename;
62} 58}
63 59
64static bool prepareDirectories(const QString& lf) 60static bool prepareDirectories(const QString& lf)
65{ 61{
66 if ( !QFile::exists(lf) ) { 62 if ( !QFile::exists(lf) ) {
67 // May need to create directories 63 // May need to create directories
68 QFileInfo fi(lf); 64 QFileInfo fi(lf);
69 if ( system(("mkdir -p "+fi.dirPath(TRUE))) ) 65 if ( system(("mkdir -p "+fi.dirPath(TRUE))) )
70 return FALSE; 66 return FALSE;
71 } 67 }
72 return TRUE; 68 return TRUE;
73} 69}
74 70
75class AppLnkPrivate 71class AppLnkPrivate
76{ 72{
77public: 73public:
78 /* the size of the Pixmap */ 74 /* the size of the Pixmap */
79 enum Size {Normal = 0, Big }; 75 enum Size {Normal = 0, Big };
80 AppLnkPrivate() { 76 AppLnkPrivate() {
81 /* we want one normal and one big item */ 77 /* we want one normal and one big item */
82 78
83 QPixmap pix; 79 QPixmap pix;
84 mPixmaps.insert(0, pix ); 80 mPixmaps.insert(0, pix );
85 mPixmaps.insert(1, pix); 81 mPixmaps.insert(1, pix);
86 } 82 }
87 83
88 QStringList mCatList; // always correct 84 QStringList mCatList; // always correct
89 QArray<int> mCat; // cached value; correct if not empty 85 QArray<int> mCat; // cached value; correct if not empty
90 QMap<int, QPixmap> mPixmaps; 86 QMap<int, QPixmap> mPixmaps;
91 87
92 void updateCatListFromArray() 88 void updateCatListFromArray()
93 { 89 {
diff --git a/library/fileselector.cpp b/library/fileselector.cpp
index 052a29e..4039243 100644
--- a/library/fileselector.cpp
+++ b/library/fileselector.cpp
@@ -1,83 +1,81 @@
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// WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT 21// WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT
22// have this class. 22// have this class.
23#define QTOPIA_INTERNAL_FSLP 23#define QTOPIA_INTERNAL_FSLP
24 24
25#include "fileselector.h" 25#include "fileselector.h"
26#include "fileselector_p.h" 26#include "fileselector_p.h"
27#include "global.h" 27#include "global.h"
28#include "resource.h" 28#include "resource.h"
29#include "config.h" 29#include "config.h"
30#include "applnk.h" 30#include "applnk.h"
31#include "storage.h" 31#include "storage.h"
32#include "qpemenubar.h" 32#include "qpemenubar.h"
33#ifdef QWS
34#include <qcopchannel_qws.h> 33#include <qcopchannel_qws.h>
35#endif
36#include "lnkproperties.h" 34#include "lnkproperties.h"
37#include "applnk.h" 35#include "applnk.h"
38#include <qpe/qpeapplication.h> 36#include <qpe/qpeapplication.h>
39#include "categorymenu.h" 37#include "categorymenu.h"
40#include "categoryselect.h" 38#include "categoryselect.h"
41#include "mimetype.h" 39#include "mimetype.h"
42#include <qpe/categories.h> 40#include <qpe/categories.h>
43 41
44#include <stdlib.h> 42#include <stdlib.h>
45 43
46#include <qdir.h> 44#include <qdir.h>
47#include <qwidget.h> 45#include <qwidget.h>
48#include <qpopupmenu.h> 46#include <qpopupmenu.h>
49#include <qtoolbutton.h> 47#include <qtoolbutton.h>
50#include <qpushbutton.h> 48#include <qpushbutton.h>
51#include <qheader.h> 49#include <qheader.h>
52#include <qtooltip.h> 50#include <qtooltip.h>
53#include <qwhatsthis.h> 51#include <qwhatsthis.h>
54 52
55class TypeCombo : public QComboBox 53class TypeCombo : public QComboBox
56{ 54{
57 Q_OBJECT 55 Q_OBJECT
58public: 56public:
59 TypeCombo( QWidget *parent, const char *name=0 ) 57 TypeCombo( QWidget *parent, const char *name=0 )
60 : QComboBox( parent, name ) 58 : QComboBox( parent, name )
61 { 59 {
62 connect( this, SIGNAL(activated(int)), this, SLOT(selectType(int)) ); 60 connect( this, SIGNAL(activated(int)), this, SLOT(selectType(int)) );
63 } 61 }
64 62
65 void reread( DocLnkSet &files, const QString &filter ); 63 void reread( DocLnkSet &files, const QString &filter );
66 64
67signals: 65signals:
68 void selected( const QString & ); 66 void selected( const QString & );
69 67
70protected slots: 68protected slots:
71 void selectType( int idx ) { 69 void selectType( int idx ) {
72 emit selected( typelist[idx] ); 70 emit selected( typelist[idx] );
73 } 71 }
74 72
75protected: 73protected:
76 QStringList typelist; 74 QStringList typelist;
77 QString prev; 75 QString prev;
78}; 76};
79 77
80void TypeCombo::reread( DocLnkSet &files, const QString &filter ) 78void TypeCombo::reread( DocLnkSet &files, const QString &filter )
81{ 79{
82 typelist.clear(); 80 typelist.clear();
83 QStringList filters = QStringList::split( ';', filter ); 81 QStringList filters = QStringList::split( ';', filter );
diff --git a/library/fontdatabase.cpp b/library/fontdatabase.cpp
index 2b5e0d2..147134c 100644
--- a/library/fontdatabase.cpp
+++ b/library/fontdatabase.cpp
@@ -1,77 +1,75 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include <qpe/qpeapplication.h> 21#include <qpe/qpeapplication.h>
22#include "fontfactoryinterface.h" 22#include "fontfactoryinterface.h"
23#include "fontdatabase.h" 23#include "fontdatabase.h"
24 24
25#include <qpe/qlibrary.h> 25#include <qpe/qlibrary.h>
26 26
27#ifdef QWS
28#include <qfontmanager_qws.h> 27#include <qfontmanager_qws.h>
29#endif
30#include <qdir.h> 28#include <qdir.h>
31#include <qdict.h> 29#include <qdict.h>
32#include <stdio.h> 30#include <stdio.h>
33#include <stdlib.h> 31#include <stdlib.h>
34 32
35static QString fontDir() 33static QString fontDir()
36{ 34{
37 QString qtdir = getenv("QTDIR"); 35 QString qtdir = getenv("QTDIR");
38 if ( qtdir.isEmpty() ) qtdir = "/usr/local/qt-embedded"; 36 if ( qtdir.isEmpty() ) qtdir = "/usr/local/qt-embedded";
39 return qtdir+"/lib/fonts/"; 37 return qtdir+"/lib/fonts/";
40} 38}
41 39
42#ifdef QT_NO_FONTDATABASE 40#ifdef QT_NO_FONTDATABASE
43static QString fontFamily( const QString& key ) 41static QString fontFamily( const QString& key )
44{ 42{
45 int u0 = key.find('_'); 43 int u0 = key.find('_');
46 int u1 = key.find('_',u0+1); 44 int u1 = key.find('_',u0+1);
47 int u2 = key.find('_',u1+1); 45 int u2 = key.find('_',u1+1);
48 QString family = key.left(u0); 46 QString family = key.left(u0);
49 //int pointSize = key.mid(u0+1,u1-u0-1).toInt(); 47 //int pointSize = key.mid(u0+1,u1-u0-1).toInt();
50 //int weight = key.mid(u1+1,u2-u1-1).toInt(); 48 //int weight = key.mid(u1+1,u2-u1-1).toInt();
51 //bool italic = key.mid(u2-1,1) == "i"; 49 //bool italic = key.mid(u2-1,1) == "i";
52 // #### ignores _t and _I fields 50 // #### ignores _t and _I fields
53 return family; 51 return family;
54} 52}
55#endif 53#endif
56 54
57QValueList<FontFactory> *FontDatabase::factoryList = 0; 55QValueList<FontFactory> *FontDatabase::factoryList = 0;
58 56
59/*! 57/*!
60 \class FontDatabase fontdatabase.h 58 \class FontDatabase fontdatabase.h
61 \brief The FontDatabase class provides information about available fonts. 59 \brief The FontDatabase class provides information about available fonts.
62 60
63 Most often you will simply want to query the database for the 61 Most often you will simply want to query the database for the
64 available font families(). 62 available font families().
65 63
66 Use FontDatabase rather than QFontDatabase when you may need access 64 Use FontDatabase rather than QFontDatabase when you may need access
67 to fonts that are not normally available. For example, if the 65 to fonts that are not normally available. For example, if the
68 freetype library and the Qtopia freetype plugin are installed, 66 freetype library and the Qtopia freetype plugin are installed,
69 TrueType fonts will be available to your application. Font renderer 67 TrueType fonts will be available to your application. Font renderer
70 plugins have greater resource requirements than system fonts so they 68 plugins have greater resource requirements than system fonts so they
71 should be used only when necessary. You can force the loading of 69 should be used only when necessary. You can force the loading of
72 font renderer plugins with loadRenderers(). 70 font renderer plugins with loadRenderers().
73 71
74 \ingroup qtopiaemb 72 \ingroup qtopiaemb
75*/ 73*/
76 74
77/*! 75/*!
diff --git a/library/fontmanager.cpp b/library/fontmanager.cpp
index 28a5212..c854133 100644
--- a/library/fontmanager.cpp
+++ b/library/fontmanager.cpp
@@ -1,103 +1,101 @@
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#ifdef QWS
22#include "fontmanager.h" 21#include "fontmanager.h"
23#include <qfile.h> 22#include <qfile.h>
24#include <stdlib.h> 23#include <stdlib.h>
25#include <qgfx_qws.h> 24#include <qgfx_qws.h>
26 25
27 26
28 27
29/* 28/*
30 QFontInfo doesn't work in QWS at the moment, 29 QFontInfo doesn't work in QWS at the moment,
31 otherwise we would just have used that to check 30 otherwise we would just have used that to check
32 the real values 31 the real values
33 32
34 For now, there are only two Unicode fonts in 33 For now, there are only two Unicode fonts in
35 the known universe... 34 the known universe...
36 35
37*/ 36*/
38 37
39bool FontManager::hasUnicodeFont() 38bool FontManager::hasUnicodeFont()
40{ 39{
41 QString fontDir = getenv("QTDIR") + QString("/lib/fonts/"); 40 QString fontDir = getenv("QTDIR") + QString("/lib/fonts/");
42 41
43 QString suffix; 42 QString suffix;
44 if ( qt_screen->isTransformed() ) { 43 if ( qt_screen->isTransformed() ) {
45 suffix += "_t"; 44 suffix += "_t";
46 QPoint a = qt_screen->mapToDevice(QPoint(0,0),QSize(2,2)); 45 QPoint a = qt_screen->mapToDevice(QPoint(0,0),QSize(2,2));
47 QPoint b = qt_screen->mapToDevice(QPoint(1,1),QSize(2,2)); 46 QPoint b = qt_screen->mapToDevice(QPoint(1,1),QSize(2,2));
48 suffix += QString::number( a.x()*8+a.y()*4+(1-b.x())*2+(1-b.y()) ); 47 suffix += QString::number( a.x()*8+a.y()*4+(1-b.x())*2+(1-b.y()) );
49 } 48 }
50 suffix += ".qpf"; 49 suffix += ".qpf";
51 50
52 return QFile::exists( fontDir+"cyberbit_120_50"+suffix ) 51 return QFile::exists( fontDir+"cyberbit_120_50"+suffix )
53 || QFile::exists( fontDir+"unifont_160_50"+suffix ) || 52 || QFile::exists( fontDir+"unifont_160_50"+suffix ) ||
54 QFile::exists( fontDir+"arial_140_50" + suffix ); 53 QFile::exists( fontDir+"arial_140_50" + suffix );
55} 54}
56 55
57QFont FontManager::unicodeFont( Spacing sp ) 56QFont FontManager::unicodeFont( Spacing sp )
58{ 57{
59 QString key; 58 QString key;
60 QString fontName; 59 QString fontName;
61 QString fontDir = getenv("QTDIR") + QString("/lib/fonts/"); 60 QString fontDir = getenv("QTDIR") + QString("/lib/fonts/");
62 61
63 int size; 62 int size;
64 if ( sp == Proportional ) { 63 if ( sp == Proportional ) {
65 fontName = "Arial"; 64 fontName = "Arial";
66 size=14; 65 size=14;
67 key = "arial_140_50"; 66 key = "arial_140_50";
68 } else { 67 } else {
69 fontName = "Unifont"; 68 fontName = "Unifont";
70 size=16; 69 size=16;
71 key = "unifont_160_50"; 70 key = "unifont_160_50";
72 } 71 }
73 72
74 QString suffix; 73 QString suffix;
75 if ( qt_screen->isTransformed() ) { 74 if ( qt_screen->isTransformed() ) {
76 suffix += "_t"; 75 suffix += "_t";
77 QPoint a = qt_screen->mapToDevice(QPoint(0,0),QSize(2,2)); 76 QPoint a = qt_screen->mapToDevice(QPoint(0,0),QSize(2,2));
78 QPoint b = qt_screen->mapToDevice(QPoint(1,1),QSize(2,2)); 77 QPoint b = qt_screen->mapToDevice(QPoint(1,1),QSize(2,2));
79 suffix += QString::number( a.x()*8+a.y()*4+(1-b.x())*2+(1-b.y()) ); 78 suffix += QString::number( a.x()*8+a.y()*4+(1-b.x())*2+(1-b.y()) );
80 } 79 }
81 suffix += ".qpf"; 80 suffix += ".qpf";
82 81
83 // if we cannot find it, try the other one 82 // if we cannot find it, try the other one
84 83
85 if ( !QFile::exists(fontDir+key+suffix) ) { 84 if ( !QFile::exists(fontDir+key+suffix) ) {
86 key = (sp == Fixed ) ? "arial_140_50" : "unifont_160_50"; 85 key = (sp == Fixed ) ? "arial_140_50" : "unifont_160_50";
87 if ( QFile::exists(fontDir+key+suffix) ) { 86 if ( QFile::exists(fontDir+key+suffix) ) {
88 fontName = (sp == Fixed) ? "Arial" : "Unifont"; 87 fontName = (sp == Fixed) ? "Arial" : "Unifont";
89 size = (sp == Fixed) ? 14 : 16; 88 size = (sp == Fixed) ? 14 : 16;
90 } else { 89 } else {
91 key = "cyberbit_120_50"; 90 key = "cyberbit_120_50";
92 if ( QFile::exists(fontDir+key+suffix) ) { 91 if ( QFile::exists(fontDir+key+suffix) ) {
93 fontName = "Cyberbit"; 92 fontName = "Cyberbit";
94 size = 12; 93 size = 12;
95 } else { 94 } else {
96 fontName = "Helvetica"; 95 fontName = "Helvetica";
97 size = 14; 96 size = 14;
98 } 97 }
99 } 98 }
100 } 99 }
101 return QFont(fontName,size); 100 return QFont(fontName,size);
102} 101}
103#endif
diff --git a/library/global.cpp b/library/global.cpp
index 9b908bf..d02e711 100644
--- a/library/global.cpp
+++ b/library/global.cpp
@@ -1,167 +1,161 @@
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#define QTOPIA_INTERNAL_LANGLIST 20#define QTOPIA_INTERNAL_LANGLIST
21#include <qpe/qpedebug.h> 21#include <qpe/qpedebug.h>
22#include <qpe/global.h> 22#include <qpe/global.h>
23#include <qpe/qdawg.h> 23#include <qpe/qdawg.h>
24#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
25#include <qpe/resource.h> 25#include <qpe/resource.h>
26#include <qpe/storage.h> 26#include <qpe/storage.h>
27#include <qpe/applnk.h> 27#include <qpe/applnk.h>
28#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 28#include <qpe/qcopenvelope_qws.h>
29#include "qpe/qcopenvelope_qws.h"
30#endif
31 29
32#include <qfile.h> 30#include <qfile.h>
33#include <qlabel.h> 31#include <qlabel.h>
34#include <qtimer.h> 32#include <qtimer.h>
35#include <qmap.h> 33#include <qmap.h>
36#include <qdict.h> 34#include <qdict.h>
37#include <qdir.h> 35#include <qdir.h>
38#include <qmessagebox.h> 36#include <qmessagebox.h>
39#include <qregexp.h> 37#include <qregexp.h>
40 38
41#include <stdlib.h> 39#include <stdlib.h>
42#include <sys/stat.h> 40#include <sys/stat.h>
43#include <sys/wait.h> 41#include <sys/wait.h>
44#include <sys/types.h> 42#include <sys/types.h>
45#include <fcntl.h> 43#include <fcntl.h>
46#include <unistd.h> 44#include <unistd.h>
47 45
48#ifdef QWS
49#include <qwindowsystem_qws.h> // for qwsServer 46#include <qwindowsystem_qws.h> // for qwsServer
50#endif
51#include <qdatetime.h> 47#include <qdatetime.h>
52 48
53#include <qfile.h> 49#include <qfile.h>
54 50
55namespace { 51namespace {
56 // checks if the storage should be searched 52 // checks if the storage should be searched
57 bool checkStorage(const QString &path ){ // this is a small Config replacement cause config is too limited -zecke 53 bool checkStorage(const QString &path ){ // this is a small Config replacement cause config is too limited -zecke
58 QFile file(path ); 54 QFile file(path );
59 if(!file.open(IO_ReadOnly ) ) 55 if(!file.open(IO_ReadOnly ) )
60 return true; 56 return true;
61 57
62 QByteArray array = file.readAll(); 58 QByteArray array = file.readAll();
63 QStringList list = QStringList::split('\n', QString( array ) ); 59 QStringList list = QStringList::split('\n', QString( array ) );
64 for(QStringList::Iterator it = list.begin(); it != list.end(); ++it ){ 60 for(QStringList::Iterator it = list.begin(); it != list.end(); ++it ){
65 if( (*it).startsWith("autocheck = 0" ) ){ 61 if( (*it).startsWith("autocheck = 0" ) ){
66 return false; 62 return false;
67 }else if( (*it).startsWith("autocheck = 1" ) ){ 63 }else if( (*it).startsWith("autocheck = 1" ) ){
68 return true; 64 return true;
69 } 65 }
70 } 66 }
71 return true; 67 return true;
72 } 68 }
73} 69}
74 70
75//#include "quickexec_p.h" 71//#include "quickexec_p.h"
76 72
77class Emitter : public QObject { 73class Emitter : public QObject {
78 Q_OBJECT 74 Q_OBJECT
79public: 75public:
80 Emitter( QWidget* receiver, const QString& document ) 76 Emitter( QWidget* receiver, const QString& document )
81 { 77 {
82 connect(this, SIGNAL(setDocument(const QString&)), 78 connect(this, SIGNAL(setDocument(const QString&)),
83 receiver, SLOT(setDocument(const QString&))); 79 receiver, SLOT(setDocument(const QString&)));
84 emit setDocument(document); 80 emit setDocument(document);
85 disconnect(this, SIGNAL(setDocument(const QString&)), 81 disconnect(this, SIGNAL(setDocument(const QString&)),
86 receiver, SLOT(setDocument(const QString&))); 82 receiver, SLOT(setDocument(const QString&)));
87 } 83 }
88 84
89signals: 85signals:
90 void setDocument(const QString&); 86 void setDocument(const QString&);
91}; 87};
92 88
93 89
94class StartingAppList : public QObject { 90class StartingAppList : public QObject {
95 Q_OBJECT 91 Q_OBJECT
96public: 92public:
97 static void add( const QString& name ); 93 static void add( const QString& name );
98 static bool isStarting( const QString name ); 94 static bool isStarting( const QString name );
99private slots: 95private slots:
100 void handleNewChannel( const QString &); 96 void handleNewChannel( const QString &);
101private: 97private:
102 StartingAppList( QObject *parent=0, const char* name=0 ) ; 98 StartingAppList( QObject *parent=0, const char* name=0 ) ;
103 99
104 QDict<QTime> dict; 100 QDict<QTime> dict;
105 static StartingAppList *appl; 101 static StartingAppList *appl;
106}; 102};
107 103
108StartingAppList* StartingAppList::appl = 0; 104StartingAppList* StartingAppList::appl = 0;
109 105
110StartingAppList::StartingAppList( QObject *parent, const char* name ) 106StartingAppList::StartingAppList( QObject *parent, const char* name )
111 :QObject( parent, name ) 107 :QObject( parent, name )
112{ 108{
113#ifdef QWS
114#if QT_VERSION >= 232 && !defined(QT_NO_COP) 109#if QT_VERSION >= 232 && !defined(QT_NO_COP)
115 connect( qwsServer, SIGNAL( newChannel(const QString&)), 110 connect( qwsServer, SIGNAL( newChannel(const QString&)),
116 this, SLOT( handleNewChannel(const QString&)) ); 111 this, SLOT( handleNewChannel(const QString&)) );
117 dict.setAutoDelete( TRUE ); 112 dict.setAutoDelete( TRUE );
118#endif 113#endif
119#endif
120} 114}
121 115
122void StartingAppList::add( const QString& name ) 116void StartingAppList::add( const QString& name )
123{ 117{
124#if QT_VERSION >= 232 && !defined(QT_NO_COP) 118#if QT_VERSION >= 232 && !defined(QT_NO_COP)
125 if ( !appl ) 119 if ( !appl )
126 appl = new StartingAppList; 120 appl = new StartingAppList;
127 QTime *t = new QTime; 121 QTime *t = new QTime;
128 t->start(); 122 t->start();
129 appl->dict.insert( "QPE/Application/" + name, t ); 123 appl->dict.insert( "QPE/Application/" + name, t );
130#endif 124#endif
131} 125}
132 126
133bool StartingAppList::isStarting( const QString name ) 127bool StartingAppList::isStarting( const QString name )
134{ 128{
135#if QT_VERSION >= 232 && !defined(QT_NO_COP) 129#if QT_VERSION >= 232 && !defined(QT_NO_COP)
136 if ( appl ) { 130 if ( appl ) {
137 QTime *t = appl->dict.find( "QPE/Application/" + name ); 131 QTime *t = appl->dict.find( "QPE/Application/" + name );
138 if ( !t ) 132 if ( !t )
139 return FALSE; 133 return FALSE;
140 if ( t->elapsed() > 10000 ) { 134 if ( t->elapsed() > 10000 ) {
141 // timeout in case of crash or something 135 // timeout in case of crash or something
142 appl->dict.remove( "QPE/Application/" + name ); 136 appl->dict.remove( "QPE/Application/" + name );
143 return FALSE; 137 return FALSE;
144 } 138 }
145 return TRUE; 139 return TRUE;
146 } 140 }
147#endif 141#endif
148 return FALSE; 142 return FALSE;
149} 143}
150 144
151void StartingAppList::handleNewChannel( const QString & name ) 145void StartingAppList::handleNewChannel( const QString & name )
152{ 146{
153#if QT_VERSION >= 232 && !defined(QT_NO_COP) 147#if QT_VERSION >= 232 && !defined(QT_NO_COP)
154 dict.remove( name ); 148 dict.remove( name );
155#endif 149#endif
156} 150}
157 151
158static bool docDirCreated = FALSE; 152static bool docDirCreated = FALSE;
159static QDawg* fixed_dawg = 0; 153static QDawg* fixed_dawg = 0;
160static QDict<QDawg> *named_dawg = 0; 154static QDict<QDawg> *named_dawg = 0;
161 155
162static QString qpeDir() 156static QString qpeDir()
163{ 157{
164 QString dir = getenv("OPIEDIR"); 158 QString dir = getenv("OPIEDIR");
165 if ( dir.isEmpty() ) dir = ".."; 159 if ( dir.isEmpty() ) dir = "..";
166 return dir; 160 return dir;
167} 161}
@@ -348,164 +342,164 @@ void Global::addWords(const QString& dictname, const QStringList& wordlist)
348 342
349 // #### Re-read the dawg here if we use mmap(). 343 // #### Re-read the dawg here if we use mmap().
350 344
351 // #### Signal other processes to re-read. 345 // #### Signal other processes to re-read.
352} 346}
353 347
354 348
355/*! 349/*!
356 Returns the full path for the application called \a appname, with the 350 Returns the full path for the application called \a appname, with the
357 given \a filename. Returns QString::null if there was a problem creating 351 given \a filename. Returns QString::null if there was a problem creating
358 the directory tree for \a appname. 352 the directory tree for \a appname.
359 If \a filename contains "/", it is the caller's responsibility to 353 If \a filename contains "/", it is the caller's responsibility to
360 ensure that those directories exist. 354 ensure that those directories exist.
361*/ 355*/
362QString Global::applicationFileName(const QString& appname, const QString& filename) 356QString Global::applicationFileName(const QString& appname, const QString& filename)
363{ 357{
364 QDir d; 358 QDir d;
365 QString r = getenv("HOME"); 359 QString r = getenv("HOME");
366 r += "/Applications/"; 360 r += "/Applications/";
367 if ( !QFile::exists( r ) ) 361 if ( !QFile::exists( r ) )
368 if ( d.mkdir(r) == false ) 362 if ( d.mkdir(r) == false )
369 return QString::null; 363 return QString::null;
370 r += appname; 364 r += appname;
371 if ( !QFile::exists( r ) ) 365 if ( !QFile::exists( r ) )
372 if ( d.mkdir(r) == false ) 366 if ( d.mkdir(r) == false )
373 return QString::null; 367 return QString::null;
374 r += "/"; r += filename; 368 r += "/"; r += filename;
375 return r; 369 return r;
376} 370}
377 371
378/*! 372/*!
379 \internal 373 \internal
380*/ 374*/
381void Global::createDocDir() 375void Global::createDocDir()
382{ 376{
383 if ( !docDirCreated ) { 377 if ( !docDirCreated ) {
384 docDirCreated = TRUE; 378 docDirCreated = TRUE;
385 mkdir( QPEApplication::documentDir().latin1(), 0755 ); 379 mkdir( QPEApplication::documentDir().latin1(), 0755 );
386 } 380 }
387} 381}
388 382
389 383
390/*! 384/*!
391 Displays a status \a message to the user. This usually appears 385 Displays a status \a message to the user. This usually appears
392 in the taskbar for a short amount of time, then disappears. 386 in the taskbar for a short amount of time, then disappears.
393*/ 387*/
394void Global::statusMessage(const QString& message) 388void Global::statusMessage(const QString& message)
395{ 389{
396#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 390#if!defined(QT_NO_COP)
397 QCopEnvelope e( "QPE/TaskBar", "message(QString)" ); 391 QCopEnvelope e( "QPE/TaskBar", "message(QString)" );
398 e << message; 392 e << message;
399#endif 393#endif
400} 394}
401 395
402/*! 396/*!
403 \internal 397 \internal
404*/ 398*/
405void Global::applyStyle() 399void Global::applyStyle()
406{ 400{
407#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 401#if !defined(QT_NO_COP)
408 QCopChannel::send( "QPE/System", "applyStyle()" ); 402 QCopChannel::send( "QPE/System", "applyStyle()" );
409#else 403#else
410 ((QPEApplication *)qApp)->applyStyle(); // apply without needing QCop for floppy version 404 ((QPEApplication *)qApp)->applyStyle(); // apply without needing QCop for floppy version
411#endif 405#endif
412} 406}
413 407
414/*! 408/*!
415 \internal 409 \internal
416*/ 410*/
417QWidget *Global::shutdown( bool ) 411QWidget *Global::shutdown( bool )
418{ 412{
419#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 413#if !defined(QT_NO_COP)
420 QCopChannel::send( "QPE/System", "shutdown()" ); 414 QCopChannel::send( "QPE/System", "shutdown()" );
421#endif 415#endif
422 return 0; 416 return 0;
423} 417}
424 418
425/*! 419/*!
426 \internal 420 \internal
427*/ 421*/
428QWidget *Global::restart( bool ) 422QWidget *Global::restart( bool )
429{ 423{
430#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 424#if !defined(QT_NO_COP)
431 QCopChannel::send( "QPE/System", "restart()" ); 425 QCopChannel::send( "QPE/System", "restart()" );
432#endif 426#endif
433 return 0; 427 return 0;
434} 428}
435 429
436/*! 430/*!
437 Explicitly show the current input method. 431 Explicitly show the current input method.
438 432
439 Input methods are indicated in the taskbar by a small icon. If the 433 Input methods are indicated in the taskbar by a small icon. If the
440 input method is activated (shown) then it takes up some proportion 434 input method is activated (shown) then it takes up some proportion
441 of the bottom of the screen, to allow the user to interact (input 435 of the bottom of the screen, to allow the user to interact (input
442 characters) with it. 436 characters) with it.
443 437
444 \sa hideInputMethod() 438 \sa hideInputMethod()
445*/ 439*/
446void Global::showInputMethod() 440void Global::showInputMethod()
447{ 441{
448#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 442#if !defined(QT_NO_COP)
449 QCopChannel::send( "QPE/TaskBar", "showInputMethod()" ); 443 QCopChannel::send( "QPE/TaskBar", "showInputMethod()" );
450#endif 444#endif
451} 445}
452 446
453/*! 447/*!
454 Explicitly hide the current input method. 448 Explicitly hide the current input method.
455 449
456 The current input method is still indicated in the taskbar, but no 450 The current input method is still indicated in the taskbar, but no
457 longer takes up screen space, and can no longer be interacted with. 451 longer takes up screen space, and can no longer be interacted with.
458 452
459 \sa showInputMethod() 453 \sa showInputMethod()
460*/ 454*/
461void Global::hideInputMethod() 455void Global::hideInputMethod()
462{ 456{
463#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 457#if !defined(QT_NO_COP)
464 QCopChannel::send( "QPE/TaskBar", "hideInputMethod()" ); 458 QCopChannel::send( "QPE/TaskBar", "hideInputMethod()" );
465#endif 459#endif
466} 460}
467 461
468 462
469/*! 463/*!
470 \internal 464 \internal
471*/ 465*/
472bool Global::isBuiltinCommand( const QString &name ) 466bool Global::isBuiltinCommand( const QString &name )
473{ 467{
474 if(!builtin) 468 if(!builtin)
475 return FALSE; // yes, it can happen 469 return FALSE; // yes, it can happen
476 for (int i = 0; builtin[i].file; i++) { 470 for (int i = 0; builtin[i].file; i++) {
477 if ( builtin[i].file == name ) { 471 if ( builtin[i].file == name ) {
478 return TRUE; 472 return TRUE;
479 } 473 }
480 } 474 }
481 return FALSE; 475 return FALSE;
482} 476}
483 477
484Global::Command* Global::builtin=0; 478Global::Command* Global::builtin=0;
485QGuardedPtr<QWidget> *Global::running=0; 479QGuardedPtr<QWidget> *Global::running=0;
486 480
487/*! 481/*!
488 \class Global::Command 482 \class Global::Command
489 \brief The Global::Command class is internal. 483 \brief The Global::Command class is internal.
490 \internal 484 \internal
491*/ 485*/
492 486
493/*! 487/*!
494 \internal 488 \internal
495*/ 489*/
496void Global::setBuiltinCommands( Command* list ) 490void Global::setBuiltinCommands( Command* list )
497{ 491{
498 if ( running ) 492 if ( running )
499 delete [] running; 493 delete [] running;
500 494
501 builtin = list; 495 builtin = list;
502 int count = 0; 496 int count = 0;
503 if (!builtin) 497 if (!builtin)
504 return; 498 return;
505 while ( builtin[count].file ) 499 while ( builtin[count].file )
506 count++; 500 count++;
507 501
508 running = new QGuardedPtr<QWidget> [ count ]; 502 running = new QGuardedPtr<QWidget> [ count ];
509} 503}
510 504
511/*! 505/*!
@@ -514,214 +508,214 @@ void Global::setBuiltinCommands( Command* list )
514void Global::setDocument( QWidget* receiver, const QString& document ) 508void Global::setDocument( QWidget* receiver, const QString& document )
515{ 509{
516 Emitter emitter(receiver,document); 510 Emitter emitter(receiver,document);
517} 511}
518 512
519/*! 513/*!
520 \internal 514 \internal
521*/ 515*/
522bool Global::terminateBuiltin( const QString& n ) 516bool Global::terminateBuiltin( const QString& n )
523{ 517{
524 if (!builtin) 518 if (!builtin)
525 return FALSE; 519 return FALSE;
526 for (int i = 0; builtin[i].file; i++) { 520 for (int i = 0; builtin[i].file; i++) {
527 if ( builtin[i].file == n ) { 521 if ( builtin[i].file == n ) {
528 delete running[i]; 522 delete running[i];
529 return TRUE; 523 return TRUE;
530 } 524 }
531 } 525 }
532 return FALSE; 526 return FALSE;
533} 527}
534 528
535/*! 529/*!
536 \internal 530 \internal
537*/ 531*/
538void Global::terminate( const AppLnk* app ) 532void Global::terminate( const AppLnk* app )
539{ 533{
540 //if ( terminateBuiltin(app->exec()) ) return; // maybe? haven't tried this 534 //if ( terminateBuiltin(app->exec()) ) return; // maybe? haven't tried this
541 535
542#ifndef QT_NO_COP 536#ifndef QT_NO_COP
543 QCString channel = "QPE/Application/" + app->exec().utf8(); 537 QCString channel = "QPE/Application/" + app->exec().utf8();
544 if ( QCopChannel::isRegistered(channel) ) { 538 if ( QCopChannel::isRegistered(channel) ) {
545 QCopEnvelope e(channel, "quit()"); 539 QCopEnvelope e(channel, "quit()");
546 } 540 }
547#endif 541#endif
548} 542}
549 543
550/*! 544/*!
551 Low-level function to run command \a c. 545 Low-level function to run command \a c.
552 546
553 \warning Do not use this function. Use execute instead. 547 \warning Do not use this function. Use execute instead.
554 548
555 \sa execute() 549 \sa execute()
556*/ 550*/
557void Global::invoke(const QString &c) 551void Global::invoke(const QString &c)
558{ 552{
559 // Convert the command line in to a list of arguments 553 // Convert the command line in to a list of arguments
560 QStringList list = QStringList::split(QRegExp(" *"),c); 554 QStringList list = QStringList::split(QRegExp(" *"),c);
561 555
562#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 556#if !defined(QT_NO_COP)
563 QString ap=list[0]; 557 QString ap=list[0];
564 // see if the application is already running 558 // see if the application is already running
565 // XXX should lock file /tmp/qcop-msg-ap 559 // XXX should lock file /tmp/qcop-msg-ap
566 if ( QCopChannel::isRegistered( ("QPE/Application/" + ap).latin1() ) ) { 560 if ( QCopChannel::isRegistered( ("QPE/Application/" + ap).latin1() ) ) {
567 // If the channel is already register, the app is already running, so show it. 561 // If the channel is already register, the app is already running, so show it.
568 { QCopEnvelope env( ("QPE/Application/" + ap).latin1(), "raise()" ); } 562 { QCopEnvelope env( ("QPE/Application/" + ap).latin1(), "raise()" ); }
569 563
570 QCopEnvelope e("QPE/System", "notBusy(QString)" ); 564 QCopEnvelope e("QPE/System", "notBusy(QString)" );
571 e << ap; 565 e << ap;
572 return; 566 return;
573 } 567 }
574 // XXX should unlock file /tmp/qcop-msg-ap 568 // XXX should unlock file /tmp/qcop-msg-ap
575 //see if it is being started 569 //see if it is being started
576 if ( StartingAppList::isStarting( ap ) ) { 570 if ( StartingAppList::isStarting( ap ) ) {
577 QCopEnvelope e("QPE/System", "notBusy(QString)" ); 571 QCopEnvelope e("QPE/System", "notBusy(QString)" );
578 e << ap; 572 e << ap;
579 return; 573 return;
580 } 574 }
581 575
582#endif 576#endif
583 577
584#ifdef QT_NO_QWS_MULTIPROCESS 578#ifdef QT_NO_QWS_MULTIPROCESS
585 QMessageBox::warning( 0, "Error", "Could not find the application " + c, "Ok", 0, 0, 0, 1 ); 579 QMessageBox::warning( 0, "Error", "Could not find the application " + c, "Ok", 0, 0, 0, 1 );
586#else 580#else
587 581
588 QStrList slist; 582 QStrList slist;
589 unsigned int j; 583 unsigned int j;
590 for ( j = 0; j < list.count(); j++ ) 584 for ( j = 0; j < list.count(); j++ )
591 slist.append( list[j].utf8() ); 585 slist.append( list[j].utf8() );
592 586
593 const char **args = new (const char *)[slist.count() + 1]; 587 const char **args = new (const char *)[slist.count() + 1];
594 for ( j = 0; j < slist.count(); j++ ) 588 for ( j = 0; j < slist.count(); j++ )
595 args[j] = slist.at(j); 589 args[j] = slist.at(j);
596 args[j] = NULL; 590 args[j] = NULL;
597 591
598#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 592#if !defined(QT_NO_COP)
599 // an attempt to show a wait... 593 // an attempt to show a wait...
600 // more logic should be used, but this will be fine for the moment... 594 // more logic should be used, but this will be fine for the moment...
601 QCopEnvelope ( "QPE/System", "busy()" ); 595 QCopEnvelope ( "QPE/System", "busy()" );
602#endif 596#endif
603 597
604#ifdef HAVE_QUICKEXEC 598#ifdef HAVE_QUICKEXEC
605 QString libexe = qpeDir()+"/binlib/lib"+args[0] + ".so"; 599 QString libexe = qpeDir()+"/binlib/lib"+args[0] + ".so";
606 qDebug("libfile = %s", libexe.latin1() ); 600 qDebug("libfile = %s", libexe.latin1() );
607 if ( QFile::exists( libexe ) ) { 601 if ( QFile::exists( libexe ) ) {
608 qDebug("calling quickexec %s", libexe.latin1() ); 602 qDebug("calling quickexec %s", libexe.latin1() );
609 quickexecv( libexe.utf8().data(), (const char **)args ); 603 quickexecv( libexe.utf8().data(), (const char **)args );
610 } else 604 } else
611#endif 605#endif
612 { 606 {
613 if ( !::vfork() ) { 607 if ( !::vfork() ) {
614 for ( int fd = 3; fd < 100; fd++ ) 608 for ( int fd = 3; fd < 100; fd++ )
615 ::close( fd ); 609 ::close( fd );
616 ::setpgid( ::getpid(), ::getppid() ); 610 ::setpgid( ::getpid(), ::getppid() );
617 // Try bindir first, so that foo/bar works too 611 // Try bindir first, so that foo/bar works too
618 ::execv( qpeDir()+"/bin/"+args[0], (char * const *)args ); 612 ::execv( qpeDir()+"/bin/"+args[0], (char * const *)args );
619 ::execvp( args[0], (char * const *)args ); 613 ::execvp( args[0], (char * const *)args );
620 _exit( -1 ); 614 _exit( -1 );
621 } 615 }
622 } 616 }
623 StartingAppList::add( list[0] ); 617 StartingAppList::add( list[0] );
624#endif //QT_NO_QWS_MULTIPROCESS 618#endif //QT_NO_QWS_MULTIPROCESS
625} 619}
626 620
627 621
628/*! 622/*!
629 Executes the application identfied by \a c, passing \a 623 Executes the application identfied by \a c, passing \a
630 document if it isn't null. 624 document if it isn't null.
631 625
632 Note that a better approach might be to send a QCop message to the 626 Note that a better approach might be to send a QCop message to the
633 application's QPE/Application/\e{appname} channel. 627 application's QPE/Application/\e{appname} channel.
634*/ 628*/
635void Global::execute( const QString &c, const QString& document ) 629void Global::execute( const QString &c, const QString& document )
636{ 630{
637 if ( qApp->type() != QApplication::GuiServer ) { 631 if ( qApp->type() != QApplication::GuiServer ) {
638 // ask the server to do the work 632 // ask the server to do the work
639#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 633#if !defined(QT_NO_COP)
640 if ( document.isNull() ) { 634 if ( document.isNull() ) {
641 QCopEnvelope e( "QPE/System", "execute(QString)" ); 635 QCopEnvelope e( "QPE/System", "execute(QString)" );
642 e << c; 636 e << c;
643 } else { 637 } else {
644 QCopEnvelope e( "QPE/System", "execute(QString,QString)" ); 638 QCopEnvelope e( "QPE/System", "execute(QString,QString)" );
645 e << c << document; 639 e << c << document;
646 } 640 }
647#endif 641#endif
648 return; 642 return;
649 } 643 }
650 644
651 // Attempt to execute the app using a builtin class for the app first 645 // Attempt to execute the app using a builtin class for the app first
652 // else try and find it in the bin directory 646 // else try and find it in the bin directory
653 if (builtin) { 647 if (builtin) {
654 for (int i = 0; builtin[i].file; i++) { 648 for (int i = 0; builtin[i].file; i++) {
655 if ( builtin[i].file == c ) { 649 if ( builtin[i].file == c ) {
656 if ( running[i] ) { 650 if ( running[i] ) {
657 if ( !document.isNull() && builtin[i].documentary ) 651 if ( !document.isNull() && builtin[i].documentary )
658 setDocument(running[i], document); 652 setDocument(running[i], document);
659 running[i]->raise(); 653 running[i]->raise();
660 running[i]->show(); 654 running[i]->show();
661 running[i]->setActiveWindow(); 655 running[i]->setActiveWindow();
662 } else { 656 } else {
663 running[i] = builtin[i].func( builtin[i].maximized ); 657 running[i] = builtin[i].func( builtin[i].maximized );
664 } 658 }
665#ifndef QT_NO_COP 659#ifndef QT_NO_COP
666 QCopEnvelope e("QPE/System", "notBusy(QString)" ); 660 QCopEnvelope e("QPE/System", "notBusy(QString)" );
667 e << c; // that was quick ;-) 661 e << c; // that was quick ;-)
668#endif 662#endif
669 return; 663 return;
670 } 664 }
671 } 665 }
672 } 666 }
673 667
674 //Global::invoke(c, document); 668 //Global::invoke(c, document);
675 669
676 // Convert the command line in to a list of arguments 670 // Convert the command line in to a list of arguments
677 QStringList list = QStringList::split(QRegExp(" *"),c); 671 QStringList list = QStringList::split(QRegExp(" *"),c);
678 672
679#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 673#if !defined(QT_NO_COP)
680 QString ap=list[0]; 674 QString ap=list[0];
681 675
682 qDebug("executing %s", ap.latin1() ); 676 qDebug("executing %s", ap.latin1() );
683 677
684 /* if need be, sending a qcop message will result in an invoke, see 678 /* if need be, sending a qcop message will result in an invoke, see
685 preceeding function */ 679 preceeding function */
686 invoke( ap ); 680 invoke( ap );
687 //{ QCopEnvelope env( ("QPE/Application/" + ap).latin1(), "raise()" ); } 681 //{ QCopEnvelope env( ("QPE/Application/" + ap).latin1(), "raise()" ); }
688 if ( !document.isEmpty() ) { 682 if ( !document.isEmpty() ) {
689 QCopEnvelope env( ("QPE/Application/" + ap).latin1(), "setDocument(QString)" ); 683 QCopEnvelope env( ("QPE/Application/" + ap).latin1(), "setDocument(QString)" );
690 env << document; 684 env << document;
691 } 685 }
692#endif 686#endif
693} 687}
694 688
695/*! 689/*!
696 Returns the string \a s with the characters '\', '"', and '$' quoted 690 Returns the string \a s with the characters '\', '"', and '$' quoted
697 by a preceeding '\'. 691 by a preceeding '\'.
698 692
699 \sa stringQuote() 693 \sa stringQuote()
700*/ 694*/
701QString Global::shellQuote(const QString& s) 695QString Global::shellQuote(const QString& s)
702{ 696{
703 QString r="\""; 697 QString r="\"";
704 for (int i=0; i<(int)s.length(); i++) { 698 for (int i=0; i<(int)s.length(); i++) {
705 char c = s[i].latin1(); 699 char c = s[i].latin1();
706 switch (c) { 700 switch (c) {
707 case '\\': case '"': case '$': 701 case '\\': case '"': case '$':
708 r+="\\"; 702 r+="\\";
709 } 703 }
710 r += s[i]; 704 r += s[i];
711 } 705 }
712 r += "\""; 706 r += "\"";
713 return r; 707 return r;
714} 708}
715 709
716/*! 710/*!
717 Returns the string \a s with the characters '\' and '"' quoted by a 711 Returns the string \a s with the characters '\' and '"' quoted by a
718 preceeding '\'. 712 preceeding '\'.
719 713
720 \sa shellQuote() 714 \sa shellQuote()
721*/ 715*/
722QString Global::stringQuote(const QString& s) 716QString Global::stringQuote(const QString& s)
723{ 717{
724 QString r="\""; 718 QString r="\"";
725 for (int i=0; i<(int)s.length(); i++) { 719 for (int i=0; i<(int)s.length(); i++) {
726 char c = s[i].latin1(); 720 char c = s[i].latin1();
727 switch (c) { 721 switch (c) {
diff --git a/library/ir.cpp b/library/ir.cpp
index a7cf7b1..b5b726d 100644
--- a/library/ir.cpp
+++ b/library/ir.cpp
@@ -1,75 +1,73 @@
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 "ir.h" 21#include "ir.h"
22 22
23#include <qstring.h> 23#include <qstring.h>
24#ifdef QWS
25#include "qcopenvelope_qws.h" 24#include "qcopenvelope_qws.h"
26#include <qcopchannel_qws.h> 25#include <qcopchannel_qws.h>
27#endif
28#include "applnk.h" 26#include "applnk.h"
29 27
30/*! 28/*!
31 \class Ir ir.h 29 \class Ir ir.h
32 \brief The Ir class implements basic support for sending objects over an 30 \brief The Ir class implements basic support for sending objects over an
33 infrared communication link. 31 infrared communication link.
34 32
35 Both \link doclnk.html DocLnk\endlink objects and files can be 33 Both \link doclnk.html DocLnk\endlink objects and files can be
36 sent to another device via the infrared link using the send() 34 sent to another device via the infrared link using the send()
37 function. When the send has completed the done() signal is 35 function. When the send has completed the done() signal is
38 emitted. 36 emitted.
39 37
40 The supported() function returns whether the device supports 38 The supported() function returns whether the device supports
41 infrared communication or not. 39 infrared communication or not.
42 40
43 \ingroup qtopiaemb 41 \ingroup qtopiaemb
44*/ 42*/
45 43
46/*! 44/*!
47 Constructs an Ir object. The \a parent and \a name classes are the 45 Constructs an Ir object. The \a parent and \a name classes are the
48 standard QObject parameters. 46 standard QObject parameters.
49*/ 47*/
50Ir::Ir( QObject *parent, const char *name ) 48Ir::Ir( QObject *parent, const char *name )
51 : QObject( parent, name ) 49 : QObject( parent, name )
52{ 50{
53#ifndef QT_NO_COP 51#ifndef QT_NO_COP
54 ch = new QCopChannel( "QPE/Obex" ); 52 ch = new QCopChannel( "QPE/Obex" );
55 connect( ch, SIGNAL(received(const QCString &, const QByteArray &)), 53 connect( ch, SIGNAL(received(const QCString &, const QByteArray &)),
56 this, SLOT(obexMessage( const QCString &, const QByteArray &)) ); 54 this, SLOT(obexMessage( const QCString &, const QByteArray &)) );
57#endif 55#endif
58} 56}
59 57
60/*! 58/*!
61 Returns TRUE if the system supports infrared communication; 59 Returns TRUE if the system supports infrared communication;
62 otherwise returns FALSE. 60 otherwise returns FALSE.
63*/ 61*/
64bool Ir::supported() 62bool Ir::supported()
65{ 63{
66#ifndef QT_NO_COP 64#ifndef QT_NO_COP
67 return QCopChannel::isRegistered( "QPE/Obex" ); 65 return QCopChannel::isRegistered( "QPE/Obex" );
68#endif 66#endif
69} 67}
70 68
71/*! 69/*!
72 Sends the object in file \a fn over the infrared link. The \a 70 Sends the object in file \a fn over the infrared link. The \a
73 description is used in the text shown to the user while sending 71 description is used in the text shown to the user while sending
74 is in progress. The optional \a mimetype parameter specifies the 72 is in progress. The optional \a mimetype parameter specifies the
75 mimetype of the object. If this parameter is not set, it is 73 mimetype of the object. If this parameter is not set, it is
diff --git a/library/lnkproperties.cpp b/library/lnkproperties.cpp
index 0b50bae..50cf5af 100644
--- a/library/lnkproperties.cpp
+++ b/library/lnkproperties.cpp
@@ -1,83 +1,81 @@
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// WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT 21// WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT
22// have this class. 22// have this class.
23#define QTOPIA_INTERNAL_FSLP 23#define QTOPIA_INTERNAL_FSLP
24#include "lnkproperties.h" 24#include "lnkproperties.h"
25#include "lnkproperties.h" 25#include "lnkproperties.h"
26#include "lnkpropertiesbase_p.h" 26#include "lnkpropertiesbase_p.h"
27#include "ir.h" 27#include "ir.h"
28 28
29#include <qpe/qpeapplication.h> 29#include <qpe/qpeapplication.h>
30#include <qpe/applnk.h> 30#include <qpe/applnk.h>
31#include <qpe/global.h> 31#include <qpe/global.h>
32#include <qpe/categorywidget.h> 32#include <qpe/categorywidget.h>
33#ifdef QWS
34#include <qpe/qcopenvelope_qws.h> 33#include <qpe/qcopenvelope_qws.h>
35#endif
36#include <qpe/filemanager.h> 34#include <qpe/filemanager.h>
37#include <qpe/config.h> 35#include <qpe/config.h>
38#include <qpe/storage.h> 36#include <qpe/storage.h>
39#include <qpe/qpemessagebox.h> 37#include <qpe/qpemessagebox.h>
40#include <qpe/mimetype.h> 38#include <qpe/mimetype.h>
41 39
42#include <qlineedit.h> 40#include <qlineedit.h>
43#include <qtoolbutton.h> 41#include <qtoolbutton.h>
44#include <qpushbutton.h> 42#include <qpushbutton.h>
45#include <qgroupbox.h> 43#include <qgroupbox.h>
46#include <qcheckbox.h> 44#include <qcheckbox.h>
47#include <qlabel.h> 45#include <qlabel.h>
48#include <qlayout.h> 46#include <qlayout.h>
49#include <qfile.h> 47#include <qfile.h>
50#include <qfileinfo.h> 48#include <qfileinfo.h>
51#include <qmessagebox.h> 49#include <qmessagebox.h>
52#include <qsize.h> 50#include <qsize.h>
53#include <qcombobox.h> 51#include <qcombobox.h>
54#include <qregexp.h> 52#include <qregexp.h>
55#include <qbuttongroup.h> 53#include <qbuttongroup.h>
56 54
57#include <stdlib.h> 55#include <stdlib.h>
58 56
59LnkProperties::LnkProperties( AppLnk* l, QWidget* parent ) 57LnkProperties::LnkProperties( AppLnk* l, QWidget* parent )
60 : QDialog( parent, 0, TRUE ), lnk(l), fileSize( 0 ) 58 : QDialog( parent, 0, TRUE ), lnk(l), fileSize( 0 )
61{ 59{
62 setCaption( tr("Properties") ); 60 setCaption( tr("Properties") );
63 61
64 QVBoxLayout *vbox = new QVBoxLayout( this ); 62 QVBoxLayout *vbox = new QVBoxLayout( this );
65 d = new LnkPropertiesBase( this ); 63 d = new LnkPropertiesBase( this );
66 vbox->add( d ); 64 vbox->add( d );
67 65
68 d->docname->setText(l->name()); 66 d->docname->setText(l->name());
69 QString inf; 67 QString inf;
70 if ( l->type().isEmpty() ) { 68 if ( l->type().isEmpty() ) {
71 d->type->hide(); 69 d->type->hide();
72 d->typeLabel->hide(); 70 d->typeLabel->hide();
73 } else { 71 } else {
74 d->type->setText( l->type() ); 72 d->type->setText( l->type() );
75 } 73 }
76 74
77 if ( l->comment().isEmpty() ) { 75 if ( l->comment().isEmpty() ) {
78 d->comment->hide(); 76 d->comment->hide();
79 d->commentLabel->hide(); 77 d->commentLabel->hide();
80 } else { 78 } else {
81 d->comment->setText( l->comment() ); 79 d->comment->setText( l->comment() );
82 } 80 }
83 81
diff --git a/library/network.cpp b/library/network.cpp
index 185b147..3568809 100644
--- a/library/network.cpp
+++ b/library/network.cpp
@@ -1,78 +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#define QTOPIA_INTERNAL_LANGLIST 21#define QTOPIA_INTERNAL_LANGLIST
22#include "qpe/network.h" 22#include "qpe/network.h"
23#include "qpe/networkinterface.h" 23#include "qpe/networkinterface.h"
24#include "qpe/global.h" 24#include "qpe/global.h"
25#include "qpe/config.h" 25#include "qpe/config.h"
26#include "qpe/resource.h" 26#include "qpe/resource.h"
27#include "qpe/qpeapplication.h" 27#include "qpe/qpeapplication.h"
28#ifdef QWS
29#include <qpe/qcopenvelope_qws.h> 28#include <qpe/qcopenvelope_qws.h>
30#endif
31#include <qpe/qlibrary.h> 29#include <qpe/qlibrary.h>
32 30
33#include <qlistbox.h> 31#include <qlistbox.h>
34#include <qdir.h> 32#include <qdir.h>
35#include <qlayout.h> 33#include <qlayout.h>
36#include <qdict.h> 34#include <qdict.h>
37#include <qtranslator.h> 35#include <qtranslator.h>
38 36
39#include <stdlib.h> 37#include <stdlib.h>
40 38
41#ifndef QT_NO_COP 39#ifndef QT_NO_COP
42class NetworkEmitter : public QCopChannel { 40class NetworkEmitter : public QCopChannel {
43 Q_OBJECT 41 Q_OBJECT
44public: 42public:
45 NetworkEmitter() : QCopChannel("QPE/Network",qApp) 43 NetworkEmitter() : QCopChannel("QPE/Network",qApp)
46 { 44 {
47 } 45 }
48 46
49 void receive(const QCString &msg, const QByteArray&) 47 void receive(const QCString &msg, const QByteArray&)
50 { 48 {
51 if ( msg == "choicesChanged()" ) 49 if ( msg == "choicesChanged()" )
52 emit changed(); 50 emit changed();
53 } 51 }
54 52
55signals: 53signals:
56 void changed(); 54 void changed();
57}; 55};
58 56
59/*! 57/*!
60 \internal 58 \internal
61 59
62 Requests that the service \a choice be started. The \a password is 60 Requests that the service \a choice be started. The \a password is
63 the password to use if required. 61 the password to use if required.
64*/ 62*/
65void Network::start(const QString& choice, const QString& password) 63void Network::start(const QString& choice, const QString& password)
66{ 64{
67 QCopEnvelope e("QPE/Network", "start(QString,QString)"); 65 QCopEnvelope e("QPE/Network", "start(QString,QString)");
68 e << choice << password; 66 e << choice << password;
69} 67}
70 68
71/*! 69/*!
72 \class Network network.h 70 \class Network network.h
73 \brief The Network class provides network access functionality. 71 \brief The Network class provides network access functionality.
74 \internal 72 \internal
75*/ 73*/
76 74
77// copy the proxy settings of the active config over to the Proxies.conf file 75// copy the proxy settings of the active config over to the Proxies.conf file
78/*! 76/*!
diff --git a/library/networkinterface.cpp b/library/networkinterface.cpp
index 2b5c77e..0ba773a 100644
--- a/library/networkinterface.cpp
+++ b/library/networkinterface.cpp
@@ -1,98 +1,96 @@
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 "networkinterface.h" 21#include "networkinterface.h"
22#include "network.h" 22#include "network.h"
23#include "config.h" 23#include "config.h"
24#include <stdio.h> 24#include <stdio.h>
25 25
26QString NetworkInterface::device( Config& cfg ) const 26QString NetworkInterface::device( Config& cfg ) const
27{ 27{
28 return cfg.readEntry("Device"); 28 return cfg.readEntry("Device");
29} 29}
30 30
31bool NetworkInterface::isActive( Config& cfg ) const 31bool NetworkInterface::isActive( Config& cfg ) const
32{ 32{
33 QString dev = device(cfg); 33 QString dev = device(cfg);
34 if ( dev.isEmpty() ) 34 if ( dev.isEmpty() )
35 return FALSE; 35 return FALSE;
36 QString dev0 = dev+'0'; 36 QString dev0 = dev+'0';
37 37
38 FILE* f; 38 FILE* f;
39 f = fopen("/proc/net/dev", "r"); 39 f = fopen("/proc/net/dev", "r");
40 if ( f ) { 40 if ( f ) {
41 char line[1024]; 41 char line[1024];
42 char devname[80]; 42 char devname[80];
43 while ( fgets( line, 1024, f ) ) { 43 while ( fgets( line, 1024, f ) ) {
44 if ( sscanf(line," %[^:]:", devname)==1 ) 44 if ( sscanf(line," %[^:]:", devname)==1 )
45 { 45 {
46 if ( devname == dev || devname == dev0 ) { 46 if ( devname == dev || devname == dev0 ) {
47 fclose(f); 47 fclose(f);
48#ifdef QWS
49 Network::writeProxySettings( cfg ); 48 Network::writeProxySettings( cfg );
50#endif
51 return TRUE; 49 return TRUE;
52 } 50 }
53 } 51 }
54 } 52 }
55 fclose(f); 53 fclose(f);
56 } 54 }
57 return FALSE; 55 return FALSE;
58} 56}
59 57
60QString NetworkInterface::cardType( Config& cfg ) const 58QString NetworkInterface::cardType( Config& cfg ) const
61{ 59{
62 return cfg.readEntry("CardType"); 60 return cfg.readEntry("CardType");
63} 61}
64 62
65bool NetworkInterface::isAvailable( Config& cfg ) const 63bool NetworkInterface::isAvailable( Config& cfg ) const
66{ 64{
67 QString ct = cardType(cfg); 65 QString ct = cardType(cfg);
68 if ( ct.isEmpty() ) 66 if ( ct.isEmpty() )
69 return FALSE; 67 return FALSE;
70 68
71 FILE* f = fopen("/var/run/stab", "r"); 69 FILE* f = fopen("/var/run/stab", "r");
72 if (!f) f = fopen("/var/state/pcmcia/stab", "r"); 70 if (!f) f = fopen("/var/state/pcmcia/stab", "r");
73 if (!f) f = fopen("/var/lib/pcmcia/stab", "r"); 71 if (!f) f = fopen("/var/lib/pcmcia/stab", "r");
74 72
75 if ( f ) { 73 if ( f ) {
76 char line[1024]; 74 char line[1024];
77 char devtype[80]; 75 char devtype[80];
78 while ( fgets( line, 1024, f ) ) { 76 while ( fgets( line, 1024, f ) ) {
79 if ( sscanf(line,"%*d %s %*s", devtype )==1 ) 77 if ( sscanf(line,"%*d %s %*s", devtype )==1 )
80 { 78 {
81 if ( ct == devtype ) { 79 if ( ct == devtype ) {
82 fclose(f); 80 fclose(f);
83 return TRUE; 81 return TRUE;
84 } 82 }
85 } 83 }
86 } 84 }
87 fclose(f); 85 fclose(f);
88 } 86 }
89 87
90 return FALSE; 88 return FALSE;
91} 89}
92 90
93bool NetworkInterface::start( Config& cfg, const QString& /*password*/ ) 91bool NetworkInterface::start( Config& cfg, const QString& /*password*/ )
94{ 92{
95 return start(cfg); 93 return start(cfg);
96} 94}
97 95
98bool NetworkInterface::needPassword( Config& ) const 96bool NetworkInterface::needPassword( Config& ) const
diff --git a/library/password.cpp b/library/password.cpp
index 41b3358..4b22b65 100644
--- a/library/password.cpp
+++ b/library/password.cpp
@@ -1,80 +1,78 @@
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#include "password.h" 20#include "password.h"
21#include "config.h" 21#include "config.h"
22#include "global.h" 22#include "global.h"
23#include "backend/contact.h" 23#include "backend/contact.h"
24#include <qlabel.h> 24#include <qlabel.h>
25#include <qlineedit.h> 25#include <qlineedit.h>
26#include <qtextview.h> 26#include <qtextview.h>
27#include <qstring.h> 27#include <qstring.h>
28#include <qapplication.h> 28#include <qapplication.h>
29#include <qfile.h> 29#include <qfile.h>
30#ifdef QWS
31#include <qwindowsystem_qws.h> 30#include <qwindowsystem_qws.h>
32#endif
33 31
34#include <qdialog.h> 32#include <qdialog.h>
35 33
36#include <unistd.h> //for sleep 34#include <unistd.h> //for sleep
37#include "passwordbase_p.h" 35#include "passwordbase_p.h"
38 36
39class PasswordDialog : public PasswordBase 37class PasswordDialog : public PasswordBase
40{ 38{
41 Q_OBJECT 39 Q_OBJECT
42 40
43public: 41public:
44 PasswordDialog( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 42 PasswordDialog( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
45 ~PasswordDialog(); 43 ~PasswordDialog();
46 44
47 void clear(); 45 void clear();
48 void setPrompt( const QString& ); 46 void setPrompt( const QString& );
49 47
50signals: 48signals:
51 void passwordEntered( const QString& ); 49 void passwordEntered( const QString& );
52 50
53protected: 51protected:
54 bool eventFilter( QObject*, QEvent* ); 52 bool eventFilter( QObject*, QEvent* );
55 void keyPressEvent( QKeyEvent * ); 53 void keyPressEvent( QKeyEvent * );
56 54
57private: 55private:
58 void input( QString ); 56 void input( QString );
59 friend class Password; 57 friend class Password;
60 QString text; 58 QString text;
61}; 59};
62 60
63 61
64extern "C" char *crypt(const char *key, const char *salt); 62extern "C" char *crypt(const char *key, const char *salt);
65static QString qcrypt(const QString& k, const char *salt) 63static QString qcrypt(const QString& k, const char *salt)
66{ 64{
67 return QString::fromUtf8(crypt(k.utf8(),salt)); 65 return QString::fromUtf8(crypt(k.utf8(),salt));
68} 66}
69 67
70/* 68/*
71 * Constructs a PasswordDialog which is a child of 'parent', with the 69 * Constructs a PasswordDialog which is a child of 'parent', with the
72 * name 'name' and widget flags set to 'f' 70 * name 'name' and widget flags set to 'f'
73 */ 71 */
74PasswordDialog::PasswordDialog( QWidget* parent, const char* name, WFlags fl ) 72PasswordDialog::PasswordDialog( QWidget* parent, const char* name, WFlags fl )
75 : PasswordBase( parent, name, fl ) 73 : PasswordBase( parent, name, fl )
76{ 74{
77 QRect desk = qApp->desktop()->geometry(); 75 QRect desk = qApp->desktop()->geometry();
78 76
79 if ( desk.width() < 220 ) { 77 if ( desk.width() < 220 ) {
80 QFont f( font() ); 78 QFont f( font() );
diff --git a/library/qpedecoration_qws.cpp b/library/qpedecoration_qws.cpp
index 214c721..9cbe92b 100644
--- a/library/qpedecoration_qws.cpp
+++ b/library/qpedecoration_qws.cpp
@@ -1,68 +1,67 @@
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#ifdef QWS
21#define QTOPIA_INTERNAL_LANGLIST 20#define QTOPIA_INTERNAL_LANGLIST
22#include <qapplication.h> 21#include <qapplication.h>
23#include <qstyle.h> 22#include <qstyle.h>
24#include <qwidget.h> 23#include <qwidget.h>
25#include <qpainter.h> 24#include <qpainter.h>
26#include <qtimer.h> 25#include <qtimer.h>
27#include <qwhatsthis.h> 26#include <qwhatsthis.h>
28#include "qcopenvelope_qws.h" 27#include "qcopenvelope_qws.h"
29#include "qpedecoration_qws.h" 28#include "qpedecoration_qws.h"
30#include <qdialog.h> 29#include <qdialog.h>
31#include <qdrawutil.h> 30#include <qdrawutil.h>
32#include <qgfx_qws.h> 31#include <qgfx_qws.h>
33#include "qpeapplication.h" 32#include "qpeapplication.h"
34#include "resource.h" 33#include "resource.h"
35#include "global.h" 34#include "global.h"
36#include "qlibrary.h" 35#include "qlibrary.h"
37#include "windowdecorationinterface.h" 36#include "windowdecorationinterface.h"
38#include <qfile.h> 37#include <qfile.h>
39#include <qsignal.h> 38#include <qsignal.h>
40 39
41#include <stdlib.h> 40#include <stdlib.h>
42 41
43extern QRect qt_maxWindowRect; 42extern QRect qt_maxWindowRect;
44 43
45#define WHATSTHIS_MODE 44#define WHATSTHIS_MODE
46 45
47#ifndef QT_NO_QWS_QPE_WM_STYLE 46#ifndef QT_NO_QWS_QPE_WM_STYLE
48 47
49#ifndef QT_NO_IMAGEIO_XPM 48#ifndef QT_NO_IMAGEIO_XPM
50 49
51/* XPM */ 50/* XPM */
52static const char * const qpe_close_xpm[] = { 51static const char * const qpe_close_xpm[] = {
53"16 16 3 1", 52"16 16 3 1",
54" c None", 53" c None",
55". c #FFFFFF", 54". c #FFFFFF",
56"+ c #000000", 55"+ c #000000",
57" ", 56" ",
58" ", 57" ",
59" ..... ", 58" ..... ",
60" ..+++++.. ", 59" ..+++++.. ",
61" .+++++++++. ", 60" .+++++++++. ",
62" .+..+++..+. ", 61" .+..+++..+. ",
63" .++...+...++. ", 62" .++...+...++. ",
64" .+++.....+++. ", 63" .+++.....+++. ",
65" .++++...++++. ", 64" .++++...++++. ",
66" .+++.....+++. ", 65" .+++.....+++. ",
67" .++...+...++. ", 66" .++...+...++. ",
68" .+..+++..+. ", 67" .+..+++..+. ",
@@ -866,49 +865,48 @@ void QPEDecoration::minimize( QWidget *widget )
866 help( widget ); 865 help( widget );
867 } 866 }
868} 867}
869 868
870void QPEDecoration::help( QWidget *w ) 869void QPEDecoration::help( QWidget *w )
871{ 870{
872 if ( helpExists ) { 871 if ( helpExists ) {
873 Global::execute( "helpbrowser", helpFile ); 872 Global::execute( "helpbrowser", helpFile );
874 } else if ( w && w->testWFlags(Qt::WStyle_ContextHelp) ) { 873 } else if ( w && w->testWFlags(Qt::WStyle_ContextHelp) ) {
875 QWhatsThis::enterWhatsThisMode(); 874 QWhatsThis::enterWhatsThisMode();
876 QWhatsThis::leaveWhatsThisMode( qApp->tr( 875 QWhatsThis::leaveWhatsThisMode( qApp->tr(
877 "<Qt>Comprehensive help is not available for this application, " 876 "<Qt>Comprehensive help is not available for this application, "
878 "however there is context-sensitive help.<p>To use context-sensitive help:<p>" 877 "however there is context-sensitive help.<p>To use context-sensitive help:<p>"
879 "<ol><li>click and hold the help button." 878 "<ol><li>click and hold the help button."
880 "<li>when the title bar shows <b>What's this...</b>, " 879 "<li>when the title bar shows <b>What's this...</b>, "
881 "click on any control.</ol></Qt>" ) ); 880 "click on any control.</ol></Qt>" ) );
882 } 881 }
883} 882}
884 883
885void QPEDecoration::windowData( const QWidget *w, WindowDecorationInterface::WindowData &wd ) const 884void QPEDecoration::windowData( const QWidget *w, WindowDecorationInterface::WindowData &wd ) const
886{ 885{
887 wd.rect = w->rect(); 886 wd.rect = w->rect();
888 if ( qpeManager->whatsThisWidget() == w ) 887 if ( qpeManager->whatsThisWidget() == w )
889 wd.caption = qApp->tr("What's this..." ); 888 wd.caption = qApp->tr("What's this..." );
890 else 889 else
891 wd.caption = w->caption(); 890 wd.caption = w->caption();
892 wd.palette = qApp->palette(); 891 wd.palette = qApp->palette();
893 wd.flags = 0; 892 wd.flags = 0;
894 wd.flags |= w->isMaximized() ? WindowDecorationInterface::WindowData::Maximized : 0; 893 wd.flags |= w->isMaximized() ? WindowDecorationInterface::WindowData::Maximized : 0;
895 wd.flags |= w->testWFlags(Qt::WStyle_Dialog) ? WindowDecorationInterface::WindowData::Dialog : 0; 894 wd.flags |= w->testWFlags(Qt::WStyle_Dialog) ? WindowDecorationInterface::WindowData::Dialog : 0;
896 const QWidget *active = qpeManager->activeWidget(); 895 const QWidget *active = qpeManager->activeWidget();
897 wd.flags |= w == active ? WindowDecorationInterface::WindowData::Active : 0; 896 wd.flags |= w == active ? WindowDecorationInterface::WindowData::Active : 0;
898 wd.reserved = 1; 897 wd.reserved = 1;
899} 898}
900 899
901/* 900/*
902#ifndef QT_NO_POPUPMENU 901#ifndef QT_NO_POPUPMENU
903QPopupMenu *QPEDecoration::menu(QWSManager*, const QWidget*, const QPoint&) 902QPopupMenu *QPEDecoration::menu(QWSManager*, const QWidget*, const QPoint&)
904{ 903{
905 return 0; 904 return 0;
906} 905}
907#endif 906#endif
908*/ 907*/
909 908
910 909
911 910
912 911
913#endif // QT_NO_QWS_QPE_WM_STYLE 912#endif // QT_NO_QWS_QPE_WM_STYLE
914#endif
diff --git a/library/tzselect.cpp b/library/tzselect.cpp
index 9436867..2e5a433 100644
--- a/library/tzselect.cpp
+++ b/library/tzselect.cpp
@@ -1,125 +1,121 @@
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#define QTOPIA_INTERNAL_TZSELECT_INC_LOCAL 21#define QTOPIA_INTERNAL_TZSELECT_INC_LOCAL
22 22
23#include "tzselect.h" 23#include "tzselect.h"
24#include "resource.h" 24#include "resource.h"
25#include "global.h" 25#include "global.h"
26#include "config.h" 26#include "config.h"
27#include <qtoolbutton.h> 27#include <qtoolbutton.h>
28#include <qfile.h> 28#include <qfile.h>
29#include <stdlib.h> 29#include <stdlib.h>
30 30
31#ifdef Q_WS_QWS
32#include <qcopchannel_qws.h> 31#include <qcopchannel_qws.h>
33#endif
34 32
35class TimeZoneSelectorPrivate 33class TimeZoneSelectorPrivate
36{ 34{
37public: 35public:
38 TimeZoneSelectorPrivate() : includeLocal(FALSE) {} 36 TimeZoneSelectorPrivate() : includeLocal(FALSE) {}
39 bool includeLocal; 37 bool includeLocal;
40}; 38};
41 39
42TZCombo::TZCombo( QWidget *p, const char* n ) 40TZCombo::TZCombo( QWidget *p, const char* n )
43 : QComboBox( p, n ) 41 : QComboBox( p, n )
44{ 42{
45 updateZones(); 43 updateZones();
46 // check to see if TZ is set, if it is set the current item to that 44 // check to see if TZ is set, if it is set the current item to that
47 QString tz = getenv("TZ"); 45 QString tz = getenv("TZ");
48 if (parent()->inherits("TimeZoneSelector")) { 46 if (parent()->inherits("TimeZoneSelector")) {
49 if ( ((TimeZoneSelector *)parent())->localIncluded() ) { 47 if ( ((TimeZoneSelector *)parent())->localIncluded() ) {
50 // overide to the 'local' type. 48 // overide to the 'local' type.
51 tz = "None"; 49 tz = "None";
52 } 50 }
53 } 51 }
54 if ( !tz.isNull() ) { 52 if ( !tz.isNull() ) {
55 int n = 0, 53 int n = 0,
56 index = 0; 54 index = 0;
57 for ( QStringList::Iterator it=identifiers.begin(); 55 for ( QStringList::Iterator it=identifiers.begin();
58 it!=identifiers.end(); ++it) { 56 it!=identifiers.end(); ++it) {
59 if ( *it == tz ) 57 if ( *it == tz )
60 index = n; 58 index = n;
61 n++; 59 n++;
62 } 60 }
63 setCurrentItem(index); 61 setCurrentItem(index);
64 } else { 62 } else {
65 setCurrentItem(0); 63 setCurrentItem(0);
66 } 64 }
67 65
68 66
69 67
70 // listen on QPE/System 68 // listen on QPE/System
71#if defined(Q_WS_QWS)
72#if !defined(QT_NO_COP) 69#if !defined(QT_NO_COP)
73 QCopChannel *channel = new QCopChannel( "QPE/System", this ); 70 QCopChannel *channel = new QCopChannel( "QPE/System", this );
74 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 71 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
75 this, SLOT(handleSystemChannel(const QCString&, const QByteArray&)) ); 72 this, SLOT(handleSystemChannel(const QCString&, const QByteArray&)) );
76#endif 73#endif
77#endif
78 74
79 75
80} 76}
81 77
82TZCombo::~TZCombo() 78TZCombo::~TZCombo()
83{ 79{
84} 80}
85 81
86void TZCombo::updateZones() 82void TZCombo::updateZones()
87{ 83{
88 QString cur = currentText(); 84 QString cur = currentText();
89 clear(); 85 clear();
90 identifiers.clear(); 86 identifiers.clear();
91 int curix=0; 87 int curix=0;
92 QString tz = getenv("TZ"); 88 QString tz = getenv("TZ");
93 bool tzFound = FALSE; 89 bool tzFound = FALSE;
94 Config cfg("CityTime"); 90 Config cfg("CityTime");
95 cfg.setGroup("TimeZones"); 91 cfg.setGroup("TimeZones");
96 int listIndex = 0; 92 int listIndex = 0;
97 if (parent()->inherits("TimeZoneSelector")) { 93 if (parent()->inherits("TimeZoneSelector")) {
98 if ( ((TimeZoneSelector *)parent())->localIncluded() ) { 94 if ( ((TimeZoneSelector *)parent())->localIncluded() ) {
99 // overide to the 'local' type. 95 // overide to the 'local' type.
100 identifiers.append( "None" ); 96 identifiers.append( "None" );
101 insertItem( tr("None") ); 97 insertItem( tr("None") );
102 if ( cur == tr("None")) 98 if ( cur == tr("None"))
103 curix = 0; 99 curix = 0;
104 listIndex++; 100 listIndex++;
105 } 101 }
106 } 102 }
107 int cfgIndex = 0; 103 int cfgIndex = 0;
108 while (1) { 104 while (1) {
109 QString zn = cfg.readEntry("Zone"+QString::number(cfgIndex), QString::null); 105 QString zn = cfg.readEntry("Zone"+QString::number(cfgIndex), QString::null);
110 if ( zn.isNull() ) 106 if ( zn.isNull() )
111 break; 107 break;
112 if ( zn == tz ) 108 if ( zn == tz )
113 tzFound = TRUE; 109 tzFound = TRUE;
114 QString nm = cfg.readEntry("ZoneName"+QString::number(cfgIndex)); 110 QString nm = cfg.readEntry("ZoneName"+QString::number(cfgIndex));
115 identifiers.append(zn); 111 identifiers.append(zn);
116 insertItem(nm); 112 insertItem(nm);
117 if ( nm == cur ) 113 if ( nm == cur )
118 curix = listIndex; 114 curix = listIndex;
119 ++cfgIndex; 115 ++cfgIndex;
120 ++listIndex; 116 ++listIndex;
121 } 117 }
122 if ( !listIndex ) { 118 if ( !listIndex ) {
123 QStringList list = timezoneDefaults(); 119 QStringList list = timezoneDefaults();
124 for ( QStringList::Iterator it = list.begin(); it!=list.end(); ++it ) { 120 for ( QStringList::Iterator it = list.begin(); it!=list.end(); ++it ) {
125 QString zn = *it; 121 QString zn = *it;