-rw-r--r-- | core/launcher/appicons.cpp | 14 | ||||
-rw-r--r-- | core/launcher/applauncher.cpp | 8 | ||||
-rw-r--r-- | core/launcher/firstuse.cpp | 8 | ||||
-rw-r--r-- | core/launcher/inputmethods.cpp | 4 | ||||
-rw-r--r-- | core/launcher/launcher.cpp | 12 | ||||
-rw-r--r-- | core/launcher/launcherview.cpp | 12 | ||||
-rw-r--r-- | core/launcher/packageslave.cpp | 4 | ||||
-rw-r--r-- | core/launcher/qcopbridge.cpp | 12 | ||||
-rw-r--r-- | core/launcher/runningappbar.cpp | 4 | ||||
-rw-r--r-- | core/launcher/server.cpp | 18 | ||||
-rw-r--r-- | core/launcher/serverapp.cpp | 10 | ||||
-rw-r--r-- | core/launcher/shutdownimpl.cpp | 6 | ||||
-rw-r--r-- | core/launcher/taskbar.cpp | 4 | ||||
-rw-r--r-- | core/launcher/transferserver.cpp | 12 |
14 files changed, 65 insertions, 63 deletions
diff --git a/core/launcher/appicons.cpp b/core/launcher/appicons.cpp index c51ee5a..4d48b24 100644 --- a/core/launcher/appicons.cpp +++ b/core/launcher/appicons.cpp | |||
@@ -1,119 +1,121 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | 21 | ||
22 | #include "appicons.h" | 22 | #include "appicons.h" |
23 | 23 | ||
24 | #include <qpe/qcopenvelope_qws.h> | 24 | #ifdef QWS |
25 | #include <qtopia/qcopenvelope_qws.h> | ||
26 | #endif | ||
25 | 27 | ||
26 | #include <qtooltip.h> | 28 | #include <qtooltip.h> |
27 | #include <qpixmap.h> | 29 | #include <qpixmap.h> |
28 | 30 | ||
29 | 31 | ||
30 | AppIcons::AppIcons( QWidget *parent ) : | 32 | AppIcons::AppIcons( QWidget *parent ) : |
31 | QHBox(parent) | 33 | QHBox(parent) |
32 | { | 34 | { |
33 | buttons.setAutoDelete(TRUE); | 35 | buttons.setAutoDelete(TRUE); |
34 | 36 | ||
35 | #ifndef QT_NO_COP | 37 | #ifndef QT_NO_COP |
36 | QCopChannel* channel = new QCopChannel("Qt/Tray", this); | 38 | QCopChannel* channel = new QCopChannel("Qt/Tray", this); |
37 | connect(channel, SIGNAL(received(const QCString&, const QByteArray&)), | 39 | connect(channel, SIGNAL(received(const QCString&,const QByteArray&)), |
38 | this, SLOT(receive(const QCString&, const QByteArray&))); | 40 | this, SLOT(receive(const QCString&,const QByteArray&))); |
39 | #endif | 41 | #endif |
40 | } | 42 | } |
41 | 43 | ||
42 | void AppIcons::setIcon(int id, const QPixmap& pm) | 44 | void AppIcons::setIcon(int id, const QPixmap& pm) |
43 | { | 45 | { |
44 | button(id)->setPixmap(pm); | 46 | button(id)->setPixmap(pm); |
45 | } | 47 | } |
46 | 48 | ||
47 | class FlatButton : public QLabel { | 49 | class FlatButton : public QLabel { |
48 | Q_OBJECT | 50 | Q_OBJECT |
49 | public: | 51 | public: |
50 | FlatButton(QWidget* parent) : QLabel(parent) { } | 52 | FlatButton(QWidget* parent) : QLabel(parent) { } |
51 | 53 | ||
52 | void mouseDoubleClickEvent(QMouseEvent* e) | 54 | void mouseDoubleClickEvent(QMouseEvent* e) |
53 | { | 55 | { |
54 | emit clicked(e->pos(),e->button(),TRUE); | 56 | emit clicked(e->pos(),e->button(),TRUE); |
55 | } | 57 | } |
56 | void mouseReleaseEvent(QMouseEvent* e) | 58 | void mouseReleaseEvent(QMouseEvent* e) |
57 | { | 59 | { |
58 | if ( rect().contains(e->pos()) ) | 60 | if ( rect().contains(e->pos()) ) |
59 | emit clicked(e->pos(),e->button(),FALSE); | 61 | emit clicked(e->pos(),e->button(),FALSE); |
60 | } | 62 | } |
61 | 63 | ||
62 | signals: | 64 | signals: |
63 | void clicked(const QPoint&, int, bool); | 65 | void clicked(const QPoint&, int, bool); |
64 | }; | 66 | }; |
65 | 67 | ||
66 | QLabel* AppIcons::button(int id) | 68 | QLabel* AppIcons::button(int id) |
67 | { | 69 | { |
68 | QLabel* f = buttons.find(id); | 70 | QLabel* f = buttons.find(id); |
69 | if ( !f ) { | 71 | if ( !f ) { |
70 | buttons.insert(id,f=new FlatButton(this)); | 72 | buttons.insert(id,f=new FlatButton(this)); |
71 | connect(f,SIGNAL(clicked(const QPoint&, int, bool)),this,SLOT(clicked(const QPoint&, int, bool))); | 73 | connect(f,SIGNAL(clicked(const QPoint&,int,bool)),this,SLOT(clicked(const QPoint&,int,bool))); |
72 | f->show(); | 74 | f->show(); |
73 | } | 75 | } |
74 | return f; | 76 | return f; |
75 | } | 77 | } |
76 | 78 | ||
77 | int AppIcons::findId(QLabel* b) | 79 | int AppIcons::findId(QLabel* b) |
78 | { | 80 | { |
79 | QIntDictIterator<QLabel> it(buttons); | 81 | QIntDictIterator<QLabel> it(buttons); |
80 | for ( ; ; ++it ) | 82 | for ( ; ; ++it ) |
81 | if ( it.current() == b ) return it.currentKey(); | 83 | if ( it.current() == b ) return it.currentKey(); |
82 | } | 84 | } |
83 | 85 | ||
84 | void AppIcons::clicked(const QPoint& relpos, int button, bool dbl) | 86 | void AppIcons::clicked(const QPoint& relpos, int button, bool dbl) |
85 | { | 87 | { |
86 | #ifndef QT_NO_COP | 88 | #ifndef QT_NO_COP |
87 | QLabel* s = (QLabel*)sender(); | 89 | QLabel* s = (QLabel*)sender(); |
88 | if ( button == RightButton ) { | 90 | if ( button == RightButton ) { |
89 | QCopEnvelope("Qt/Tray","popup(int,QPoint)") | 91 | QCopEnvelope("Qt/Tray","popup(int,QPoint)") |
90 | << findId(s) << s->mapToGlobal(QPoint(0,0)); | 92 | << findId(s) << s->mapToGlobal(QPoint(0,0)); |
91 | } else { | 93 | } else { |
92 | QCopEnvelope("Qt/Tray", | 94 | QCopEnvelope("Qt/Tray", |
93 | dbl ? "doubleClicked(int,QPoint)" : "clicked(int,QPoint)") | 95 | dbl ? "doubleClicked(int,QPoint)" : "clicked(int,QPoint)") |
94 | << findId(s) << relpos; | 96 | << findId(s) << relpos; |
95 | } | 97 | } |
96 | #endif | 98 | #endif |
97 | } | 99 | } |
98 | 100 | ||
99 | void AppIcons::setToolTip(int id, const QString& tip) | 101 | void AppIcons::setToolTip(int id, const QString& tip) |
100 | { | 102 | { |
101 | QToolTip::add(button(id),tip); | 103 | QToolTip::add(button(id),tip); |
102 | } | 104 | } |
103 | 105 | ||
104 | void AppIcons::remove(int id) | 106 | void AppIcons::remove(int id) |
105 | { | 107 | { |
106 | buttons.remove(id); | 108 | buttons.remove(id); |
107 | } | 109 | } |
108 | 110 | ||
109 | void AppIcons::receive( const QCString &msg, const QByteArray &data ) | 111 | void AppIcons::receive( const QCString &msg, const QByteArray &data ) |
110 | { | 112 | { |
111 | QDataStream stream( data, IO_ReadOnly ); | 113 | QDataStream stream( data, IO_ReadOnly ); |
112 | if ( msg == "remove(int)" ) { | 114 | if ( msg == "remove(int)" ) { |
113 | int id; | 115 | int id; |
114 | stream >> id; | 116 | stream >> id; |
115 | remove(id); | 117 | remove(id); |
116 | } else if ( msg == "setIcon(int,QPixmap)" ) { | 118 | } else if ( msg == "setIcon(int,QPixmap)" ) { |
117 | int id; | 119 | int id; |
118 | QPixmap pm; | 120 | QPixmap pm; |
119 | stream >> id >> pm; | 121 | stream >> id >> pm; |
diff --git a/core/launcher/applauncher.cpp b/core/launcher/applauncher.cpp index 7d3c032..08a3cb4 100644 --- a/core/launcher/applauncher.cpp +++ b/core/launcher/applauncher.cpp | |||
@@ -41,102 +41,102 @@ | |||
41 | #include <process.h> | 41 | #include <process.h> |
42 | #include <windows.h> | 42 | #include <windows.h> |
43 | #include <winbase.h> | 43 | #include <winbase.h> |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | #include <signal.h> | 46 | #include <signal.h> |
47 | #include <sys/types.h> | 47 | #include <sys/types.h> |
48 | #include <stdlib.h> | 48 | #include <stdlib.h> |
49 | 49 | ||
50 | #include <qtimer.h> | 50 | #include <qtimer.h> |
51 | #include <qwindowsystem_qws.h> | 51 | #include <qwindowsystem_qws.h> |
52 | #include <qmessagebox.h> | 52 | #include <qmessagebox.h> |
53 | #include <qfileinfo.h> | 53 | #include <qfileinfo.h> |
54 | 54 | ||
55 | #include <qtopia/qcopenvelope_qws.h> | 55 | #include <qtopia/qcopenvelope_qws.h> |
56 | #include <qtopia/qpeapplication.h> | 56 | #include <qtopia/qpeapplication.h> |
57 | 57 | ||
58 | #include "applauncher.h" | 58 | #include "applauncher.h" |
59 | #include "documentlist.h" | 59 | #include "documentlist.h" |
60 | 60 | ||
61 | const int AppLauncher::RAISE_TIMEOUT_MS = 5000; | 61 | const int AppLauncher::RAISE_TIMEOUT_MS = 5000; |
62 | 62 | ||
63 | //--------------------------------------------------------------------------- | 63 | //--------------------------------------------------------------------------- |
64 | 64 | ||
65 | static AppLauncher* appLauncherPtr; | 65 | static AppLauncher* appLauncherPtr; |
66 | 66 | ||
67 | const int appStopEventID = 1290; | 67 | const int appStopEventID = 1290; |
68 | 68 | ||
69 | class AppStoppedEvent : public QCustomEvent | 69 | class AppStoppedEvent : public QCustomEvent |
70 | { | 70 | { |
71 | public: | 71 | public: |
72 | AppStoppedEvent(int pid, int status) | 72 | AppStoppedEvent(int pid, int status) |
73 | : QCustomEvent( appStopEventID ), mPid(pid), mStatus(status) { } | 73 | : QCustomEvent( appStopEventID ), mPid(pid), mStatus(status) { } |
74 | 74 | ||
75 | int pid() { return mPid; } | 75 | int pid() { return mPid; } |
76 | int status() { return mStatus; } | 76 | int status() { return mStatus; } |
77 | 77 | ||
78 | private: | 78 | private: |
79 | int mPid, mStatus; | 79 | int mPid, mStatus; |
80 | }; | 80 | }; |
81 | 81 | ||
82 | AppLauncher::AppLauncher(QObject *parent, const char *name) | 82 | AppLauncher::AppLauncher(QObject *parent, const char *name) |
83 | : QObject(parent, name), qlPid(0), qlReady(FALSE), | 83 | : QObject(parent, name), qlPid(0), qlReady(FALSE), |
84 | appKillerBox(0) | 84 | appKillerBox(0) |
85 | { | 85 | { |
86 | connect(qwsServer, SIGNAL(newChannel(const QString&)), this, SLOT(newQcopChannel(const QString&))); | 86 | connect(qwsServer, SIGNAL(newChannel(const QString&)), this, SLOT(newQcopChannel(const QString&))); |
87 | connect(qwsServer, SIGNAL(removedChannel(const QString&)), this, SLOT(removedQcopChannel(const QString&))); | 87 | connect(qwsServer, SIGNAL(removedChannel(const QString&)), this, SLOT(removedQcopChannel(const QString&))); |
88 | QCopChannel* channel = new QCopChannel( "QPE/System", this ); | 88 | QCopChannel* channel = new QCopChannel( "QPE/System", this ); |
89 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 89 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), |
90 | this, SLOT(received(const QCString&, const QByteArray&)) ); | 90 | this, SLOT(received(const QCString&,const QByteArray&)) ); |
91 | 91 | ||
92 | channel = new QCopChannel( "QPE/Server", this ); | 92 | channel = new QCopChannel( "QPE/Server", this ); |
93 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 93 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), |
94 | this, SLOT(received(const QCString&, const QByteArray&)) ); | 94 | this, SLOT(received(const QCString&,const QByteArray&)) ); |
95 | 95 | ||
96 | #ifndef Q_OS_WIN32 | 96 | #ifndef Q_OS_WIN32 |
97 | signal(SIGCHLD, signalHandler); | 97 | signal(SIGCHLD, signalHandler); |
98 | #else | 98 | #else |
99 | runningAppsProc.setAutoDelete( TRUE ); | 99 | runningAppsProc.setAutoDelete( TRUE ); |
100 | #endif | 100 | #endif |
101 | QString tmp = qApp->argv()[0]; | 101 | QString tmp = qApp->argv()[0]; |
102 | int pos = tmp.findRev('/'); | 102 | int pos = tmp.findRev('/'); |
103 | if ( pos > -1 ) | 103 | if ( pos > -1 ) |
104 | tmp = tmp.mid(++pos); | 104 | tmp = tmp.mid(++pos); |
105 | runningApps[::getpid()] = tmp; | 105 | runningApps[::getpid()] = tmp; |
106 | 106 | ||
107 | appLauncherPtr = this; | 107 | appLauncherPtr = this; |
108 | 108 | ||
109 | QTimer::singleShot( 1000, this, SLOT(createQuickLauncher()) ); | 109 | QTimer::singleShot( 1000, this, SLOT(createQuickLauncher()) ); |
110 | } | 110 | } |
111 | 111 | ||
112 | AppLauncher::~AppLauncher() | 112 | AppLauncher::~AppLauncher() |
113 | { | 113 | { |
114 | appLauncherPtr = 0; | 114 | appLauncherPtr = 0; |
115 | #ifndef Q_OS_WIN32 | 115 | #ifndef Q_OS_WIN32 |
116 | signal(SIGCHLD, SIG_DFL); | 116 | signal(SIGCHLD, SIG_DFL); |
117 | #endif | 117 | #endif |
118 | if ( qlPid ) { | 118 | if ( qlPid ) { |
119 | int status; | 119 | int status; |
120 | ::kill( qlPid, SIGTERM ); | 120 | ::kill( qlPid, SIGTERM ); |
121 | waitpid( qlPid, &status, 0 ); | 121 | waitpid( qlPid, &status, 0 ); |
122 | } | 122 | } |
123 | } | 123 | } |
124 | 124 | ||
125 | /* We use the QCopChannel of the app as an indicator of when it has been launched | 125 | /* We use the QCopChannel of the app as an indicator of when it has been launched |
126 | so that we can disable the busy indicators */ | 126 | so that we can disable the busy indicators */ |
127 | void AppLauncher::newQcopChannel(const QString& channelName) | 127 | void AppLauncher::newQcopChannel(const QString& channelName) |
128 | { | 128 | { |
129 | // qDebug("channel %s added", channelName.data() ); | 129 | // qDebug("channel %s added", channelName.data() ); |
130 | QString prefix("QPE/Application/"); | 130 | QString prefix("QPE/Application/"); |
131 | if (channelName.startsWith(prefix)) { | 131 | if (channelName.startsWith(prefix)) { |
132 | { | 132 | { |
133 | QCopEnvelope e("QPE/System", "newChannel(QString)"); | 133 | QCopEnvelope e("QPE/System", "newChannel(QString)"); |
134 | e << channelName; | 134 | e << channelName; |
135 | } | 135 | } |
136 | QString appName = channelName.mid(prefix.length()); | 136 | QString appName = channelName.mid(prefix.length()); |
137 | if ( appName != "quicklauncher" ) { | 137 | if ( appName != "quicklauncher" ) { |
138 | emit connected( appName ); | 138 | emit connected( appName ); |
139 | QCopEnvelope e("QPE/System", "notBusy(QString)"); | 139 | QCopEnvelope e("QPE/System", "notBusy(QString)"); |
140 | e << appName; | 140 | e << appName; |
141 | } | 141 | } |
142 | } else if (channelName.startsWith("QPE/QuickLauncher-")) { | 142 | } else if (channelName.startsWith("QPE/QuickLauncher-")) { |
diff --git a/core/launcher/firstuse.cpp b/core/launcher/firstuse.cpp index 50ae6c2..4316648 100644 --- a/core/launcher/firstuse.cpp +++ b/core/launcher/firstuse.cpp | |||
@@ -53,157 +53,157 @@ | |||
53 | 53 | ||
54 | 54 | ||
55 | #include <stdlib.h> | 55 | #include <stdlib.h> |
56 | #include <sys/types.h> | 56 | #include <sys/types.h> |
57 | #if defined(Q_OS_LINUX) || defined(_OS_LINUX_) | 57 | #if defined(Q_OS_LINUX) || defined(_OS_LINUX_) |
58 | #include <unistd.h> | 58 | #include <unistd.h> |
59 | #endif | 59 | #endif |
60 | 60 | ||
61 | 61 | ||
62 | struct { | 62 | struct { |
63 | bool enabled; | 63 | bool enabled; |
64 | const char *app; | 64 | const char *app; |
65 | const char *start; | 65 | const char *start; |
66 | const char *stop; | 66 | const char *stop; |
67 | const char *desc; | 67 | const char *desc; |
68 | } | 68 | } |
69 | settingsTable [] = | 69 | settingsTable [] = |
70 | { | 70 | { |
71 | { FALSE, "language", "raise()", "accept()", // No tr | 71 | { FALSE, "language", "raise()", "accept()", // No tr |
72 | QT_TR_NOOP("Language") }, | 72 | QT_TR_NOOP("Language") }, |
73 | { FALSE, "doctab", "raise()", "accept()", // No tr | 73 | { FALSE, "doctab", "raise()", "accept()", // No tr |
74 | QT_TR_NOOP("DocTab") }, | 74 | QT_TR_NOOP("DocTab") }, |
75 | #ifndef Q_OS_WIN32 | 75 | #ifndef Q_OS_WIN32 |
76 | { FALSE, "systemtime", "raise()", "accept()", // No tr | 76 | { FALSE, "systemtime", "raise()", "accept()", // No tr |
77 | QT_TR_NOOP("Time and Date") }, | 77 | QT_TR_NOOP("Time and Date") }, |
78 | #endif | 78 | #endif |
79 | { FALSE, "addressbook", "editPersonalAndClose()", "accept()", // No tr | 79 | { FALSE, "addressbook", "editPersonalAndClose()", "accept()", // No tr |
80 | QT_TR_NOOP("Personal Information") }, | 80 | QT_TR_NOOP("Personal Information") }, |
81 | { FALSE, 0, 0, 0, 0 } | 81 | { FALSE, 0, 0, 0, 0 } |
82 | }; | 82 | }; |
83 | 83 | ||
84 | 84 | ||
85 | FirstUse::FirstUse(QWidget* parent, const char * name, WFlags wf) : | 85 | FirstUse::FirstUse(QWidget* parent, const char * name, WFlags wf) : |
86 | QDialog( parent, name, TRUE, wf), | 86 | QDialog( parent, name, TRUE, wf), |
87 | transApp(0), transLib(0), needCalibrate(FALSE), currApp(-1), | 87 | transApp(0), transLib(0), needCalibrate(FALSE), currApp(-1), |
88 | waitForExit(-1), waitingForLaunch(FALSE), needRestart(FALSE) | 88 | waitForExit(-1), waitingForLaunch(FALSE), needRestart(FALSE) |
89 | { | 89 | { |
90 | ServerApplication::allowRestart = FALSE; | 90 | ServerApplication::allowRestart = FALSE; |
91 | // we force our height beyound the maximum (which we set anyway) | 91 | // we force our height beyound the maximum (which we set anyway) |
92 | QRect desk = qApp->desktop()->geometry(); | 92 | QRect desk = qApp->desktop()->geometry(); |
93 | setGeometry( 0, 0, desk.width(), desk.height() ); | 93 | setGeometry( 0, 0, desk.width(), desk.height() ); |
94 | 94 | ||
95 | connect(qwsServer, SIGNAL(newChannel(const QString&)), | 95 | connect(qwsServer, SIGNAL(newChannel(const QString&)), |
96 | this, SLOT(newQcopChannel(const QString&))); | 96 | this, SLOT(newQcopChannel(const QString&))); |
97 | 97 | ||
98 | // Create a DocumentList so appLauncher has appLnkSet to search | 98 | // Create a DocumentList so appLauncher has appLnkSet to search |
99 | docList = new DocumentList( 0, FALSE ); | 99 | docList = new DocumentList( 0, FALSE ); |
100 | appLauncher = new AppLauncher( this ); | 100 | appLauncher = new AppLauncher( this ); |
101 | connect( appLauncher, SIGNAL(terminated(int, const QString&)), | 101 | connect( appLauncher, SIGNAL(terminated(int,const QString&)), |
102 | this, SLOT(terminated(int, const QString&)) ); | 102 | this, SLOT(terminated(int,const QString&)) ); |
103 | 103 | ||
104 | // more hackery | 104 | // more hackery |
105 | // I will be run as either the main server or as part of the main server | 105 | // I will be run as either the main server or as part of the main server |
106 | QWSServer::setScreenSaverIntervals(0); | 106 | QWSServer::setScreenSaverIntervals(0); |
107 | loadPixmaps(); | 107 | loadPixmaps(); |
108 | 108 | ||
109 | //check if there is a language program | 109 | //check if there is a language program |
110 | #ifndef Q_OS_WIN32 | 110 | #ifndef Q_OS_WIN32 |
111 | QString exeSuffix; | 111 | QString exeSuffix; |
112 | #else | 112 | #else |
113 | QString exeSuffix(".exe"); | 113 | QString exeSuffix(".exe"); |
114 | #endif | 114 | #endif |
115 | 115 | ||
116 | for ( int i = 0; settingsTable[i].app; i++ ) { | 116 | for ( int i = 0; settingsTable[i].app; i++ ) { |
117 | QString file = QPEApplication::qpeDir() + "bin/"; | 117 | QString file = QPEApplication::qpeDir() + "bin/"; |
118 | file += settingsTable[i].app; | 118 | file += settingsTable[i].app; |
119 | file += exeSuffix; | 119 | file += exeSuffix; |
120 | if ( QFile::exists(file) ) | 120 | if ( QFile::exists(file) ) |
121 | settingsTable[i].enabled = TRUE; | 121 | settingsTable[i].enabled = TRUE; |
122 | } | 122 | } |
123 | 123 | ||
124 | setFocusPolicy(NoFocus); | 124 | setFocusPolicy(NoFocus); |
125 | 125 | ||
126 | taskBar = new QWidget(0, 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop | WGroupLeader); | 126 | taskBar = new QWidget(0, 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop | WGroupLeader); |
127 | 127 | ||
128 | inputMethods = new InputMethods(taskBar); | 128 | inputMethods = new InputMethods(taskBar); |
129 | connect(inputMethods, SIGNAL(inputToggled(bool)), | 129 | connect(inputMethods, SIGNAL(inputToggled(bool)), |
130 | this, SLOT(calcMaxWindowRect())); | 130 | this, SLOT(calcMaxWindowRect())); |
131 | 131 | ||
132 | back = new QPushButton(tr("<< Back"), taskBar); | 132 | back = new QPushButton(tr("<< Back"), taskBar); |
133 | back->setFocusPolicy(NoFocus); | 133 | back->setFocusPolicy(NoFocus); |
134 | connect(back, SIGNAL(clicked()), this, SLOT(previousDialog()) ); | 134 | connect(back, SIGNAL(clicked()), this, SLOT(previousDialog()) ); |
135 | 135 | ||
136 | next = new QPushButton(tr("Next >>"), taskBar); | 136 | next = new QPushButton(tr("Next >>"), taskBar); |
137 | next->setFocusPolicy(NoFocus); | 137 | next->setFocusPolicy(NoFocus); |
138 | connect(next, SIGNAL(clicked()), this, SLOT(nextDialog()) ); | 138 | connect(next, SIGNAL(clicked()), this, SLOT(nextDialog()) ); |
139 | 139 | ||
140 | // need to set the geom to lower corner | 140 | // need to set the geom to lower corner |
141 | QSize sz = inputMethods->sizeHint(); | 141 | QSize sz = inputMethods->sizeHint(); |
142 | int buttonWidth = (width() - sz.width()) / 2; | 142 | int buttonWidth = (width() - sz.width()) / 2; |
143 | int x = 0; | 143 | int x = 0; |
144 | 144 | ||
145 | controlHeight = back->sizeHint().height(); | 145 | controlHeight = back->sizeHint().height(); |
146 | 146 | ||
147 | inputMethods->setGeometry(0,0, sz.width(), controlHeight ); | 147 | inputMethods->setGeometry(0,0, sz.width(), controlHeight ); |
148 | x += sz.width(); | 148 | x += sz.width(); |
149 | 149 | ||
150 | back->setGeometry(x, 0, buttonWidth, controlHeight); | 150 | back->setGeometry(x, 0, buttonWidth, controlHeight); |
151 | x += buttonWidth; | 151 | x += buttonWidth; |
152 | next->setGeometry(x, 0, buttonWidth, controlHeight); | 152 | next->setGeometry(x, 0, buttonWidth, controlHeight); |
153 | 153 | ||
154 | taskBar->setGeometry( 0, height() - controlHeight, desk.width(), controlHeight); | 154 | taskBar->setGeometry( 0, height() - controlHeight, desk.width(), controlHeight); |
155 | taskBar->hide(); | 155 | taskBar->hide(); |
156 | 156 | ||
157 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 157 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
158 | qDebug("Setting up QCop to QPE/System"); | 158 | qDebug("Setting up QCop to QPE/System"); |
159 | QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); | 159 | QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); |
160 | connect(sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), | 160 | connect(sysChannel, SIGNAL(received(const QCString&,const QByteArray&)), |
161 | this, SLOT(message(const QCString &, const QByteArray &)) ); | 161 | this, SLOT(message(const QCString&,const QByteArray&)) ); |
162 | #endif | 162 | #endif |
163 | calcMaxWindowRect(); | 163 | calcMaxWindowRect(); |
164 | 164 | ||
165 | m_calHandler = ( QWSServer::mouseHandler() && QWSServer::mouseHandler()->inherits("QCalibratedMouseHandler") ) ? true : false; | 165 | m_calHandler = ( QWSServer::mouseHandler() && QWSServer::mouseHandler()->inherits("QCalibratedMouseHandler") ) ? true : false; |
166 | 166 | ||
167 | if ( m_calHandler) { | 167 | if ( m_calHandler) { |
168 | if ( !QFile::exists("/etc/pointercal") ) { | 168 | if ( !QFile::exists("/etc/pointercal") ) { |
169 | needCalibrate = TRUE; | 169 | needCalibrate = TRUE; |
170 | grabMouse(); | 170 | grabMouse(); |
171 | } | 171 | } |
172 | } | 172 | } |
173 | 173 | ||
174 | Config config("locale"); | 174 | Config config("locale"); |
175 | config.setGroup( "Language"); | 175 | config.setGroup( "Language"); |
176 | lang = config.readEntry( "Language", "en"); | 176 | lang = config.readEntry( "Language", "en"); |
177 | 177 | ||
178 | defaultFont = font(); | 178 | defaultFont = font(); |
179 | 179 | ||
180 | //###language/font hack; should look it up somewhere | 180 | //###language/font hack; should look it up somewhere |
181 | #ifdef Q_WS_QWS | 181 | #ifdef Q_WS_QWS |
182 | if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { | 182 | if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { |
183 | QFont fn = FontManager::unicodeFont( FontManager::Proportional ); | 183 | QFont fn = FontManager::unicodeFont( FontManager::Proportional ); |
184 | qApp->setFont( fn, TRUE ); | 184 | qApp->setFont( fn, TRUE ); |
185 | } | 185 | } |
186 | #endif | 186 | #endif |
187 | } | 187 | } |
188 | 188 | ||
189 | FirstUse::~FirstUse() | 189 | FirstUse::~FirstUse() |
190 | { | 190 | { |
191 | delete appLauncher; | 191 | delete appLauncher; |
192 | delete docList; | 192 | delete docList; |
193 | delete taskBar; | 193 | delete taskBar; |
194 | ServerApplication::allowRestart = TRUE; | 194 | ServerApplication::allowRestart = TRUE; |
195 | } | 195 | } |
196 | 196 | ||
197 | void FirstUse::calcMaxWindowRect() | 197 | void FirstUse::calcMaxWindowRect() |
198 | { | 198 | { |
199 | #ifdef Q_WS_QWS | 199 | #ifdef Q_WS_QWS |
200 | QRect wr; | 200 | QRect wr; |
201 | int displayWidth = qApp->desktop()->width(); | 201 | int displayWidth = qApp->desktop()->width(); |
202 | QRect ir = inputMethods->inputRect(); | 202 | QRect ir = inputMethods->inputRect(); |
203 | if ( ir.isValid() ) { | 203 | if ( ir.isValid() ) { |
204 | wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 ); | 204 | wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 ); |
205 | } else { | 205 | } else { |
206 | wr.setCoords( 0, 0, displayWidth-1, | 206 | wr.setCoords( 0, 0, displayWidth-1, |
207 | qApp->desktop()->height() - controlHeight-1); | 207 | qApp->desktop()->height() - controlHeight-1); |
208 | } | 208 | } |
209 | 209 | ||
diff --git a/core/launcher/inputmethods.cpp b/core/launcher/inputmethods.cpp index 683f1e2..19e799a 100644 --- a/core/launcher/inputmethods.cpp +++ b/core/launcher/inputmethods.cpp | |||
@@ -100,98 +100,98 @@ InputMethods::InputMethods( QWidget *parent ) : | |||
100 | 100 | ||
101 | setBackgroundMode( PaletteBackground ); | 101 | setBackgroundMode( PaletteBackground ); |
102 | QHBoxLayout *hbox = new QHBoxLayout( this ); | 102 | QHBoxLayout *hbox = new QHBoxLayout( this ); |
103 | 103 | ||
104 | kbdButton = new IMToolButton( this); | 104 | kbdButton = new IMToolButton( this); |
105 | kbdButton->setFocusPolicy(NoFocus); | 105 | kbdButton->setFocusPolicy(NoFocus); |
106 | kbdButton->setToggleButton( TRUE ); | 106 | kbdButton->setToggleButton( TRUE ); |
107 | if (parent->sizeHint().height() > 0) | 107 | if (parent->sizeHint().height() > 0) |
108 | kbdButton->setFixedHeight( parent->sizeHint().height() ); | 108 | kbdButton->setFixedHeight( parent->sizeHint().height() ); |
109 | kbdButton->setFixedWidth( 32 ); | 109 | kbdButton->setFixedWidth( 32 ); |
110 | kbdButton->setAutoRaise( TRUE ); | 110 | kbdButton->setAutoRaise( TRUE ); |
111 | kbdButton->setUsesBigPixmap( TRUE ); | 111 | kbdButton->setUsesBigPixmap( TRUE ); |
112 | hbox->addWidget( kbdButton ); | 112 | hbox->addWidget( kbdButton ); |
113 | connect( kbdButton, SIGNAL(toggled(bool)), this, SLOT(showKbd(bool)) ); | 113 | connect( kbdButton, SIGNAL(toggled(bool)), this, SLOT(showKbd(bool)) ); |
114 | 114 | ||
115 | kbdChoice = new IMToolButton( this ); | 115 | kbdChoice = new IMToolButton( this ); |
116 | kbdChoice->setFocusPolicy(NoFocus); | 116 | kbdChoice->setFocusPolicy(NoFocus); |
117 | kbdChoice->setPixmap( QPixmap( (const char **)tri_xpm ) ); | 117 | kbdChoice->setPixmap( QPixmap( (const char **)tri_xpm ) ); |
118 | if (parent->sizeHint().height() > 0) | 118 | if (parent->sizeHint().height() > 0) |
119 | kbdChoice->setFixedHeight( parent->sizeHint().height() ); | 119 | kbdChoice->setFixedHeight( parent->sizeHint().height() ); |
120 | kbdChoice->setFixedWidth( 13 ); | 120 | kbdChoice->setFixedWidth( 13 ); |
121 | kbdChoice->setAutoRaise( TRUE ); | 121 | kbdChoice->setAutoRaise( TRUE ); |
122 | hbox->addWidget( kbdChoice ); | 122 | hbox->addWidget( kbdChoice ); |
123 | connect( kbdChoice, SIGNAL(clicked()), this, SLOT(chooseKbd()) ); | 123 | connect( kbdChoice, SIGNAL(clicked()), this, SLOT(chooseKbd()) ); |
124 | 124 | ||
125 | connect( (QPEApplication*)qApp, SIGNAL(clientMoused()), | 125 | connect( (QPEApplication*)qApp, SIGNAL(clientMoused()), |
126 | this, SLOT(resetStates()) ); | 126 | this, SLOT(resetStates()) ); |
127 | 127 | ||
128 | 128 | ||
129 | imButton = new QWidgetStack( this ); // later a widget stack | 129 | imButton = new QWidgetStack( this ); // later a widget stack |
130 | imButton->setFocusPolicy(NoFocus); | 130 | imButton->setFocusPolicy(NoFocus); |
131 | if (parent->sizeHint().height() > 0) | 131 | if (parent->sizeHint().height() > 0) |
132 | imButton->setFixedHeight( parent->sizeHint().height() ); | 132 | imButton->setFixedHeight( parent->sizeHint().height() ); |
133 | hbox->addWidget(imButton); | 133 | hbox->addWidget(imButton); |
134 | 134 | ||
135 | imChoice = new QToolButton( this ); | 135 | imChoice = new QToolButton( this ); |
136 | imChoice->setFocusPolicy(NoFocus); | 136 | imChoice->setFocusPolicy(NoFocus); |
137 | imChoice->setPixmap( QPixmap( (const char **)tri_xpm ) ); | 137 | imChoice->setPixmap( QPixmap( (const char **)tri_xpm ) ); |
138 | if (parent->sizeHint().height() > 0) | 138 | if (parent->sizeHint().height() > 0) |
139 | imChoice->setFixedHeight( parent->sizeHint().height() ); | 139 | imChoice->setFixedHeight( parent->sizeHint().height() ); |
140 | imChoice->setFixedWidth( 13 ); | 140 | imChoice->setFixedWidth( 13 ); |
141 | imChoice->setAutoRaise( TRUE ); | 141 | imChoice->setAutoRaise( TRUE ); |
142 | hbox->addWidget( imChoice ); | 142 | hbox->addWidget( imChoice ); |
143 | connect( imChoice, SIGNAL(clicked()), this, SLOT(chooseIm()) ); | 143 | connect( imChoice, SIGNAL(clicked()), this, SLOT(chooseIm()) ); |
144 | 144 | ||
145 | loadInputMethods(); | 145 | loadInputMethods(); |
146 | 146 | ||
147 | QCopChannel *channel = new QCopChannel( "QPE/IME", this ); | 147 | QCopChannel *channel = new QCopChannel( "QPE/IME", this ); |
148 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 148 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), |
149 | this, SLOT(qcopReceive(const QCString&, const QByteArray&)) ); | 149 | this, SLOT(qcopReceive(const QCString&,const QByteArray&)) ); |
150 | } | 150 | } |
151 | 151 | ||
152 | InputMethods::~InputMethods() | 152 | InputMethods::~InputMethods() |
153 | { | 153 | { |
154 | Config cfg("qpe"); | 154 | Config cfg("qpe"); |
155 | cfg.setGroup("InputMethod"); | 155 | cfg.setGroup("InputMethod"); |
156 | if (imethod) | 156 | if (imethod) |
157 | cfg.writeEntry("im", imethod->name() ); | 157 | cfg.writeEntry("im", imethod->name() ); |
158 | if (mkeyboard) | 158 | if (mkeyboard) |
159 | cfg.writeEntry("current", mkeyboard->name() ); | 159 | cfg.writeEntry("current", mkeyboard->name() ); |
160 | 160 | ||
161 | unloadInputMethods(); | 161 | unloadInputMethods(); |
162 | } | 162 | } |
163 | 163 | ||
164 | void InputMethods::hideInputMethod() | 164 | void InputMethods::hideInputMethod() |
165 | { | 165 | { |
166 | kbdButton->setOn( FALSE ); | 166 | kbdButton->setOn( FALSE ); |
167 | } | 167 | } |
168 | 168 | ||
169 | void InputMethods::showInputMethod() | 169 | void InputMethods::showInputMethod() |
170 | { | 170 | { |
171 | kbdButton->setOn( TRUE ); | 171 | kbdButton->setOn( TRUE ); |
172 | } | 172 | } |
173 | 173 | ||
174 | void InputMethods::showInputMethod(const QString& name) | 174 | void InputMethods::showInputMethod(const QString& name) |
175 | { | 175 | { |
176 | int i = 0; | 176 | int i = 0; |
177 | QValueList<InputMethod>::Iterator it; | 177 | QValueList<InputMethod>::Iterator it; |
178 | InputMethod *im = 0; | 178 | InputMethod *im = 0; |
179 | for ( it = inputMethodList.begin(); it != inputMethodList.end(); ++it, i++ ) { | 179 | for ( it = inputMethodList.begin(); it != inputMethodList.end(); ++it, i++ ) { |
180 | QString lname = (*it).libName.mid((*it).libName.findRev('/') + 1); | 180 | QString lname = (*it).libName.mid((*it).libName.findRev('/') + 1); |
181 | if ( (*it).name() == name || lname == name ) { | 181 | if ( (*it).name() == name || lname == name ) { |
182 | im = &(*it); | 182 | im = &(*it); |
183 | break; | 183 | break; |
184 | } | 184 | } |
185 | } | 185 | } |
186 | if ( im ) | 186 | if ( im ) |
187 | chooseKeyboard(im); | 187 | chooseKeyboard(im); |
188 | } | 188 | } |
189 | 189 | ||
190 | void InputMethods::resetStates() | 190 | void InputMethods::resetStates() |
191 | { | 191 | { |
192 | if ( mkeyboard && !mkeyboard->newIM ) | 192 | if ( mkeyboard && !mkeyboard->newIM ) |
193 | mkeyboard->interface->resetState(); | 193 | mkeyboard->interface->resetState(); |
194 | } | 194 | } |
195 | 195 | ||
196 | QRect InputMethods::inputRect() const | 196 | QRect InputMethods::inputRect() const |
197 | { | 197 | { |
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index 54efb0b..5d0c778 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp | |||
@@ -53,100 +53,100 @@ | |||
53 | #include "startmenu.h" | 53 | #include "startmenu.h" |
54 | #include "taskbar.h" | 54 | #include "taskbar.h" |
55 | 55 | ||
56 | #include "serverinterface.h" | 56 | #include "serverinterface.h" |
57 | #include "launcherview.h" | 57 | #include "launcherview.h" |
58 | #include "launcher.h" | 58 | #include "launcher.h" |
59 | #include "server.h" | 59 | #include "server.h" |
60 | 60 | ||
61 | #define QTOPIA_INTERNAL_FSLP | 61 | #define QTOPIA_INTERNAL_FSLP |
62 | #include <qtopia/lnkproperties.h> | 62 | #include <qtopia/lnkproperties.h> |
63 | #include <stdlib.h> | 63 | #include <stdlib.h> |
64 | #include <assert.h> | 64 | #include <assert.h> |
65 | 65 | ||
66 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 66 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
67 | #include <unistd.h> | 67 | #include <unistd.h> |
68 | #include <stdio.h> | 68 | #include <stdio.h> |
69 | #include <sys/vfs.h> | 69 | #include <sys/vfs.h> |
70 | #include <mntent.h> | 70 | #include <mntent.h> |
71 | #endif | 71 | #endif |
72 | 72 | ||
73 | #ifdef Q_WS_QWS | 73 | #ifdef Q_WS_QWS |
74 | #include <qkeyboard_qws.h> | 74 | #include <qkeyboard_qws.h> |
75 | #include <qpe/lnkproperties.h> | 75 | #include <qpe/lnkproperties.h> |
76 | #endif | 76 | #endif |
77 | 77 | ||
78 | 78 | ||
79 | static bool isVisibleWindow( int ); | 79 | static bool isVisibleWindow( int ); |
80 | //=========================================================================== | 80 | //=========================================================================== |
81 | 81 | ||
82 | LauncherTabWidget::LauncherTabWidget( Launcher* parent ) : | 82 | LauncherTabWidget::LauncherTabWidget( Launcher* parent ) : |
83 | QVBox( parent ), docview( 0 ) | 83 | QVBox( parent ), docview( 0 ) |
84 | { | 84 | { |
85 | docLoadingWidgetEnabled = false; | 85 | docLoadingWidgetEnabled = false; |
86 | docLoadingWidget = 0; | 86 | docLoadingWidget = 0; |
87 | docLoadingWidgetProgress = 0; | 87 | docLoadingWidgetProgress = 0; |
88 | launcher = parent; | 88 | launcher = parent; |
89 | categoryBar = new LauncherTabBar( this ); | 89 | categoryBar = new LauncherTabBar( this ); |
90 | QPalette pal = categoryBar->palette(); | 90 | QPalette pal = categoryBar->palette(); |
91 | pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); | 91 | pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); |
92 | pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); | 92 | pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); |
93 | categoryBar->setPalette( pal ); | 93 | categoryBar->setPalette( pal ); |
94 | stack = new QWidgetStack(this); | 94 | stack = new QWidgetStack(this); |
95 | connect( categoryBar, SIGNAL(selected(int)), this, SLOT(raiseTabWidget()) ); | 95 | connect( categoryBar, SIGNAL(selected(int)), this, SLOT(raiseTabWidget()) ); |
96 | categoryBar->show(); | 96 | categoryBar->show(); |
97 | stack->show(); | 97 | stack->show(); |
98 | 98 | ||
99 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 99 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
100 | QCopChannel *channel = new QCopChannel( "QPE/Launcher", this ); | 100 | QCopChannel *channel = new QCopChannel( "QPE/Launcher", this ); |
101 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 101 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), |
102 | this, SLOT(launcherMessage(const QCString&, const QByteArray&)) ); | 102 | this, SLOT(launcherMessage(const QCString&,const QByteArray&)) ); |
103 | connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), | 103 | connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), |
104 | this, SLOT(appMessage(const QCString&, const QByteArray&))); | 104 | this, SLOT(appMessage(const QCString&,const QByteArray&))); |
105 | #endif | 105 | #endif |
106 | 106 | ||
107 | createDocLoadingWidget(); | 107 | createDocLoadingWidget(); |
108 | } | 108 | } |
109 | 109 | ||
110 | void LauncherTabWidget::createDocLoadingWidget() | 110 | void LauncherTabWidget::createDocLoadingWidget() |
111 | { | 111 | { |
112 | // Construct the 'doc loading widget' shown when finding documents | 112 | // Construct the 'doc loading widget' shown when finding documents |
113 | 113 | ||
114 | // ### LauncherView class needs changing to be more generic so | 114 | // ### LauncherView class needs changing to be more generic so |
115 | // this widget can change its background similar to the iconviews | 115 | // this widget can change its background similar to the iconviews |
116 | // so the background for this matches | 116 | // so the background for this matches |
117 | docLoadingWidget = new LauncherView( stack ); | 117 | docLoadingWidget = new LauncherView( stack ); |
118 | docLoadingWidget->hideIcons(); | 118 | docLoadingWidget->hideIcons(); |
119 | QVBox *docLoadingVBox = new QVBox( docLoadingWidget ); | 119 | QVBox *docLoadingVBox = new QVBox( docLoadingWidget ); |
120 | 120 | ||
121 | docLoadingVBox->setSpacing( 20 ); | 121 | docLoadingVBox->setSpacing( 20 ); |
122 | docLoadingVBox->setMargin( 10 ); | 122 | docLoadingVBox->setMargin( 10 ); |
123 | 123 | ||
124 | QWidget *space1 = new QWidget( docLoadingVBox ); | 124 | QWidget *space1 = new QWidget( docLoadingVBox ); |
125 | docLoadingVBox->setStretchFactor( space1, 1 ); | 125 | docLoadingVBox->setStretchFactor( space1, 1 ); |
126 | 126 | ||
127 | QLabel *waitPixmap = new QLabel( docLoadingVBox ); | 127 | QLabel *waitPixmap = new QLabel( docLoadingVBox ); |
128 | waitPixmap->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, waitPixmap->sizePolicy().hasHeightForWidth() ) ); | 128 | waitPixmap->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, waitPixmap->sizePolicy().hasHeightForWidth() ) ); |
129 | waitPixmap->setPixmap( Resource::loadPixmap( "bigwait" ) ); | 129 | waitPixmap->setPixmap( Resource::loadPixmap( "bigwait" ) ); |
130 | waitPixmap->setAlignment( int( QLabel::AlignCenter ) ); | 130 | waitPixmap->setAlignment( int( QLabel::AlignCenter ) ); |
131 | 131 | ||
132 | Config cfg( "Launcher" ); | 132 | Config cfg( "Launcher" ); |
133 | cfg.setGroup( "DocTab" ); | 133 | cfg.setGroup( "DocTab" ); |
134 | bool docTabEnabled = cfg.readBoolEntry( "Enable", true ); | 134 | bool docTabEnabled = cfg.readBoolEntry( "Enable", true ); |
135 | 135 | ||
136 | QLabel *textLabel = new QLabel( docLoadingVBox ); | 136 | QLabel *textLabel = new QLabel( docLoadingVBox ); |
137 | textLabel->setAlignment( int( QLabel::AlignCenter ) ); | 137 | textLabel->setAlignment( int( QLabel::AlignCenter ) ); |
138 | docLoadingWidgetProgress = new QProgressBar( docLoadingVBox ); | 138 | docLoadingWidgetProgress = new QProgressBar( docLoadingVBox ); |
139 | docLoadingWidgetProgress->setProgress( 0 ); | 139 | docLoadingWidgetProgress->setProgress( 0 ); |
140 | docLoadingWidgetProgress->setCenterIndicator( TRUE ); | 140 | docLoadingWidgetProgress->setCenterIndicator( TRUE ); |
141 | docLoadingWidgetProgress->setBackgroundMode( NoBackground ); // No flicker | 141 | docLoadingWidgetProgress->setBackgroundMode( NoBackground ); // No flicker |
142 | setProgressStyle(); | 142 | setProgressStyle(); |
143 | 143 | ||
144 | if ( docTabEnabled ) | 144 | if ( docTabEnabled ) |
145 | { | 145 | { |
146 | textLabel->setText( tr( "<b>Finding Documents...</b>" ) ); | 146 | textLabel->setText( tr( "<b>Finding Documents...</b>" ) ); |
147 | } | 147 | } |
148 | else | 148 | else |
149 | { | 149 | { |
150 | textLabel->setText( tr( "<b>The Documents Tab<p>has been disabled.<p>" | 150 | textLabel->setText( tr( "<b>The Documents Tab<p>has been disabled.<p>" |
151 | "Use Settings->Launcher->DocTab<p>to reenable it.</b></center>" ) ); | 151 | "Use Settings->Launcher->DocTab<p>to reenable it.</b></center>" ) ); |
152 | docLoadingWidgetProgress->hide(); | 152 | docLoadingWidgetProgress->hide(); |
@@ -432,98 +432,98 @@ void LauncherTabWidget::launcherMessage( const QCString &msg, const QByteArray & | |||
432 | } | 432 | } |
433 | 433 | ||
434 | 434 | ||
435 | 435 | ||
436 | //--------------------------------------------------------------------------- | 436 | //--------------------------------------------------------------------------- |
437 | 437 | ||
438 | Launcher::Launcher() | 438 | Launcher::Launcher() |
439 | : QMainWindow( 0, "PDA User Interface", QWidget::WStyle_Customize | QWidget::WGroupLeader ) | 439 | : QMainWindow( 0, "PDA User Interface", QWidget::WStyle_Customize | QWidget::WGroupLeader ) |
440 | { | 440 | { |
441 | tabs = 0; | 441 | tabs = 0; |
442 | tb = 0; | 442 | tb = 0; |
443 | Config cfg( "Launcher" ); | 443 | Config cfg( "Launcher" ); |
444 | cfg.setGroup( "DocTab" ); | 444 | cfg.setGroup( "DocTab" ); |
445 | docTabEnabled = cfg.readBoolEntry( "Enable", true ); | 445 | docTabEnabled = cfg.readBoolEntry( "Enable", true ); |
446 | } | 446 | } |
447 | 447 | ||
448 | void Launcher::createGUI() | 448 | void Launcher::createGUI() |
449 | { | 449 | { |
450 | setCaption( tr("Launcher") ); | 450 | setCaption( tr("Launcher") ); |
451 | 451 | ||
452 | // we have a pretty good idea how big we'll be | 452 | // we have a pretty good idea how big we'll be |
453 | setGeometry( 0, 0, qApp->desktop()->width(), qApp->desktop()->height() ); | 453 | setGeometry( 0, 0, qApp->desktop()->width(), qApp->desktop()->height() ); |
454 | 454 | ||
455 | tb = new TaskBar; | 455 | tb = new TaskBar; |
456 | tabs = new LauncherTabWidget( this ); | 456 | tabs = new LauncherTabWidget( this ); |
457 | setCentralWidget( tabs ); | 457 | setCentralWidget( tabs ); |
458 | 458 | ||
459 | ServerInterface::dockWidget( tb, ServerInterface::Bottom ); | 459 | ServerInterface::dockWidget( tb, ServerInterface::Bottom ); |
460 | tb->show(); | 460 | tb->show(); |
461 | 461 | ||
462 | qApp->installEventFilter( this ); | 462 | qApp->installEventFilter( this ); |
463 | 463 | ||
464 | 464 | ||
465 | connect( qApp, SIGNAL(symbol()), this, SLOT(toggleSymbolInput()) ); | 465 | connect( qApp, SIGNAL(symbol()), this, SLOT(toggleSymbolInput()) ); |
466 | connect( qApp, SIGNAL(numLockStateToggle()), this, SLOT(toggleNumLockState()) ); | 466 | connect( qApp, SIGNAL(numLockStateToggle()), this, SLOT(toggleNumLockState()) ); |
467 | connect( qApp, SIGNAL(capsLockStateToggle()), this, SLOT(toggleCapsLockState()) ); | 467 | connect( qApp, SIGNAL(capsLockStateToggle()), this, SLOT(toggleCapsLockState()) ); |
468 | 468 | ||
469 | connect( tb, SIGNAL(tabSelected(const QString&)), | 469 | connect( tb, SIGNAL(tabSelected(const QString&)), |
470 | this, SLOT(showTab(const QString&)) ); | 470 | this, SLOT(showTab(const QString&)) ); |
471 | connect( tabs, SIGNAL(selected(const QString&)), | 471 | connect( tabs, SIGNAL(selected(const QString&)), |
472 | this, SLOT(viewSelected(const QString&)) ); | 472 | this, SLOT(viewSelected(const QString&)) ); |
473 | connect( tabs, SIGNAL(clicked(const AppLnk*)), | 473 | connect( tabs, SIGNAL(clicked(const AppLnk*)), |
474 | this, SLOT(select(const AppLnk*))); | 474 | this, SLOT(select(const AppLnk*))); |
475 | connect( tabs, SIGNAL(rightPressed(AppLnk*)), | 475 | connect( tabs, SIGNAL(rightPressed(AppLnk*)), |
476 | this, SLOT(properties(AppLnk*))); | 476 | this, SLOT(properties(AppLnk*))); |
477 | 477 | ||
478 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 478 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
479 | QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); | 479 | QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); |
480 | connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), | 480 | connect( sysChannel, SIGNAL(received(const QCString&,const QByteArray&)), |
481 | this, SLOT(systemMessage( const QCString &, const QByteArray &)) ); | 481 | this, SLOT(systemMessage(const QCString&,const QByteArray&)) ); |
482 | #endif | 482 | #endif |
483 | 483 | ||
484 | // all documents | 484 | // all documents |
485 | QImage img( Resource::loadImage( "DocsIcon" ) ); | 485 | QImage img( Resource::loadImage( "DocsIcon" ) ); |
486 | QPixmap pm; | 486 | QPixmap pm; |
487 | pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); | 487 | pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); |
488 | // It could add this itself if it handles docs | 488 | // It could add this itself if it handles docs |
489 | 489 | ||
490 | tabs->newView("Documents", pm, tr("Documents") )->setToolsEnabled( TRUE ); | 490 | tabs->newView("Documents", pm, tr("Documents") )->setToolsEnabled( TRUE ); |
491 | 491 | ||
492 | QTimer::singleShot( 0, tabs, SLOT( initLayout() ) ); | 492 | QTimer::singleShot( 0, tabs, SLOT( initLayout() ) ); |
493 | qApp->setMainWidget( this ); | 493 | qApp->setMainWidget( this ); |
494 | QTimer::singleShot( 500, this, SLOT( makeVisible() ) ); | 494 | QTimer::singleShot( 500, this, SLOT( makeVisible() ) ); |
495 | } | 495 | } |
496 | 496 | ||
497 | Launcher::~Launcher() | 497 | Launcher::~Launcher() |
498 | { | 498 | { |
499 | if ( tb ) | 499 | if ( tb ) |
500 | destroyGUI(); | 500 | destroyGUI(); |
501 | } | 501 | } |
502 | 502 | ||
503 | bool Launcher::requiresDocuments() const | 503 | bool Launcher::requiresDocuments() const |
504 | { | 504 | { |
505 | Config cfg( "Launcher" ); | 505 | Config cfg( "Launcher" ); |
506 | cfg.setGroup( "DocTab" ); | 506 | cfg.setGroup( "DocTab" ); |
507 | return cfg.readBoolEntry( "Enable", true ); | 507 | return cfg.readBoolEntry( "Enable", true ); |
508 | } | 508 | } |
509 | 509 | ||
510 | void Launcher::makeVisible() | 510 | void Launcher::makeVisible() |
511 | { | 511 | { |
512 | showMaximized(); | 512 | showMaximized(); |
513 | } | 513 | } |
514 | 514 | ||
515 | void Launcher::destroyGUI() | 515 | void Launcher::destroyGUI() |
516 | { | 516 | { |
517 | delete tb; | 517 | delete tb; |
518 | tb = 0; | 518 | tb = 0; |
519 | delete tabs; | 519 | delete tabs; |
520 | tabs =0; | 520 | tabs =0; |
521 | } | 521 | } |
522 | 522 | ||
523 | bool Launcher::eventFilter( QObject*, QEvent *ev ) | 523 | bool Launcher::eventFilter( QObject*, QEvent *ev ) |
524 | { | 524 | { |
525 | #ifdef QT_QWS_CUSTOM | 525 | #ifdef QT_QWS_CUSTOM |
526 | if ( ev->type() == QEvent::KeyPress ) { | 526 | if ( ev->type() == QEvent::KeyPress ) { |
527 | QKeyEvent *ke = (QKeyEvent *)ev; | 527 | QKeyEvent *ke = (QKeyEvent *)ev; |
528 | if ( ke->key() == Qt::Key_F11 ) { // menu key | 528 | if ( ke->key() == Qt::Key_F11 ) { // menu key |
529 | QWidget *active = qApp->activeWindow(); | 529 | QWidget *active = qApp->activeWindow(); |
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp index 513b1bd..6c7d487 100644 --- a/core/launcher/launcherview.cpp +++ b/core/launcher/launcherview.cpp | |||
@@ -570,104 +570,104 @@ bool LauncherIconView::removeLink(const QString& linkfile) | |||
570 | bool did = FALSE; | 570 | bool did = FALSE; |
571 | DocLnk dl(linkfile); | 571 | DocLnk dl(linkfile); |
572 | while (item) { | 572 | while (item) { |
573 | l = item->appLnk(); | 573 | l = item->appLnk(); |
574 | LauncherItem *nextItem = (LauncherItem *)item->nextItem(); | 574 | LauncherItem *nextItem = (LauncherItem *)item->nextItem(); |
575 | if ( l->linkFileKnown() && l->linkFile() == linkfile | 575 | if ( l->linkFileKnown() && l->linkFile() == linkfile |
576 | || l->fileKnown() && ( | 576 | || l->fileKnown() && ( |
577 | l->file() == linkfile | 577 | l->file() == linkfile |
578 | || dl.isValid() && dl.file() == l->file() ) ) { | 578 | || dl.isValid() && dl.file() == l->file() ) ) { |
579 | delete item; | 579 | delete item; |
580 | did = TRUE; | 580 | did = TRUE; |
581 | } | 581 | } |
582 | item = nextItem; | 582 | item = nextItem; |
583 | } | 583 | } |
584 | QListIterator<AppLnk> it(hidden); | 584 | QListIterator<AppLnk> it(hidden); |
585 | while ((l=it.current())) { | 585 | while ((l=it.current())) { |
586 | ++it; | 586 | ++it; |
587 | if ( l->linkFileKnown() && l->linkFile() == linkfile | 587 | if ( l->linkFileKnown() && l->linkFile() == linkfile |
588 | || l->file() == linkfile | 588 | || l->file() == linkfile |
589 | || dl.isValid() && dl.file() == l->file() ) { | 589 | || dl.isValid() && dl.file() == l->file() ) { |
590 | hidden.removeRef(l); | 590 | hidden.removeRef(l); |
591 | did = TRUE; | 591 | did = TRUE; |
592 | } | 592 | } |
593 | } | 593 | } |
594 | return did; | 594 | return did; |
595 | } | 595 | } |
596 | 596 | ||
597 | //=========================================================================== | 597 | //=========================================================================== |
598 | 598 | ||
599 | LauncherView::LauncherView( QWidget* parent, const char* name, WFlags fl ) | 599 | LauncherView::LauncherView( QWidget* parent, const char* name, WFlags fl ) |
600 | : QVBox( parent, name, fl ) | 600 | : QVBox( parent, name, fl ) |
601 | { | 601 | { |
602 | catmb = 0; | 602 | catmb = 0; |
603 | icons = new LauncherIconView( this ); | 603 | icons = new LauncherIconView( this ); |
604 | setFocusProxy(icons); | 604 | setFocusProxy(icons); |
605 | QPEApplication::setStylusOperation( icons->viewport(), QPEApplication::RightOnHold ); | 605 | QPEApplication::setStylusOperation( icons->viewport(), QPEApplication::RightOnHold ); |
606 | 606 | ||
607 | icons->setItemsMovable( FALSE ); | 607 | icons->setItemsMovable( FALSE ); |
608 | icons->setAutoArrange( TRUE ); | 608 | icons->setAutoArrange( TRUE ); |
609 | icons->setSorting( TRUE ); | 609 | icons->setSorting( TRUE ); |
610 | icons->setFrameStyle( QFrame::NoFrame ); | 610 | icons->setFrameStyle( QFrame::NoFrame ); |
611 | icons->setMargin( 0 ); | 611 | icons->setMargin( 0 ); |
612 | icons->setSelectionMode( QIconView::NoSelection ); | 612 | icons->setSelectionMode( QIconView::NoSelection ); |
613 | icons->setBackgroundMode( PaletteBase ); | 613 | icons->setBackgroundMode( PaletteBase ); |
614 | icons->setResizeMode( QIconView::Fixed ); | 614 | icons->setResizeMode( QIconView::Fixed ); |
615 | vmode = (ViewMode)-1; | 615 | vmode = (ViewMode)-1; |
616 | setViewMode( Icon ); | 616 | setViewMode( Icon ); |
617 | 617 | ||
618 | connect( icons, SIGNAL(mouseButtonClicked(int, QIconViewItem *, const QPoint&)), | 618 | connect( icons, SIGNAL(mouseButtonClicked(int,QIconViewItem*,const QPoint&)), |
619 | SLOT(itemClicked(int, QIconViewItem *)) ); | 619 | SLOT(itemClicked(int,QIconViewItem*)) ); |
620 | connect( icons, SIGNAL(selectionChanged()), | 620 | connect( icons, SIGNAL(selectionChanged()), |
621 | SLOT(selectionChanged()) ); | 621 | SLOT(selectionChanged()) ); |
622 | connect( icons, SIGNAL(returnPressed(QIconViewItem *)), | 622 | connect( icons, SIGNAL(returnPressed(QIconViewItem*)), |
623 | SLOT(returnPressed(QIconViewItem *)) ); | 623 | SLOT(returnPressed(QIconViewItem*)) ); |
624 | connect( icons, SIGNAL(mouseButtonPressed(int, QIconViewItem *, const QPoint&)), | 624 | connect( icons, SIGNAL(mouseButtonPressed(int,QIconViewItem*,const QPoint&)), |
625 | SLOT(itemPressed(int, QIconViewItem *)) ); | 625 | SLOT(itemPressed(int,QIconViewItem*)) ); |
626 | 626 | ||
627 | tools = 0; | 627 | tools = 0; |
628 | setBackgroundType( Ruled, QString::null ); | 628 | setBackgroundType( Ruled, QString::null ); |
629 | } | 629 | } |
630 | 630 | ||
631 | LauncherView::~LauncherView() | 631 | LauncherView::~LauncherView() |
632 | { | 632 | { |
633 | if ( bgCache && bgCache->contains( bgName ) ) | 633 | if ( bgCache && bgCache->contains( bgName ) ) |
634 | (*bgCache)[bgName]->ref--; | 634 | (*bgCache)[bgName]->ref--; |
635 | } | 635 | } |
636 | 636 | ||
637 | void LauncherView::hideIcons() | 637 | void LauncherView::hideIcons() |
638 | { | 638 | { |
639 | icons->hide(); | 639 | icons->hide(); |
640 | } | 640 | } |
641 | 641 | ||
642 | void LauncherView::setToolsEnabled(bool y) | 642 | void LauncherView::setToolsEnabled(bool y) |
643 | { | 643 | { |
644 | if ( !y != !tools ) { | 644 | if ( !y != !tools ) { |
645 | if ( y ) { | 645 | if ( y ) { |
646 | tools = new QHBox(this); | 646 | tools = new QHBox(this); |
647 | 647 | ||
648 | // Type filter | 648 | // Type filter |
649 | typemb = new QComboBox(tools); | 649 | typemb = new QComboBox(tools); |
650 | QSizePolicy p = typemb->sizePolicy(); | 650 | QSizePolicy p = typemb->sizePolicy(); |
651 | p.setHorData(QSizePolicy::Expanding); | 651 | p.setHorData(QSizePolicy::Expanding); |
652 | typemb->setSizePolicy(p); | 652 | typemb->setSizePolicy(p); |
653 | 653 | ||
654 | // Category filter | 654 | // Category filter |
655 | updateTools(); | 655 | updateTools(); |
656 | tools->show(); | 656 | tools->show(); |
657 | 657 | ||
658 | // Always show vscrollbar | 658 | // Always show vscrollbar |
659 | icons->setVScrollBarMode( QScrollView::AlwaysOn ); | 659 | icons->setVScrollBarMode( QScrollView::AlwaysOn ); |
660 | } else { | 660 | } else { |
661 | delete tools; | 661 | delete tools; |
662 | tools = 0; | 662 | tools = 0; |
663 | } | 663 | } |
664 | } | 664 | } |
665 | } | 665 | } |
666 | 666 | ||
667 | void LauncherView::updateTools() | 667 | void LauncherView::updateTools() |
668 | { | 668 | { |
669 | disconnect( typemb, SIGNAL(activated(int)), | 669 | disconnect( typemb, SIGNAL(activated(int)), |
670 | this, SLOT(showType(int)) ); | 670 | this, SLOT(showType(int)) ); |
671 | if ( catmb ) disconnect( catmb, SIGNAL(signalSelected(int)), | 671 | if ( catmb ) disconnect( catmb, SIGNAL(signalSelected(int)), |
672 | this, SLOT(showCategory(int)) ); | 672 | this, SLOT(showCategory(int)) ); |
673 | 673 | ||
diff --git a/core/launcher/packageslave.cpp b/core/launcher/packageslave.cpp index 321b5dd..7e61b0e 100644 --- a/core/launcher/packageslave.cpp +++ b/core/launcher/packageslave.cpp | |||
@@ -7,98 +7,98 @@ | |||
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 "packageslave.h" | 21 | #include "packageslave.h" |
22 | #include <qtopia/qprocess.h> | 22 | #include <qtopia/qprocess.h> |
23 | 23 | ||
24 | #ifdef Q_WS_QWS | 24 | #ifdef Q_WS_QWS |
25 | #include <qtopia/qcopenvelope_qws.h> | 25 | #include <qtopia/qcopenvelope_qws.h> |
26 | #endif | 26 | #endif |
27 | 27 | ||
28 | #ifdef Q_WS_QWS | 28 | #ifdef Q_WS_QWS |
29 | #include <qcopchannel_qws.h> | 29 | #include <qcopchannel_qws.h> |
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | #include <qtextstream.h> | 32 | #include <qtextstream.h> |
33 | 33 | ||
34 | #include <stdlib.h> | 34 | #include <stdlib.h> |
35 | #include <sys/stat.h> // mkdir() | 35 | #include <sys/stat.h> // mkdir() |
36 | 36 | ||
37 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 37 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
38 | #include <unistd.h> | 38 | #include <unistd.h> |
39 | #include <sys/vfs.h> | 39 | #include <sys/vfs.h> |
40 | #include <mntent.h> | 40 | #include <mntent.h> |
41 | #elif defined(Q_OS_WIN32) | 41 | #elif defined(Q_OS_WIN32) |
42 | #include <windows.h> | 42 | #include <windows.h> |
43 | #include <winbase.h> | 43 | #include <winbase.h> |
44 | #elif defined(Q_OS_MACX) | 44 | #elif defined(Q_OS_MACX) |
45 | #include <unistd.h> | 45 | #include <unistd.h> |
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | 48 | ||
49 | PackageHandler::PackageHandler( QObject *parent, char* name ) | 49 | PackageHandler::PackageHandler( QObject *parent, char* name ) |
50 | : QObject( parent, name ), packageChannel( 0 ), currentProcess( 0 ), mNoSpaceLeft( FALSE ) | 50 | : QObject( parent, name ), packageChannel( 0 ), currentProcess( 0 ), mNoSpaceLeft( FALSE ) |
51 | { | 51 | { |
52 | // setup qcop channel | 52 | // setup qcop channel |
53 | #ifndef QT_NO_COP | 53 | #ifndef QT_NO_COP |
54 | packageChannel = new QCopChannel( "QPE/Package", this ); | 54 | packageChannel = new QCopChannel( "QPE/Package", this ); |
55 | connect( packageChannel, SIGNAL( received(const QCString &, const QByteArray &) ), | 55 | connect( packageChannel, SIGNAL( received(const QCString&,const QByteArray&) ), |
56 | this, SLOT( qcopMessage( const QCString &, const QByteArray &) ) ); | 56 | this, SLOT( qcopMessage(const QCString&,const QByteArray&) ) ); |
57 | #endif | 57 | #endif |
58 | } | 58 | } |
59 | 59 | ||
60 | void PackageHandler::qcopMessage( const QCString &msg, const QByteArray &data ) | 60 | void PackageHandler::qcopMessage( const QCString &msg, const QByteArray &data ) |
61 | { | 61 | { |
62 | QDataStream stream( data, IO_ReadOnly ); | 62 | QDataStream stream( data, IO_ReadOnly ); |
63 | 63 | ||
64 | if ( msg == "installPackage(QString)" ) { | 64 | if ( msg == "installPackage(QString)" ) { |
65 | QString file; | 65 | QString file; |
66 | stream >> file; | 66 | stream >> file; |
67 | installPackage( file ); | 67 | installPackage( file ); |
68 | } else if ( msg == "removePackage(QString)" ) { | 68 | } else if ( msg == "removePackage(QString)" ) { |
69 | QString file; | 69 | QString file; |
70 | stream >> file; | 70 | stream >> file; |
71 | removePackage( file ); | 71 | removePackage( file ); |
72 | } else if ( msg == "addPackageFiles(QString,QString)" ) { | 72 | } else if ( msg == "addPackageFiles(QString,QString)" ) { |
73 | QString location, listfile; | 73 | QString location, listfile; |
74 | stream >> location >> listfile; | 74 | stream >> location >> listfile; |
75 | addPackageFiles( location, listfile); | 75 | addPackageFiles( location, listfile); |
76 | } else if ( msg == "addPackages(QString)" ) { | 76 | } else if ( msg == "addPackages(QString)" ) { |
77 | QString location; | 77 | QString location; |
78 | stream >> location; | 78 | stream >> location; |
79 | addPackages( location ); | 79 | addPackages( location ); |
80 | } else if ( msg == "cleanupPackageFiles(QString)" ) { | 80 | } else if ( msg == "cleanupPackageFiles(QString)" ) { |
81 | QString listfile; | 81 | QString listfile; |
82 | stream >> listfile; | 82 | stream >> listfile; |
83 | cleanupPackageFiles( listfile ); | 83 | cleanupPackageFiles( listfile ); |
84 | } else if ( msg == "cleanupPackages(QString)" ) { | 84 | } else if ( msg == "cleanupPackages(QString)" ) { |
85 | QString location; | 85 | QString location; |
86 | stream >> location; | 86 | stream >> location; |
87 | cleanupPackages( location ); | 87 | cleanupPackages( location ); |
88 | } else if ( msg == "prepareInstall(QString,QString)" ) { | 88 | } else if ( msg == "prepareInstall(QString,QString)" ) { |
89 | QString size, path; | 89 | QString size, path; |
90 | stream >> size; | 90 | stream >> size; |
91 | stream >> path; | 91 | stream >> path; |
92 | prepareInstall( size, path ); | 92 | prepareInstall( size, path ); |
93 | } | 93 | } |
94 | } | 94 | } |
95 | 95 | ||
96 | void PackageHandler::installPackage( const QString &package ) | 96 | void PackageHandler::installPackage( const QString &package ) |
97 | { | 97 | { |
98 | if ( mNoSpaceLeft ) { | 98 | if ( mNoSpaceLeft ) { |
99 | mNoSpaceLeft = FALSE; | 99 | mNoSpaceLeft = FALSE; |
100 | // Don't emit that for now, I still couldn't test it (Wener) | 100 | // Don't emit that for now, I still couldn't test it (Wener) |
101 | //sendReply( "installFailed(QString)", package ); | 101 | //sendReply( "installFailed(QString)", package ); |
102 | //return; | 102 | //return; |
103 | } | 103 | } |
104 | 104 | ||
diff --git a/core/launcher/qcopbridge.cpp b/core/launcher/qcopbridge.cpp index 24f471d..53efba4 100644 --- a/core/launcher/qcopbridge.cpp +++ b/core/launcher/qcopbridge.cpp | |||
@@ -20,135 +20,135 @@ | |||
20 | 20 | ||
21 | #include "qcopbridge.h" | 21 | #include "qcopbridge.h" |
22 | #include "transferserver.h" | 22 | #include "transferserver.h" |
23 | 23 | ||
24 | #include <opie2/oglobal.h> | 24 | #include <opie2/oglobal.h> |
25 | 25 | ||
26 | #ifdef Q_WS_QWS | 26 | #ifdef Q_WS_QWS |
27 | #include <qtopia/qcopenvelope_qws.h> | 27 | #include <qtopia/qcopenvelope_qws.h> |
28 | #endif | 28 | #endif |
29 | #include <qtopia/qpeapplication.h> | 29 | #include <qtopia/qpeapplication.h> |
30 | 30 | ||
31 | #include <qtopia/version.h> | 31 | #include <qtopia/version.h> |
32 | 32 | ||
33 | #include <qtextstream.h> | 33 | #include <qtextstream.h> |
34 | #include <qtimer.h> | 34 | #include <qtimer.h> |
35 | #ifdef Q_WS_QWS | 35 | #ifdef Q_WS_QWS |
36 | #include <qcopchannel_qws.h> | 36 | #include <qcopchannel_qws.h> |
37 | #endif | 37 | #endif |
38 | 38 | ||
39 | #ifndef _XOPEN_SOURCE | 39 | #ifndef _XOPEN_SOURCE |
40 | #define _XOPEN_SOURCE | 40 | #define _XOPEN_SOURCE |
41 | #endif | 41 | #endif |
42 | #ifndef Q_OS_WIN32 | 42 | #ifndef Q_OS_WIN32 |
43 | #include <pwd.h> | 43 | #include <pwd.h> |
44 | #include <unistd.h> | 44 | #include <unistd.h> |
45 | #include <sys/types.h> | 45 | #include <sys/types.h> |
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | #if defined(_OS_LINUX_) | 48 | #if defined(_OS_LINUX_) |
49 | #include <shadow.h> | 49 | #include <shadow.h> |
50 | #endif | 50 | #endif |
51 | 51 | ||
52 | 52 | ||
53 | //#define INSECURE | 53 | //#define INSECURE |
54 | 54 | ||
55 | const int block_size = 51200; | 55 | const int block_size = 51200; |
56 | 56 | ||
57 | QCopBridge::QCopBridge( Q_UINT16 port, QObject *parent, | 57 | QCopBridge::QCopBridge( Q_UINT16 port, QObject *parent, |
58 | const char* name ) | 58 | const char* name ) |
59 | : QServerSocket( port, 1, parent, name ), | 59 | : QServerSocket( port, 1, parent, name ), |
60 | desktopChannel( 0 ), | 60 | desktopChannel( 0 ), |
61 | cardChannel( 0 ) | 61 | cardChannel( 0 ) |
62 | { | 62 | { |
63 | if ( !ok() ) | 63 | if ( !ok() ) |
64 | qWarning( "Failed to bind to port %d", port ); | 64 | qWarning( "Failed to bind to port %d", port ); |
65 | else { | 65 | else { |
66 | #ifndef QT_NO_COP | 66 | #ifndef QT_NO_COP |
67 | desktopChannel = new QCopChannel( "QPE/Desktop", this ); | 67 | desktopChannel = new QCopChannel( "QPE/Desktop", this ); |
68 | connect( desktopChannel, SIGNAL(received(const QCString &, const QByteArray &)), | 68 | connect( desktopChannel, SIGNAL(received(const QCString&,const QByteArray&)), |
69 | this, SLOT(desktopMessage( const QCString &, const QByteArray &)) ); | 69 | this, SLOT(desktopMessage(const QCString&,const QByteArray&)) ); |
70 | cardChannel = new QCopChannel( "QPE/Card", this ); | 70 | cardChannel = new QCopChannel( "QPE/Card", this ); |
71 | connect( cardChannel, SIGNAL(received(const QCString &, const QByteArray &)), | 71 | connect( cardChannel, SIGNAL(received(const QCString&,const QByteArray&)), |
72 | this, SLOT(desktopMessage( const QCString &, const QByteArray &)) ); | 72 | this, SLOT(desktopMessage(const QCString&,const QByteArray&)) ); |
73 | #endif | 73 | #endif |
74 | } | 74 | } |
75 | sendSync = FALSE; | 75 | sendSync = FALSE; |
76 | openConnections.setAutoDelete( TRUE ); | 76 | openConnections.setAutoDelete( TRUE ); |
77 | authorizeConnections(); | 77 | authorizeConnections(); |
78 | } | 78 | } |
79 | 79 | ||
80 | QCopBridge::~QCopBridge() | 80 | QCopBridge::~QCopBridge() |
81 | { | 81 | { |
82 | #ifndef QT_NO_COP | 82 | #ifndef QT_NO_COP |
83 | delete desktopChannel; | 83 | delete desktopChannel; |
84 | #endif | 84 | #endif |
85 | } | 85 | } |
86 | 86 | ||
87 | void QCopBridge::authorizeConnections() | 87 | void QCopBridge::authorizeConnections() |
88 | { | 88 | { |
89 | Config cfg("Security"); | 89 | Config cfg("Security"); |
90 | cfg.setGroup("SyncMode"); | 90 | cfg.setGroup("SyncMode"); |
91 | m_mode = Mode(cfg.readNumEntry("Mode", Sharp )); | 91 | m_mode = Mode(cfg.readNumEntry("Mode", Sharp )); |
92 | QListIterator<QCopBridgePI> it(openConnections); | 92 | QListIterator<QCopBridgePI> it(openConnections); |
93 | while ( it.current() ) { | 93 | while ( it.current() ) { |
94 | if ( !it.current()->verifyAuthorised() ) { | 94 | if ( !it.current()->verifyAuthorised() ) { |
95 | disconnect ( it.current(), SIGNAL( connectionClosed( QCopBridgePI *) ), this, SLOT( closed( QCopBridgePI *) ) ); | 95 | disconnect ( it.current(), SIGNAL( connectionClosed(QCopBridgePI*) ), this, SLOT( closed(QCopBridgePI*) ) ); |
96 | openConnections.removeRef( it.current() ); | 96 | openConnections.removeRef( it.current() ); |
97 | } else | 97 | } else |
98 | ++it; | 98 | ++it; |
99 | } | 99 | } |
100 | } | 100 | } |
101 | 101 | ||
102 | void QCopBridge::newConnection( int socket ) | 102 | void QCopBridge::newConnection( int socket ) |
103 | { | 103 | { |
104 | QCopBridgePI *pi = new QCopBridgePI( socket, this ); | 104 | QCopBridgePI *pi = new QCopBridgePI( socket, this ); |
105 | openConnections.append( pi ); | 105 | openConnections.append( pi ); |
106 | connect ( pi, SIGNAL( connectionClosed( QCopBridgePI *) ), this, SLOT( closed( QCopBridgePI *) ) ); | 106 | connect ( pi, SIGNAL( connectionClosed(QCopBridgePI*) ), this, SLOT( closed(QCopBridgePI*) ) ); |
107 | 107 | ||
108 | /* ### libqtopia merge FIXME */ | 108 | /* ### libqtopia merge FIXME */ |
109 | #if 0 | 109 | #if 0 |
110 | QPEApplication::setTempScreenSaverMode( QPEApplication::DisableSuspend ); | 110 | QPEApplication::setTempScreenSaverMode( QPEApplication::DisableSuspend ); |
111 | #endif | 111 | #endif |
112 | #ifndef QT_NO_COP | 112 | #ifndef QT_NO_COP |
113 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend; | 113 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend; |
114 | #endif | 114 | #endif |
115 | 115 | ||
116 | if ( sendSync ) { | 116 | if ( sendSync ) { |
117 | pi ->startSync(); | 117 | pi ->startSync(); |
118 | sendSync = FALSE; | 118 | sendSync = FALSE; |
119 | } | 119 | } |
120 | } | 120 | } |
121 | 121 | ||
122 | void QCopBridge::closed( QCopBridgePI *pi ) | 122 | void QCopBridge::closed( QCopBridgePI *pi ) |
123 | { | 123 | { |
124 | emit connectionClosed( pi->peerAddress() ); | 124 | emit connectionClosed( pi->peerAddress() ); |
125 | openConnections.removeRef( pi ); | 125 | openConnections.removeRef( pi ); |
126 | if ( openConnections.count() == 0 ) { | 126 | if ( openConnections.count() == 0 ) { |
127 | /* ### FIXME libqtopia merge */ | 127 | /* ### FIXME libqtopia merge */ |
128 | #if 0 | 128 | #if 0 |
129 | QPEApplication::setTempScreenSaverMode( QPEApplication::Enable ); | 129 | QPEApplication::setTempScreenSaverMode( QPEApplication::Enable ); |
130 | #endif | 130 | #endif |
131 | #ifndef QT_NO_COP | 131 | #ifndef QT_NO_COP |
132 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; | 132 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; |
133 | #endif | 133 | #endif |
134 | } | 134 | } |
135 | } | 135 | } |
136 | 136 | ||
137 | void QCopBridge::closeOpenConnections() | 137 | void QCopBridge::closeOpenConnections() |
138 | { | 138 | { |
139 | QCopBridgePI *pi; | 139 | QCopBridgePI *pi; |
140 | for ( pi = openConnections.first(); pi != 0; pi = openConnections.next() ) | 140 | for ( pi = openConnections.first(); pi != 0; pi = openConnections.next() ) |
141 | pi->close(); | 141 | pi->close(); |
142 | } | 142 | } |
143 | 143 | ||
144 | 144 | ||
145 | void QCopBridge::desktopMessage( const QCString &command, const QByteArray &data ) | 145 | void QCopBridge::desktopMessage( const QCString &command, const QByteArray &data ) |
146 | { | 146 | { |
147 | if ( command == "startSync()" ) { | 147 | if ( command == "startSync()" ) { |
148 | // we need to buffer it a bit | 148 | // we need to buffer it a bit |
149 | sendSync = TRUE; | 149 | sendSync = TRUE; |
150 | startTimer( 20000 ); | 150 | startTimer( 20000 ); |
151 | } | 151 | } |
152 | 152 | ||
153 | if ( m_mode & Qtopia1_7 ) { | 153 | if ( m_mode & Qtopia1_7 ) { |
154 | // send the command to all open connections | 154 | // send the command to all open connections |
diff --git a/core/launcher/runningappbar.cpp b/core/launcher/runningappbar.cpp index 11d10dc..2e9d2a9 100644 --- a/core/launcher/runningappbar.cpp +++ b/core/launcher/runningappbar.cpp | |||
@@ -1,86 +1,86 @@ | |||
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_PRELOADACCESS | 21 | #define QTOPIA_INTERNAL_PRELOADACCESS |
22 | 22 | ||
23 | 23 | ||
24 | #include <stdlib.h> | 24 | #include <stdlib.h> |
25 | 25 | ||
26 | #include <qpainter.h> | 26 | #include <qpainter.h> |
27 | 27 | ||
28 | #include <qtopia/qcopenvelope_qws.h> | 28 | #include <qtopia/qcopenvelope_qws.h> |
29 | 29 | ||
30 | #include "runningappbar.h" | 30 | #include "runningappbar.h" |
31 | #include "serverinterface.h" | 31 | #include "serverinterface.h" |
32 | 32 | ||
33 | RunningAppBar::RunningAppBar(QWidget* parent) | 33 | RunningAppBar::RunningAppBar(QWidget* parent) |
34 | : QFrame(parent), selectedAppIndex(-1) | 34 | : QFrame(parent), selectedAppIndex(-1) |
35 | { | 35 | { |
36 | QCopChannel* channel = new QCopChannel( "QPE/System", this ); | 36 | QCopChannel* channel = new QCopChannel( "QPE/System", this ); |
37 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 37 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), |
38 | this, SLOT(received(const QCString&, const QByteArray&)) ); | 38 | this, SLOT(received(const QCString&,const QByteArray&)) ); |
39 | 39 | ||
40 | spacing = AppLnk::smallIconSize()+3; | 40 | spacing = AppLnk::smallIconSize()+3; |
41 | } | 41 | } |
42 | 42 | ||
43 | RunningAppBar::~RunningAppBar() | 43 | RunningAppBar::~RunningAppBar() |
44 | { | 44 | { |
45 | } | 45 | } |
46 | 46 | ||
47 | void RunningAppBar::received(const QCString& msg, const QByteArray& data) { | 47 | void RunningAppBar::received(const QCString& msg, const QByteArray& data) { |
48 | // Since fast apps appear and disappear without disconnecting from their | 48 | // Since fast apps appear and disappear without disconnecting from their |
49 | // channel we need to watch for the showing/hiding events and update according. | 49 | // channel we need to watch for the showing/hiding events and update according. |
50 | QDataStream stream( data, IO_ReadOnly ); | 50 | QDataStream stream( data, IO_ReadOnly ); |
51 | if ( msg == "fastAppShowing(QString)") { | 51 | if ( msg == "fastAppShowing(QString)") { |
52 | QString appName; | 52 | QString appName; |
53 | stream >> appName; | 53 | stream >> appName; |
54 | // qDebug("fastAppShowing %s", appName.data() ); | 54 | // qDebug("fastAppShowing %s", appName.data() ); |
55 | const AppLnk* f = ServerInterface::appLnks().findExec(appName); | 55 | const AppLnk* f = ServerInterface::appLnks().findExec(appName); |
56 | if ( f ) addTask(*f); | 56 | if ( f ) addTask(*f); |
57 | } else if ( msg == "fastAppHiding(QString)") { | 57 | } else if ( msg == "fastAppHiding(QString)") { |
58 | QString appName; | 58 | QString appName; |
59 | stream >> appName; | 59 | stream >> appName; |
60 | const AppLnk* f = ServerInterface::appLnks().findExec(appName); | 60 | const AppLnk* f = ServerInterface::appLnks().findExec(appName); |
61 | if ( f ) removeTask(*f); | 61 | if ( f ) removeTask(*f); |
62 | } | 62 | } |
63 | } | 63 | } |
64 | 64 | ||
65 | void RunningAppBar::addTask(const AppLnk& appLnk) { | 65 | void RunningAppBar::addTask(const AppLnk& appLnk) { |
66 | qDebug("Added %s to app list.", appLnk.name().latin1()); | 66 | qDebug("Added %s to app list.", appLnk.name().latin1()); |
67 | AppLnk* newApp = new AppLnk(appLnk); | 67 | AppLnk* newApp = new AppLnk(appLnk); |
68 | newApp->setExec(appLnk.exec()); | 68 | newApp->setExec(appLnk.exec()); |
69 | appList.prepend(newApp); | 69 | appList.prepend(newApp); |
70 | update(); | 70 | update(); |
71 | } | 71 | } |
72 | 72 | ||
73 | void RunningAppBar::removeTask(const AppLnk& appLnk) { | 73 | void RunningAppBar::removeTask(const AppLnk& appLnk) { |
74 | unsigned int i = 0; | 74 | unsigned int i = 0; |
75 | for (; i < appList.count() ; i++) { | 75 | for (; i < appList.count() ; i++) { |
76 | AppLnk* target = appList.at(i); | 76 | AppLnk* target = appList.at(i); |
77 | if (target->exec() == appLnk.exec()) { | 77 | if (target->exec() == appLnk.exec()) { |
78 | qDebug("Removing %s from app list.", appLnk.name().latin1()); | 78 | qDebug("Removing %s from app list.", appLnk.name().latin1()); |
79 | appList.remove(); | 79 | appList.remove(); |
80 | delete target; | 80 | delete target; |
81 | } | 81 | } |
82 | } | 82 | } |
83 | update(); | 83 | update(); |
84 | } | 84 | } |
85 | 85 | ||
86 | void RunningAppBar::mousePressEvent(QMouseEvent *e) | 86 | void RunningAppBar::mousePressEvent(QMouseEvent *e) |
diff --git a/core/launcher/server.cpp b/core/launcher/server.cpp index 068d716..ea0b792 100644 --- a/core/launcher/server.cpp +++ b/core/launcher/server.cpp | |||
@@ -102,120 +102,120 @@ static Global::Command builtins[] = { | |||
102 | #ifdef SINGLE_APP | 102 | #ifdef SINGLE_APP |
103 | #define APP(a,b,c,d) { a, new##b, c, d }, | 103 | #define APP(a,b,c,d) { a, new##b, c, d }, |
104 | #include "apps.h" | 104 | #include "apps.h" |
105 | #undef APP | 105 | #undef APP |
106 | #endif | 106 | #endif |
107 | 107 | ||
108 | /* FIXME defines need to be defined*/ | 108 | /* FIXME defines need to be defined*/ |
109 | #if !defined(OPIE_NO_BUILTIN_CALIBRATE) | 109 | #if !defined(OPIE_NO_BUILTIN_CALIBRATE) |
110 | { "calibrate", calibrate, 1, 0 }, // No tr | 110 | { "calibrate", calibrate, 1, 0 }, // No tr |
111 | #endif | 111 | #endif |
112 | #if !defined(OPIE_NO_BUILTIN_SHUTDOWN) | 112 | #if !defined(OPIE_NO_BUILTIN_SHUTDOWN) |
113 | { "shutdown", Global::shutdown, 1, 0 }, // No tr | 113 | { "shutdown", Global::shutdown, 1, 0 }, // No tr |
114 | // { "run", run, 1, 0 }, // No tr | 114 | // { "run", run, 1, 0 }, // No tr |
115 | #endif | 115 | #endif |
116 | 116 | ||
117 | { 0, calibrate,0, 0 }, | 117 | { 0, calibrate,0, 0 }, |
118 | }; | 118 | }; |
119 | 119 | ||
120 | 120 | ||
121 | //--------------------------------------------------------------------------- | 121 | //--------------------------------------------------------------------------- |
122 | 122 | ||
123 | 123 | ||
124 | //=========================================================================== | 124 | //=========================================================================== |
125 | 125 | ||
126 | Server::Server() : | 126 | Server::Server() : |
127 | QWidget( 0, 0, WStyle_Tool | WStyle_Customize ), | 127 | QWidget( 0, 0, WStyle_Tool | WStyle_Customize ), |
128 | qcopBridge( 0 ), | 128 | qcopBridge( 0 ), |
129 | transferServer( 0 ), | 129 | transferServer( 0 ), |
130 | packageHandler( 0 ), | 130 | packageHandler( 0 ), |
131 | syncDialog( 0 ) | 131 | syncDialog( 0 ) |
132 | { | 132 | { |
133 | Global::setBuiltinCommands(builtins); | 133 | Global::setBuiltinCommands(builtins); |
134 | 134 | ||
135 | tid_xfer = 0; | 135 | tid_xfer = 0; |
136 | /* ### FIXME ### */ | 136 | /* ### FIXME ### */ |
137 | /* tid_today = startTimer(3600*2*1000);*/ | 137 | /* tid_today = startTimer(3600*2*1000);*/ |
138 | last_today_show = QDate::currentDate(); | 138 | last_today_show = QDate::currentDate(); |
139 | 139 | ||
140 | #if 0 | 140 | #if 0 |
141 | tsmMonitor = new TempScreenSaverMode(); | 141 | tsmMonitor = new TempScreenSaverMode(); |
142 | connect( tsmMonitor, SIGNAL(forceSuspend()), qApp, SIGNAL(power()) ); | 142 | connect( tsmMonitor, SIGNAL(forceSuspend()), qApp, SIGNAL(power()) ); |
143 | #endif | 143 | #endif |
144 | 144 | ||
145 | serverGui = new Launcher; | 145 | serverGui = new Launcher; |
146 | serverGui->createGUI(); | 146 | serverGui->createGUI(); |
147 | 147 | ||
148 | docList = new DocumentList( serverGui ); | 148 | docList = new DocumentList( serverGui ); |
149 | appLauncher = new AppLauncher(this); | 149 | appLauncher = new AppLauncher(this); |
150 | connect(appLauncher, SIGNAL(launched(int, const QString &)), this, SLOT(applicationLaunched(int, const QString &)) ); | 150 | connect(appLauncher, SIGNAL(launched(int,const QString&)), this, SLOT(applicationLaunched(int,const QString&)) ); |
151 | connect(appLauncher, SIGNAL(terminated(int, const QString &)), this, SLOT(applicationTerminated(int, const QString &)) ); | 151 | connect(appLauncher, SIGNAL(terminated(int,const QString&)), this, SLOT(applicationTerminated(int,const QString&)) ); |
152 | connect(appLauncher, SIGNAL(connected(const QString &)), this, SLOT(applicationConnected(const QString &)) ); | 152 | connect(appLauncher, SIGNAL(connected(const QString&)), this, SLOT(applicationConnected(const QString&)) ); |
153 | 153 | ||
154 | storage = new StorageInfo( this ); | 154 | storage = new StorageInfo( this ); |
155 | connect( storage, SIGNAL(disksChanged()), this, SLOT(storageChanged()) ); | 155 | connect( storage, SIGNAL(disksChanged()), this, SLOT(storageChanged()) ); |
156 | 156 | ||
157 | // start services | 157 | // start services |
158 | startTransferServer(); | 158 | startTransferServer(); |
159 | (void) new IrServer( this ); | 159 | (void) new IrServer( this ); |
160 | 160 | ||
161 | packageHandler = new PackageHandler( this ); | 161 | packageHandler = new PackageHandler( this ); |
162 | connect(qApp, SIGNAL(activate(const Opie::ODeviceButton*,bool)), | 162 | connect(qApp, SIGNAL(activate(const Opie::ODeviceButton*,bool)), |
163 | this,SLOT(activate(const Opie::ODeviceButton*,bool))); | 163 | this,SLOT(activate(const Opie::ODeviceButton*,bool))); |
164 | 164 | ||
165 | setGeometry( -10, -10, 9, 9 ); | 165 | setGeometry( -10, -10, 9, 9 ); |
166 | 166 | ||
167 | QCopChannel *channel = new QCopChannel("QPE/System", this); | 167 | QCopChannel *channel = new QCopChannel("QPE/System", this); |
168 | connect(channel, SIGNAL(received(const QCString &, const QByteArray &)), | 168 | connect(channel, SIGNAL(received(const QCString&,const QByteArray&)), |
169 | this, SLOT(systemMsg(const QCString &, const QByteArray &)) ); | 169 | this, SLOT(systemMsg(const QCString&,const QByteArray&)) ); |
170 | 170 | ||
171 | QCopChannel *tbChannel = new QCopChannel( "QPE/TaskBar", this ); | 171 | QCopChannel *tbChannel = new QCopChannel( "QPE/TaskBar", this ); |
172 | connect( tbChannel, SIGNAL(received(const QCString&, const QByteArray&)), | 172 | connect( tbChannel, SIGNAL(received(const QCString&,const QByteArray&)), |
173 | this, SLOT(receiveTaskBar(const QCString&, const QByteArray&)) ); | 173 | this, SLOT(receiveTaskBar(const QCString&,const QByteArray&)) ); |
174 | 174 | ||
175 | connect( qApp, SIGNAL(prepareForRestart()), this, SLOT(terminateServers()) ); | 175 | connect( qApp, SIGNAL(prepareForRestart()), this, SLOT(terminateServers()) ); |
176 | connect( qApp, SIGNAL(timeChanged()), this, SLOT(pokeTimeMonitors()) ); | 176 | connect( qApp, SIGNAL(timeChanged()), this, SLOT(pokeTimeMonitors()) ); |
177 | 177 | ||
178 | preloadApps(); | 178 | preloadApps(); |
179 | } | 179 | } |
180 | 180 | ||
181 | void Server::show() | 181 | void Server::show() |
182 | { | 182 | { |
183 | ServerApplication::login(TRUE); | 183 | ServerApplication::login(TRUE); |
184 | QWidget::show(); | 184 | QWidget::show(); |
185 | } | 185 | } |
186 | 186 | ||
187 | Server::~Server() | 187 | Server::~Server() |
188 | { | 188 | { |
189 | serverGui->destroyGUI(); | 189 | serverGui->destroyGUI(); |
190 | delete docList; | 190 | delete docList; |
191 | delete qcopBridge; | 191 | delete qcopBridge; |
192 | delete transferServer; | 192 | delete transferServer; |
193 | delete serverGui; | 193 | delete serverGui; |
194 | #if 0 | 194 | #if 0 |
195 | delete tsmMonitor; | 195 | delete tsmMonitor; |
196 | #endif | 196 | #endif |
197 | } | 197 | } |
198 | 198 | ||
199 | static bool hasVisibleWindow(const QString& clientname, bool partial) | 199 | static bool hasVisibleWindow(const QString& clientname, bool partial) |
200 | { | 200 | { |
201 | #ifdef QWS | 201 | #ifdef QWS |
202 | const QList<QWSWindow> &list = qwsServer->clientWindows(); | 202 | const QList<QWSWindow> &list = qwsServer->clientWindows(); |
203 | QWSWindow* w; | 203 | QWSWindow* w; |
204 | for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { | 204 | for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { |
205 | if ( w->client()->identity() == clientname ) { | 205 | if ( w->client()->identity() == clientname ) { |
206 | if ( partial && !w->isFullyObscured() ) | 206 | if ( partial && !w->isFullyObscured() ) |
207 | return TRUE; | 207 | return TRUE; |
208 | if ( !partial && !w->isFullyObscured() && !w->isPartiallyObscured() ) { | 208 | if ( !partial && !w->isFullyObscured() && !w->isPartiallyObscured() ) { |
209 | # if QT_VERSION < 0x030000 | 209 | # if QT_VERSION < 0x030000 |
210 | QRect mwr = qt_screen->mapToDevice(qt_maxWindowRect, | 210 | QRect mwr = qt_screen->mapToDevice(qt_maxWindowRect, |
211 | QSize(qt_screen->width(),qt_screen->height()) ); | 211 | QSize(qt_screen->width(),qt_screen->height()) ); |
212 | # else | 212 | # else |
213 | QRect mwr = qt_maxWindowRect; | 213 | QRect mwr = qt_maxWindowRect; |
214 | # endif | 214 | # endif |
215 | if ( mwr.contains(w->requested().boundingRect()) ) | 215 | if ( mwr.contains(w->requested().boundingRect()) ) |
216 | return TRUE; | 216 | return TRUE; |
217 | } | 217 | } |
218 | } | 218 | } |
219 | } | 219 | } |
220 | #endif | 220 | #endif |
221 | return FALSE; | 221 | return FALSE; |
@@ -568,98 +568,98 @@ bool Server::mkdir(const QString &localPath) | |||
568 | 568 | ||
569 | QString dirSeps = "/"; | 569 | QString dirSeps = "/"; |
570 | int dirIndex = localPath.find(dirSeps); | 570 | int dirIndex = localPath.find(dirSeps); |
571 | QString checkedPath; | 571 | QString checkedPath; |
572 | 572 | ||
573 | // didn't find any seps; weird, use the cur dir instead | 573 | // didn't find any seps; weird, use the cur dir instead |
574 | if (dirIndex == -1) { | 574 | if (dirIndex == -1) { |
575 | //qDebug("No seperators found in path %s", localPath.latin1()); | 575 | //qDebug("No seperators found in path %s", localPath.latin1()); |
576 | checkedPath = QDir::currentDirPath(); | 576 | checkedPath = QDir::currentDirPath(); |
577 | } | 577 | } |
578 | 578 | ||
579 | while (checkedPath != localPath) { | 579 | while (checkedPath != localPath) { |
580 | // no more seperators found, use the local path | 580 | // no more seperators found, use the local path |
581 | if (dirIndex == -1) | 581 | if (dirIndex == -1) |
582 | checkedPath = localPath; | 582 | checkedPath = localPath; |
583 | else { | 583 | else { |
584 | // the next directory to check | 584 | // the next directory to check |
585 | checkedPath = localPath.left(dirIndex) + "/"; | 585 | checkedPath = localPath.left(dirIndex) + "/"; |
586 | // advance the iterator; the next dir seperator | 586 | // advance the iterator; the next dir seperator |
587 | dirIndex = localPath.find(dirSeps, dirIndex+1); | 587 | dirIndex = localPath.find(dirSeps, dirIndex+1); |
588 | } | 588 | } |
589 | 589 | ||
590 | QDir checkDir(checkedPath); | 590 | QDir checkDir(checkedPath); |
591 | if (!checkDir.exists()) { | 591 | if (!checkDir.exists()) { |
592 | //qDebug("mkdir making dir %s", checkedPath.latin1()); | 592 | //qDebug("mkdir making dir %s", checkedPath.latin1()); |
593 | 593 | ||
594 | if (!checkDir.mkdir(checkedPath)) { | 594 | if (!checkDir.mkdir(checkedPath)) { |
595 | qDebug("Unable to make directory %s", checkedPath.latin1()); | 595 | qDebug("Unable to make directory %s", checkedPath.latin1()); |
596 | return FALSE; | 596 | return FALSE; |
597 | } | 597 | } |
598 | } | 598 | } |
599 | 599 | ||
600 | } | 600 | } |
601 | return TRUE; | 601 | return TRUE; |
602 | } | 602 | } |
603 | 603 | ||
604 | void Server::styleChange( QStyle &s ) | 604 | void Server::styleChange( QStyle &s ) |
605 | { | 605 | { |
606 | QWidget::styleChange( s ); | 606 | QWidget::styleChange( s ); |
607 | } | 607 | } |
608 | 608 | ||
609 | void Server::startTransferServer() | 609 | void Server::startTransferServer() |
610 | { | 610 | { |
611 | if ( !qcopBridge ) { | 611 | if ( !qcopBridge ) { |
612 | // start qcop bridge server | 612 | // start qcop bridge server |
613 | qcopBridge = new QCopBridge( 4243 ); | 613 | qcopBridge = new QCopBridge( 4243 ); |
614 | if ( qcopBridge->ok() ) { | 614 | if ( qcopBridge->ok() ) { |
615 | // ... OK | 615 | // ... OK |
616 | connect( qcopBridge, SIGNAL(connectionClosed(const QHostAddress &)), | 616 | connect( qcopBridge, SIGNAL(connectionClosed(const QHostAddress&)), |
617 | this, SLOT(syncConnectionClosed(const QHostAddress &)) ); | 617 | this, SLOT(syncConnectionClosed(const QHostAddress&)) ); |
618 | } else { | 618 | } else { |
619 | delete qcopBridge; | 619 | delete qcopBridge; |
620 | qcopBridge = 0; | 620 | qcopBridge = 0; |
621 | } | 621 | } |
622 | } | 622 | } |
623 | if ( !transferServer ) { | 623 | if ( !transferServer ) { |
624 | // start transfer server | 624 | // start transfer server |
625 | transferServer = new TransferServer( 4242 ); | 625 | transferServer = new TransferServer( 4242 ); |
626 | if ( transferServer->ok() ) { | 626 | if ( transferServer->ok() ) { |
627 | // ... OK | 627 | // ... OK |
628 | } else { | 628 | } else { |
629 | delete transferServer; | 629 | delete transferServer; |
630 | transferServer = 0; | 630 | transferServer = 0; |
631 | } | 631 | } |
632 | } | 632 | } |
633 | if ( !transferServer || !qcopBridge ) | 633 | if ( !transferServer || !qcopBridge ) |
634 | tid_xfer = startTimer( 2000 ); | 634 | tid_xfer = startTimer( 2000 ); |
635 | } | 635 | } |
636 | 636 | ||
637 | void Server::timerEvent( QTimerEvent *e ) | 637 | void Server::timerEvent( QTimerEvent *e ) |
638 | { | 638 | { |
639 | if ( e->timerId() == tid_xfer ) { | 639 | if ( e->timerId() == tid_xfer ) { |
640 | killTimer( tid_xfer ); | 640 | killTimer( tid_xfer ); |
641 | tid_xfer = 0; | 641 | tid_xfer = 0; |
642 | startTransferServer(); | 642 | startTransferServer(); |
643 | } | 643 | } |
644 | /* ### FIXME today startin */ | 644 | /* ### FIXME today startin */ |
645 | #if 0 | 645 | #if 0 |
646 | else if ( e->timerId() == tid_today ) { | 646 | else if ( e->timerId() == tid_today ) { |
647 | QDate today = QDate::currentDate(); | 647 | QDate today = QDate::currentDate(); |
648 | if ( today != last_today_show ) { | 648 | if ( today != last_today_show ) { |
649 | last_today_show = today; | 649 | last_today_show = today; |
650 | Config cfg("today"); | 650 | Config cfg("today"); |
651 | cfg.setGroup("Start"); | 651 | cfg.setGroup("Start"); |
652 | #ifndef QPE_DEFAULT_TODAY_MODE | 652 | #ifndef QPE_DEFAULT_TODAY_MODE |
653 | #define QPE_DEFAULT_TODAY_MODE "Never" | 653 | #define QPE_DEFAULT_TODAY_MODE "Never" |
654 | #endif | 654 | #endif |
655 | if ( cfg.readEntry("Mode",QPE_DEFAULT_TODAY_MODE) == "Daily" ) { | 655 | if ( cfg.readEntry("Mode",QPE_DEFAULT_TODAY_MODE) == "Daily" ) { |
656 | QCopEnvelope env(Service::channel("today"),"raise()"); | 656 | QCopEnvelope env(Service::channel("today"),"raise()"); |
657 | } | 657 | } |
658 | } | 658 | } |
659 | } | 659 | } |
660 | #endif | 660 | #endif |
661 | } | 661 | } |
662 | 662 | ||
663 | void Server::terminateServers() | 663 | void Server::terminateServers() |
664 | { | 664 | { |
665 | delete transferServer; | 665 | delete transferServer; |
diff --git a/core/launcher/serverapp.cpp b/core/launcher/serverapp.cpp index f7c2341..d38dd97 100644 --- a/core/launcher/serverapp.cpp +++ b/core/launcher/serverapp.cpp | |||
@@ -256,108 +256,108 @@ enum MemState { MemUnknown, MemVeryLow, MemLow, MemNormal } memstate=MemUnknown; | |||
256 | QPE_MEMALERTER_IMPL | 256 | QPE_MEMALERTER_IMPL |
257 | #endif | 257 | #endif |
258 | 258 | ||
259 | 259 | ||
260 | 260 | ||
261 | //--------------------------------------------------------------------------- | 261 | //--------------------------------------------------------------------------- |
262 | 262 | ||
263 | bool ServerApplication::doRestart = FALSE; | 263 | bool ServerApplication::doRestart = FALSE; |
264 | bool ServerApplication::allowRestart = TRUE; | 264 | bool ServerApplication::allowRestart = TRUE; |
265 | bool ServerApplication::ms_is_starting = TRUE; | 265 | bool ServerApplication::ms_is_starting = TRUE; |
266 | 266 | ||
267 | void ServerApplication::switchLCD( bool on ) { | 267 | void ServerApplication::switchLCD( bool on ) { |
268 | if ( !qApp ) | 268 | if ( !qApp ) |
269 | return; | 269 | return; |
270 | 270 | ||
271 | ServerApplication *dapp = ServerApplication::me() ; | 271 | ServerApplication *dapp = ServerApplication::me() ; |
272 | 272 | ||
273 | if ( !dapp-> m_screensaver ) | 273 | if ( !dapp-> m_screensaver ) |
274 | return; | 274 | return; |
275 | 275 | ||
276 | if ( on ) { | 276 | if ( on ) { |
277 | dapp-> m_screensaver-> setDisplayState ( true ); | 277 | dapp-> m_screensaver-> setDisplayState ( true ); |
278 | dapp-> m_screensaver-> setBacklight ( -3 ); | 278 | dapp-> m_screensaver-> setBacklight ( -3 ); |
279 | }else | 279 | }else |
280 | dapp-> m_screensaver-> setDisplayState ( false ); | 280 | dapp-> m_screensaver-> setDisplayState ( false ); |
281 | 281 | ||
282 | 282 | ||
283 | } | 283 | } |
284 | 284 | ||
285 | ServerApplication::ServerApplication( int& argc, char **argv, Type t ) | 285 | ServerApplication::ServerApplication( int& argc, char **argv, Type t ) |
286 | : QPEApplication( argc, argv, t ) | 286 | : QPEApplication( argc, argv, t ) |
287 | { | 287 | { |
288 | ms_is_starting = true; | 288 | ms_is_starting = true; |
289 | 289 | ||
290 | // We know we'll have lots of cached pixmaps due to App/DocLnks | 290 | // We know we'll have lots of cached pixmaps due to App/DocLnks |
291 | QPixmapCache::setCacheLimit(512); | 291 | QPixmapCache::setCacheLimit(512); |
292 | 292 | ||
293 | m_ps = new PowerStatus; | 293 | m_ps = new PowerStatus; |
294 | m_ps_last = new PowerStatus; | 294 | m_ps_last = new PowerStatus; |
295 | pa = new DesktopPowerAlerter( 0 ); | 295 | pa = new DesktopPowerAlerter( 0 ); |
296 | 296 | ||
297 | m_apm_timer = new QTimer( this ); | 297 | m_apm_timer = new QTimer( this ); |
298 | connect(m_apm_timer, SIGNAL( timeout() ), | 298 | connect(m_apm_timer, SIGNAL( timeout() ), |
299 | this, SLOT( apmTimeout() ) ); | 299 | this, SLOT( apmTimeout() ) ); |
300 | 300 | ||
301 | reloadPowerWarnSettings(); | 301 | reloadPowerWarnSettings(); |
302 | 302 | ||
303 | QCopChannel *channel = new QCopChannel( "QPE/System", this ); | 303 | QCopChannel *channel = new QCopChannel( "QPE/System", this ); |
304 | connect(channel, SIGNAL(received( const QCString&, const QByteArray& ) ), | 304 | connect(channel, SIGNAL(received(const QCString&,const QByteArray&) ), |
305 | this, SLOT(systemMessage(const QCString&, const QByteArray& ) ) ); | 305 | this, SLOT(systemMessage(const QCString&,const QByteArray&) ) ); |
306 | 306 | ||
307 | channel = new QCopChannel("QPE/Launcher", this ); | 307 | channel = new QCopChannel("QPE/Launcher", this ); |
308 | connect(channel, SIGNAL(received( const QCString&, const QByteArray& ) ), | 308 | connect(channel, SIGNAL(received(const QCString&,const QByteArray&) ), |
309 | this, SLOT(launcherMessage( const QCString&, const QByteArray& ) ) ); | 309 | this, SLOT(launcherMessage(const QCString&,const QByteArray&) ) ); |
310 | 310 | ||
311 | m_screensaver = new OpieScreenSaver(); | 311 | m_screensaver = new OpieScreenSaver(); |
312 | m_screensaver->setInterval( -1 ); | 312 | m_screensaver->setInterval( -1 ); |
313 | QWSServer::setScreenSaver( m_screensaver ); | 313 | QWSServer::setScreenSaver( m_screensaver ); |
314 | 314 | ||
315 | connect( qApp, SIGNAL( volumeChanged( bool ) ), | 315 | connect( qApp, SIGNAL( volumeChanged(bool) ), |
316 | this, SLOT( rereadVolumes() ) ); | 316 | this, SLOT( rereadVolumes() ) ); |
317 | 317 | ||
318 | 318 | ||
319 | /* ### PluginLoader libqtopia SafeMode */ | 319 | /* ### PluginLoader libqtopia SafeMode */ |
320 | #if 0 | 320 | #if 0 |
321 | if ( PluginLoader::inSafeMode() ) | 321 | if ( PluginLoader::inSafeMode() ) |
322 | QTimer::singleShot(500, this, SLOT(showSafeMode()) ); | 322 | QTimer::singleShot(500, this, SLOT(showSafeMode()) ); |
323 | QTimer::singleShot(20*1000, this, SLOT(clearSafeMode()) ); | 323 | QTimer::singleShot(20*1000, this, SLOT(clearSafeMode()) ); |
324 | #endif | 324 | #endif |
325 | 325 | ||
326 | kf = new KeyFilter(this); | 326 | kf = new KeyFilter(this); |
327 | 327 | ||
328 | connect( kf, SIGNAL(launch()), this, SIGNAL(launch()) ); | 328 | connect( kf, SIGNAL(launch()), this, SIGNAL(launch()) ); |
329 | connect( kf, SIGNAL(power()), this, SIGNAL(power()) ); | 329 | connect( kf, SIGNAL(power()), this, SIGNAL(power()) ); |
330 | connect( kf, SIGNAL(backlight()), this, SIGNAL(backlight()) ); | 330 | connect( kf, SIGNAL(backlight()), this, SIGNAL(backlight()) ); |
331 | connect( kf, SIGNAL(symbol()), this, SIGNAL(symbol())); | 331 | connect( kf, SIGNAL(symbol()), this, SIGNAL(symbol())); |
332 | connect( kf, SIGNAL(numLockStateToggle()), this,SIGNAL(numLockStateToggle())); | 332 | connect( kf, SIGNAL(numLockStateToggle()), this,SIGNAL(numLockStateToggle())); |
333 | connect( kf, SIGNAL(capsLockStateToggle()), this,SIGNAL(capsLockStateToggle())); | 333 | connect( kf, SIGNAL(capsLockStateToggle()), this,SIGNAL(capsLockStateToggle())); |
334 | connect( kf, SIGNAL(activate(const Opie::ODeviceButton*,bool)), | 334 | connect( kf, SIGNAL(activate(const Opie::ODeviceButton*,bool)), |
335 | this,SIGNAL(activate(const Opie::ODeviceButton*,bool))); | 335 | this,SIGNAL(activate(const Opie::ODeviceButton*,bool))); |
336 | 336 | ||
337 | 337 | ||
338 | connect( kf, SIGNAL(backlight()), this, SLOT(toggleLight()) ); | 338 | connect( kf, SIGNAL(backlight()), this, SLOT(toggleLight()) ); |
339 | 339 | ||
340 | connect( this, SIGNAL(power() ), | 340 | connect( this, SIGNAL(power() ), |
341 | SLOT(togglePower() ) ); | 341 | SLOT(togglePower() ) ); |
342 | 342 | ||
343 | rereadVolumes(); | 343 | rereadVolumes(); |
344 | 344 | ||
345 | serverApp = this; | 345 | serverApp = this; |
346 | 346 | ||
347 | apmTimeout(); | 347 | apmTimeout(); |
348 | grabKeyboard(); | 348 | grabKeyboard(); |
349 | 349 | ||
350 | /* make sure the event filter is installed */ | 350 | /* make sure the event filter is installed */ |
351 | const Opie::ODeviceButton* but = Opie::ODevice::inst()->buttonForKeycode( -1 ); | 351 | const Opie::ODeviceButton* but = Opie::ODevice::inst()->buttonForKeycode( -1 ); |
352 | } | 352 | } |
353 | 353 | ||
354 | 354 | ||
355 | ServerApplication::~ServerApplication() | 355 | ServerApplication::~ServerApplication() |
356 | { | 356 | { |
357 | ungrabKeyboard(); | 357 | ungrabKeyboard(); |
358 | 358 | ||
359 | 359 | ||
360 | delete pa; | 360 | delete pa; |
361 | delete m_ps; | 361 | delete m_ps; |
362 | delete m_ps_last; | 362 | delete m_ps_last; |
363 | } | 363 | } |
diff --git a/core/launcher/shutdownimpl.cpp b/core/launcher/shutdownimpl.cpp index f43a2a3..2731568 100644 --- a/core/launcher/shutdownimpl.cpp +++ b/core/launcher/shutdownimpl.cpp | |||
@@ -61,100 +61,100 @@ ShutdownImpl::ShutdownImpl( QWidget* parent, const char *name, WFlags fl ) | |||
61 | 61 | ||
62 | QGridLayout *grid = new QGridLayout ( btngrp-> layout ( ) ); | 62 | QGridLayout *grid = new QGridLayout ( btngrp-> layout ( ) ); |
63 | grid-> setAlignment ( Qt::AlignTop ); | 63 | grid-> setAlignment ( Qt::AlignTop ); |
64 | grid-> setSpacing ( 3 ); | 64 | grid-> setSpacing ( 3 ); |
65 | grid-> setMargin ( 7 ); | 65 | grid-> setMargin ( 7 ); |
66 | 66 | ||
67 | QPushButton *quit = new QPushButton ( tr( "Terminate Opie" ), btngrp, "quit" ); | 67 | QPushButton *quit = new QPushButton ( tr( "Terminate Opie" ), btngrp, "quit" ); |
68 | changeButtonColor ( quit, QColor ( 236, 236, 179 ) ); | 68 | changeButtonColor ( quit, QColor ( 236, 236, 179 ) ); |
69 | btngrp-> insert ( quit, 4 ); | 69 | btngrp-> insert ( quit, 4 ); |
70 | grid-> addWidget ( quit, 1, 1 ); | 70 | grid-> addWidget ( quit, 1, 1 ); |
71 | 71 | ||
72 | QPushButton *reboot = new QPushButton ( tr( "Reboot" ), btngrp, "reboot" ); | 72 | QPushButton *reboot = new QPushButton ( tr( "Reboot" ), btngrp, "reboot" ); |
73 | changeButtonColor ( reboot, QColor( 236, 183, 181 ) ); | 73 | changeButtonColor ( reboot, QColor( 236, 183, 181 ) ); |
74 | btngrp-> insert ( reboot, 2 ); | 74 | btngrp-> insert ( reboot, 2 ); |
75 | grid-> addWidget( reboot, 1, 0 ); | 75 | grid-> addWidget( reboot, 1, 0 ); |
76 | 76 | ||
77 | QPushButton *restart = new QPushButton ( tr( "Restart Opie" ), btngrp, "restart" ); | 77 | QPushButton *restart = new QPushButton ( tr( "Restart Opie" ), btngrp, "restart" ); |
78 | changeButtonColor ( restart, QColor( 236, 236, 179 ) ); | 78 | changeButtonColor ( restart, QColor( 236, 236, 179 ) ); |
79 | btngrp-> insert ( restart, 3 ); | 79 | btngrp-> insert ( restart, 3 ); |
80 | grid-> addWidget ( restart, 0, 1 ); | 80 | grid-> addWidget ( restart, 0, 1 ); |
81 | 81 | ||
82 | QPushButton *shutdown = new QPushButton( tr( "Shutdown" ), btngrp, "shutdown" ); | 82 | QPushButton *shutdown = new QPushButton( tr( "Shutdown" ), btngrp, "shutdown" ); |
83 | changeButtonColor ( shutdown, QColor( 236, 183, 181 ) ); | 83 | changeButtonColor ( shutdown, QColor( 236, 183, 181 ) ); |
84 | btngrp-> insert ( shutdown, 1 ); | 84 | btngrp-> insert ( shutdown, 1 ); |
85 | grid-> addWidget ( shutdown, 0, 0 ); | 85 | grid-> addWidget ( shutdown, 0, 0 ); |
86 | 86 | ||
87 | vbox-> addWidget ( btngrp ); | 87 | vbox-> addWidget ( btngrp ); |
88 | 88 | ||
89 | m_info = new QLabel ( this, "info" ); | 89 | m_info = new QLabel ( this, "info" ); |
90 | m_info-> setText( tr( "<p>\n" "These termination options are provided primarily for use while developing and testing the Opie system. In a normal environment, these concepts are unnecessary." ) ); | 90 | m_info-> setText( tr( "<p>\n" "These termination options are provided primarily for use while developing and testing the Opie system. In a normal environment, these concepts are unnecessary." ) ); |
91 | vbox-> addWidget ( m_info ); | 91 | vbox-> addWidget ( m_info ); |
92 | 92 | ||
93 | m_progress = new QProgressBar ( this, "progressBar" ); | 93 | m_progress = new QProgressBar ( this, "progressBar" ); |
94 | m_progress-> setFrameShape ( QProgressBar::Panel ); | 94 | m_progress-> setFrameShape ( QProgressBar::Panel ); |
95 | m_progress-> setFrameShadow ( QProgressBar::Sunken ); | 95 | m_progress-> setFrameShadow ( QProgressBar::Sunken ); |
96 | m_progress-> setTotalSteps ( 20 ); | 96 | m_progress-> setTotalSteps ( 20 ); |
97 | m_progress-> setIndicatorFollowsStyle ( false ); | 97 | m_progress-> setIndicatorFollowsStyle ( false ); |
98 | vbox-> addWidget ( m_progress ); | 98 | vbox-> addWidget ( m_progress ); |
99 | 99 | ||
100 | vbox-> addItem ( new QSpacerItem ( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); | 100 | vbox-> addItem ( new QSpacerItem ( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); |
101 | 101 | ||
102 | QPushButton *cancel = new QPushButton ( tr( "Cancel" ), this, "cancel" ); | 102 | QPushButton *cancel = new QPushButton ( tr( "Cancel" ), this, "cancel" ); |
103 | changeButtonColor ( cancel, QColor( 181, 222, 178 ) ); | 103 | changeButtonColor ( cancel, QColor( 181, 222, 178 ) ); |
104 | cancel-> setDefault ( true ); | 104 | cancel-> setDefault ( true ); |
105 | cancel-> setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding, cancel-> sizePolicy ( ). hasHeightForWidth ( ) ) ); | 105 | cancel-> setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding, cancel-> sizePolicy ( ). hasHeightForWidth ( ) ) ); |
106 | vbox-> addWidget ( cancel ); | 106 | vbox-> addWidget ( cancel ); |
107 | 107 | ||
108 | m_timer = new QTimer ( this ); | 108 | m_timer = new QTimer ( this ); |
109 | connect ( m_timer, SIGNAL( timeout ( ) ), this, SLOT( timeout ( ) ) ); | 109 | connect ( m_timer, SIGNAL( timeout() ), this, SLOT( timeout() ) ); |
110 | 110 | ||
111 | connect ( btngrp, SIGNAL( clicked ( int ) ), this, SLOT( buttonClicked ( int ) ) ); | 111 | connect ( btngrp, SIGNAL( clicked(int) ), this, SLOT( buttonClicked(int) ) ); |
112 | connect ( cancel, SIGNAL( clicked ( ) ), this, SLOT( cancelClicked ( ) ) ); | 112 | connect ( cancel, SIGNAL( clicked() ), this, SLOT( cancelClicked() ) ); |
113 | 113 | ||
114 | m_progress-> hide ( ); | 114 | m_progress-> hide ( ); |
115 | Global::hideInputMethod ( ); | 115 | Global::hideInputMethod ( ); |
116 | } | 116 | } |
117 | 117 | ||
118 | void ShutdownImpl::buttonClicked ( int b ) | 118 | void ShutdownImpl::buttonClicked ( int b ) |
119 | { | 119 | { |
120 | m_counter = 0; | 120 | m_counter = 0; |
121 | 121 | ||
122 | switch ( b ) { | 122 | switch ( b ) { |
123 | case 1: | 123 | case 1: |
124 | m_operation = ShutdownSystem; | 124 | m_operation = ShutdownSystem; |
125 | break; | 125 | break; |
126 | case 2: | 126 | case 2: |
127 | m_operation = RebootSystem; | 127 | m_operation = RebootSystem; |
128 | break; | 128 | break; |
129 | case 3: | 129 | case 3: |
130 | m_operation = RestartDesktop; | 130 | m_operation = RestartDesktop; |
131 | break; | 131 | break; |
132 | case 4: | 132 | case 4: |
133 | m_operation = TerminateDesktop; | 133 | m_operation = TerminateDesktop; |
134 | break; | 134 | break; |
135 | } | 135 | } |
136 | m_info-> hide ( ); | 136 | m_info-> hide ( ); |
137 | m_progress-> show ( ); | 137 | m_progress-> show ( ); |
138 | m_timer-> start ( 300 ); | 138 | m_timer-> start ( 300 ); |
139 | timeout ( ); | 139 | timeout ( ); |
140 | } | 140 | } |
141 | 141 | ||
142 | void ShutdownImpl::cancelClicked ( ) | 142 | void ShutdownImpl::cancelClicked ( ) |
143 | { | 143 | { |
144 | m_progress-> hide ( ); | 144 | m_progress-> hide ( ); |
145 | m_info-> show ( ); | 145 | m_info-> show ( ); |
146 | if ( m_timer-> isActive ( ) ) | 146 | if ( m_timer-> isActive ( ) ) |
147 | m_timer-> stop ( ); | 147 | m_timer-> stop ( ); |
148 | else | 148 | else |
149 | close ( ); | 149 | close ( ); |
150 | } | 150 | } |
151 | 151 | ||
152 | void ShutdownImpl::timeout ( ) | 152 | void ShutdownImpl::timeout ( ) |
153 | { | 153 | { |
154 | if ( ( m_counter += 2 ) > m_progress-> totalSteps ( ) ) { | 154 | if ( ( m_counter += 2 ) > m_progress-> totalSteps ( ) ) { |
155 | m_progress-> hide ( ); | 155 | m_progress-> hide ( ); |
156 | m_timer-> stop ( ); | 156 | m_timer-> stop ( ); |
157 | emit shutdown ( m_operation ); | 157 | emit shutdown ( m_operation ); |
158 | } | 158 | } |
159 | else | 159 | else |
160 | m_progress-> setProgress ( m_counter ); | 160 | m_progress-> setProgress ( m_counter ); |
diff --git a/core/launcher/taskbar.cpp b/core/launcher/taskbar.cpp index 491a8a3..91e2f20 100644 --- a/core/launcher/taskbar.cpp +++ b/core/launcher/taskbar.cpp | |||
@@ -168,98 +168,98 @@ private: | |||
168 | 168 | ||
169 | TaskBar::~TaskBar() | 169 | TaskBar::~TaskBar() |
170 | { | 170 | { |
171 | } | 171 | } |
172 | 172 | ||
173 | 173 | ||
174 | TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader) | 174 | TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader) |
175 | { | 175 | { |
176 | Config cfg( "Launcher" ); | 176 | Config cfg( "Launcher" ); |
177 | cfg.setGroup( "InputMethods" ); | 177 | cfg.setGroup( "InputMethods" ); |
178 | resizeRunningApp = cfg.readBoolEntry( "Resize", true ); | 178 | resizeRunningApp = cfg.readBoolEntry( "Resize", true ); |
179 | 179 | ||
180 | sm = new StartMenu( this ); | 180 | sm = new StartMenu( this ); |
181 | connect( sm, SIGNAL(tabSelected(const QString&)), this, | 181 | connect( sm, SIGNAL(tabSelected(const QString&)), this, |
182 | SIGNAL(tabSelected(const QString&)) ); | 182 | SIGNAL(tabSelected(const QString&)) ); |
183 | 183 | ||
184 | inputMethods = new InputMethods( this ); | 184 | inputMethods = new InputMethods( this ); |
185 | connect( inputMethods, SIGNAL(inputToggled(bool)), | 185 | connect( inputMethods, SIGNAL(inputToggled(bool)), |
186 | this, SLOT(calcMaxWindowRect()) ); | 186 | this, SLOT(calcMaxWindowRect()) ); |
187 | 187 | ||
188 | stack = new QWidgetStack( this ); | 188 | stack = new QWidgetStack( this ); |
189 | stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); | 189 | stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); |
190 | label = new QLabel(stack); | 190 | label = new QLabel(stack); |
191 | 191 | ||
192 | runningAppBar = new RunningAppBar(stack); | 192 | runningAppBar = new RunningAppBar(stack); |
193 | stack->raiseWidget(runningAppBar); | 193 | stack->raiseWidget(runningAppBar); |
194 | 194 | ||
195 | waitIcon = new Wait( this ); | 195 | waitIcon = new Wait( this ); |
196 | (void) new AppIcons( this ); | 196 | (void) new AppIcons( this ); |
197 | 197 | ||
198 | sysTray = new SysTray( this ); | 198 | sysTray = new SysTray( this ); |
199 | 199 | ||
200 | /* ### FIXME plugin loader and safe mode */ | 200 | /* ### FIXME plugin loader and safe mode */ |
201 | #if 0 | 201 | #if 0 |
202 | if (PluginLoader::inSafeMode()) | 202 | if (PluginLoader::inSafeMode()) |
203 | (void)new SafeMode( this ); | 203 | (void)new SafeMode( this ); |
204 | #endif | 204 | #endif |
205 | 205 | ||
206 | // ## make customizable in some way? | 206 | // ## make customizable in some way? |
207 | #ifdef QT_QWS_CUSTOM | 207 | #ifdef QT_QWS_CUSTOM |
208 | lockState = new LockKeyState( this ); | 208 | lockState = new LockKeyState( this ); |
209 | #else | 209 | #else |
210 | lockState = 0; | 210 | lockState = 0; |
211 | #endif | 211 | #endif |
212 | 212 | ||
213 | #if defined(Q_WS_QWS) | 213 | #if defined(Q_WS_QWS) |
214 | #if !defined(QT_NO_COP) | 214 | #if !defined(QT_NO_COP) |
215 | QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this ); | 215 | QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this ); |
216 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 216 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), |
217 | this, SLOT(receive(const QCString&, const QByteArray&)) ); | 217 | this, SLOT(receive(const QCString&,const QByteArray&)) ); |
218 | #endif | 218 | #endif |
219 | #endif | 219 | #endif |
220 | waitTimer = new QTimer( this ); | 220 | waitTimer = new QTimer( this ); |
221 | connect( waitTimer, SIGNAL( timeout() ), this, SLOT( stopWait() ) ); | 221 | connect( waitTimer, SIGNAL( timeout() ), this, SLOT( stopWait() ) ); |
222 | clearer = new QTimer( this ); | 222 | clearer = new QTimer( this ); |
223 | QObject::connect(clearer, SIGNAL(timeout()), SLOT(clearStatusBar())); | 223 | QObject::connect(clearer, SIGNAL(timeout()), SLOT(clearStatusBar())); |
224 | 224 | ||
225 | connect( qApp, SIGNAL(symbol()), this, SLOT(toggleSymbolInput()) ); | 225 | connect( qApp, SIGNAL(symbol()), this, SLOT(toggleSymbolInput()) ); |
226 | connect( qApp, SIGNAL(numLockStateToggle()), this, SLOT(toggleNumLockState()) ); | 226 | connect( qApp, SIGNAL(numLockStateToggle()), this, SLOT(toggleNumLockState()) ); |
227 | connect( qApp, SIGNAL(capsLockStateToggle()), this, SLOT(toggleCapsLockState()) ); | 227 | connect( qApp, SIGNAL(capsLockStateToggle()), this, SLOT(toggleCapsLockState()) ); |
228 | } | 228 | } |
229 | 229 | ||
230 | void TaskBar::setStatusMessage( const QString &text ) | 230 | void TaskBar::setStatusMessage( const QString &text ) |
231 | { | 231 | { |
232 | if ( !text.isEmpty() ) { | 232 | if ( !text.isEmpty() ) { |
233 | label->setText( text ); | 233 | label->setText( text ); |
234 | stack->raiseWidget( label ); | 234 | stack->raiseWidget( label ); |
235 | if ( sysTray && ( label->fontMetrics().width( text ) > label->width() ) ) | 235 | if ( sysTray && ( label->fontMetrics().width( text ) > label->width() ) ) |
236 | sysTray->hide(); | 236 | sysTray->hide(); |
237 | clearer->start( 3000, TRUE ); | 237 | clearer->start( 3000, TRUE ); |
238 | } else { | 238 | } else { |
239 | clearStatusBar(); | 239 | clearStatusBar(); |
240 | } | 240 | } |
241 | } | 241 | } |
242 | 242 | ||
243 | void TaskBar::clearStatusBar() | 243 | void TaskBar::clearStatusBar() |
244 | { | 244 | { |
245 | label->clear(); | 245 | label->clear(); |
246 | stack->raiseWidget(runningAppBar); | 246 | stack->raiseWidget(runningAppBar); |
247 | if ( sysTray ) | 247 | if ( sysTray ) |
248 | sysTray->show(); | 248 | sysTray->show(); |
249 | // stack->raiseWidget( mru ); | 249 | // stack->raiseWidget( mru ); |
250 | } | 250 | } |
251 | 251 | ||
252 | void TaskBar::startWait() | 252 | void TaskBar::startWait() |
253 | { | 253 | { |
254 | waitIcon->setWaiting( true ); | 254 | waitIcon->setWaiting( true ); |
255 | // a catchall stop after 10 seconds... | 255 | // a catchall stop after 10 seconds... |
256 | waitTimer->start( 10 * 1000, true ); | 256 | waitTimer->start( 10 * 1000, true ); |
257 | } | 257 | } |
258 | 258 | ||
259 | void TaskBar::stopWait(const QString&) | 259 | void TaskBar::stopWait(const QString&) |
260 | { | 260 | { |
261 | waitTimer->stop(); | 261 | waitTimer->stop(); |
262 | waitIcon->setWaiting( false ); | 262 | waitIcon->setWaiting( false ); |
263 | } | 263 | } |
264 | 264 | ||
265 | void TaskBar::stopWait() | 265 | void TaskBar::stopWait() |
diff --git a/core/launcher/transferserver.cpp b/core/launcher/transferserver.cpp index b998e95..a5e20b2 100644 --- a/core/launcher/transferserver.cpp +++ b/core/launcher/transferserver.cpp | |||
@@ -28,116 +28,116 @@ | |||
28 | #include <stdlib.h> | 28 | #include <stdlib.h> |
29 | #include <time.h> | 29 | #include <time.h> |
30 | 30 | ||
31 | #ifndef Q_OS_MACX | 31 | #ifndef Q_OS_MACX |
32 | #include <shadow.h> | 32 | #include <shadow.h> |
33 | #include <crypt.h> | 33 | #include <crypt.h> |
34 | #endif /* Q_OS_MACX */ | 34 | #endif /* Q_OS_MACX */ |
35 | 35 | ||
36 | #else | 36 | #else |
37 | #include <stdlib.h> | 37 | #include <stdlib.h> |
38 | #include <time.h> | 38 | #include <time.h> |
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | 41 | ||
42 | #if defined(_OS_LINUX_) | 42 | #if defined(_OS_LINUX_) |
43 | #include <shadow.h> | 43 | #include <shadow.h> |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | #include <qtextstream.h> | 46 | #include <qtextstream.h> |
47 | #include <qmessagebox.h> | 47 | #include <qmessagebox.h> |
48 | //#include <qtopia/qcopchannel_qws.h> | 48 | //#include <qtopia/qcopchannel_qws.h> |
49 | #include <qtopia/process.h> | 49 | #include <qtopia/process.h> |
50 | #include <qtopia/private/contact.h> | 50 | #include <qtopia/private/contact.h> |
51 | #include <qtopia/version.h> | 51 | #include <qtopia/version.h> |
52 | #ifdef Q_WS_QWS | 52 | #ifdef Q_WS_QWS |
53 | #include <qtopia/qcopenvelope_qws.h> | 53 | #include <qtopia/qcopenvelope_qws.h> |
54 | #endif | 54 | #endif |
55 | 55 | ||
56 | 56 | ||
57 | #include "transferserver.h" | 57 | #include "transferserver.h" |
58 | #include <qtopia/qprocess.h> | 58 | #include <qtopia/qprocess.h> |
59 | 59 | ||
60 | const int block_size = 51200; | 60 | const int block_size = 51200; |
61 | 61 | ||
62 | TransferServer::TransferServer( Q_UINT16 port, QObject *parent, | 62 | TransferServer::TransferServer( Q_UINT16 port, QObject *parent, |
63 | const char* name) | 63 | const char* name) |
64 | : QServerSocket( port, 1, parent, name ) | 64 | : QServerSocket( port, 1, parent, name ) |
65 | { | 65 | { |
66 | connections.setAutoDelete( TRUE ); | 66 | connections.setAutoDelete( TRUE ); |
67 | if ( !ok() ) | 67 | if ( !ok() ) |
68 | qWarning( "Failed to bind to port %d", port ); | 68 | qWarning( "Failed to bind to port %d", port ); |
69 | } | 69 | } |
70 | 70 | ||
71 | void TransferServer::authorizeConnections() | 71 | void TransferServer::authorizeConnections() |
72 | { | 72 | { |
73 | QListIterator<ServerPI> it(connections); | 73 | QListIterator<ServerPI> it(connections); |
74 | while ( it.current() ) { | 74 | while ( it.current() ) { |
75 | if ( !it.current()->verifyAuthorised() ) { | 75 | if ( !it.current()->verifyAuthorised() ) { |
76 | disconnect( it.current(), SIGNAL(connectionClosed(ServerPI *)), this, SLOT( closed(ServerPI *)) ); | 76 | disconnect( it.current(), SIGNAL(connectionClosed(ServerPI*)), this, SLOT( closed(ServerPI*)) ); |
77 | connections.removeRef( it.current() ); | 77 | connections.removeRef( it.current() ); |
78 | } else | 78 | } else |
79 | ++it; | 79 | ++it; |
80 | } | 80 | } |
81 | } | 81 | } |
82 | 82 | ||
83 | void TransferServer::closed(ServerPI *item) | 83 | void TransferServer::closed(ServerPI *item) |
84 | { | 84 | { |
85 | connections.removeRef(item); | 85 | connections.removeRef(item); |
86 | } | 86 | } |
87 | 87 | ||
88 | TransferServer::~TransferServer() | 88 | TransferServer::~TransferServer() |
89 | { | 89 | { |
90 | } | 90 | } |
91 | 91 | ||
92 | void TransferServer::newConnection( int socket ) | 92 | void TransferServer::newConnection( int socket ) |
93 | { | 93 | { |
94 | ServerPI *ptr = new ServerPI( socket, this ); | 94 | ServerPI *ptr = new ServerPI( socket, this ); |
95 | connect( ptr, SIGNAL(connectionClosed(ServerPI *)), this, SLOT( closed(ServerPI *)) ); | 95 | connect( ptr, SIGNAL(connectionClosed(ServerPI*)), this, SLOT( closed(ServerPI*)) ); |
96 | connections.append( ptr ); | 96 | connections.append( ptr ); |
97 | } | 97 | } |
98 | 98 | ||
99 | QString SyncAuthentication::serverId() | 99 | QString SyncAuthentication::serverId() |
100 | { | 100 | { |
101 | Config cfg("Security"); | 101 | Config cfg("Security"); |
102 | cfg.setGroup("Sync"); | 102 | cfg.setGroup("Sync"); |
103 | QString r = cfg.readEntry("serverid"); | 103 | QString r = cfg.readEntry("serverid"); |
104 | 104 | ||
105 | if ( r.isEmpty() ) { | 105 | if ( r.isEmpty() ) { |
106 | r = OGlobal::generateUuid(); | 106 | r = OGlobal::generateUuid(); |
107 | cfg.writeEntry("serverid", r ); | 107 | cfg.writeEntry("serverid", r ); |
108 | } | 108 | } |
109 | return r; | 109 | return r; |
110 | } | 110 | } |
111 | 111 | ||
112 | QString SyncAuthentication::ownerName() | 112 | QString SyncAuthentication::ownerName() |
113 | { | 113 | { |
114 | QString vfilename = Global::applicationFileName("addressbook", | 114 | QString vfilename = Global::applicationFileName("addressbook", |
115 | "businesscard.vcf"); | 115 | "businesscard.vcf"); |
116 | if (QFile::exists(vfilename)) { | 116 | if (QFile::exists(vfilename)) { |
117 | Contact c; | 117 | Contact c; |
118 | c = Contact::readVCard( vfilename )[0]; | 118 | c = Contact::readVCard( vfilename )[0]; |
119 | return c.fullName(); | 119 | return c.fullName(); |
120 | } | 120 | } |
121 | 121 | ||
122 | return QString::null; | 122 | return QString::null; |
123 | } | 123 | } |
124 | 124 | ||
125 | QString SyncAuthentication::loginName() | 125 | QString SyncAuthentication::loginName() |
126 | { | 126 | { |
127 | struct passwd *pw = 0L; | 127 | struct passwd *pw = 0L; |
128 | #ifndef Q_OS_WIN32 | 128 | #ifndef Q_OS_WIN32 |
129 | pw = getpwuid( geteuid() ); | 129 | pw = getpwuid( geteuid() ); |
130 | return QString::fromLocal8Bit( pw->pw_name ); | 130 | return QString::fromLocal8Bit( pw->pw_name ); |
131 | #else | 131 | #else |
132 | //### revise | 132 | //### revise |
133 | return QString(); | 133 | return QString(); |
134 | #endif | 134 | #endif |
135 | } | 135 | } |
136 | 136 | ||
137 | int SyncAuthentication::isAuthorized(QHostAddress peeraddress) | 137 | int SyncAuthentication::isAuthorized(QHostAddress peeraddress) |
138 | { | 138 | { |
139 | Config cfg("Security"); | 139 | Config cfg("Security"); |
140 | cfg.setGroup("Sync"); | 140 | cfg.setGroup("Sync"); |
141 | // QString allowedstr = cfg.readEntry("auth_peer","192.168.1.0"); | 141 | // QString allowedstr = cfg.readEntry("auth_peer","192.168.1.0"); |
142 | uint auth_peer = cfg.readNumEntry("auth_peer", 0xc0a80100); | 142 | uint auth_peer = cfg.readNumEntry("auth_peer", 0xc0a80100); |
143 | 143 | ||
@@ -288,109 +288,109 @@ bool SyncAuthentication::checkPassword( const QString& password ) | |||
288 | #else | 288 | #else |
289 | //### revise | 289 | //### revise |
290 | QString cpassword(""); | 290 | QString cpassword(""); |
291 | #endif | 291 | #endif |
292 | denials=0; | 292 | denials=0; |
293 | pwds.prepend(cpassword); | 293 | pwds.prepend(cpassword); |
294 | cfg.writeEntry("Passwords",pwds,' '); | 294 | cfg.writeEntry("Passwords",pwds,' '); |
295 | lock--; | 295 | lock--; |
296 | return TRUE; | 296 | return TRUE; |
297 | } | 297 | } |
298 | } | 298 | } |
299 | lock--; | 299 | lock--; |
300 | 300 | ||
301 | return FALSE; | 301 | return FALSE; |
302 | } | 302 | } |
303 | 303 | ||
304 | 304 | ||
305 | ServerPI::ServerPI( int socket, QObject *parent, const char* name ) | 305 | ServerPI::ServerPI( int socket, QObject *parent, const char* name ) |
306 | : QSocket( parent, name ) , dtp( 0 ), serversocket( 0 ), waitsocket( 0 ), | 306 | : QSocket( parent, name ) , dtp( 0 ), serversocket( 0 ), waitsocket( 0 ), |
307 | storFileSize(-1) | 307 | storFileSize(-1) |
308 | { | 308 | { |
309 | state = Connected; | 309 | state = Connected; |
310 | 310 | ||
311 | setSocket( socket ); | 311 | setSocket( socket ); |
312 | 312 | ||
313 | peerport = peerPort(); | 313 | peerport = peerPort(); |
314 | peeraddress = peerAddress(); | 314 | peeraddress = peerAddress(); |
315 | 315 | ||
316 | #ifndef INSECURE | 316 | #ifndef INSECURE |
317 | if ( !SyncAuthentication::isAuthorized(peeraddress) ) { | 317 | if ( !SyncAuthentication::isAuthorized(peeraddress) ) { |
318 | state = Forbidden; | 318 | state = Forbidden; |
319 | startTimer( 0 ); | 319 | startTimer( 0 ); |
320 | } else | 320 | } else |
321 | #endif | 321 | #endif |
322 | { | 322 | { |
323 | connect( this, SIGNAL( readyRead() ), SLOT( read() ) ); | 323 | connect( this, SIGNAL( readyRead() ), SLOT( read() ) ); |
324 | connect( this, SIGNAL( connectionClosed() ), SLOT( connectionClosed() ) ); | 324 | connect( this, SIGNAL( connectionClosed() ), SLOT( connectionClosed() ) ); |
325 | 325 | ||
326 | passiv = FALSE; | 326 | passiv = FALSE; |
327 | for( int i = 0; i < 4; i++ ) | 327 | for( int i = 0; i < 4; i++ ) |
328 | wait[i] = FALSE; | 328 | wait[i] = FALSE; |
329 | 329 | ||
330 | send( "220 Qtopia " QPE_VERSION " FTP Server" ); // No tr | 330 | send( "220 Qtopia " QPE_VERSION " FTP Server" ); // No tr |
331 | state = Wait_USER; | 331 | state = Wait_USER; |
332 | 332 | ||
333 | dtp = new ServerDTP( this ); | 333 | dtp = new ServerDTP( this ); |
334 | connect( dtp, SIGNAL( completed() ), SLOT( dtpCompleted() ) ); | 334 | connect( dtp, SIGNAL( completed() ), SLOT( dtpCompleted() ) ); |
335 | connect( dtp, SIGNAL( failed() ), SLOT( dtpFailed() ) ); | 335 | connect( dtp, SIGNAL( failed() ), SLOT( dtpFailed() ) ); |
336 | connect( dtp, SIGNAL( error( int ) ), SLOT( dtpError( int ) ) ); | 336 | connect( dtp, SIGNAL( error(int) ), SLOT( dtpError(int) ) ); |
337 | 337 | ||
338 | 338 | ||
339 | directory = QDir::currentDirPath(); | 339 | directory = QDir::currentDirPath(); |
340 | 340 | ||
341 | static int p = 1024; | 341 | static int p = 1024; |
342 | 342 | ||
343 | while ( !serversocket || !serversocket->ok() ) { | 343 | while ( !serversocket || !serversocket->ok() ) { |
344 | delete serversocket; | 344 | delete serversocket; |
345 | serversocket = new ServerSocket( ++p, this ); | 345 | serversocket = new ServerSocket( ++p, this ); |
346 | } | 346 | } |
347 | connect( serversocket, SIGNAL( newIncomming( int ) ), | 347 | connect( serversocket, SIGNAL( newIncomming(int) ), |
348 | SLOT( newConnection( int ) ) ); | 348 | SLOT( newConnection(int) ) ); |
349 | } | 349 | } |
350 | } | 350 | } |
351 | 351 | ||
352 | ServerPI::~ServerPI() | 352 | ServerPI::~ServerPI() |
353 | { | 353 | { |
354 | close(); | 354 | close(); |
355 | 355 | ||
356 | if ( dtp ) | 356 | if ( dtp ) |
357 | dtp->close(); | 357 | dtp->close(); |
358 | delete dtp; | 358 | delete dtp; |
359 | delete serversocket; | 359 | delete serversocket; |
360 | } | 360 | } |
361 | 361 | ||
362 | bool ServerPI::verifyAuthorised() | 362 | bool ServerPI::verifyAuthorised() |
363 | { | 363 | { |
364 | if ( !SyncAuthentication::isAuthorized(peerAddress()) ) { | 364 | if ( !SyncAuthentication::isAuthorized(peerAddress()) ) { |
365 | state = Forbidden; | 365 | state = Forbidden; |
366 | return FALSE; | 366 | return FALSE; |
367 | } | 367 | } |
368 | return TRUE; | 368 | return TRUE; |
369 | } | 369 | } |
370 | 370 | ||
371 | void ServerPI::connectionClosed() | 371 | void ServerPI::connectionClosed() |
372 | { | 372 | { |
373 | // qDebug( "Debug: Connection closed" ); | 373 | // qDebug( "Debug: Connection closed" ); |
374 | emit connectionClosed(this); | 374 | emit connectionClosed(this); |
375 | } | 375 | } |
376 | 376 | ||
377 | void ServerPI::send( const QString& msg ) | 377 | void ServerPI::send( const QString& msg ) |
378 | { | 378 | { |
379 | QTextStream os( this ); | 379 | QTextStream os( this ); |
380 | os << msg << endl; | 380 | os << msg << endl; |
381 | //qDebug( "Reply: %s", msg.latin1() ); | 381 | //qDebug( "Reply: %s", msg.latin1() ); |
382 | } | 382 | } |
383 | 383 | ||
384 | void ServerPI::read() | 384 | void ServerPI::read() |
385 | { | 385 | { |
386 | while ( canReadLine() ) | 386 | while ( canReadLine() ) |
387 | process( readLine().stripWhiteSpace() ); | 387 | process( readLine().stripWhiteSpace() ); |
388 | } | 388 | } |
389 | 389 | ||
390 | bool ServerPI::checkReadFile( const QString& file ) | 390 | bool ServerPI::checkReadFile( const QString& file ) |
391 | { | 391 | { |
392 | QString filename; | 392 | QString filename; |
393 | 393 | ||
394 | if ( file[0] != "/" ) | 394 | if ( file[0] != "/" ) |
395 | filename = directory.path() + "/" + file; | 395 | filename = directory.path() + "/" + file; |
396 | else | 396 | else |
@@ -1041,97 +1041,97 @@ void ServerPI::newConnection( int socket ) | |||
1041 | qDebug("check retrieve file"); | 1041 | qDebug("check retrieve file"); |
1042 | if ( backupRestoreGzip( waitfile ) ) | 1042 | if ( backupRestoreGzip( waitfile ) ) |
1043 | dtp->retrieveGzipFile( waitfile ); | 1043 | dtp->retrieveGzipFile( waitfile ); |
1044 | else | 1044 | else |
1045 | dtp->retrieveFile( waitfile, storFileSize ); | 1045 | dtp->retrieveFile( waitfile, storFileSize ); |
1046 | dtp->setSocket( socket ); | 1046 | dtp->setSocket( socket ); |
1047 | } | 1047 | } |
1048 | else if ( wait[SendByteArray] ) { | 1048 | else if ( wait[SendByteArray] ) { |
1049 | dtp->sendByteArray( waitarray ); | 1049 | dtp->sendByteArray( waitarray ); |
1050 | dtp->setSocket( socket ); | 1050 | dtp->setSocket( socket ); |
1051 | } | 1051 | } |
1052 | else if ( wait[RetrieveByteArray] ) { | 1052 | else if ( wait[RetrieveByteArray] ) { |
1053 | qDebug("retrieve byte array"); | 1053 | qDebug("retrieve byte array"); |
1054 | dtp->retrieveByteArray(); | 1054 | dtp->retrieveByteArray(); |
1055 | dtp->setSocket( socket ); | 1055 | dtp->setSocket( socket ); |
1056 | } | 1056 | } |
1057 | else | 1057 | else |
1058 | waitsocket = socket; | 1058 | waitsocket = socket; |
1059 | 1059 | ||
1060 | for( int i = 0; i < 4; i++ ) | 1060 | for( int i = 0; i < 4; i++ ) |
1061 | wait[i] = FALSE; | 1061 | wait[i] = FALSE; |
1062 | } | 1062 | } |
1063 | 1063 | ||
1064 | QString ServerPI::absFilePath( const QString& file ) | 1064 | QString ServerPI::absFilePath( const QString& file ) |
1065 | { | 1065 | { |
1066 | if ( file.isEmpty() ) return file; | 1066 | if ( file.isEmpty() ) return file; |
1067 | 1067 | ||
1068 | QString filepath( file ); | 1068 | QString filepath( file ); |
1069 | if ( file[0] != "/" ) | 1069 | if ( file[0] != "/" ) |
1070 | filepath = directory.path() + "/" + file; | 1070 | filepath = directory.path() + "/" + file; |
1071 | 1071 | ||
1072 | return filepath; | 1072 | return filepath; |
1073 | } | 1073 | } |
1074 | 1074 | ||
1075 | 1075 | ||
1076 | void ServerPI::timerEvent( QTimerEvent * ) | 1076 | void ServerPI::timerEvent( QTimerEvent * ) |
1077 | { | 1077 | { |
1078 | connectionClosed(); | 1078 | connectionClosed(); |
1079 | } | 1079 | } |
1080 | 1080 | ||
1081 | 1081 | ||
1082 | ServerDTP::ServerDTP( QObject *parent, const char* name) | 1082 | ServerDTP::ServerDTP( QObject *parent, const char* name) |
1083 | : QSocket( parent, name ), mode( Idle ), createTargzProc( 0 ), | 1083 | : QSocket( parent, name ), mode( Idle ), createTargzProc( 0 ), |
1084 | retrieveTargzProc( 0 ) | 1084 | retrieveTargzProc( 0 ) |
1085 | { | 1085 | { |
1086 | 1086 | ||
1087 | connect( this, SIGNAL( connected() ), SLOT( connected() ) ); | 1087 | connect( this, SIGNAL( connected() ), SLOT( connected() ) ); |
1088 | connect( this, SIGNAL( connectionClosed() ), SLOT( connectionClosed() ) ); | 1088 | connect( this, SIGNAL( connectionClosed() ), SLOT( connectionClosed() ) ); |
1089 | connect( this, SIGNAL( bytesWritten( int ) ), SLOT( bytesWritten( int ) ) ); | 1089 | connect( this, SIGNAL( bytesWritten(int) ), SLOT( bytesWritten(int) ) ); |
1090 | connect( this, SIGNAL( readyRead() ), SLOT( readyRead() ) ); | 1090 | connect( this, SIGNAL( readyRead() ), SLOT( readyRead() ) ); |
1091 | 1091 | ||
1092 | createTargzProc = new QProcess( QString("tar"), this, "createTargzProc"); // No tr | 1092 | createTargzProc = new QProcess( QString("tar"), this, "createTargzProc"); // No tr |
1093 | createTargzProc->setCommunication( QProcess::Stdout ); | 1093 | createTargzProc->setCommunication( QProcess::Stdout ); |
1094 | createTargzProc->setWorkingDirectory( QDir::rootDirPath() ); | 1094 | createTargzProc->setWorkingDirectory( QDir::rootDirPath() ); |
1095 | connect( createTargzProc, SIGNAL( processExited() ), SLOT( targzDone() ) ); | 1095 | connect( createTargzProc, SIGNAL( processExited() ), SLOT( targzDone() ) ); |
1096 | 1096 | ||
1097 | retrieveTargzProc = new QProcess( this, "retrieveTargzProc" ); | 1097 | retrieveTargzProc = new QProcess( this, "retrieveTargzProc" ); |
1098 | retrieveTargzProc->setCommunication( QProcess::Stdin ); | 1098 | retrieveTargzProc->setCommunication( QProcess::Stdin ); |
1099 | retrieveTargzProc->setWorkingDirectory( QDir::rootDirPath() ); | 1099 | retrieveTargzProc->setWorkingDirectory( QDir::rootDirPath() ); |
1100 | connect( retrieveTargzProc, SIGNAL( processExited() ), | 1100 | connect( retrieveTargzProc, SIGNAL( processExited() ), |
1101 | SIGNAL( completed() ) ); | 1101 | SIGNAL( completed() ) ); |
1102 | connect( retrieveTargzProc, SIGNAL( processExited() ), | 1102 | connect( retrieveTargzProc, SIGNAL( processExited() ), |
1103 | SLOT( extractTarDone() ) ); | 1103 | SLOT( extractTarDone() ) ); |
1104 | } | 1104 | } |
1105 | 1105 | ||
1106 | ServerDTP::~ServerDTP() | 1106 | ServerDTP::~ServerDTP() |
1107 | { | 1107 | { |
1108 | buf.close(); | 1108 | buf.close(); |
1109 | if ( RetrieveFile == mode && file.isOpen() ) { | 1109 | if ( RetrieveFile == mode && file.isOpen() ) { |
1110 | // We're being shutdown before the client closed. | 1110 | // We're being shutdown before the client closed. |
1111 | file.close(); | 1111 | file.close(); |
1112 | if ( recvFileSize >= 0 && (int)file.size() != recvFileSize ) { | 1112 | if ( recvFileSize >= 0 && (int)file.size() != recvFileSize ) { |
1113 | qDebug( "STOR incomplete" ); | 1113 | qDebug( "STOR incomplete" ); |
1114 | file.remove(); | 1114 | file.remove(); |
1115 | } | 1115 | } |
1116 | } else { | 1116 | } else { |
1117 | file.close(); | 1117 | file.close(); |
1118 | } | 1118 | } |
1119 | createTargzProc->kill(); | 1119 | createTargzProc->kill(); |
1120 | } | 1120 | } |
1121 | 1121 | ||
1122 | void ServerDTP::extractTarDone() | 1122 | void ServerDTP::extractTarDone() |
1123 | { | 1123 | { |
1124 | qDebug("extract done"); | 1124 | qDebug("extract done"); |
1125 | #ifndef QT_NO_COP | 1125 | #ifndef QT_NO_COP |
1126 | QCopEnvelope e( "QPE/System", "restoreDone(QString)" ); | 1126 | QCopEnvelope e( "QPE/System", "restoreDone(QString)" ); |
1127 | e << file.name(); | 1127 | e << file.name(); |
1128 | #endif | 1128 | #endif |
1129 | } | 1129 | } |
1130 | 1130 | ||
1131 | void ServerDTP::connected() | 1131 | void ServerDTP::connected() |
1132 | { | 1132 | { |
1133 | // send file mode | 1133 | // send file mode |
1134 | switch ( mode ) { | 1134 | switch ( mode ) { |
1135 | case SendFile : | 1135 | case SendFile : |
1136 | if ( !file.exists() || !file.open( IO_ReadOnly) ) { | 1136 | if ( !file.exists() || !file.open( IO_ReadOnly) ) { |
1137 | emit failed(); | 1137 | emit failed(); |