author | harlekin <harlekin> | 2002-08-07 14:25:20 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-08-07 14:25:20 (UTC) |
commit | 7effde67fd121736ec658e690858c6c54bd6d125 (patch) (unidiff) | |
tree | 3209a4af6ce12e1dbfeccb67b71ecdda1c029256 | |
parent | c829f4047a79947310b8ae759594c3fcf70a6df7 (diff) | |
download | opie-7effde67fd121736ec658e690858c6c54bd6d125.zip opie-7effde67fd121736ec658e690858c6c54bd6d125.tar.gz opie-7effde67fd121736ec658e690858c6c54bd6d125.tar.bz2 |
small gcc3.x fix
-rw-r--r-- | core/applets/cardmon/cardmon.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/applets/cardmon/cardmon.cpp b/core/applets/cardmon/cardmon.cpp index ffead4d..e94f1dc 100644 --- a/core/applets/cardmon/cardmon.cpp +++ b/core/applets/cardmon/cardmon.cpp | |||
@@ -20,97 +20,97 @@ | |||
20 | #include "cardmon.h" | 20 | #include "cardmon.h" |
21 | 21 | ||
22 | #include <qpe/resource.h> | 22 | #include <qpe/resource.h> |
23 | 23 | ||
24 | #include <qcopchannel_qws.h> | 24 | #include <qcopchannel_qws.h> |
25 | #include <qpainter.h> | 25 | #include <qpainter.h> |
26 | #include <qmessagebox.h> | 26 | #include <qmessagebox.h> |
27 | #include <qfile.h> | 27 | #include <qfile.h> |
28 | #include <qtextstream.h> | 28 | #include <qtextstream.h> |
29 | #include <qtimer.h> | 29 | #include <qtimer.h> |
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 | #include <qsound.h> |
37 | 37 | ||
38 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 38 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
39 | #include <sys/vfs.h> | 39 | #include <sys/vfs.h> |
40 | #include <mntent.h> | 40 | #include <mntent.h> |
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | CardMonitor::CardMonitor( QWidget *parent ) : QWidget( parent ), | 43 | CardMonitor::CardMonitor( QWidget *parent ) : QWidget( parent ), |
44 | pm( Resource::loadPixmap( "cardmon/pcmcia" ) ) { | 44 | pm( Resource::loadPixmap( "cardmon/pcmcia" ) ) { |
45 | 45 | ||
46 | QCopChannel* pcmciaChannel = new QCopChannel( "QPE/Card", this ); | 46 | QCopChannel* pcmciaChannel = new QCopChannel( "QPE/Card", this ); |
47 | connect( pcmciaChannel, SIGNAL(received(const QCString &, const QByteArray &)), | 47 | connect( pcmciaChannel, SIGNAL(received(const QCString &, const QByteArray &)), |
48 | this, SLOT(cardMessage( const QCString &, const QByteArray &)) ); | 48 | this, SLOT(cardMessage( const QCString &, const QByteArray &)) ); |
49 | 49 | ||
50 | QCopChannel* sdChannel = new QCopChannel( "QPE/Card", this ); | 50 | QCopChannel* sdChannel = new QCopChannel( "QPE/Card", this ); |
51 | connect( sdChannel, SIGNAL(received(const QCString &, const QByteArray &)), | 51 | connect( sdChannel, SIGNAL(received(const QCString &, const QByteArray &)), |
52 | this, SLOT(cardMessage( const QCString &, const QByteArray &)) ); | 52 | this, SLOT(cardMessage( const QCString &, const QByteArray &)) ); |
53 | 53 | ||
54 | cardInPcmcia0 = FALSE; | 54 | cardInPcmcia0 = FALSE; |
55 | cardInPcmcia1 = FALSE; | 55 | cardInPcmcia1 = FALSE; |
56 | 56 | ||
57 | setFixedSize( pm.size() ); | 57 | setFixedSize( pm.size() ); |
58 | getStatusPcmcia(TRUE); | 58 | getStatusPcmcia(TRUE); |
59 | getStatusSd(TRUE); | 59 | getStatusSd(TRUE); |
60 | repaint(FALSE); | 60 | repaint(FALSE); |
61 | popupMenu = 0; | 61 | popupMenu = 0; |
62 | } | 62 | } |
63 | 63 | ||
64 | CardMonitor::~CardMonitor() { | 64 | CardMonitor::~CardMonitor() { |
65 | if( popupMenu ) { delete popupMenu; } | 65 | if( popupMenu ) { delete popupMenu; } |
66 | } | 66 | } |
67 | 67 | ||
68 | void CardMonitor::popUp( QString message, QString icon = QString::null ) { | 68 | void CardMonitor::popUp( QString message, QString icon ) { |
69 | if ( ! popupMenu ) { | 69 | if ( ! popupMenu ) { |
70 | popupMenu = new QPopupMenu(); | 70 | popupMenu = new QPopupMenu(); |
71 | } | 71 | } |
72 | popupMenu->clear(); | 72 | popupMenu->clear(); |
73 | if( icon.isEmpty() ) { | 73 | if( icon.isEmpty() ) { |
74 | popupMenu->insertItem( message, 0 ); | 74 | popupMenu->insertItem( message, 0 ); |
75 | } else { | 75 | } else { |
76 | popupMenu->insertItem( QIconSet ( Resource::loadPixmap ( icon )), | 76 | popupMenu->insertItem( QIconSet ( Resource::loadPixmap ( icon )), |
77 | message, 0 ); | 77 | message, 0 ); |
78 | } | 78 | } |
79 | 79 | ||
80 | QPoint p = mapToGlobal ( QPoint ( 0, 0 )); | 80 | QPoint p = mapToGlobal ( QPoint ( 0, 0 )); |
81 | QSize s = popupMenu->sizeHint ( ); | 81 | QSize s = popupMenu->sizeHint ( ); |
82 | popupMenu->popup( QPoint ( | 82 | popupMenu->popup( QPoint ( |
83 | p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), | 83 | p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), |
84 | p. y ( ) - s. height ( ) ), 0); | 84 | p. y ( ) - s. height ( ) ), 0); |
85 | 85 | ||
86 | QTimer::singleShot( 2000, this, SLOT(popupTimeout()) ); | 86 | QTimer::singleShot( 2000, this, SLOT(popupTimeout()) ); |
87 | } | 87 | } |
88 | 88 | ||
89 | void CardMonitor::popupTimeout() { | 89 | void CardMonitor::popupTimeout() { |
90 | popupMenu->hide(); | 90 | popupMenu->hide(); |
91 | } | 91 | } |
92 | 92 | ||
93 | void CardMonitor::mousePressEvent( QMouseEvent * ) { | 93 | void CardMonitor::mousePressEvent( QMouseEvent * ) { |
94 | QPopupMenu *menu = new QPopupMenu(); | 94 | QPopupMenu *menu = new QPopupMenu(); |
95 | QString cmd; | 95 | QString cmd; |
96 | int err=0; | 96 | int err=0; |
97 | 97 | ||
98 | if ( cardInSd ) { | 98 | if ( cardInSd ) { |
99 | menu->insertItem( tr("Eject SD/MMC card"), 0 ); | 99 | menu->insertItem( tr("Eject SD/MMC card"), 0 ); |
100 | } | 100 | } |
101 | 101 | ||
102 | if ( cardInPcmcia0 ) { | 102 | if ( cardInPcmcia0 ) { |
103 | menu->insertItem( QIconSet ( Resource::loadPixmap ( "cardmon/" + cardInPcmcia0Type )), | 103 | menu->insertItem( QIconSet ( Resource::loadPixmap ( "cardmon/" + cardInPcmcia0Type )), |
104 | tr("Eject card 0: %1").arg(cardInPcmcia0Name), 1 ); | 104 | tr("Eject card 0: %1").arg(cardInPcmcia0Name), 1 ); |
105 | } | 105 | } |
106 | 106 | ||
107 | if ( cardInPcmcia1 ) { | 107 | if ( cardInPcmcia1 ) { |
108 | menu->insertItem( QIconSet ( Resource::loadPixmap ( "cardmon/" + cardInPcmcia1Type )), | 108 | menu->insertItem( QIconSet ( Resource::loadPixmap ( "cardmon/" + cardInPcmcia1Type )), |
109 | tr("Eject card 1: %1").arg(cardInPcmcia1Name), 2 ); | 109 | tr("Eject card 1: %1").arg(cardInPcmcia1Name), 2 ); |
110 | } | 110 | } |
111 | 111 | ||
112 | QPoint p = mapToGlobal ( QPoint ( 0, 0 )); | 112 | QPoint p = mapToGlobal ( QPoint ( 0, 0 )); |
113 | QSize s = menu->sizeHint ( ); | 113 | QSize s = menu->sizeHint ( ); |
114 | int opt = menu->exec( QPoint ( | 114 | int opt = menu->exec( QPoint ( |
115 | p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), | 115 | p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), |
116 | p. y ( ) - s. height ( ) ), 0); | 116 | p. y ( ) - s. height ( ) ), 0); |