author | mickeyl <mickeyl> | 2005-05-21 15:43:07 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-05-21 15:43:07 (UTC) |
commit | e570da2879fb3220a46f1a19bb797512fca144c6 (patch) (unidiff) | |
tree | 9ba374f101078fb5ba2e77ad9ab3beefa0a05415 | |
parent | c5cb180e37514584fd0015d7713fe07c041f3815 (diff) | |
download | opie-e570da2879fb3220a46f1a19bb797512fca144c6.zip opie-e570da2879fb3220a46f1a19bb797512fca144c6.tar.gz opie-e570da2879fb3220a46f1a19bb797512fca144c6.tar.bz2 |
catch up with pcmcia changes
-rw-r--r-- | noncore/applets/pcmcia/pcmcia.cpp | 24 | ||||
-rw-r--r-- | noncore/settings/sysinfo/devicesinfo.cpp | 2 |
2 files changed, 18 insertions, 8 deletions
diff --git a/noncore/applets/pcmcia/pcmcia.cpp b/noncore/applets/pcmcia/pcmcia.cpp index 5183572..7f24371 100644 --- a/noncore/applets/pcmcia/pcmcia.cpp +++ b/noncore/applets/pcmcia/pcmcia.cpp | |||
@@ -83,151 +83,161 @@ PcmciaManager::~PcmciaManager() | |||
83 | 83 | ||
84 | void PcmciaManager::popUp( QString message, QString icon ) | 84 | void PcmciaManager::popUp( QString message, QString icon ) |
85 | { | 85 | { |
86 | if ( !popupMenu ) { | 86 | if ( !popupMenu ) { |
87 | popupMenu = new QPopupMenu( this ); | 87 | popupMenu = new QPopupMenu( this ); |
88 | } | 88 | } |
89 | 89 | ||
90 | popupMenu->clear(); | 90 | popupMenu->clear(); |
91 | if ( icon.isEmpty() ) { | 91 | if ( icon.isEmpty() ) { |
92 | popupMenu->insertItem( message, 0 ); | 92 | popupMenu->insertItem( message, 0 ); |
93 | } else { | 93 | } else { |
94 | popupMenu->insertItem( QIconSet( Opie::Core::OResource::loadPixmap( icon, Opie::Core::OResource::SmallIcon ) ), | 94 | popupMenu->insertItem( QIconSet( Opie::Core::OResource::loadPixmap( icon, Opie::Core::OResource::SmallIcon ) ), |
95 | message, 0 ); | 95 | message, 0 ); |
96 | } | 96 | } |
97 | 97 | ||
98 | QPoint p = mapToGlobal( QPoint( 0, 0 ) ); | 98 | QPoint p = mapToGlobal( QPoint( 0, 0 ) ); |
99 | QSize s = popupMenu->sizeHint(); | 99 | QSize s = popupMenu->sizeHint(); |
100 | popupMenu->popup( QPoint( p.x() + ( width() / 2 ) - ( s.width() / 2 ), | 100 | popupMenu->popup( QPoint( p.x() + ( width() / 2 ) - ( s.width() / 2 ), |
101 | p.y() - s.height() ), 0 ); | 101 | p.y() - s.height() ), 0 ); |
102 | 102 | ||
103 | QTimer::singleShot( 2000, this, SLOT( popupTimeout() ) ); | 103 | QTimer::singleShot( 2000, this, SLOT( popupTimeout() ) ); |
104 | } | 104 | } |
105 | 105 | ||
106 | 106 | ||
107 | void PcmciaManager::popupTimeout() | 107 | void PcmciaManager::popupTimeout() |
108 | { | 108 | { |
109 | popupMenu->hide(); | 109 | popupMenu->hide(); |
110 | } | 110 | } |
111 | 111 | ||
112 | 112 | ||
113 | void PcmciaManager::mousePressEvent( QMouseEvent* ) | 113 | void PcmciaManager::mousePressEvent( QMouseEvent* ) |
114 | { | 114 | { |
115 | QPopupMenu * menu = new QPopupMenu( this ); | 115 | QPopupMenu* menu = new QPopupMenu( this ); |
116 | QStringList cmd; | 116 | QStringList cmd; |
117 | bool execute = true; | 117 | bool execute = true; |
118 | 118 | ||
119 | OPcmciaSystem* sys = OPcmciaSystem::instance(); | 119 | OPcmciaSystem* sys = OPcmciaSystem::instance(); |
120 | OPcmciaSystem::CardIterator it = sys->iterator(); | 120 | OPcmciaSystem::CardIterator it = sys->iterator(); |
121 | if ( !sys->count() ) return; | 121 | if ( !sys->count() ) return; |
122 | 122 | ||
123 | int i = 0; | 123 | int i = 0; |
124 | while ( it.current() ) | 124 | while ( it.current() ) |
125 | { | 125 | { |
126 | menu->insertItem( tr( "Eject card %1: %2" ).arg( i++ ).arg( it.currentKey() ), 1 ); | 126 | |
127 | QPopupMenu* submenu = new QPopupMenu( menu ); | ||
128 | submenu->insertItem( "Eject" ); | ||
129 | submenu->insertItem( "Insert" ); | ||
130 | submenu->insertItem( "Suspend" ); | ||
131 | submenu->insertItem( "Resume" ); | ||
132 | submenu->insertItem( "Configure" ); | ||
133 | |||
134 | menu->insertItem( tr( "%1: %2" ).arg( i++ ).arg( it.current()->identity() ), submenu, 1 ); | ||
127 | ++it; | 135 | ++it; |
128 | } | 136 | } |
129 | 137 | ||
130 | 138 | ||
139 | |||
131 | /* insert items depending on number of cards etc. | 140 | /* insert items depending on number of cards etc. |
132 | 141 | ||
133 | if ( cardInSd ) { | 142 | if ( cardInSd ) { |
134 | menu->insertItem( QIconSet( Opie::Core::OResource::loadPixmap( "cardmon/ide", Opie::Core::OResource::SmallIcon ) ), | 143 | menu->insertItem( QIconSet( Opie::Core::OResource::loadPixmap( "cardmon/ide", Opie::Core::OResource::SmallIcon ) ), |
135 | tr( "Eject SD/MMC card" ), 0 ); | 144 | tr( "Eject SD/MMC card" ), 0 ); |
136 | } | 145 | } |
137 | 146 | ||
138 | 147 | ||
139 | 148 | ||
140 | if ( cardInPcmcia0 ) { | 149 | if ( cardInPcmcia0 ) { |
141 | menu-> | 150 | menu-> |
142 | insertItem( QIconSet | 151 | insertItem( QIconSet |
143 | ( Opie::Core::OResource::loadPixmap( "cardmon/" + cardInPcmcia0Type, Opie::Core::OResource::SmallIcon ) ), | 152 | ( Opie::Core::OResource::loadPixmap( "cardmon/" + cardInPcmcia0Type, Opie::Core::OResource::SmallIcon ) ), |
144 | tr( "Eject card 0: %1" ).arg( cardInPcmcia0Name ), 1 ); | 153 | tr( "Eject card 0: %1" ).arg( cardInPcmcia0Name ), 1 ); |
145 | } | 154 | } |
146 | 155 | ||
147 | if ( cardInPcmcia1 ) { | 156 | if ( cardInPcmcia1 ) { |
148 | menu-> | 157 | menu-> |
149 | insertItem( QIconSet | 158 | insertItem( QIconSet |
150 | ( Opie::Core::OResource::loadPixmap( "cardmon/" + cardInPcmcia1Type, Opie::Core::OResource::SmallIcon ) ), | 159 | ( Opie::Core::OResource::loadPixmap( "cardmon/" + cardInPcmcia1Type, Opie::Core::OResource::SmallIcon ) ), |
151 | tr( "Eject card 1: %1" ).arg( cardInPcmcia1Name ), 2 ); | 160 | tr( "Eject card 1: %1" ).arg( cardInPcmcia1Name ), 2 ); |
152 | } | 161 | } |
153 | */ | 162 | */ |
154 | 163 | ||
155 | QPoint p = mapToGlobal( QPoint( 0, 0 ) ); | 164 | QPoint p = mapToGlobal( QPoint( 0, 0 ) ); |
156 | QSize s = menu->sizeHint(); | 165 | QSize s = menu->sizeHint(); |
157 | int opt = menu->exec( QPoint( p.x() + ( width() / 2 ) - ( s.width() / 2 ), p.y() - s.height() ), 0 ); | 166 | int opt = menu->exec( QPoint( p.x() + ( width() / 2 ) - ( s.width() / 2 ), p.y() - s.height() ), 0 ); |
158 | qDebug( "pcmcia: menu result = %d", opt ); | 167 | qDebug( "pcmcia: menu result = %d", opt ); |
159 | delete menu; | 168 | delete menu; |
160 | } | 169 | } |
161 | 170 | ||
162 | 171 | ||
163 | void PcmciaManager::cardMessage( const QCString & msg, const QByteArray & ) | 172 | void PcmciaManager::cardMessage( const QCString & msg, const QByteArray & ) |
164 | { | 173 | { |
165 | odebug << "PcmciaManager::cardMessage( '" << msg << "' )" << oendl; | 174 | odebug << "PcmciaManager::cardMessage( '" << msg << "' )" << oendl; |
166 | if ( msg != "stabChanged()" ) return; | 175 | if ( msg != "stabChanged()" ) return; |
167 | 176 | ||
168 | /* check if a previously unknown card has been inserted */ | 177 | /* check if a previously unknown card has been inserted */ |
169 | OPcmciaSystem::instance()->synchronize(); | 178 | OPcmciaSystem::instance()->synchronize(); |
170 | 179 | ||
171 | if ( !OPcmciaSystem::instance()->count() ) return; | 180 | if ( !OPcmciaSystem::instance()->cardCount() ) return; |
172 | 181 | ||
173 | OConfig cfg( "PCMCIA" ); | 182 | OConfig cfg( "PCMCIA" ); |
174 | cfg.setGroup( "Global" ); | 183 | cfg.setGroup( "Global" ); |
175 | int nCards = cfg.readNumEntry( "nCards", 0 ); | 184 | int nCards = cfg.readNumEntry( "nCards", 0 ); |
176 | 185 | ||
177 | OPcmciaSystem* sys = OPcmciaSystem::instance(); | 186 | OPcmciaSystem* sys = OPcmciaSystem::instance(); |
178 | OPcmciaSystem::CardIterator it = sys->iterator(); | 187 | OPcmciaSystem::CardIterator it = sys->iterator(); |
179 | 188 | ||
180 | bool newCard = true; | 189 | bool newCard = true; |
181 | while ( it.current() && newCard ) | 190 | |
191 | while ( it.current() && !it.current()->isEmpty() && newCard ) | ||
182 | { | 192 | { |
183 | QString name = it.currentKey(); | 193 | QString name = it.current()->identity(); |
184 | for ( int i = 0; i < nCards; ++i ) | 194 | for ( int i = 0; i < nCards; ++i ) |
185 | { | 195 | { |
186 | QString cardSection = QString( "Card_%1" ).arg( i ); | 196 | QString cardSection = QString( "Card_%1" ).arg( i ); |
187 | cfg.setGroup( cardSection ); | 197 | cfg.setGroup( cardSection ); |
188 | QString cardName = cfg.readEntry( "name" ); | 198 | QString cardName = cfg.readEntry( "name" ); |
189 | odebug << "comparing card '" << name << "' with known card '" << cardName << "'" << oendl; | 199 | odebug << "comparing card '" << name << "' with known card '" << cardName << "'" << oendl; |
190 | if ( cardName == name ) | 200 | if ( cardName == name ) |
191 | { | 201 | { |
192 | newCard = false; | 202 | newCard = false; |
193 | break; | 203 | break; |
194 | } | 204 | } |
195 | } | 205 | } |
196 | if ( !newCard ) ++it; else break; | 206 | if ( !newCard ) ++it; else break; |
197 | } | 207 | } |
198 | QString newCardName = it.currentKey(); | ||
199 | 208 | ||
200 | if ( newCard ) | 209 | if ( newCard ) |
201 | { | 210 | { |
211 | QString newCardName = it.current()->identity(); | ||
202 | odebug << "pcmcia: new card detected" << oendl; | 212 | odebug << "pcmcia: new card detected" << oendl; |
203 | cfg.setGroup( QString( "Card_%1" ).arg( nCards ) ); | 213 | cfg.setGroup( QString( "Card_%1" ).arg( nCards ) ); |
204 | cfg.writeEntry( "name", newCardName ); | 214 | cfg.writeEntry( "name", newCardName ); |
205 | cfg.setGroup( "Global" ); | 215 | cfg.setGroup( "Global" ); |
206 | cfg.writeEntry( "nCards", nCards+1 ); | 216 | cfg.writeEntry( "nCards", nCards+1 ); |
207 | cfg.write(); | 217 | cfg.write(); |
208 | 218 | ||
209 | int result = QMessageBox::information( qApp->desktop(), | 219 | int result = QMessageBox::information( qApp->desktop(), |
210 | tr( "PCMCIA/CF Subsystem" ), | 220 | tr( "PCMCIA/CF Subsystem" ), |
211 | tr( "You have inserted a new card\n%1\nDo you want to configure this card?" ).arg( newCardName ), | 221 | tr( "You have inserted a new card\n%1\nDo you want to configure this card?" ).arg( newCardName ), |
212 | tr( "Yes" ), tr( "No" ), 0, 0, 1 ); | 222 | tr( "Yes" ), tr( "No" ), 0, 0, 1 ); |
213 | odebug << "result = " << result << oendl; | 223 | odebug << "result = " << result << oendl; |
214 | 224 | ||
215 | } | 225 | } |
216 | else | 226 | else |
217 | { | 227 | { |
218 | odebug << "pcmcia: card has been previously inserted" << oendl; | 228 | odebug << "pcmcia: card has been previously inserted" << oendl; |
219 | } | 229 | } |
220 | repaint( TRUE ); | 230 | repaint( TRUE ); |
221 | } | 231 | } |
222 | 232 | ||
223 | 233 | ||
224 | void PcmciaManager::paintEvent( QPaintEvent * ) | 234 | void PcmciaManager::paintEvent( QPaintEvent * ) |
225 | { | 235 | { |
226 | QPainter p( this ); | 236 | QPainter p( this ); |
227 | qDebug( "count = %d", (OPcmciaSystem::instance()->count() ) ); | 237 | qDebug( "count = %d", (OPcmciaSystem::instance()->count() ) ); |
228 | if ( OPcmciaSystem::instance()->count() ) | 238 | if ( OPcmciaSystem::instance()->count() ) |
229 | { | 239 | { |
230 | p.drawPixmap( 0, 0, pm ); | 240 | p.drawPixmap( 0, 0, pm ); |
231 | show(); | 241 | show(); |
232 | } | 242 | } |
233 | else | 243 | else |
diff --git a/noncore/settings/sysinfo/devicesinfo.cpp b/noncore/settings/sysinfo/devicesinfo.cpp index 945edea..4940286 100644 --- a/noncore/settings/sysinfo/devicesinfo.cpp +++ b/noncore/settings/sysinfo/devicesinfo.cpp | |||
@@ -179,65 +179,65 @@ InputCategory::~InputCategory() | |||
179 | { | 179 | { |
180 | } | 180 | } |
181 | 181 | ||
182 | void InputCategory::populate() | 182 | void InputCategory::populate() |
183 | { | 183 | { |
184 | odebug << "InputCategory::populate()" << oendl; | 184 | odebug << "InputCategory::populate()" << oendl; |
185 | OInputSystem* sys = OInputSystem::instance(); | 185 | OInputSystem* sys = OInputSystem::instance(); |
186 | OInputSystem::DeviceIterator it = sys->iterator(); | 186 | OInputSystem::DeviceIterator it = sys->iterator(); |
187 | while ( it.current() ) | 187 | while ( it.current() ) |
188 | { | 188 | { |
189 | new InputDevice( this, it.current()->identity() ); | 189 | new InputDevice( this, it.current()->identity() ); |
190 | ++it; | 190 | ++it; |
191 | } | 191 | } |
192 | } | 192 | } |
193 | 193 | ||
194 | //================================================================================================= | 194 | //================================================================================================= |
195 | CardsCategory::CardsCategory( DevicesView* parent ) | 195 | CardsCategory::CardsCategory( DevicesView* parent ) |
196 | :Category( parent, "3. Removable Cards" ) | 196 | :Category( parent, "3. Removable Cards" ) |
197 | { | 197 | { |
198 | } | 198 | } |
199 | 199 | ||
200 | CardsCategory::~CardsCategory() | 200 | CardsCategory::~CardsCategory() |
201 | { | 201 | { |
202 | } | 202 | } |
203 | 203 | ||
204 | void CardsCategory::populate() | 204 | void CardsCategory::populate() |
205 | { | 205 | { |
206 | odebug << "CardsCategory::populate()" << oendl; | 206 | odebug << "CardsCategory::populate()" << oendl; |
207 | OPcmciaSystem* sys = OPcmciaSystem::instance(); | 207 | OPcmciaSystem* sys = OPcmciaSystem::instance(); |
208 | OPcmciaSystem::CardIterator it = sys->iterator(); | 208 | OPcmciaSystem::CardIterator it = sys->iterator(); |
209 | while ( it.current() ) | 209 | while ( it.current() ) |
210 | { | 210 | { |
211 | new CardDevice( this, (const char*) it.currentKey() ); | 211 | new CardDevice( this, it.current()->identity() ); |
212 | ++it; | 212 | ++it; |
213 | } | 213 | } |
214 | } | 214 | } |
215 | 215 | ||
216 | //================================================================================================= | 216 | //================================================================================================= |
217 | UsbCategory::UsbCategory( DevicesView* parent ) | 217 | UsbCategory::UsbCategory( DevicesView* parent ) |
218 | :Category( parent, "4. Universal Serial Bus" ) | 218 | :Category( parent, "4. Universal Serial Bus" ) |
219 | { | 219 | { |
220 | } | 220 | } |
221 | 221 | ||
222 | UsbCategory::~UsbCategory() | 222 | UsbCategory::~UsbCategory() |
223 | { | 223 | { |
224 | } | 224 | } |
225 | 225 | ||
226 | void UsbCategory::populate() | 226 | void UsbCategory::populate() |
227 | { | 227 | { |
228 | odebug << "UsbCategory::populate()" << oendl; | 228 | odebug << "UsbCategory::populate()" << oendl; |
229 | QFile usbinfofile( "/proc/bus/usb/devices" ); | 229 | QFile usbinfofile( "/proc/bus/usb/devices" ); |
230 | if ( !usbinfofile.exists() || !usbinfofile.open( IO_ReadOnly ) ) | 230 | if ( !usbinfofile.exists() || !usbinfofile.open( IO_ReadOnly ) ) |
231 | { | 231 | { |
232 | new UsbDevice( this, "ERROR: /proc/bus/usb/devices not found or unaccessible" ); | 232 | new UsbDevice( this, "ERROR: /proc/bus/usb/devices not found or unaccessible" ); |
233 | return; | 233 | return; |
234 | } | 234 | } |
235 | QTextStream usbinfo( &usbinfofile ); | 235 | QTextStream usbinfo( &usbinfofile ); |
236 | 236 | ||
237 | int _bus, _level, _parent, _port, _count, _device, _channels, _power; | 237 | int _bus, _level, _parent, _port, _count, _device, _channels, _power; |
238 | float _speed; | 238 | float _speed; |
239 | QString _manufacturer, _product, _serial; | 239 | QString _manufacturer, _product, _serial; |
240 | 240 | ||
241 | int usbcount = 0; | 241 | int usbcount = 0; |
242 | UsbDevice* lastDev = 0; | 242 | UsbDevice* lastDev = 0; |
243 | UsbDevice* dev = 0; | 243 | UsbDevice* dev = 0; |