author | harlekin <harlekin> | 2002-06-24 22:26:27 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-06-24 22:26:27 (UTC) |
commit | b5e6ed78ad6075550985b092211318da47904897 (patch) (unidiff) | |
tree | 1fa2bfa2dfddc89a7eabcdd996b312b1105f10e4 /core | |
parent | 7b9de311a7f30d3acdcf78cbb447cd5c20057df2 (diff) | |
download | opie-b5e6ed78ad6075550985b092211318da47904897.zip opie-b5e6ed78ad6075550985b092211318da47904897.tar.gz opie-b5e6ed78ad6075550985b092211318da47904897.tar.bz2 |
gimmick (sound,pics) and hopefully dual sleeve handling right, thanks to Bruno David Rodrigues <bruno.rodrigues@litux.org>
-rw-r--r-- | core/applets/cardmon/cardmon.cpp | 54 | ||||
-rw-r--r-- | core/applets/cardmon/cardmon.h | 3 | ||||
-rw-r--r-- | core/applets/cardmon/cardmon.pro | 31 | ||||
-rw-r--r-- | core/applets/cardmon/opie-cardmon.control | 2 |
4 files changed, 41 insertions, 49 deletions
diff --git a/core/applets/cardmon/cardmon.cpp b/core/applets/cardmon/cardmon.cpp index 0addb89..0bd1ed3 100644 --- a/core/applets/cardmon/cardmon.cpp +++ b/core/applets/cardmon/cardmon.cpp | |||
@@ -30,12 +30,13 @@ | |||
30 | 30 | ||
31 | #include <stdio.h> | 31 | #include <stdio.h> |
32 | #include <unistd.h> | 32 | #include <unistd.h> |
33 | #include <stdlib.h> | 33 | #include <stdlib.h> |
34 | #include <string.h> | 34 | #include <string.h> |
35 | #include <fcntl.h> | 35 | #include <fcntl.h> |
36 | #include <qsound.h> | ||
36 | 37 | ||
37 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 38 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
38 | #include <sys/vfs.h> | 39 | #include <sys/vfs.h> |
39 | #include <mntent.h> | 40 | #include <mntent.h> |
40 | #endif | 41 | #endif |
41 | 42 | ||
@@ -96,18 +97,18 @@ void CardMonitor::mousePressEvent( QMouseEvent * ) { | |||
96 | 97 | ||
97 | if ( cardInSd ) { | 98 | if ( cardInSd ) { |
98 | menu->insertItem( tr("Eject SD/MMC card"), 0 ); | 99 | menu->insertItem( tr("Eject SD/MMC card"), 0 ); |
99 | } | 100 | } |
100 | 101 | ||
101 | if ( cardInPcmcia0 ) { | 102 | if ( cardInPcmcia0 ) { |
102 | menu->insertItem( QIconSet ( Resource::loadPixmap ( getIconName(cardInPcmcia0Type) )), | 103 | menu->insertItem( QIconSet ( Resource::loadPixmap ( "cardmon/" + cardInPcmcia0Type )), |
103 | tr("Eject card 0: %1").arg(cardInPcmcia0Name), 1 ); | 104 | tr("Eject card 0: %1").arg(cardInPcmcia0Name), 1 ); |
104 | } | 105 | } |
105 | 106 | ||
106 | if ( cardInPcmcia1 ) { | 107 | if ( cardInPcmcia1 ) { |
107 | menu->insertItem( QIconSet ( Resource::loadPixmap ( getIconName(cardInPcmcia1Type) )), | 108 | menu->insertItem( QIconSet ( Resource::loadPixmap ( "cardmon/" + cardInPcmcia1Type )), |
108 | tr("Eject card 1: %1").arg(cardInPcmcia1Name), 2 ); | 109 | tr("Eject card 1: %1").arg(cardInPcmcia1Name), 2 ); |
109 | } | 110 | } |
110 | 111 | ||
111 | QPoint p = mapToGlobal ( QPoint ( 0, 0 )); | 112 | QPoint p = mapToGlobal ( QPoint ( 0, 0 )); |
112 | QSize s = menu->sizeHint ( ); | 113 | QSize s = menu->sizeHint ( ); |
113 | int opt = menu->exec( QPoint ( | 114 | int opt = menu->exec( QPoint ( |
@@ -206,39 +207,38 @@ bool CardMonitor::getStatusPcmcia( int showPopUp ) { | |||
206 | int pos=(*line).find('\t')+1; | 207 | int pos=(*line).find('\t')+1; |
207 | cardInPcmcia1Type = (*line).mid( pos, (*line).find("\t", pos) - pos); | 208 | cardInPcmcia1Type = (*line).mid( pos, (*line).find("\t", pos) - pos); |
208 | } | 209 | } |
209 | } | 210 | } |
210 | } | 211 | } |
211 | f.close(); | 212 | f.close(); |
213 | if( !showPopUp && (cardWas0 != cardInPcmcia0 || cardWas1 != cardInPcmcia1)) { | ||
214 | QString text = ""; | ||
215 | QString what = ""; | ||
216 | if(cardWas0 != cardInPcmcia0) { | ||
217 | if(cardInPcmcia0) { text += tr("New card: "); what="on";} | ||
218 | else { text += tr("Ejected: "); what="off";} | ||
219 | text += cardInPcmcia0Name; | ||
220 | popUp( text, "cardmon/" + cardInPcmcia0Type ); | ||
221 | } | ||
222 | if(cardWas1 != cardInPcmcia1) { | ||
223 | if(cardInPcmcia1) { text += tr("New card: "); what="on";} | ||
224 | else { text += tr("Ejected: "); what="off";} | ||
225 | text += cardInPcmcia1Name; | ||
226 | popUp( text, "cardmon/" + cardInPcmcia1Type ); | ||
227 | } | ||
228 | QSound::play(Resource::findSound("cardmon/card" + what)); | ||
229 | } | ||
230 | |||
212 | } else { | 231 | } else { |
213 | // no file found | 232 | // no file found |
214 | qDebug("no file found"); | 233 | qDebug("no file found"); |
215 | cardInPcmcia0 = FALSE; | 234 | cardInPcmcia0 = FALSE; |
216 | cardInPcmcia1 = FALSE; | 235 | cardInPcmcia1 = FALSE; |
217 | return FALSE; | ||
218 | |||
219 | } | 236 | } |
220 | 237 | ||
221 | if( !showPopUp && (cardWas0 != cardInPcmcia0 || cardWas1 != cardInPcmcia1)) { | 238 | return ((cardWas0 == cardInPcmcia0 && cardWas1 == cardInPcmcia1) ? FALSE : TRUE); |
222 | QString text = ""; | ||
223 | if(cardWas0 != cardInPcmcia0) { | ||
224 | if(cardInPcmcia0) { text += tr("New card: "); } | ||
225 | else { text += tr("Ejected: "); } | ||
226 | text += cardInPcmcia0Name; | ||
227 | popUp( text, getIconName( cardInPcmcia0Type ) ); | ||
228 | } | ||
229 | if(cardWas1 != cardInPcmcia1) { | ||
230 | if(cardInPcmcia1) { text += tr("New card: "); } | ||
231 | else { text += tr("Ejected: "); } | ||
232 | text += cardInPcmcia1Name; | ||
233 | popUp( text, getIconName( cardInPcmcia1Type ) ); | ||
234 | } | ||
235 | } | ||
236 | |||
237 | |||
238 | return ((cardWas0 == cardInPcmcia0 || cardWas1 == cardInPcmcia1) ? FALSE : TRUE); | ||
239 | } | 239 | } |
240 | 240 | ||
241 | 241 | ||
242 | bool CardMonitor::getStatusSd( int showPopUp ) { | 242 | bool CardMonitor::getStatusSd( int showPopUp ) { |
243 | 243 | ||
244 | bool cardWas=cardInSd; // remember last state | 244 | bool cardWas=cardInSd; // remember last state |
@@ -278,16 +278,6 @@ void CardMonitor::paintEvent( QPaintEvent * ) { | |||
278 | show(); | 278 | show(); |
279 | } else { | 279 | } else { |
280 | p.eraseRect( rect() ); | 280 | p.eraseRect( rect() ); |
281 | hide(); | 281 | hide(); |
282 | } | 282 | } |
283 | } | 283 | } |
284 | |||
285 | QString CardMonitor::getIconName( QString type ) { | ||
286 | if( type != "network" && | ||
287 | type != "ide" ) { | ||
288 | type="cardmon"; | ||
289 | } | ||
290 | return "cardmon/"+type; | ||
291 | } | ||
292 | |||
293 | |||
diff --git a/core/applets/cardmon/cardmon.h b/core/applets/cardmon/cardmon.h index 3dcf235..9651783 100644 --- a/core/applets/cardmon/cardmon.h +++ b/core/applets/cardmon/cardmon.h | |||
@@ -49,11 +49,10 @@ private: | |||
49 | QString cardInPcmcia1Name; | 49 | QString cardInPcmcia1Name; |
50 | QString cardInPcmcia1Type; | 50 | QString cardInPcmcia1Type; |
51 | bool cardInSd; | 51 | bool cardInSd; |
52 | void iconShow(); | 52 | void iconShow(); |
53 | QPopupMenu *popupMenu; | 53 | QPopupMenu *popupMenu; |
54 | void popUp(QString message, QString icon=""); | 54 | void popUp(QString message, QString icon=""); |
55 | QString getIconName(QString type); | 55 | }; |
56 | }; | ||
57 | 56 | ||
58 | #endif | 57 | #endif |
59 | 58 | ||
diff --git a/core/applets/cardmon/cardmon.pro b/core/applets/cardmon/cardmon.pro index e79e91a..3bddd22 100644 --- a/core/applets/cardmon/cardmon.pro +++ b/core/applets/cardmon/cardmon.pro | |||
@@ -6,20 +6,23 @@ 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 | 9 | LIBS += -lqpe |
10 | VERSION = 1.0.0 | 10 | VERSION = 1.0.0 |
11 | 11 | ||
12 | TRANSLATIONS = ../../i18n/de/libcardmonapplet.ts | 12 | |
13 | TRANSLATIONS += ../../i18n/es/libcardmonapplet.ts | 13 | |
14 | TRANSLATIONS += ../../i18n/pt/libcardmonapplet.ts | 14 | TRANSLATIONS = ../../../i18n/de/libcardmonapplet.ts |
15 | TRANSLATIONS += ../../i18n/pt_BR/libcardmonapplet.ts | 15 | TRANSLATIONS += ../../../i18n/en/libcardmonapplet.ts |
16 | TRANSLATIONS += ../../i18n/en/libcardmonapplet.ts | 16 | TRANSLATIONS += ../../../i18n/es/libcardmonapplet.ts |
17 | TRANSLATIONS += ../../i18n/hu/libcardmonapplet.ts | 17 | TRANSLATIONS += ../../../i18n/fr/libcardmonapplet.ts |
18 | TRANSLATIONS += ../../i18n/sl/libcardmonapplet.ts | 18 | TRANSLATIONS += ../../../i18n/hu/libcardmonapplet.ts |
19 | TRANSLATIONS += ../../i18n/pl/libcardmonapplet.ts | 19 | TRANSLATIONS += ../../../i18n/ja/libcardmonapplet.ts |
20 | TRANSLATIONS += ../../i18n/ja/libcardmonapplet.ts | 20 | TRANSLATIONS += ../../../i18n/ko/libcardmonapplet.ts |
21 | TRANSLATIONS += ../../i18n/fr/libcardmonapplet.ts | 21 | TRANSLATIONS += ../../../i18n/no/libcardmonapplet.ts |
22 | TRANSLATIONS += ../../i18n/ko/libcardmonapplet.ts | 22 | TRANSLATIONS += ../../../i18n/pl/libcardmonapplet.ts |
23 | TRANSLATIONS += ../../i18n/no/libcardmonapplet.ts | 23 | TRANSLATIONS += ../../../i18n/pt/libcardmonapplet.ts |
24 | TRANSLATIONS += ../../i18n/zh_CN/libcardmonapplet.ts | 24 | TRANSLATIONS += ../../../i18n/pt_BR/libcardmonapplet.ts |
25 | TRANSLATIONS += ../../i18n/zh_TW/libcardmonapplet.ts | 25 | TRANSLATIONS += ../../../i18n/sl/libcardmonapplet.ts |
26 | TRANSLATIONS += ../../../i18n/zh_CN/libcardmonapplet.ts | ||
27 | TRANSLATIONS += ../../../i18n/zh_TW/libcardmonapplet.ts | ||
28 | |||
diff --git a/core/applets/cardmon/opie-cardmon.control b/core/applets/cardmon/opie-cardmon.control index bcd0326..6382fdb 100644 --- a/core/applets/cardmon/opie-cardmon.control +++ b/core/applets/cardmon/opie-cardmon.control | |||
@@ -1,7 +1,7 @@ | |||
1 | Files: plugins/applets/libcardmonapplet.so* pics/cardmon/*.png | 1 | Files: plugins/applets/libcardmonapplet.so* pics/cardmon/*.png sound/cardmon/*.wav |
2 | Priority: optional | 2 | Priority: optional |
3 | Section: opie/taskbar | 3 | Section: opie/taskbar |
4 | Maintainer: Maximilian Reiß <max.reiss@gmx.de> | 4 | Maintainer: Maximilian Reiß <max.reiss@gmx.de> |
5 | Architecture: arm | 5 | Architecture: arm |
6 | Version: $QPE_VERSION-$SUB_VERSION | 6 | Version: $QPE_VERSION-$SUB_VERSION |
7 | Depends: opie-base ($QPE_VERSION) | 7 | Depends: opie-base ($QPE_VERSION) |