author | mickeyl <mickeyl> | 2004-03-01 14:24:18 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-03-01 14:24:18 (UTC) |
commit | 3cdec2fe5b3201a121cfbb2352162fe0cbae0a1d (patch) (unidiff) | |
tree | 409756ff03a1ceabfa85d37e08ed12a14c72289a | |
parent | 60cc11a7c619bebec117e953f3b34bbf213d0fb2 (diff) | |
download | opie-3cdec2fe5b3201a121cfbb2352162fe0cbae0a1d.zip opie-3cdec2fe5b3201a121cfbb2352162fe0cbae0a1d.tar.gz opie-3cdec2fe5b3201a121cfbb2352162fe0cbae0a1d.tar.bz2 |
libopie1->libopie2
-rw-r--r-- | core/applets/cardmon/cardmon.cpp | 178 | ||||
-rw-r--r-- | core/applets/cardmon/cardmon.h | 2 | ||||
-rw-r--r-- | core/applets/cardmon/cardmon.pro | 6 | ||||
-rw-r--r-- | core/applets/cardmon/cardmonimpl.cpp | 42 | ||||
-rw-r--r-- | core/applets/cardmon/cardmonimpl.h | 18 |
5 files changed, 129 insertions, 117 deletions
diff --git a/core/applets/cardmon/cardmon.cpp b/core/applets/cardmon/cardmon.cpp index 4ed09b8..8ffaada 100644 --- a/core/applets/cardmon/cardmon.cpp +++ b/core/applets/cardmon/cardmon.cpp | |||
@@ -13,35 +13,36 @@ | |||
13 | * it under the terms of the GNU General Public License as published by * | 13 | * it under the terms of the GNU General Public License as published by * |
14 | * the Free Software Foundation; either version 2 of the License, or * | 14 | * the Free Software Foundation; either version 2 of the License, or * |
15 | * (at your option) any later version. * | 15 | * (at your option) any later version. * |
16 | * * | 16 | * * |
17 | ***************************************************************************/ | 17 | ***************************************************************************/ |
18 | 18 | ||
19 | |||
20 | #include "cardmon.h" | 19 | #include "cardmon.h" |
21 | 20 | ||
22 | #include <qpe/resource.h> | 21 | /* OPIE */ |
23 | 22 | #include <opie2/odevice.h> | |
24 | #include <opie/odevice.h> | 23 | #include <opie2/otaskbarapplet.h> |
25 | |||
26 | #include <qpe/applnk.h> | 24 | #include <qpe/applnk.h> |
25 | #include <qpe/resource.h> | ||
27 | 26 | ||
27 | /* QT */ | ||
28 | #include <qapplication.h> | ||
28 | #include <qcopchannel_qws.h> | 29 | #include <qcopchannel_qws.h> |
29 | #include <qpainter.h> | 30 | #include <qpainter.h> |
30 | #include <qmessagebox.h> | 31 | #include <qmessagebox.h> |
31 | #include <qfile.h> | 32 | #include <qfile.h> |
32 | #include <qtextstream.h> | 33 | #include <qtextstream.h> |
34 | #include <qsound.h> | ||
33 | #include <qtimer.h> | 35 | #include <qtimer.h> |
34 | #include <qapplication.h> | ||
35 | 36 | ||
37 | /* STD */ | ||
36 | #include <stdio.h> | 38 | #include <stdio.h> |
37 | #include <unistd.h> | 39 | #include <unistd.h> |
38 | #include <stdlib.h> | 40 | #include <stdlib.h> |
39 | #include <string.h> | 41 | #include <string.h> |
40 | #include <fcntl.h> | 42 | #include <fcntl.h> |
41 | #include <qsound.h> | ||
42 | 43 | ||
43 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 44 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
44 | #include <sys/vfs.h> | 45 | #include <sys/vfs.h> |
45 | #include <mntent.h> | 46 | #include <mntent.h> |
46 | #endif | 47 | #endif |
47 | 48 | ||
@@ -75,27 +76,32 @@ CardMonitor::CardMonitor(QWidget * parent):QWidget(parent), | |||
75 | repaint(FALSE); | 76 | repaint(FALSE); |
76 | popupMenu = 0; | 77 | popupMenu = 0; |
77 | } | 78 | } |
78 | 79 | ||
79 | CardMonitor::~CardMonitor() | 80 | CardMonitor::~CardMonitor() |
80 | { | 81 | { |
81 | if (popupMenu) { | 82 | if ( popupMenu ) |
83 | { | ||
82 | delete popupMenu; | 84 | delete popupMenu; |
83 | } | 85 | } |
84 | } | 86 | } |
85 | 87 | ||
86 | void CardMonitor::popUp(QString message, QString icon) | 88 | void CardMonitor::popUp(QString message, QString icon) |
87 | { | 89 | { |
88 | if (!popupMenu) { | 90 | if ( !popupMenu ) |
91 | { | ||
89 | popupMenu = new QPopupMenu(this); | 92 | popupMenu = new QPopupMenu(this); |
90 | } | 93 | } |
91 | 94 | ||
92 | popupMenu->clear(); | 95 | popupMenu->clear(); |
93 | if (icon.isEmpty()) { | 96 | if ( icon.isEmpty() ) |
97 | { | ||
94 | popupMenu->insertItem(message, 0); | 98 | popupMenu->insertItem(message, 0); |
95 | } else { | 99 | } |
100 | else | ||
101 | { | ||
96 | popupMenu->insertItem(QIconSet(Resource::loadPixmap(icon)), | 102 | popupMenu->insertItem(QIconSet(Resource::loadPixmap(icon)), |
97 | message, 0); | 103 | message, 0); |
98 | } | 104 | } |
99 | 105 | ||
100 | QPoint p = mapToGlobal(QPoint(0, 0)); | 106 | QPoint p = mapToGlobal(QPoint(0, 0)); |
101 | QSize s = popupMenu->sizeHint(); | 107 | QSize s = popupMenu->sizeHint(); |
@@ -113,73 +119,90 @@ void CardMonitor::popupTimeout() | |||
113 | void CardMonitor::mousePressEvent(QMouseEvent *) | 119 | void CardMonitor::mousePressEvent(QMouseEvent *) |
114 | { | 120 | { |
115 | QPopupMenu *menu = new QPopupMenu(this); | 121 | QPopupMenu *menu = new QPopupMenu(this); |
116 | QString cmd; | 122 | QString cmd; |
117 | int err = 0; | 123 | int err = 0; |
118 | 124 | ||
119 | if (cardInSd) { | 125 | if ( cardInSd ) |
126 | { | ||
120 | menu->insertItem(QIconSet(Resource::loadPixmap("cardmon/ide")), | 127 | menu->insertItem(QIconSet(Resource::loadPixmap("cardmon/ide")), |
121 | tr("Eject SD/MMC card"), 0); | 128 | tr("Eject SD/MMC card"), 0); |
122 | } | 129 | } |
123 | 130 | ||
124 | if (cardInPcmcia0) { | 131 | if ( cardInPcmcia0 ) |
132 | { | ||
125 | menu-> | 133 | menu-> |
126 | insertItem(QIconSet | 134 | insertItem(QIconSet |
127 | (Resource::loadPixmap("cardmon/" + cardInPcmcia0Type)), | 135 | (Resource::loadPixmap("cardmon/" + cardInPcmcia0Type)), |
128 | tr("Eject card 0: %1").arg(cardInPcmcia0Name), 1); | 136 | tr("Eject card 0: %1").arg(cardInPcmcia0Name), 1); |
129 | } | 137 | } |
130 | 138 | ||
131 | if (cardInPcmcia1) { | 139 | if ( cardInPcmcia1 ) |
140 | { | ||
132 | menu-> | 141 | menu-> |
133 | insertItem(QIconSet | 142 | insertItem(QIconSet |
134 | (Resource::loadPixmap("cardmon/" + cardInPcmcia1Type)), | 143 | (Resource::loadPixmap("cardmon/" + cardInPcmcia1Type)), |
135 | tr("Eject card 1: %1").arg(cardInPcmcia1Name), 2); | 144 | tr("Eject card 1: %1").arg(cardInPcmcia1Name), 2); |
136 | } | 145 | } |
137 | 146 | ||
138 | QPoint p = mapToGlobal(QPoint(0, 0)); | 147 | QPoint p = mapToGlobal(QPoint(0, 0)); |
139 | QSize s = menu->sizeHint(); | 148 | QSize s = menu->sizeHint(); |
140 | int opt = menu->exec(QPoint(p.x() + (width() / 2) - (s.width() / 2), | 149 | int opt = menu->exec(QPoint(p.x() + (width() / 2) - (s.width() / 2), |
141 | p.y() - s.height()), 0); | 150 | p.y() - s.height()), 0); |
142 | 151 | ||
143 | if (opt == 1) { | 152 | if ( opt == 1 ) |
153 | { | ||
144 | cmd = "/sbin/cardctl eject 0"; | 154 | cmd = "/sbin/cardctl eject 0"; |
145 | err = system((const char *) cmd); | 155 | err = system((const char *) cmd); |
146 | if (err != 0) { | 156 | if ( err != 0 ) |
157 | { | ||
147 | qDebug("Could not execute `/sbin/cardctl eject 0'! err=%d", | 158 | qDebug("Could not execute `/sbin/cardctl eject 0'! err=%d", |
148 | err); | 159 | err); |
149 | popUp(tr("CF/PCMCIA card eject failed!")); | 160 | popUp(tr("CF/PCMCIA card eject failed!")); |
150 | } | 161 | } |
151 | } else if (opt == 0) { | 162 | } |
152 | if (ODevice::inst()->system() == System_Familiar) { | 163 | else if ( opt == 0 ) |
164 | { | ||
165 | if ( ODevice::inst() ->system() == System_Familiar ) | ||
166 | { | ||
153 | cmd = "umount /dev/mmc/part1"; | 167 | cmd = "umount /dev/mmc/part1"; |
154 | } else { | 168 | } |
169 | else | ||
170 | { | ||
155 | cmd = "umount /dev/mmcda1"; | 171 | cmd = "umount /dev/mmcda1"; |
156 | } | 172 | } |
157 | err = system((const char *) cmd); | 173 | err = system((const char *) cmd); |
158 | if (err != 0) { | 174 | if ( err != 0 ) |
175 | { | ||
159 | popUp(tr("SD/MMC card eject failed!")); | 176 | popUp(tr("SD/MMC card eject failed!")); |
160 | } | 177 | } |
161 | } else if (opt == 2) { | 178 | } |
179 | else if ( opt == 2 ) | ||
180 | { | ||
162 | cmd = "/sbin/cardctl eject 1"; | 181 | cmd = "/sbin/cardctl eject 1"; |
163 | err = system((const char *) cmd); | 182 | err = system((const char *) cmd); |
164 | if (err != 0) { | 183 | if ( err != 0 ) |
184 | { | ||
165 | qDebug("Could not execute `/sbin/cardctl eject 1'! err=%d", | 185 | qDebug("Could not execute `/sbin/cardctl eject 1'! err=%d", |
166 | err); | 186 | err); |
167 | popUp(tr("CF/PCMCIA card eject failed!")); | 187 | popUp(tr("CF/PCMCIA card eject failed!")); |
168 | } | 188 | } |
169 | } | 189 | } |
170 | delete menu; | 190 | delete menu; |
171 | } | 191 | } |
172 | 192 | ||
173 | 193 | ||
174 | void CardMonitor::cardMessage(const QCString & msg, const QByteArray &) | 194 | void CardMonitor::cardMessage(const QCString & msg, const QByteArray &) |
175 | { | 195 | { |
176 | if (msg == "stabChanged()") { | 196 | if ( msg == "stabChanged()" ) |
197 | { | ||
177 | // qDebug("Pcmcia: stabchanged"); | 198 | // qDebug("Pcmcia: stabchanged"); |
178 | getStatusPcmcia(); | 199 | getStatusPcmcia(); |
179 | } else if (msg == "mtabChanged()") { | 200 | } |
201 | else if ( msg == "mtabChanged()" ) | ||
202 | { | ||
180 | // qDebug("CARDMONAPPLET: mtabchanged"); | 203 | // qDebug("CARDMONAPPLET: mtabchanged"); |
181 | getStatusSd(); | 204 | getStatusSd(); |
182 | } | 205 | } |
183 | } | 206 | } |
184 | 207 | ||
185 | bool CardMonitor::getStatusPcmcia(int showPopUp) | 208 | bool CardMonitor::getStatusPcmcia(int showPopUp) |
@@ -188,51 +211,67 @@ bool CardMonitor::getStatusPcmcia(int showPopUp) | |||
188 | bool cardWas0 = cardInPcmcia0;// remember last state | 211 | bool cardWas0 = cardInPcmcia0;// remember last state |
189 | bool cardWas1 = cardInPcmcia1; | 212 | bool cardWas1 = cardInPcmcia1; |
190 | 213 | ||
191 | QString fileName; | 214 | QString fileName; |
192 | 215 | ||
193 | // one of these 3 files should exist | 216 | // one of these 3 files should exist |
194 | if (QFile::exists("/var/run/stab")) { | 217 | if ( QFile::exists( "/var/run/stab" ) ) |
218 | { | ||
195 | fileName = "/var/run/stab"; | 219 | fileName = "/var/run/stab"; |
196 | } else if (QFile::exists("/var/state/pcmcia/stab")) { | 220 | } |
221 | else if ( QFile::exists( "/var/state/pcmcia/stab" ) ) | ||
222 | { | ||
197 | fileName = "/var/state/pcmcia/stab"; | 223 | fileName = "/var/state/pcmcia/stab"; |
198 | } else { | 224 | } |
225 | else | ||
226 | { | ||
199 | fileName = "/var/lib/pcmcia/stab"; | 227 | fileName = "/var/lib/pcmcia/stab"; |
200 | } | 228 | } |
201 | 229 | ||
202 | QFile f(fileName); | 230 | QFile f(fileName); |
203 | 231 | ||
204 | if (f.open(IO_ReadOnly)) { | 232 | if ( f.open( IO_ReadOnly ) ) |
233 | { | ||
205 | QStringList list; | 234 | QStringList list; |
206 | QTextStream stream(&f); | 235 | QTextStream stream(&f); |
207 | QString streamIn; | 236 | QString streamIn; |
208 | streamIn = stream.read(); | 237 | streamIn = stream.read(); |
209 | list = QStringList::split("\n", streamIn); | 238 | list = QStringList::split("\n", streamIn); |
210 | for (QStringList::Iterator line = list.begin(); line != list.end(); | 239 | for (QStringList::Iterator line = list.begin(); line != list.end(); |
211 | line++) { | 240 | line++ ) |
212 | if ((*line).startsWith("Socket 0:")) { | 241 | { |
213 | if ((*line).startsWith("Socket 0: empty") && cardInPcmcia0) { | 242 | if ( ( *line ).startsWith( "Socket 0:" ) ) |
243 | { | ||
244 | if ( ( *line ).startsWith( "Socket 0: empty" ) && cardInPcmcia0 ) | ||
245 | { | ||
214 | cardInPcmcia0 = FALSE; | 246 | cardInPcmcia0 = FALSE; |
215 | } else if (!(*line).startsWith("Socket 0: empty") | 247 | } |
216 | && !cardInPcmcia0) { | 248 | else if ( !( *line ).startsWith( "Socket 0: empty" ) |
249 | && !cardInPcmcia0 ) | ||
250 | { | ||
217 | cardInPcmcia0Name = | 251 | cardInPcmcia0Name = |
218 | (*line).mid(((*line).find(':') + 1), | 252 | (*line).mid(((*line).find(':') + 1), |
219 | (*line).length() - 9); | 253 | (*line).length() - 9); |
220 | cardInPcmcia0Name.stripWhiteSpace(); | 254 | cardInPcmcia0Name.stripWhiteSpace(); |
221 | cardInPcmcia0 = TRUE; | 255 | cardInPcmcia0 = TRUE; |
222 | show(); | 256 | show(); |
223 | line++; | 257 | line++; |
224 | int pos = (*line).find('\t') + 1; | 258 | int pos = (*line).find('\t') + 1; |
225 | cardInPcmcia0Type = | 259 | cardInPcmcia0Type = |
226 | (*line).mid(pos, (*line).find("\t", pos) - pos); | 260 | (*line).mid(pos, (*line).find("\t", pos) - pos); |
227 | } | 261 | } |
228 | } else if ((*line).startsWith("Socket 1:")) { | 262 | } |
229 | if ((*line).startsWith("Socket 1: empty") && cardInPcmcia1) { | 263 | else if ( ( *line ).startsWith( "Socket 1:" ) ) |
264 | { | ||
265 | if ( ( *line ).startsWith( "Socket 1: empty" ) && cardInPcmcia1 ) | ||
266 | { | ||
230 | cardInPcmcia1 = FALSE; | 267 | cardInPcmcia1 = FALSE; |
231 | } else if (!(*line).startsWith("Socket 1: empty") | 268 | } |
232 | && !cardInPcmcia1) { | 269 | else if ( !( *line ).startsWith( "Socket 1: empty" ) |
270 | && !cardInPcmcia1 ) | ||
271 | { | ||
233 | cardInPcmcia1Name = | 272 | cardInPcmcia1Name = |
234 | (*line).mid(((*line).find(':') + 1), | 273 | (*line).mid(((*line).find(':') + 1), |
235 | (*line).length() - 9); | 274 | (*line).length() - 9); |
236 | cardInPcmcia1Name.stripWhiteSpace(); | 275 | cardInPcmcia1Name.stripWhiteSpace(); |
237 | cardInPcmcia1 = TRUE; | 276 | cardInPcmcia1 = TRUE; |
238 | show(); | 277 | show(); |
@@ -243,43 +282,55 @@ bool CardMonitor::getStatusPcmcia(int showPopUp) | |||
243 | } | 282 | } |
244 | } | 283 | } |
245 | } | 284 | } |
246 | f.close(); | 285 | f.close(); |
247 | 286 | ||
248 | if (!showPopUp | 287 | if (!showPopUp |
249 | && (cardWas0 != cardInPcmcia0 || cardWas1 != cardInPcmcia1)) { | 288 | && ( cardWas0 != cardInPcmcia0 || cardWas1 != cardInPcmcia1 ) ) |
289 | { | ||
250 | QString text = QString::null; | 290 | QString text = QString::null; |
251 | QString what = QString::null; | 291 | QString what = QString::null; |
252 | if (cardWas0 != cardInPcmcia0) { | 292 | if ( cardWas0 != cardInPcmcia0 ) |
253 | if (cardInPcmcia0) { | 293 | { |
294 | if ( cardInPcmcia0 ) | ||
295 | { | ||
254 | text += tr("New card: "); | 296 | text += tr("New card: "); |
255 | what = "on"; | 297 | what = "on"; |
256 | } else { | 298 | } |
299 | else | ||
300 | { | ||
257 | text += tr("Ejected: "); | 301 | text += tr("Ejected: "); |
258 | what = "off"; | 302 | what = "off"; |
259 | } | 303 | } |
260 | text += cardInPcmcia0Name; | 304 | text += cardInPcmcia0Name; |
261 | popUp(text, "cardmon/" + cardInPcmcia0Type); | 305 | popUp(text, "cardmon/" + cardInPcmcia0Type); |
262 | } | 306 | } |
263 | 307 | ||
264 | if (cardWas1 != cardInPcmcia1) { | 308 | if ( cardWas1 != cardInPcmcia1 ) |
265 | if (cardInPcmcia1) { | 309 | { |
310 | if ( cardInPcmcia1 ) | ||
311 | { | ||
266 | text += tr("New card: "); | 312 | text += tr("New card: "); |
267 | what = "on"; | 313 | what = "on"; |
268 | } else { | 314 | } |
315 | else | ||
316 | { | ||
269 | text += tr("Ejected: "); | 317 | text += tr("Ejected: "); |
270 | what = "off"; | 318 | what = "off"; |
271 | } | 319 | } |
272 | text += cardInPcmcia1Name; | 320 | text += cardInPcmcia1Name; |
273 | popUp(text, "cardmon/" + cardInPcmcia1Type); | 321 | popUp(text, "cardmon/" + cardInPcmcia1Type); |
274 | } | 322 | } |
275 | #ifndef QT_NO_SOUND | 323 | #ifndef QT_NO_SOUND |
276 | QSound::play(Resource::findSound("cardmon/card" + what)); | 324 | QSound::play(Resource::findSound("cardmon/card" + what)); |
277 | #endif | 325 | #endif |
326 | |||
278 | } | 327 | } |
279 | } else { | 328 | } |
329 | else | ||
330 | { | ||
280 | // no file found | 331 | // no file found |
281 | qDebug("no file found"); | 332 | qDebug("no file found"); |
282 | cardInPcmcia0 = FALSE; | 333 | cardInPcmcia0 = FALSE; |
283 | cardInPcmcia1 = FALSE; | 334 | cardInPcmcia1 = FALSE; |
284 | } | 335 | } |
285 | repaint( FALSE ); | 336 | repaint( FALSE ); |
@@ -296,35 +347,42 @@ bool CardMonitor::getStatusSd(int showPopUp) | |||
296 | cardInSd = FALSE; | 347 | cardInSd = FALSE; |
297 | 348 | ||
298 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 349 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
299 | struct mntent *me; | 350 | struct mntent *me; |
300 | FILE *mntfp = setmntent("/etc/mtab", "r"); | 351 | FILE *mntfp = setmntent("/etc/mtab", "r"); |
301 | 352 | ||
302 | if (mntfp) { | 353 | if ( mntfp ) |
303 | while ((me = getmntent(mntfp)) != 0) { | 354 | { |
355 | while ( ( me = getmntent( mntfp ) ) != 0 ) | ||
356 | { | ||
304 | QString fs = me->mnt_fsname; | 357 | QString fs = me->mnt_fsname; |
305 | //qDebug( fs ); | 358 | //qDebug( fs ); |
306 | if (fs.left(14) == "/dev/mmc/part1" || fs.left(7) == "/dev/sd" | 359 | if (fs.left(14) == "/dev/mmc/part1" || fs.left(7) == "/dev/sd" |
307 | || fs.left(9) == "/dev/mmcd") { | 360 | || fs.left( 9 ) == "/dev/mmcd" ) |
361 | { | ||
308 | cardInSd = TRUE; | 362 | cardInSd = TRUE; |
309 | show(); | 363 | show(); |
310 | } | 364 | } |
311 | // else { | 365 | // else { |
312 | // cardInSd = FALSE; | 366 | // cardInSd = FALSE; |
313 | // } | 367 | // } |
314 | } | 368 | } |
315 | endmntent(mntfp); | 369 | endmntent(mntfp); |
316 | } | 370 | } |
317 | 371 | ||
318 | if (!showPopUp && cardWas != cardInSd) { | 372 | if ( !showPopUp && cardWas != cardInSd ) |
373 | { | ||
319 | QString text = QString::null; | 374 | QString text = QString::null; |
320 | QString what = QString::null; | 375 | QString what = QString::null; |
321 | if (cardInSd) { | 376 | if ( cardInSd ) |
377 | { | ||
322 | text += "New card: SD/MMC"; | 378 | text += "New card: SD/MMC"; |
323 | what = "on"; | 379 | what = "on"; |
324 | } else { | 380 | } |
381 | else | ||
382 | { | ||
325 | text += "Ejected: SD/MMC"; | 383 | text += "Ejected: SD/MMC"; |
326 | what = "off"; | 384 | what = "off"; |
327 | } | 385 | } |
328 | //qDebug("TEXT: " + text ); | 386 | //qDebug("TEXT: " + text ); |
329 | #ifndef QT_NO_SOUND | 387 | #ifndef QT_NO_SOUND |
330 | QSound::play(Resource::findSound("cardmon/card" + what)); | 388 | QSound::play(Resource::findSound("cardmon/card" + what)); |
@@ -340,14 +398,28 @@ bool CardMonitor::getStatusSd(int showPopUp) | |||
340 | 398 | ||
341 | void CardMonitor::paintEvent(QPaintEvent *) | 399 | void CardMonitor::paintEvent(QPaintEvent *) |
342 | { | 400 | { |
343 | 401 | ||
344 | QPainter p(this); | 402 | QPainter p(this); |
345 | 403 | ||
346 | if ( cardInPcmcia0 || cardInPcmcia1 || cardInSd ) { | 404 | if ( cardInPcmcia0 || cardInPcmcia1 || cardInSd ) |
405 | { | ||
347 | p.drawPixmap(0, 0, pm ); | 406 | p.drawPixmap(0, 0, pm ); |
348 | show(); | 407 | show(); |
349 | } else { | 408 | } |
409 | else | ||
410 | { | ||
350 | //p.eraseRect(rect()); | 411 | //p.eraseRect(rect()); |
351 | hide(); | 412 | hide(); |
352 | } | 413 | } |
353 | } | 414 | } |
415 | |||
416 | int CardMonitor::position() | ||
417 | { | ||
418 | return 7; | ||
419 | } | ||
420 | |||
421 | Q_EXPORT_INTERFACE() | ||
422 | { | ||
423 | Q_CREATE_INSTANCE( OTaskbarAppletWrapper<CardMonitor> ); | ||
424 | } | ||
425 | |||
diff --git a/core/applets/cardmon/cardmon.h b/core/applets/cardmon/cardmon.h index 4f00920..37de366 100644 --- a/core/applets/cardmon/cardmon.h +++ b/core/applets/cardmon/cardmon.h | |||
@@ -27,13 +27,13 @@ class CardMonitor : public QWidget { | |||
27 | Q_OBJECT | 27 | Q_OBJECT |
28 | public: | 28 | public: |
29 | CardMonitor( QWidget *parent = 0 ); | 29 | CardMonitor( QWidget *parent = 0 ); |
30 | ~CardMonitor(); | 30 | ~CardMonitor(); |
31 | bool getStatusPcmcia( int showPopUp = FALSE ); | 31 | bool getStatusPcmcia( int showPopUp = FALSE ); |
32 | bool getStatusSd( int showPopUp = FALSE ); | 32 | bool getStatusSd( int showPopUp = FALSE ); |
33 | 33 | static int position(); | |
34 | private slots: | 34 | private slots: |
35 | void cardMessage( const QCString &msg, const QByteArray & ); | 35 | void cardMessage( const QCString &msg, const QByteArray & ); |
36 | void popupTimeout(); | 36 | void popupTimeout(); |
37 | 37 | ||
38 | protected: | 38 | protected: |
39 | void paintEvent( QPaintEvent* ); | 39 | void paintEvent( QPaintEvent* ); |
diff --git a/core/applets/cardmon/cardmon.pro b/core/applets/cardmon/cardmon.pro index 1e8f86f..7c0c739 100644 --- a/core/applets/cardmon/cardmon.pro +++ b/core/applets/cardmon/cardmon.pro | |||
@@ -1,13 +1,13 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt plugin warn_on release | 2 | CONFIG += qt plugin warn_on release |
3 | HEADERS =cardmon.h cardmonimpl.h | 3 | HEADERS =cardmon.h |
4 | SOURCES =cardmon.cpp cardmonimpl.cpp | 4 | SOURCES =cardmon.cpp |
5 | TARGET = cardmonapplet | 5 | TARGET = cardmonapplet |
6 | DESTDIR = $(OPIEDIR)/plugins/applets | 6 | DESTDIR = $(OPIEDIR)/plugins/applets |
7 | INCLUDEPATH += $(OPIEDIR)/include | 7 | INCLUDEPATH += $(OPIEDIR)/include |
8 | DEPENDPATH += $(OPIEDIR)/include ../launcher | 8 | DEPENDPATH += $(OPIEDIR)/include ../launcher |
9 | LIBS += -lqpe -lopie | 9 | LIBS += -lqpe -lopiecore2 |
10 | VERSION = 1.0.0 | 10 | VERSION = 1.0.0 |
11 | 11 | ||
12 | include ( $(OPIEDIR)/include.pro ) | 12 | include ( $(OPIEDIR)/include.pro ) |
13 | target.path = $$prefix/plugins/applets | 13 | target.path = $$prefix/plugins/applets |
diff --git a/core/applets/cardmon/cardmonimpl.cpp b/core/applets/cardmon/cardmonimpl.cpp deleted file mode 100644 index 7b144d4..0000000 --- a/core/applets/cardmon/cardmonimpl.cpp +++ b/dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | #include "cardmon.h" | ||
2 | #include "cardmonimpl.h" | ||
3 | |||
4 | |||
5 | CardMonitorImpl::CardMonitorImpl() | ||
6 | : cardMonitor(0) { | ||
7 | } | ||
8 | |||
9 | CardMonitorImpl::~CardMonitorImpl() { | ||
10 | delete cardMonitor; | ||
11 | } | ||
12 | |||
13 | QWidget *CardMonitorImpl::applet( QWidget *parent ) { | ||
14 | if ( !cardMonitor ) { | ||
15 | cardMonitor = new CardMonitor( parent ); | ||
16 | } | ||
17 | return cardMonitor; | ||
18 | } | ||
19 | |||
20 | int CardMonitorImpl::position() const { | ||
21 | return 7; | ||
22 | } | ||
23 | |||
24 | QRESULT CardMonitorImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { | ||
25 | *iface = 0; | ||
26 | if ( uuid == IID_QUnknown ) { | ||
27 | *iface = this; | ||
28 | } else if ( uuid == IID_TaskbarApplet ) { | ||
29 | *iface = this; | ||
30 | } else { | ||
31 | return QS_FALSE; | ||
32 | } | ||
33 | |||
34 | if ( *iface ) { | ||
35 | (*iface)->addRef(); | ||
36 | } | ||
37 | return QS_OK; | ||
38 | } | ||
39 | |||
40 | Q_EXPORT_INTERFACE() { | ||
41 | Q_CREATE_INSTANCE( CardMonitorImpl ) | ||
42 | } | ||
diff --git a/core/applets/cardmon/cardmonimpl.h b/core/applets/cardmon/cardmonimpl.h deleted file mode 100644 index 26b7fe5..0000000 --- a/core/applets/cardmon/cardmonimpl.h +++ b/dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | #include <qpe/taskbarappletinterface.h> | ||
2 | |||
3 | class CardMonitor; | ||
4 | |||
5 | class CardMonitorImpl : public TaskbarAppletInterface { | ||
6 | public: | ||
7 | CardMonitorImpl(); | ||
8 | virtual ~CardMonitorImpl(); | ||
9 | |||
10 | QRESULT queryInterface( const QUuid&, QUnknownInterface** ); | ||
11 | Q_REFCOUNT | ||
12 | |||
13 | virtual QWidget *applet( QWidget *parent ); | ||
14 | virtual int position() const; | ||
15 | |||
16 | private: | ||
17 | CardMonitor *cardMonitor; | ||
18 | }; | ||