author | zecke <zecke> | 2003-11-30 13:13:52 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-11-30 13:13:52 (UTC) |
commit | 8339a705567a3bd50af2e41805e9256973eedcc4 (patch) (unidiff) | |
tree | e38f9a739b02d3c709aa843c8f4bce95e68bfacf | |
parent | 6804b865ea84e995e93e22582d0584b84810be38 (diff) | |
download | opie-8339a705567a3bd50af2e41805e9256973eedcc4.zip opie-8339a705567a3bd50af2e41805e9256973eedcc4.tar.gz opie-8339a705567a3bd50af2e41805e9256973eedcc4.tar.bz2 |
If OPIE_NO_BUILTIN_CALIBRATION is not requested bultin calibration
-rw-r--r-- | core/launcher/server.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/launcher/server.cpp b/core/launcher/server.cpp index 6a140e9..b9580c7 100644 --- a/core/launcher/server.cpp +++ b/core/launcher/server.cpp | |||
@@ -1,494 +1,494 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "server.h" | 21 | #include "server.h" |
22 | #include "serverapp.h" | 22 | #include "serverapp.h" |
23 | #include "launcher.h" | 23 | #include "launcher.h" |
24 | #include "startmenu.h" | 24 | #include "startmenu.h" |
25 | #include "transferserver.h" | 25 | #include "transferserver.h" |
26 | #include "qcopbridge.h" | 26 | #include "qcopbridge.h" |
27 | #include "irserver.h" | 27 | #include "irserver.h" |
28 | #include "packageslave.h" | 28 | #include "packageslave.h" |
29 | #include "calibrate.h" | 29 | #include "calibrate.h" |
30 | #include "qrsync.h" | 30 | #include "qrsync.h" |
31 | #include "syncdialog.h" | 31 | #include "syncdialog.h" |
32 | #include "launcher.h" | 32 | #include "launcher.h" |
33 | #include "shutdownimpl.h" | 33 | #include "shutdownimpl.h" |
34 | #include "applauncher.h" | 34 | #include "applauncher.h" |
35 | #if 0 | 35 | #if 0 |
36 | #include "suspendmonitor.h" | 36 | #include "suspendmonitor.h" |
37 | #endif | 37 | #endif |
38 | #include "documentlist.h" | 38 | #include "documentlist.h" |
39 | 39 | ||
40 | #include <qtopia/applnk.h> | 40 | #include <qtopia/applnk.h> |
41 | #include <qtopia/private/categories.h> | 41 | #include <qtopia/private/categories.h> |
42 | #include <qtopia/mimetype.h> | 42 | #include <qtopia/mimetype.h> |
43 | #include <qtopia/config.h> | 43 | #include <qtopia/config.h> |
44 | #include <qtopia/resource.h> | 44 | #include <qtopia/resource.h> |
45 | #include <qtopia/version.h> | 45 | #include <qtopia/version.h> |
46 | #include <qtopia/storage.h> | 46 | #include <qtopia/storage.h> |
47 | 47 | ||
48 | #include <qtopia/qcopenvelope_qws.h> | 48 | #include <qtopia/qcopenvelope_qws.h> |
49 | #include <qwindowsystem_qws.h> | 49 | #include <qwindowsystem_qws.h> |
50 | #include <qgfx_qws.h> | 50 | #include <qgfx_qws.h> |
51 | #include <qtopia/global.h> | 51 | #include <qtopia/global.h> |
52 | //#include <qtopia/custom.h> | 52 | //#include <qtopia/custom.h> |
53 | 53 | ||
54 | #include <opie/odevicebutton.h> | 54 | #include <opie/odevicebutton.h> |
55 | #include <opie/odevice.h> | 55 | #include <opie/odevice.h> |
56 | 56 | ||
57 | #include <unistd.h> | 57 | #include <unistd.h> |
58 | #include <qmainwindow.h> | 58 | #include <qmainwindow.h> |
59 | #include <qmessagebox.h> | 59 | #include <qmessagebox.h> |
60 | #include <qtimer.h> | 60 | #include <qtimer.h> |
61 | #include <qtextstream.h> | 61 | #include <qtextstream.h> |
62 | 62 | ||
63 | #include <stdlib.h> | 63 | #include <stdlib.h> |
64 | 64 | ||
65 | extern QRect qt_maxWindowRect; | 65 | extern QRect qt_maxWindowRect; |
66 | 66 | ||
67 | using namespace Opie; | 67 | using namespace Opie; |
68 | 68 | ||
69 | static QWidget *calibrate(bool) | 69 | static QWidget *calibrate(bool) |
70 | { | 70 | { |
71 | #ifdef Q_WS_QWS | 71 | #ifdef Q_WS_QWS |
72 | Calibrate *c = new Calibrate; | 72 | Calibrate *c = new Calibrate; |
73 | c->show(); | 73 | c->show(); |
74 | return c; | 74 | return c; |
75 | #else | 75 | #else |
76 | return 0; | 76 | return 0; |
77 | #endif | 77 | #endif |
78 | } | 78 | } |
79 | 79 | ||
80 | #define FACTORY(T) \ | 80 | #define FACTORY(T) \ |
81 | static QWidget *new##T( bool maximized ) { \ | 81 | static QWidget *new##T( bool maximized ) { \ |
82 | QWidget *w = new T( 0, 0, QWidget::WDestructiveClose | QWidget::WGroupLeader ); \ | 82 | QWidget *w = new T( 0, 0, QWidget::WDestructiveClose | QWidget::WGroupLeader ); \ |
83 | if ( maximized ) { \ | 83 | if ( maximized ) { \ |
84 | if ( qApp->desktop()->width() <= 350 ) { \ | 84 | if ( qApp->desktop()->width() <= 350 ) { \ |
85 | w->showMaximized(); \ | 85 | w->showMaximized(); \ |
86 | } else { \ | 86 | } else { \ |
87 | w->resize( QSize( 300, 300 ) ); \ | 87 | w->resize( QSize( 300, 300 ) ); \ |
88 | } \ | 88 | } \ |
89 | } \ | 89 | } \ |
90 | w->show(); \ | 90 | w->show(); \ |
91 | return w; \ | 91 | return w; \ |
92 | } | 92 | } |
93 | 93 | ||
94 | 94 | ||
95 | #ifdef SINGLE_APP | 95 | #ifdef SINGLE_APP |
96 | #define APP(a,b,c,d) FACTORY(b) | 96 | #define APP(a,b,c,d) FACTORY(b) |
97 | #include "apps.h" | 97 | #include "apps.h" |
98 | #undef APP | 98 | #undef APP |
99 | #endif // SINGLE_APP | 99 | #endif // SINGLE_APP |
100 | 100 | ||
101 | static Global::Command builtins[] = { | 101 | static Global::Command builtins[] = { |
102 | 102 | ||
103 | #ifdef SINGLE_APP | 103 | #ifdef SINGLE_APP |
104 | #define APP(a,b,c,d) { a, new##b, c, d }, | 104 | #define APP(a,b,c,d) { a, new##b, c, d }, |
105 | #include "apps.h" | 105 | #include "apps.h" |
106 | #undef APP | 106 | #undef APP |
107 | #endif | 107 | #endif |
108 | 108 | ||
109 | /* FIXME defines need to be defined*/ | 109 | /* FIXME defines need to be defined*/ |
110 | #if defined(QPE_NEED_CALIBRATION) | 110 | #if !defined(OPIE_NO_BUILTIN_CALIBRATE) |
111 | { "calibrate", calibrate, 1, 0 }, // No tr | 111 | { "calibrate", calibrate, 1, 0 }, // No tr |
112 | #endif | 112 | #endif |
113 | #if !defined(OPIE_NO_BUILTIN_SHUTDOWN) | 113 | #if !defined(OPIE_NO_BUILTIN_SHUTDOWN) |
114 | { "shutdown", Global::shutdown, 1, 0 }, // No tr | 114 | { "shutdown", Global::shutdown, 1, 0 }, // No tr |
115 | // { "run", run, 1, 0 }, // No tr | 115 | // { "run", run, 1, 0 }, // No tr |
116 | #endif | 116 | #endif |
117 | 117 | ||
118 | { 0, calibrate,0, 0 }, | 118 | { 0, calibrate,0, 0 }, |
119 | }; | 119 | }; |
120 | 120 | ||
121 | 121 | ||
122 | //--------------------------------------------------------------------------- | 122 | //--------------------------------------------------------------------------- |
123 | 123 | ||
124 | 124 | ||
125 | //=========================================================================== | 125 | //=========================================================================== |
126 | 126 | ||
127 | Server::Server() : | 127 | Server::Server() : |
128 | QWidget( 0, 0, WStyle_Tool | WStyle_Customize ), | 128 | QWidget( 0, 0, WStyle_Tool | WStyle_Customize ), |
129 | qcopBridge( 0 ), | 129 | qcopBridge( 0 ), |
130 | transferServer( 0 ), | 130 | transferServer( 0 ), |
131 | packageHandler( 0 ), | 131 | packageHandler( 0 ), |
132 | syncDialog( 0 ) | 132 | syncDialog( 0 ) |
133 | { | 133 | { |
134 | Global::setBuiltinCommands(builtins); | 134 | Global::setBuiltinCommands(builtins); |
135 | 135 | ||
136 | tid_xfer = 0; | 136 | tid_xfer = 0; |
137 | /* ### FIXME ### */ | 137 | /* ### FIXME ### */ |
138 | /* tid_today = startTimer(3600*2*1000);*/ | 138 | /* tid_today = startTimer(3600*2*1000);*/ |
139 | last_today_show = QDate::currentDate(); | 139 | last_today_show = QDate::currentDate(); |
140 | 140 | ||
141 | #if 0 | 141 | #if 0 |
142 | tsmMonitor = new TempScreenSaverMode(); | 142 | tsmMonitor = new TempScreenSaverMode(); |
143 | connect( tsmMonitor, SIGNAL(forceSuspend()), qApp, SIGNAL(power()) ); | 143 | connect( tsmMonitor, SIGNAL(forceSuspend()), qApp, SIGNAL(power()) ); |
144 | #endif | 144 | #endif |
145 | 145 | ||
146 | serverGui = new Launcher; | 146 | serverGui = new Launcher; |
147 | serverGui->createGUI(); | 147 | serverGui->createGUI(); |
148 | 148 | ||
149 | docList = new DocumentList( serverGui ); | 149 | docList = new DocumentList( serverGui ); |
150 | appLauncher = new AppLauncher(this); | 150 | appLauncher = new AppLauncher(this); |
151 | connect(appLauncher, SIGNAL(launched(int, const QString &)), this, SLOT(applicationLaunched(int, const QString &)) ); | 151 | connect(appLauncher, SIGNAL(launched(int, const QString &)), this, SLOT(applicationLaunched(int, const QString &)) ); |
152 | connect(appLauncher, SIGNAL(terminated(int, const QString &)), this, SLOT(applicationTerminated(int, const QString &)) ); | 152 | connect(appLauncher, SIGNAL(terminated(int, const QString &)), this, SLOT(applicationTerminated(int, const QString &)) ); |
153 | connect(appLauncher, SIGNAL(connected(const QString &)), this, SLOT(applicationConnected(const QString &)) ); | 153 | connect(appLauncher, SIGNAL(connected(const QString &)), this, SLOT(applicationConnected(const QString &)) ); |
154 | 154 | ||
155 | storage = new StorageInfo( this ); | 155 | storage = new StorageInfo( this ); |
156 | connect( storage, SIGNAL(disksChanged()), this, SLOT(storageChanged()) ); | 156 | connect( storage, SIGNAL(disksChanged()), this, SLOT(storageChanged()) ); |
157 | 157 | ||
158 | // start services | 158 | // start services |
159 | startTransferServer(); | 159 | startTransferServer(); |
160 | (void) new IrServer( this ); | 160 | (void) new IrServer( this ); |
161 | 161 | ||
162 | packageHandler = new PackageHandler( this ); | 162 | packageHandler = new PackageHandler( this ); |
163 | connect(qApp, SIGNAL(activate(const Opie::ODeviceButton*,bool)), | 163 | connect(qApp, SIGNAL(activate(const Opie::ODeviceButton*,bool)), |
164 | this,SLOT(activate(const Opie::ODeviceButton*,bool))); | 164 | this,SLOT(activate(const Opie::ODeviceButton*,bool))); |
165 | 165 | ||
166 | setGeometry( -10, -10, 9, 9 ); | 166 | setGeometry( -10, -10, 9, 9 ); |
167 | 167 | ||
168 | QCopChannel *channel = new QCopChannel("QPE/System", this); | 168 | QCopChannel *channel = new QCopChannel("QPE/System", this); |
169 | connect(channel, SIGNAL(received(const QCString &, const QByteArray &)), | 169 | connect(channel, SIGNAL(received(const QCString &, const QByteArray &)), |
170 | this, SLOT(systemMsg(const QCString &, const QByteArray &)) ); | 170 | this, SLOT(systemMsg(const QCString &, const QByteArray &)) ); |
171 | 171 | ||
172 | QCopChannel *tbChannel = new QCopChannel( "QPE/TaskBar", this ); | 172 | QCopChannel *tbChannel = new QCopChannel( "QPE/TaskBar", this ); |
173 | connect( tbChannel, SIGNAL(received(const QCString&, const QByteArray&)), | 173 | connect( tbChannel, SIGNAL(received(const QCString&, const QByteArray&)), |
174 | this, SLOT(receiveTaskBar(const QCString&, const QByteArray&)) ); | 174 | this, SLOT(receiveTaskBar(const QCString&, const QByteArray&)) ); |
175 | 175 | ||
176 | connect( qApp, SIGNAL(prepareForRestart()), this, SLOT(terminateServers()) ); | 176 | connect( qApp, SIGNAL(prepareForRestart()), this, SLOT(terminateServers()) ); |
177 | connect( qApp, SIGNAL(timeChanged()), this, SLOT(pokeTimeMonitors()) ); | 177 | connect( qApp, SIGNAL(timeChanged()), this, SLOT(pokeTimeMonitors()) ); |
178 | 178 | ||
179 | preloadApps(); | 179 | preloadApps(); |
180 | } | 180 | } |
181 | 181 | ||
182 | void Server::show() | 182 | void Server::show() |
183 | { | 183 | { |
184 | ServerApplication::login(TRUE); | 184 | ServerApplication::login(TRUE); |
185 | QWidget::show(); | 185 | QWidget::show(); |
186 | } | 186 | } |
187 | 187 | ||
188 | Server::~Server() | 188 | Server::~Server() |
189 | { | 189 | { |
190 | serverGui->destroyGUI(); | 190 | serverGui->destroyGUI(); |
191 | delete docList; | 191 | delete docList; |
192 | delete qcopBridge; | 192 | delete qcopBridge; |
193 | delete transferServer; | 193 | delete transferServer; |
194 | delete serverGui; | 194 | delete serverGui; |
195 | #if 0 | 195 | #if 0 |
196 | delete tsmMonitor; | 196 | delete tsmMonitor; |
197 | #endif | 197 | #endif |
198 | } | 198 | } |
199 | 199 | ||
200 | static bool hasVisibleWindow(const QString& clientname, bool partial) | 200 | static bool hasVisibleWindow(const QString& clientname, bool partial) |
201 | { | 201 | { |
202 | #ifdef QWS | 202 | #ifdef QWS |
203 | const QList<QWSWindow> &list = qwsServer->clientWindows(); | 203 | const QList<QWSWindow> &list = qwsServer->clientWindows(); |
204 | QWSWindow* w; | 204 | QWSWindow* w; |
205 | for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { | 205 | for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { |
206 | if ( w->client()->identity() == clientname ) { | 206 | if ( w->client()->identity() == clientname ) { |
207 | if ( partial && !w->isFullyObscured() ) | 207 | if ( partial && !w->isFullyObscured() ) |
208 | return TRUE; | 208 | return TRUE; |
209 | if ( !partial && !w->isFullyObscured() && !w->isPartiallyObscured() ) { | 209 | if ( !partial && !w->isFullyObscured() && !w->isPartiallyObscured() ) { |
210 | # if QT_VERSION < 0x030000 | 210 | # if QT_VERSION < 0x030000 |
211 | QRect mwr = qt_screen->mapToDevice(qt_maxWindowRect, | 211 | QRect mwr = qt_screen->mapToDevice(qt_maxWindowRect, |
212 | QSize(qt_screen->width(),qt_screen->height()) ); | 212 | QSize(qt_screen->width(),qt_screen->height()) ); |
213 | # else | 213 | # else |
214 | QRect mwr = qt_maxWindowRect; | 214 | QRect mwr = qt_maxWindowRect; |
215 | # endif | 215 | # endif |
216 | if ( mwr.contains(w->requested().boundingRect()) ) | 216 | if ( mwr.contains(w->requested().boundingRect()) ) |
217 | return TRUE; | 217 | return TRUE; |
218 | } | 218 | } |
219 | } | 219 | } |
220 | } | 220 | } |
221 | #endif | 221 | #endif |
222 | return FALSE; | 222 | return FALSE; |
223 | } | 223 | } |
224 | 224 | ||
225 | void Server::activate(const Opie::ODeviceButton* button, bool held) | 225 | void Server::activate(const Opie::ODeviceButton* button, bool held) |
226 | { | 226 | { |
227 | Global::terminateBuiltin("calibrate"); // No tr | 227 | Global::terminateBuiltin("calibrate"); // No tr |
228 | Opie::OQCopMessage om; | 228 | Opie::OQCopMessage om; |
229 | if ( held ) { | 229 | if ( held ) { |
230 | om = button->heldAction(); | 230 | om = button->heldAction(); |
231 | } else { | 231 | } else { |
232 | om = button->pressedAction(); | 232 | om = button->pressedAction(); |
233 | } | 233 | } |
234 | 234 | ||
235 | if ( om.channel() != "ignore" ) | 235 | if ( om.channel() != "ignore" ) |
236 | om.send(); | 236 | om.send(); |
237 | 237 | ||
238 | // A button with no action defined, will return a null ServiceRequest. Don't attempt | 238 | // A button with no action defined, will return a null ServiceRequest. Don't attempt |
239 | // to send/do anything with this as it will crash | 239 | // to send/do anything with this as it will crash |
240 | /* ### FIXME */ | 240 | /* ### FIXME */ |
241 | #if 0 | 241 | #if 0 |
242 | if ( !sr.isNull() ) { | 242 | if ( !sr.isNull() ) { |
243 | QString app = sr.app(); | 243 | QString app = sr.app(); |
244 | bool vis = hasVisibleWindow(app, app != "qpe"); | 244 | bool vis = hasVisibleWindow(app, app != "qpe"); |
245 | if ( sr.message() == "raise()" && vis ) { | 245 | if ( sr.message() == "raise()" && vis ) { |
246 | sr.setMessage("nextView()"); | 246 | sr.setMessage("nextView()"); |
247 | } else { | 247 | } else { |
248 | // "back door" | 248 | // "back door" |
249 | sr << (int)vis; | 249 | sr << (int)vis; |
250 | } | 250 | } |
251 | 251 | ||
252 | sr.send(); | 252 | sr.send(); |
253 | } | 253 | } |
254 | #endif | 254 | #endif |
255 | } | 255 | } |
256 | 256 | ||
257 | 257 | ||
258 | #ifdef Q_WS_QWS | 258 | #ifdef Q_WS_QWS |
259 | 259 | ||
260 | 260 | ||
261 | typedef struct KeyOverride { | 261 | typedef struct KeyOverride { |
262 | ushort scan_code; | 262 | ushort scan_code; |
263 | QWSServer::KeyMap map; | 263 | QWSServer::KeyMap map; |
264 | }; | 264 | }; |
265 | 265 | ||
266 | 266 | ||
267 | static const KeyOverride jp109keys[] = { | 267 | static const KeyOverride jp109keys[] = { |
268 | { 0x03, { Qt::Key_2, '2' , 0x22 , 0xffff } }, | 268 | { 0x03, { Qt::Key_2, '2' , 0x22 , 0xffff } }, |
269 | { 0x07, { Qt::Key_6, '6' , '&' , 0xffff } }, | 269 | { 0x07, { Qt::Key_6, '6' , '&' , 0xffff } }, |
270 | { 0x08, { Qt::Key_7, '7' , '\'' , 0xffff } }, | 270 | { 0x08, { Qt::Key_7, '7' , '\'' , 0xffff } }, |
271 | { 0x09, { Qt::Key_8, '8' , '(' , 0xffff } }, | 271 | { 0x09, { Qt::Key_8, '8' , '(' , 0xffff } }, |
272 | { 0x0a, { Qt::Key_9, '9' , ')' , 0xffff } }, | 272 | { 0x0a, { Qt::Key_9, '9' , ')' , 0xffff } }, |
273 | { 0x0b, { Qt::Key_0, '0' , 0xffff , 0xffff } }, | 273 | { 0x0b, { Qt::Key_0, '0' , 0xffff , 0xffff } }, |
274 | { 0x0c, { Qt::Key_Minus, '-' , '=' , 0xffff } }, | 274 | { 0x0c, { Qt::Key_Minus, '-' , '=' , 0xffff } }, |
275 | { 0x0d, { Qt::Key_AsciiCircum,'^' , '~' , '^' - 64 } }, | 275 | { 0x0d, { Qt::Key_AsciiCircum,'^' , '~' , '^' - 64 } }, |
276 | { 0x1a, { Qt::Key_At, '@' , '`' , 0xffff } }, | 276 | { 0x1a, { Qt::Key_At, '@' , '`' , 0xffff } }, |
277 | { 0x1b, { Qt::Key_BraceLeft, '[' , '{' , '[' - 64 } }, | 277 | { 0x1b, { Qt::Key_BraceLeft, '[' , '{' , '[' - 64 } }, |
278 | { 0x27, { Qt::Key_Semicolon, ';' , '+' , 0xffff } }, | 278 | { 0x27, { Qt::Key_Semicolon, ';' , '+' , 0xffff } }, |
279 | { 0x28, { Qt::Key_Colon, ':' , '*' , 0xffff } }, | 279 | { 0x28, { Qt::Key_Colon, ':' , '*' , 0xffff } }, |
280 | { 0x29, { Qt::Key_Zenkaku_Hankaku, 0xffff , 0xffff , 0xffff } }, | 280 | { 0x29, { Qt::Key_Zenkaku_Hankaku, 0xffff , 0xffff , 0xffff } }, |
281 | { 0x2b, { Qt::Key_BraceRight, ']' , '}' , ']'-64 } }, | 281 | { 0x2b, { Qt::Key_BraceRight, ']' , '}' , ']'-64 } }, |
282 | { 0x70, { Qt::Key_Hiragana_Katakana, 0xffff , 0xffff , 0xffff } }, | 282 | { 0x70, { Qt::Key_Hiragana_Katakana, 0xffff , 0xffff , 0xffff } }, |
283 | { 0x73, { Qt::Key_Backslash, '\\' , '_' , 0xffff } }, | 283 | { 0x73, { Qt::Key_Backslash, '\\' , '_' , 0xffff } }, |
284 | { 0x79, { Qt::Key_Henkan, 0xffff , 0xffff , 0xffff } }, | 284 | { 0x79, { Qt::Key_Henkan, 0xffff , 0xffff , 0xffff } }, |
285 | { 0x7b, { Qt::Key_Muhenkan, 0xffff , 0xffff , 0xffff } }, | 285 | { 0x7b, { Qt::Key_Muhenkan, 0xffff , 0xffff , 0xffff } }, |
286 | { 0x7d, { Qt::Key_yen, 0x00a5 , '|' , 0xffff } }, | 286 | { 0x7d, { Qt::Key_yen, 0x00a5 , '|' , 0xffff } }, |
287 | { 0x00, { 0, 0xffff , 0xffff , 0xffff } } | 287 | { 0x00, { 0, 0xffff , 0xffff , 0xffff } } |
288 | }; | 288 | }; |
289 | 289 | ||
290 | bool Server::setKeyboardLayout( const QString &kb ) | 290 | bool Server::setKeyboardLayout( const QString &kb ) |
291 | { | 291 | { |
292 | //quick demo version that can be extended | 292 | //quick demo version that can be extended |
293 | 293 | ||
294 | QIntDict<QWSServer::KeyMap> *om = 0; | 294 | QIntDict<QWSServer::KeyMap> *om = 0; |
295 | if ( kb == "us101" ) { // No tr | 295 | if ( kb == "us101" ) { // No tr |
296 | om = 0; | 296 | om = 0; |
297 | } else if ( kb == "jp109" ) { | 297 | } else if ( kb == "jp109" ) { |
298 | om = new QIntDict<QWSServer::KeyMap>(37); | 298 | om = new QIntDict<QWSServer::KeyMap>(37); |
299 | const KeyOverride *k = jp109keys; | 299 | const KeyOverride *k = jp109keys; |
300 | while ( k->scan_code ) { | 300 | while ( k->scan_code ) { |
301 | om->insert( k->scan_code, &k->map ); | 301 | om->insert( k->scan_code, &k->map ); |
302 | k++; | 302 | k++; |
303 | } | 303 | } |
304 | } | 304 | } |
305 | QWSServer::setOverrideKeys( om ); | 305 | QWSServer::setOverrideKeys( om ); |
306 | 306 | ||
307 | return TRUE; | 307 | return TRUE; |
308 | } | 308 | } |
309 | 309 | ||
310 | #endif | 310 | #endif |
311 | 311 | ||
312 | void Server::systemMsg(const QCString &msg, const QByteArray &data) | 312 | void Server::systemMsg(const QCString &msg, const QByteArray &data) |
313 | { | 313 | { |
314 | QDataStream stream( data, IO_ReadOnly ); | 314 | QDataStream stream( data, IO_ReadOnly ); |
315 | 315 | ||
316 | if ( msg == "securityChanged()" ) { | 316 | if ( msg == "securityChanged()" ) { |
317 | if ( transferServer ) | 317 | if ( transferServer ) |
318 | transferServer->authorizeConnections(); | 318 | transferServer->authorizeConnections(); |
319 | if ( qcopBridge ) | 319 | if ( qcopBridge ) |
320 | qcopBridge->authorizeConnections(); | 320 | qcopBridge->authorizeConnections(); |
321 | } | 321 | } |
322 | /* ### FIXME support TempScreenSaverMode */ | 322 | /* ### FIXME support TempScreenSaverMode */ |
323 | #if 0 | 323 | #if 0 |
324 | else if ( msg == "setTempScreenSaverMode(int,int)" ) { | 324 | else if ( msg == "setTempScreenSaverMode(int,int)" ) { |
325 | int mode, pid; | 325 | int mode, pid; |
326 | stream >> mode >> pid; | 326 | stream >> mode >> pid; |
327 | tsmMonitor->setTempMode(mode, pid); | 327 | tsmMonitor->setTempMode(mode, pid); |
328 | } | 328 | } |
329 | #endif | 329 | #endif |
330 | else if ( msg == "linkChanged(QString)" ) { | 330 | else if ( msg == "linkChanged(QString)" ) { |
331 | QString link; | 331 | QString link; |
332 | stream >> link; | 332 | stream >> link; |
333 | qDebug( "desktop.cpp systemMsg -> linkchanged( %s )", link.latin1() ); | 333 | qDebug( "desktop.cpp systemMsg -> linkchanged( %s )", link.latin1() ); |
334 | docList->linkChanged(link); | 334 | docList->linkChanged(link); |
335 | } else if ( msg == "serviceChanged(QString)" ) { | 335 | } else if ( msg == "serviceChanged(QString)" ) { |
336 | MimeType::updateApplications(); | 336 | MimeType::updateApplications(); |
337 | } else if ( msg == "mkdir(QString)" ) { | 337 | } else if ( msg == "mkdir(QString)" ) { |
338 | QString dir; | 338 | QString dir; |
339 | stream >> dir; | 339 | stream >> dir; |
340 | if ( !dir.isEmpty() ) | 340 | if ( !dir.isEmpty() ) |
341 | mkdir( dir ); | 341 | mkdir( dir ); |
342 | } else if ( msg == "rdiffGenSig(QString,QString)" ) { | 342 | } else if ( msg == "rdiffGenSig(QString,QString)" ) { |
343 | QString baseFile, sigFile; | 343 | QString baseFile, sigFile; |
344 | stream >> baseFile >> sigFile; | 344 | stream >> baseFile >> sigFile; |
345 | QRsync::generateSignature( baseFile, sigFile ); | 345 | QRsync::generateSignature( baseFile, sigFile ); |
346 | } else if ( msg == "rdiffGenDiff(QString,QString,QString)" ) { | 346 | } else if ( msg == "rdiffGenDiff(QString,QString,QString)" ) { |
347 | QString baseFile, sigFile, deltaFile; | 347 | QString baseFile, sigFile, deltaFile; |
348 | stream >> baseFile >> sigFile >> deltaFile; | 348 | stream >> baseFile >> sigFile >> deltaFile; |
349 | QRsync::generateDiff( baseFile, sigFile, deltaFile ); | 349 | QRsync::generateDiff( baseFile, sigFile, deltaFile ); |
350 | } else if ( msg == "rdiffApplyPatch(QString,QString)" ) { | 350 | } else if ( msg == "rdiffApplyPatch(QString,QString)" ) { |
351 | QString baseFile, deltaFile; | 351 | QString baseFile, deltaFile; |
352 | stream >> baseFile >> deltaFile; | 352 | stream >> baseFile >> deltaFile; |
353 | if ( !QFile::exists( baseFile ) ) { | 353 | if ( !QFile::exists( baseFile ) ) { |
354 | QFile f( baseFile ); | 354 | QFile f( baseFile ); |
355 | f.open( IO_WriteOnly ); | 355 | f.open( IO_WriteOnly ); |
356 | f.close(); | 356 | f.close(); |
357 | } | 357 | } |
358 | QRsync::applyDiff( baseFile, deltaFile ); | 358 | QRsync::applyDiff( baseFile, deltaFile ); |
359 | #ifndef QT_NO_COP | 359 | #ifndef QT_NO_COP |
360 | QCopEnvelope e( "QPE/Desktop", "patchApplied(QString)" ); | 360 | QCopEnvelope e( "QPE/Desktop", "patchApplied(QString)" ); |
361 | e << baseFile; | 361 | e << baseFile; |
362 | #endif | 362 | #endif |
363 | } else if ( msg == "rdiffCleanup()" ) { | 363 | } else if ( msg == "rdiffCleanup()" ) { |
364 | mkdir( "/tmp/rdiff" ); | 364 | mkdir( "/tmp/rdiff" ); |
365 | QDir dir; | 365 | QDir dir; |
366 | dir.setPath( "/tmp/rdiff" ); | 366 | dir.setPath( "/tmp/rdiff" ); |
367 | QStringList entries = dir.entryList(); | 367 | QStringList entries = dir.entryList(); |
368 | for ( QStringList::Iterator it = entries.begin(); it != entries.end(); ++it ) | 368 | for ( QStringList::Iterator it = entries.begin(); it != entries.end(); ++it ) |
369 | dir.remove( *it ); | 369 | dir.remove( *it ); |
370 | } else if ( msg == "sendHandshakeInfo()" ) { | 370 | } else if ( msg == "sendHandshakeInfo()" ) { |
371 | QString home = getenv( "HOME" ); | 371 | QString home = getenv( "HOME" ); |
372 | #ifndef QT_NO_COP | 372 | #ifndef QT_NO_COP |
373 | QCopEnvelope e( "QPE/Desktop", "handshakeInfo(QString,bool)" ); | 373 | QCopEnvelope e( "QPE/Desktop", "handshakeInfo(QString,bool)" ); |
374 | e << home; | 374 | e << home; |
375 | int locked = (int) ServerApplication::screenLocked(); | 375 | int locked = (int) ServerApplication::screenLocked(); |
376 | e << locked; | 376 | e << locked; |
377 | #endif | 377 | #endif |
378 | 378 | ||
379 | } | 379 | } |
380 | /* | 380 | /* |
381 | * QtopiaDesktop relies on the major number | 381 | * QtopiaDesktop relies on the major number |
382 | * to start with 1. We're at 0.9 | 382 | * to start with 1. We're at 0.9 |
383 | * so wee need to fake at least 1.4 to be able | 383 | * so wee need to fake at least 1.4 to be able |
384 | * to sync with QtopiaDesktop1.6 | 384 | * to sync with QtopiaDesktop1.6 |
385 | */ | 385 | */ |
386 | else if ( msg == "sendVersionInfo()" ) { | 386 | else if ( msg == "sendVersionInfo()" ) { |
387 | QCopEnvelope e( "QPE/Desktop", "versionInfo(QString,QString)" ); | 387 | QCopEnvelope e( "QPE/Desktop", "versionInfo(QString,QString)" ); |
388 | /* ### FIXME Architecture ### */ | 388 | /* ### FIXME Architecture ### */ |
389 | e << QString::fromLatin1("1.7") << "Uncustomized Device"; | 389 | e << QString::fromLatin1("1.7") << "Uncustomized Device"; |
390 | } else if ( msg == "sendCardInfo()" ) { | 390 | } else if ( msg == "sendCardInfo()" ) { |
391 | #ifndef QT_NO_COP | 391 | #ifndef QT_NO_COP |
392 | QCopEnvelope e( "QPE/Desktop", "cardInfo(QString)" ); | 392 | QCopEnvelope e( "QPE/Desktop", "cardInfo(QString)" ); |
393 | #endif | 393 | #endif |
394 | storage->update(); | 394 | storage->update(); |
395 | const QList<FileSystem> &fs = storage->fileSystems(); | 395 | const QList<FileSystem> &fs = storage->fileSystems(); |
396 | QListIterator<FileSystem> it ( fs ); | 396 | QListIterator<FileSystem> it ( fs ); |
397 | QString s; | 397 | QString s; |
398 | QString homeDir = getenv("HOME"); | 398 | QString homeDir = getenv("HOME"); |
399 | QString homeFs, homeFsPath; | 399 | QString homeFs, homeFsPath; |
400 | for ( ; it.current(); ++it ) { | 400 | for ( ; it.current(); ++it ) { |
401 | int k4 = (*it)->blockSize()/256; | 401 | int k4 = (*it)->blockSize()/256; |
402 | if ( (*it)->isRemovable() ) { | 402 | if ( (*it)->isRemovable() ) { |
403 | s += (*it)->name() + "=" + (*it)->path() + "/Documents " // No tr | 403 | s += (*it)->name() + "=" + (*it)->path() + "/Documents " // No tr |
404 | + QString::number( (*it)->availBlocks() * k4/4 ) | 404 | + QString::number( (*it)->availBlocks() * k4/4 ) |
405 | + "K " + (*it)->options() + ";"; | 405 | + "K " + (*it)->options() + ";"; |
406 | } else if ( homeDir.contains( (*it)->path() ) && | 406 | } else if ( homeDir.contains( (*it)->path() ) && |
407 | (*it)->path().length() > homeFsPath.length() ) { | 407 | (*it)->path().length() > homeFsPath.length() ) { |
408 | homeFsPath = (*it)->path(); | 408 | homeFsPath = (*it)->path(); |
409 | homeFs = | 409 | homeFs = |
410 | (*it)->name() + "=" + homeDir + "/Documents " // No tr | 410 | (*it)->name() + "=" + homeDir + "/Documents " // No tr |
411 | + QString::number( (*it)->availBlocks() * k4/4 ) | 411 | + QString::number( (*it)->availBlocks() * k4/4 ) |
412 | + "K " + (*it)->options() + ";"; | 412 | + "K " + (*it)->options() + ";"; |
413 | } | 413 | } |
414 | } | 414 | } |
415 | if ( !homeFs.isEmpty() ) | 415 | if ( !homeFs.isEmpty() ) |
416 | s += homeFs; | 416 | s += homeFs; |
417 | 417 | ||
418 | #ifndef QT_NO_COP | 418 | #ifndef QT_NO_COP |
419 | e << s; | 419 | e << s; |
420 | #endif | 420 | #endif |
421 | } else if ( msg == "sendSyncDate(QString)" ) { | 421 | } else if ( msg == "sendSyncDate(QString)" ) { |
422 | QString app; | 422 | QString app; |
423 | stream >> app; | 423 | stream >> app; |
424 | Config cfg( "qpe" ); | 424 | Config cfg( "qpe" ); |
425 | cfg.setGroup("SyncDate"); | 425 | cfg.setGroup("SyncDate"); |
426 | #ifndef QT_NO_COP | 426 | #ifndef QT_NO_COP |
427 | QCopEnvelope e( "QPE/Desktop", "syncDate(QString,QString)" ); | 427 | QCopEnvelope e( "QPE/Desktop", "syncDate(QString,QString)" ); |
428 | e << app << cfg.readEntry( app ); | 428 | e << app << cfg.readEntry( app ); |
429 | #endif | 429 | #endif |
430 | //qDebug("QPE/System sendSyncDate for %s: response %s", app.latin1(), | 430 | //qDebug("QPE/System sendSyncDate for %s: response %s", app.latin1(), |
431 | //cfg.readEntry( app ).latin1() ); | 431 | //cfg.readEntry( app ).latin1() ); |
432 | } else if ( msg == "setSyncDate(QString,QString)" ) { | 432 | } else if ( msg == "setSyncDate(QString,QString)" ) { |
433 | QString app, date; | 433 | QString app, date; |
434 | stream >> app >> date; | 434 | stream >> app >> date; |
435 | Config cfg( "qpe" ); | 435 | Config cfg( "qpe" ); |
436 | cfg.setGroup("SyncDate"); | 436 | cfg.setGroup("SyncDate"); |
437 | cfg.writeEntry( app, date ); | 437 | cfg.writeEntry( app, date ); |
438 | //qDebug("setSyncDate(QString,QString) %s %s", app.latin1(), date.latin1()); | 438 | //qDebug("setSyncDate(QString,QString) %s %s", app.latin1(), date.latin1()); |
439 | } else if ( msg == "startSync(QString)" ) { | 439 | } else if ( msg == "startSync(QString)" ) { |
440 | QString what; | 440 | QString what; |
441 | stream >> what; | 441 | stream >> what; |
442 | delete syncDialog; | 442 | delete syncDialog; |
443 | syncDialog = new SyncDialog( this, what ); | 443 | syncDialog = new SyncDialog( this, what ); |
444 | syncDialog->show(); | 444 | syncDialog->show(); |
445 | connect( syncDialog, SIGNAL(cancel()), SLOT(cancelSync()) ); | 445 | connect( syncDialog, SIGNAL(cancel()), SLOT(cancelSync()) ); |
446 | } else if ( msg == "stopSync()") { | 446 | } else if ( msg == "stopSync()") { |
447 | delete syncDialog; | 447 | delete syncDialog; |
448 | syncDialog = 0; | 448 | syncDialog = 0; |
449 | } else if (msg == "restoreDone(QString)") { | 449 | } else if (msg == "restoreDone(QString)") { |
450 | docList->restoreDone(); | 450 | docList->restoreDone(); |
451 | } else if ( msg == "getAllDocLinks()" ) { | 451 | } else if ( msg == "getAllDocLinks()" ) { |
452 | docList->sendAllDocLinks(); | 452 | docList->sendAllDocLinks(); |
453 | } | 453 | } |
454 | #ifdef Q_WS_QWS | 454 | #ifdef Q_WS_QWS |
455 | else if ( msg == "setMouseProto(QString)" ) { | 455 | else if ( msg == "setMouseProto(QString)" ) { |
456 | QString mice; | 456 | QString mice; |
457 | stream >> mice; | 457 | stream >> mice; |
458 | setenv("QWS_MOUSE_PROTO",mice.latin1(),1); | 458 | setenv("QWS_MOUSE_PROTO",mice.latin1(),1); |
459 | qwsServer->openMouse(); | 459 | qwsServer->openMouse(); |
460 | } else if ( msg == "setKeyboard(QString)" ) { | 460 | } else if ( msg == "setKeyboard(QString)" ) { |
461 | QString kb; | 461 | QString kb; |
462 | stream >> kb; | 462 | stream >> kb; |
463 | setenv("QWS_KEYBOARD",kb.latin1(),1); | 463 | setenv("QWS_KEYBOARD",kb.latin1(),1); |
464 | qwsServer->openKeyboard(); | 464 | qwsServer->openKeyboard(); |
465 | 465 | ||
466 | } else if ( msg == "setKeyboardAutoRepeat(int,int)" ) { | 466 | } else if ( msg == "setKeyboardAutoRepeat(int,int)" ) { |
467 | int delay, period; | 467 | int delay, period; |
468 | stream >> delay >> period; | 468 | stream >> delay >> period; |
469 | qwsSetKeyboardAutoRepeat( delay, period ); | 469 | qwsSetKeyboardAutoRepeat( delay, period ); |
470 | Config cfg( "qpe" ); | 470 | Config cfg( "qpe" ); |
471 | cfg.setGroup("Keyboard"); | 471 | cfg.setGroup("Keyboard"); |
472 | cfg.writeEntry( "RepeatDelay", delay ); | 472 | cfg.writeEntry( "RepeatDelay", delay ); |
473 | cfg.writeEntry( "RepeatPeriod", period ); | 473 | cfg.writeEntry( "RepeatPeriod", period ); |
474 | } else if ( msg == "setKeyboardLayout(QString)" ) { | 474 | } else if ( msg == "setKeyboardLayout(QString)" ) { |
475 | QString kb; | 475 | QString kb; |
476 | stream >> kb; | 476 | stream >> kb; |
477 | setKeyboardLayout( kb ); | 477 | setKeyboardLayout( kb ); |
478 | Config cfg( "qpe" ); | 478 | Config cfg( "qpe" ); |
479 | cfg.setGroup("Keyboard"); | 479 | cfg.setGroup("Keyboard"); |
480 | cfg.writeEntry( "Layout", kb ); | 480 | cfg.writeEntry( "Layout", kb ); |
481 | } else if ( msg == "autoStart(QString)" ) { | 481 | } else if ( msg == "autoStart(QString)" ) { |
482 | QString appName; | 482 | QString appName; |
483 | stream >> appName; | 483 | stream >> appName; |
484 | Config cfg( "autostart" ); | 484 | Config cfg( "autostart" ); |
485 | cfg.setGroup( "AutoStart" ); | 485 | cfg.setGroup( "AutoStart" ); |
486 | if ( appName.compare("clear") == 0){ | 486 | if ( appName.compare("clear") == 0){ |
487 | cfg.writeEntry("Apps", ""); | 487 | cfg.writeEntry("Apps", ""); |
488 | } | 488 | } |
489 | } else if ( msg == "autoStart(QString,QString)" ) { | 489 | } else if ( msg == "autoStart(QString,QString)" ) { |
490 | QString modifier, appName; | 490 | QString modifier, appName; |
491 | stream >> modifier >> appName; | 491 | stream >> modifier >> appName; |
492 | Config cfg( "autostart" ); | 492 | Config cfg( "autostart" ); |
493 | cfg.setGroup( "AutoStart" ); | 493 | cfg.setGroup( "AutoStart" ); |
494 | if ( modifier.compare("add") == 0 ){ | 494 | if ( modifier.compare("add") == 0 ){ |