author | harlekin <harlekin> | 2002-06-23 23:32:29 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-06-23 23:32:29 (UTC) |
commit | 340e6e7830df8dcc9cf73fb1bf8a29130e34211d (patch) (unidiff) | |
tree | 38f5c6a7c82d4c0758b8640be96c8e318008939c | |
parent | 5713a36f24973c01a46fdff6203acf4590927f49 (diff) | |
download | opie-340e6e7830df8dcc9cf73fb1bf8a29130e34211d.zip opie-340e6e7830df8dcc9cf73fb1bf8a29130e34211d.tar.gz opie-340e6e7830df8dcc9cf73fb1bf8a29130e34211d.tar.bz2 |
now cardmon should even start
-rw-r--r-- | core/applets/cardmon/cardmon.cpp | 20 | ||||
-rw-r--r-- | core/applets/cardmon/cardmon.h | 2 |
2 files changed, 13 insertions, 9 deletions
diff --git a/core/applets/cardmon/cardmon.cpp b/core/applets/cardmon/cardmon.cpp index de02fe6..0addb89 100644 --- a/core/applets/cardmon/cardmon.cpp +++ b/core/applets/cardmon/cardmon.cpp | |||
@@ -64,7 +64,7 @@ CardMonitor::~CardMonitor() { | |||
64 | if( popupMenu ) { delete popupMenu; } | 64 | if( popupMenu ) { delete popupMenu; } |
65 | } | 65 | } |
66 | 66 | ||
67 | void CardMonitor::popup(QString message, QString icon="") { | 67 | void CardMonitor::popUp(QString message, QString icon="") { |
68 | if ( ! popupMenu ) { | 68 | if ( ! popupMenu ) { |
69 | popupMenu = new QPopupMenu(); | 69 | popupMenu = new QPopupMenu(); |
70 | } | 70 | } |
@@ -82,7 +82,11 @@ void CardMonitor::popup(QString message, QString icon="") { | |||
82 | p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), | 82 | p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), |
83 | p. y ( ) - s. height ( ) ), 0); | 83 | p. y ( ) - s. height ( ) ), 0); |
84 | 84 | ||
85 | QTimer::singleShot( 2000, this, SLOT(popupMenuTimeout()) ); | 85 | QTimer::singleShot( 2000, this, SLOT(popupTimeout()) ); |
86 | } | ||
87 | |||
88 | void CardMonitor::popupTimeout() { | ||
89 | popupMenu->hide(); | ||
86 | } | 90 | } |
87 | 91 | ||
88 | void CardMonitor::mousePressEvent( QMouseEvent * ) { | 92 | void CardMonitor::mousePressEvent( QMouseEvent * ) { |
@@ -116,21 +120,21 @@ void CardMonitor::mousePressEvent( QMouseEvent * ) { | |||
116 | err = system( (const char *) cmd ); | 120 | err = system( (const char *) cmd ); |
117 | if ( ( err == 127 ) || ( err < 0 ) ) { | 121 | if ( ( err == 127 ) || ( err < 0 ) ) { |
118 | qDebug("Could not execute `/sbin/cardctl eject 0'! err=%d", err); | 122 | qDebug("Could not execute `/sbin/cardctl eject 0'! err=%d", err); |
119 | popup( tr("CF/PCMCIA card eject failed!")); | 123 | popUp( tr("CF/PCMCIA card eject failed!")); |
120 | } | 124 | } |
121 | } else if ( opt == 0 ) { | 125 | } else if ( opt == 0 ) { |
122 | cmd = "/etc/sdcontrol compeject"; | 126 | cmd = "/etc/sdcontrol compeject"; |
123 | err = system( (const char *) cmd ); | 127 | err = system( (const char *) cmd ); |
124 | if ( ( err != 0 ) ) { | 128 | if ( ( err != 0 ) ) { |
125 | qDebug("Could not execute `/etc/sdcontrol comeject'! err=%d", err); | 129 | qDebug("Could not execute `/etc/sdcontrol comeject'! err=%d", err); |
126 | popup( tr("SD/MMC card eject failed!")); | 130 | popUp( tr("SD/MMC card eject failed!")); |
127 | } | 131 | } |
128 | } else if ( opt == 2 ) { | 132 | } else if ( opt == 2 ) { |
129 | cmd = "/sbin/cardctl eject 1"; | 133 | cmd = "/sbin/cardctl eject 1"; |
130 | err = system( (const char *) cmd ); | 134 | err = system( (const char *) cmd ); |
131 | if ( ( err == 127 ) || ( err < 0 ) ) { | 135 | if ( ( err == 127 ) || ( err < 0 ) ) { |
132 | qDebug("Could not execute `/sbin/cardctl eject 1'! err=%d", err); | 136 | qDebug("Could not execute `/sbin/cardctl eject 1'! err=%d", err); |
133 | popup( tr("CF/PCMCIA card eject failed!")); | 137 | popUp( tr("CF/PCMCIA card eject failed!")); |
134 | } | 138 | } |
135 | } | 139 | } |
136 | 140 | ||
@@ -220,13 +224,13 @@ bool CardMonitor::getStatusPcmcia( int showPopUp ) { | |||
220 | if(cardInPcmcia0) { text += tr("New card: "); } | 224 | if(cardInPcmcia0) { text += tr("New card: "); } |
221 | else { text += tr("Ejected: "); } | 225 | else { text += tr("Ejected: "); } |
222 | text += cardInPcmcia0Name; | 226 | text += cardInPcmcia0Name; |
223 | popup( text, getIconName( cardInPcmcia0Type ) ); | 227 | popUp( text, getIconName( cardInPcmcia0Type ) ); |
224 | } | 228 | } |
225 | if(cardWas1 != cardInPcmcia1) { | 229 | if(cardWas1 != cardInPcmcia1) { |
226 | if(cardInPcmcia1) { text += tr("New card: "); } | 230 | if(cardInPcmcia1) { text += tr("New card: "); } |
227 | else { text += tr("Ejected: "); } | 231 | else { text += tr("Ejected: "); } |
228 | text += cardInPcmcia1Name; | 232 | text += cardInPcmcia1Name; |
229 | popup( text, getIconName( cardInPcmcia1Type ) ); | 233 | popUp( text, getIconName( cardInPcmcia1Type ) ); |
230 | } | 234 | } |
231 | } | 235 | } |
232 | 236 | ||
@@ -257,7 +261,7 @@ bool CardMonitor::getStatusSd( int showPopUp ) { | |||
257 | QString text = ""; | 261 | QString text = ""; |
258 | if(cardInSd) { text += "SD Inserted"; } | 262 | if(cardInSd) { text += "SD Inserted"; } |
259 | else { text += "SD Removed"; } | 263 | else { text += "SD Removed"; } |
260 | popup( text); // XX add SD pic | 264 | popUp( text); // XX add SD pic |
261 | } | 265 | } |
262 | 266 | ||
263 | #else | 267 | #else |
diff --git a/core/applets/cardmon/cardmon.h b/core/applets/cardmon/cardmon.h index e424192..3dcf235 100644 --- a/core/applets/cardmon/cardmon.h +++ b/core/applets/cardmon/cardmon.h | |||
@@ -51,7 +51,7 @@ private: | |||
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 | QString getIconName(QString type); |
56 | }; | 56 | }; |
57 | 57 | ||