summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/applets/cardmon/cardmon.cpp46
-rw-r--r--core/applets/cardmon/cardmon.h1
-rw-r--r--core/applets/cardmon/cardmon.pro31
-rw-r--r--core/applets/cardmon/opie-cardmon.control2
4 files changed, 36 insertions, 44 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
@@ -33,6 +33,7 @@
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>
@@ -99,12 +100,12 @@ void CardMonitor::mousePressEvent( QMouseEvent * ) {
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
@@ -209,33 +210,32 @@ bool CardMonitor::getStatusPcmcia( int showPopUp ) {
209 } 210 }
210 } 211 }
211 f.close(); 212 f.close();
212 } else {
213 // no file found
214 qDebug("no file found");
215 cardInPcmcia0 = FALSE;
216 cardInPcmcia1 = FALSE;
217 return FALSE;
218
219 }
220
221 if( !showPopUp && (cardWas0 != cardInPcmcia0 || cardWas1 != cardInPcmcia1)) { 213 if( !showPopUp && (cardWas0 != cardInPcmcia0 || cardWas1 != cardInPcmcia1)) {
222 QString text = ""; 214 QString text = "";
215 QString what = "";
223 if(cardWas0 != cardInPcmcia0) { 216 if(cardWas0 != cardInPcmcia0) {
224 if(cardInPcmcia0) { text += tr("New card: "); } 217 if(cardInPcmcia0) { text += tr("New card: "); what="on";}
225 else { text += tr("Ejected: "); } 218 else { text += tr("Ejected: "); what="off";}
226 text += cardInPcmcia0Name; 219 text += cardInPcmcia0Name;
227 popUp( text, getIconName( cardInPcmcia0Type ) ); 220 popUp( text, "cardmon/" + cardInPcmcia0Type );
228 } 221 }
229 if(cardWas1 != cardInPcmcia1) { 222 if(cardWas1 != cardInPcmcia1) {
230 if(cardInPcmcia1) { text += tr("New card: "); } 223 if(cardInPcmcia1) { text += tr("New card: "); what="on";}
231 else { text += tr("Ejected: "); } 224 else { text += tr("Ejected: "); what="off";}
232 text += cardInPcmcia1Name; 225 text += cardInPcmcia1Name;
233 popUp( text, getIconName( cardInPcmcia1Type ) ); 226 popUp( text, "cardmon/" + cardInPcmcia1Type );
234 } 227 }
228 QSound::play(Resource::findSound("cardmon/card" + what));
235 } 229 }
236 230
231 } else {
232 // no file found
233 qDebug("no file found");
234 cardInPcmcia0 = FALSE;
235 cardInPcmcia1 = FALSE;
236 }
237 237
238 return ((cardWas0 == cardInPcmcia0 || cardWas1 == cardInPcmcia1) ? FALSE : TRUE); 238 return ((cardWas0 == cardInPcmcia0 && cardWas1 == cardInPcmcia1) ? FALSE : TRUE);
239} 239}
240 240
241 241
@@ -281,13 +281,3 @@ void CardMonitor::paintEvent( QPaintEvent * ) {
281 hide(); 281 hide();
282 } 282 }
283} 283}
284
285QString 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
@@ -52,7 +52,6 @@ private:
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);
56}; 55};
57 56
58#endif 57#endif
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
@@ -9,17 +9,20 @@ DEPENDPATH += $(OPIEDIR)/include ../launcher
9LIBS += -lqpe 9LIBS += -lqpe
10 VERSION = 1.0.0 10 VERSION = 1.0.0
11 11
12TRANSLATIONS = ../../i18n/de/libcardmonapplet.ts 12
13TRANSLATIONS += ../../i18n/es/libcardmonapplet.ts 13
14TRANSLATIONS += ../../i18n/pt/libcardmonapplet.ts 14TRANSLATIONS = ../../../i18n/de/libcardmonapplet.ts
15TRANSLATIONS += ../../i18n/pt_BR/libcardmonapplet.ts 15TRANSLATIONS += ../../../i18n/en/libcardmonapplet.ts
16TRANSLATIONS += ../../i18n/en/libcardmonapplet.ts 16TRANSLATIONS += ../../../i18n/es/libcardmonapplet.ts
17TRANSLATIONS += ../../i18n/hu/libcardmonapplet.ts 17TRANSLATIONS += ../../../i18n/fr/libcardmonapplet.ts
18TRANSLATIONS += ../../i18n/sl/libcardmonapplet.ts 18TRANSLATIONS += ../../../i18n/hu/libcardmonapplet.ts
19TRANSLATIONS += ../../i18n/pl/libcardmonapplet.ts 19TRANSLATIONS += ../../../i18n/ja/libcardmonapplet.ts
20TRANSLATIONS += ../../i18n/ja/libcardmonapplet.ts 20TRANSLATIONS += ../../../i18n/ko/libcardmonapplet.ts
21TRANSLATIONS += ../../i18n/fr/libcardmonapplet.ts 21TRANSLATIONS += ../../../i18n/no/libcardmonapplet.ts
22TRANSLATIONS += ../../i18n/ko/libcardmonapplet.ts 22TRANSLATIONS += ../../../i18n/pl/libcardmonapplet.ts
23TRANSLATIONS += ../../i18n/no/libcardmonapplet.ts 23TRANSLATIONS += ../../../i18n/pt/libcardmonapplet.ts
24TRANSLATIONS += ../../i18n/zh_CN/libcardmonapplet.ts 24TRANSLATIONS += ../../../i18n/pt_BR/libcardmonapplet.ts
25TRANSLATIONS += ../../i18n/zh_TW/libcardmonapplet.ts 25TRANSLATIONS += ../../../i18n/sl/libcardmonapplet.ts
26TRANSLATIONS += ../../../i18n/zh_CN/libcardmonapplet.ts
27TRANSLATIONS += ../../../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,4 +1,4 @@
1Files: plugins/applets/libcardmonapplet.so* pics/cardmon/*.png 1Files: plugins/applets/libcardmonapplet.so* pics/cardmon/*.png sound/cardmon/*.wav
2Priority: optional 2Priority: optional
3Section: opie/taskbar 3Section: opie/taskbar
4Maintainer: Maximilian Reiß <max.reiss@gmx.de> 4Maintainer: Maximilian Reiß <max.reiss@gmx.de>