author | drw <drw> | 2005-04-29 00:05:39 (UTC) |
---|---|---|
committer | drw <drw> | 2005-04-29 00:05:39 (UTC) |
commit | 0d940522f5d849dd480bd2785d592f3d787e0941 (patch) (unidiff) | |
tree | 035a7b4ed517f221fd7ced4eec83708326cd50f5 | |
parent | c1cab57555a395c9da678b92f492779506421386 (diff) | |
download | opie-0d940522f5d849dd480bd2785d592f3d787e0941.zip opie-0d940522f5d849dd480bd2785d592f3d787e0941.tar.gz opie-0d940522f5d849dd480bd2785d592f3d787e0941.tar.bz2 |
Resource -> OResource
-rw-r--r-- | core/applets/cardmon/cardmon.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/core/applets/cardmon/cardmon.cpp b/core/applets/cardmon/cardmon.cpp index 452339c..11ce880 100644 --- a/core/applets/cardmon/cardmon.cpp +++ b/core/applets/cardmon/cardmon.cpp | |||
@@ -8,62 +8,63 @@ | |||
8 | * based on two apps by Devin Butterfield | 8 | * based on two apps by Devin Butterfield |
9 | */ | 9 | */ |
10 | /*************************************************************************** | 10 | /*************************************************************************** |
11 | * * | 11 | * * |
12 | * This program is free software; you can redistribute it and/or modify * | 12 | * This program is free software; you can redistribute it and/or modify * |
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 | #include "cardmon.h" | 19 | #include "cardmon.h" |
20 | 20 | ||
21 | /* OPIE */ | 21 | /* OPIE */ |
22 | #include <opie2/odebug.h> | 22 | #include <opie2/odebug.h> |
23 | #include <opie2/odevice.h> | 23 | #include <opie2/odevice.h> |
24 | #include <opie2/otaskbarapplet.h> | ||
25 | #include <opie2/oprocess.h> | 24 | #include <opie2/oprocess.h> |
25 | #include <opie2/oresource.h> | ||
26 | #include <opie2/otaskbarapplet.h> | ||
26 | 27 | ||
27 | #include <qpe/applnk.h> | 28 | #include <qpe/applnk.h> |
28 | #include <qpe/resource.h> | 29 | #include <qpe/resource.h> |
29 | using namespace Opie::Core; | 30 | using namespace Opie::Core; |
30 | using namespace Opie::Ui; | 31 | using namespace Opie::Ui; |
31 | 32 | ||
32 | /* QT */ | 33 | /* QT */ |
33 | #include <qcopchannel_qws.h> | 34 | #include <qcopchannel_qws.h> |
34 | #include <qpainter.h> | 35 | #include <qpainter.h> |
35 | #include <qfile.h> | 36 | #include <qfile.h> |
36 | #include <qtextstream.h> | 37 | #include <qtextstream.h> |
37 | #include <qsound.h> | 38 | #include <qsound.h> |
38 | #include <qtimer.h> | 39 | #include <qtimer.h> |
39 | 40 | ||
40 | /* STD */ | 41 | /* STD */ |
41 | #include <stdio.h> | 42 | #include <stdio.h> |
42 | #include <unistd.h> | 43 | #include <unistd.h> |
43 | #include <stdlib.h> | 44 | #include <stdlib.h> |
44 | #include <string.h> | 45 | #include <string.h> |
45 | #include <fcntl.h> | 46 | #include <fcntl.h> |
46 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 47 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
47 | #include <sys/vfs.h> | 48 | #include <sys/vfs.h> |
48 | #include <mntent.h> | 49 | #include <mntent.h> |
49 | #endif | 50 | #endif |
50 | 51 | ||
51 | CardMonitor::CardMonitor( QWidget * parent ) : QWidget( parent ) | 52 | CardMonitor::CardMonitor( QWidget * parent ) : QWidget( parent ) |
52 | { | 53 | { |
53 | pm = Resource::loadImage( "cardmon/pcmcia").smoothScale(AppLnk::smallIconSize(), AppLnk::smallIconSize()); | 54 | pm = Opie::Core::OResource::loadPixmap( "cardmon/pcmcia", Opie::Core::OResource::SmallIcon ); |
54 | 55 | ||
55 | QCopChannel * pcmciaChannel = new QCopChannel( "QPE/Card", this ); | 56 | QCopChannel * pcmciaChannel = new QCopChannel( "QPE/Card", this ); |
56 | connect( pcmciaChannel, | 57 | connect( pcmciaChannel, |
57 | SIGNAL( received(const QCString&,const QByteArray&) ), this, | 58 | SIGNAL( received(const QCString&,const QByteArray&) ), this, |
58 | SLOT( cardMessage(const QCString&,const QByteArray&) ) ); | 59 | SLOT( cardMessage(const QCString&,const QByteArray&) ) ); |
59 | 60 | ||
60 | QCopChannel *sdChannel = new QCopChannel( "QPE/Card", this ); | 61 | QCopChannel *sdChannel = new QCopChannel( "QPE/Card", this ); |
61 | connect( sdChannel, | 62 | connect( sdChannel, |
62 | SIGNAL( received(const QCString&,const QByteArray&) ), this, | 63 | SIGNAL( received(const QCString&,const QByteArray&) ), this, |
63 | SLOT( cardMessage(const QCString&,const QByteArray&) ) ); | 64 | SLOT( cardMessage(const QCString&,const QByteArray&) ) ); |
64 | 65 | ||
65 | cardInPcmcia0 = FALSE; | 66 | cardInPcmcia0 = FALSE; |
66 | cardInPcmcia1 = FALSE; | 67 | cardInPcmcia1 = FALSE; |
67 | cardInSd = FALSE; | 68 | cardInSd = FALSE; |
68 | m_process = 0; | 69 | m_process = 0; |
69 | 70 | ||
@@ -78,69 +79,69 @@ CardMonitor::CardMonitor( QWidget * parent ) : QWidget( parent ) | |||
78 | popupMenu = 0; | 79 | popupMenu = 0; |
79 | } | 80 | } |
80 | 81 | ||
81 | CardMonitor::~CardMonitor() { | 82 | CardMonitor::~CardMonitor() { |
82 | delete popupMenu; | 83 | delete popupMenu; |
83 | } | 84 | } |
84 | 85 | ||
85 | void CardMonitor::popUp( QString message, QString icon ) { | 86 | void CardMonitor::popUp( QString message, QString icon ) { |
86 | if ( !popupMenu ) { | 87 | if ( !popupMenu ) { |
87 | popupMenu = new QPopupMenu( this ); | 88 | popupMenu = new QPopupMenu( this ); |
88 | } | 89 | } |
89 | 90 | ||
90 | popupMenu->clear(); | 91 | popupMenu->clear(); |
91 | if ( icon.isEmpty() ) { | 92 | if ( icon.isEmpty() ) { |
92 | popupMenu->insertItem( message, 0 ); | 93 | popupMenu->insertItem( message, 0 ); |
93 | } else { | 94 | } else { |
94 | popupMenu->insertItem( QIconSet( Resource::loadPixmap( icon ) ), | 95 | popupMenu->insertItem( QIconSet( Opie::Core::OResource::loadPixmap( icon, Opie::Core::OResource::SmallIcon ) ), |
95 | message, 0 ); | 96 | message, 0 ); |
96 | } | 97 | } |
97 | 98 | ||
98 | QPoint p = mapToGlobal( QPoint( 0, 0 ) ); | 99 | QPoint p = mapToGlobal( QPoint( 0, 0 ) ); |
99 | QSize s = popupMenu->sizeHint(); | 100 | QSize s = popupMenu->sizeHint(); |
100 | popupMenu->popup( QPoint( p.x() + ( width() / 2 ) - ( s.width() / 2 ), | 101 | popupMenu->popup( QPoint( p.x() + ( width() / 2 ) - ( s.width() / 2 ), |
101 | p.y() - s.height() ), 0 ); | 102 | p.y() - s.height() ), 0 ); |
102 | 103 | ||
103 | QTimer::singleShot( 2000, this, SLOT( popupTimeout() ) ); | 104 | QTimer::singleShot( 2000, this, SLOT( popupTimeout() ) ); |
104 | } | 105 | } |
105 | 106 | ||
106 | void CardMonitor::popupTimeout() { | 107 | void CardMonitor::popupTimeout() { |
107 | popupMenu->hide(); | 108 | popupMenu->hide(); |
108 | } | 109 | } |
109 | 110 | ||
110 | void CardMonitor::mousePressEvent( QMouseEvent * ) { | 111 | void CardMonitor::mousePressEvent( QMouseEvent * ) { |
111 | QPopupMenu * menu = new QPopupMenu( this ); | 112 | QPopupMenu * menu = new QPopupMenu( this ); |
112 | QStringList cmd; | 113 | QStringList cmd; |
113 | bool execute = true; | 114 | bool execute = true; |
114 | 115 | ||
115 | if ( cardInSd ) { | 116 | if ( cardInSd ) { |
116 | menu->insertItem( QIconSet( Resource::loadPixmap( "cardmon/ide" ) ), | 117 | menu->insertItem( QIconSet( Opie::Core::OResource::loadPixmap( "cardmon/ide", Opie::Core::OResource::SmallIcon ) ), |
117 | tr( "Eject SD/MMC card" ), 0 ); | 118 | tr( "Eject SD/MMC card" ), 0 ); |
118 | } | 119 | } |
119 | 120 | ||
120 | if ( cardInPcmcia0 ) { | 121 | if ( cardInPcmcia0 ) { |
121 | menu-> | 122 | menu-> |
122 | insertItem( QIconSet | 123 | insertItem( QIconSet |
123 | ( Resource::loadPixmap( "cardmon/" + cardInPcmcia0Type ) ), | 124 | ( Opie::Core::OResource::loadPixmap( "cardmon/" + cardInPcmcia0Type, Opie::Core::OResource::SmallIcon ) ), |
124 | tr( "Eject card 0: %1" ).arg( cardInPcmcia0Name ), 1 ); | 125 | tr( "Eject card 0: %1" ).arg( cardInPcmcia0Name ), 1 ); |
125 | } | 126 | } |
126 | 127 | ||
127 | if ( cardInPcmcia1 ) { | 128 | if ( cardInPcmcia1 ) { |
128 | menu-> | 129 | menu-> |
129 | insertItem( QIconSet | 130 | insertItem( QIconSet |
130 | ( Resource::loadPixmap( "cardmon/" + cardInPcmcia1Type ) ), | 131 | ( Opie::Core::OResource::loadPixmap( "cardmon/" + cardInPcmcia1Type, Opie::Core::OResource::SmallIcon ) ), |
131 | tr( "Eject card 1: %1" ).arg( cardInPcmcia1Name ), 2 ); | 132 | tr( "Eject card 1: %1" ).arg( cardInPcmcia1Name ), 2 ); |
132 | } | 133 | } |
133 | 134 | ||
134 | QPoint p = mapToGlobal( QPoint( 0, 0 ) ); | 135 | QPoint p = mapToGlobal( QPoint( 0, 0 ) ); |
135 | QSize s = menu->sizeHint(); | 136 | QSize s = menu->sizeHint(); |
136 | int opt = menu->exec( QPoint( p.x() + ( width() / 2 ) - ( s.width() / 2 ), | 137 | int opt = menu->exec( QPoint( p.x() + ( width() / 2 ) - ( s.width() / 2 ), |
137 | p.y() - s.height() ), 0 ); | 138 | p.y() - s.height() ), 0 ); |
138 | 139 | ||
139 | if ( opt == 1 ) { | 140 | if ( opt == 1 ) { |
140 | m_commandOrig = PCMCIA_Socket1; | 141 | m_commandOrig = PCMCIA_Socket1; |
141 | cmd << "/sbin/cardctl" << "eject" << "0"; | 142 | cmd << "/sbin/cardctl" << "eject" << "0"; |
142 | } else if ( opt == 0 ) { | 143 | } else if ( opt == 0 ) { |
143 | m_commandOrig = MMC_Socket; | 144 | m_commandOrig = MMC_Socket; |
144 | cmd << "umount" << cardSdName; | 145 | cmd << "umount" << cardSdName; |
145 | } else if ( opt == 2 ) { | 146 | } else if ( opt == 2 ) { |
146 | m_commandOrig = PCMCIA_Socket2; | 147 | m_commandOrig = PCMCIA_Socket2; |