-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 | |||
@@ -14,193 +14,193 @@ | |||
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 ) { |