summaryrefslogtreecommitdiff
path: root/noncore/settings
authormickeyl <mickeyl>2005-05-19 11:59:50 (UTC)
committer mickeyl <mickeyl>2005-05-19 11:59:50 (UTC)
commitcdecf5d75233150cba06094262158fb218e9bf03 (patch) (unidiff)
tree7cd9a17fc2eb820638e73945454b02c07a927520 /noncore/settings
parented7ba8b228d3d0ffae9c9b68900b7f723d7ade4a (diff)
downloadopie-cdecf5d75233150cba06094262158fb218e9bf03.zip
opie-cdecf5d75233150cba06094262158fb218e9bf03.tar.gz
opie-cdecf5d75233150cba06094262158fb218e9bf03.tar.bz2
use OPcmciaSystem
Diffstat (limited to 'noncore/settings') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/sysinfo/devicesinfo.cpp31
1 files changed, 7 insertions, 24 deletions
diff --git a/noncore/settings/sysinfo/devicesinfo.cpp b/noncore/settings/sysinfo/devicesinfo.cpp
index 7e8aee8..945edea 100644
--- a/noncore/settings/sysinfo/devicesinfo.cpp
+++ b/noncore/settings/sysinfo/devicesinfo.cpp
@@ -9,48 +9,49 @@ _;:,     .>    :=|. This program is free software; you can
9.="- .-=="i,     .._ License as published by the Free Software 9.="- .-=="i,     .._ License as published by the Free Software
10- .   .-<_>     .<> Foundation; version 2 of the License. 10- .   .-<_>     .<> Foundation; version 2 of the License.
11    ._= =}       : 11    ._= =}       :
12   .%`+i>       _;_. 12   .%`+i>       _;_.
13   .i_,=:_.      -<s. This program is distributed in the hope that 13   .i_,=:_.      -<s. This program is distributed in the hope that
14    +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14    +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15   : ..    .:,     . . . without even the implied warranty of 15   : ..    .:,     . . . without even the implied warranty of
16   =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16   =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17 _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 17 _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
18..}^=.=       =       ; General Public License for more 18..}^=.=       =       ; General Public License for more
19++=   -.     .`     .: details. 19++=   -.     .`     .: details.
20:     =  ...= . :.=- 20:     =  ...= . :.=-
21-.   .:....=;==+<; You should have received a copy of the GNU 21-.   .:....=;==+<; You should have received a copy of the GNU
22 -_. . .   )=.  = General Public License along with 22 -_. . .   )=.  = General Public License along with
23   --        :-=` this application; see the file LICENSE.GPL. 23   --        :-=` this application; see the file LICENSE.GPL.
24 If not, write to the Free Software Foundation, 24 If not, write to the Free Software Foundation,
25 Inc., 59 Temple Place - Suite 330, 25 Inc., 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 26 Boston, MA 02111-1307, USA.
27*/ 27*/
28 28
29#include "devicesinfo.h" 29#include "devicesinfo.h"
30/* OPIE */ 30/* OPIE */
31#include <opie2/odebug.h> 31#include <opie2/odebug.h>
32#include <opie2/oinputsystem.h> 32#include <opie2/oinputsystem.h>
33#include <opie2/opcmciasystem.h>
33#include <opie2/olayout.h> 34#include <opie2/olayout.h>
34#include <opie2/olistview.h> 35#include <opie2/olistview.h>
35#include <qpe/qpeapplication.h> 36#include <qpe/qpeapplication.h>
36using namespace Opie::Core; 37using namespace Opie::Core;
37using namespace Opie::Ui; 38using namespace Opie::Ui;
38 39
39/* QT */ 40/* QT */
40#include <qobjectlist.h> 41#include <qobjectlist.h>
41#include <qlistview.h> 42#include <qlistview.h>
42#include <qcombobox.h> 43#include <qcombobox.h>
43#include <qfile.h> 44#include <qfile.h>
44#include <qpushbutton.h> 45#include <qpushbutton.h>
45#include <qtextstream.h> 46#include <qtextstream.h>
46#include <qtextview.h> 47#include <qtextview.h>
47#include <qtimer.h> 48#include <qtimer.h>
48#include <qwhatsthis.h> 49#include <qwhatsthis.h>
49 50
50//================================================================================================= 51//=================================================================================================
51DevicesView::DevicesView( QWidget* parent, const char* name, WFlags fl ) 52DevicesView::DevicesView( QWidget* parent, const char* name, WFlags fl )
52 :Opie::Ui::OListView( parent, name, fl ) 53 :Opie::Ui::OListView( parent, name, fl )
53{ 54{
54 addColumn( tr( "My Computer" ) ); 55 addColumn( tr( "My Computer" ) );
55 setAllColumnsShowFocus( true ); 56 setAllColumnsShowFocus( true );
56 setRootIsDecorated( true ); 57 setRootIsDecorated( true );
@@ -164,90 +165,72 @@ void CpuCategory::populate()
164 else 165 else
165 { 166 {
166 if ( dev ) dev->addInfo( line ); 167 if ( dev ) dev->addInfo( line );
167 } 168 }
168 } 169 }
169} 170}
170 171
171//================================================================================================= 172//=================================================================================================
172InputCategory::InputCategory( DevicesView* parent ) 173InputCategory::InputCategory( DevicesView* parent )
173 :Category( parent, "2. Input Subsystem" ) 174 :Category( parent, "2. Input Subsystem" )
174{ 175{
175} 176}
176 177
177InputCategory::~InputCategory() 178InputCategory::~InputCategory()
178{ 179{
179} 180}
180 181
181void InputCategory::populate() 182void InputCategory::populate()
182{ 183{
183 odebug << "InputCategory::populate()" << oendl; 184 odebug << "InputCategory::populate()" << oendl;
184 OInputSystem* sys = OInputSystem::instance(); 185 OInputSystem* sys = OInputSystem::instance();
185 OInputSystem::DeviceIterator it = sys->iterator(); 186 OInputSystem::DeviceIterator it = sys->iterator();
186 while ( it.current() ) 187 while ( it.current() )
187 { 188 {
188 OInputDevice* dev = it.current(); 189 new InputDevice( this, it.current()->identity() );
189 new InputDevice( this, dev->identity() );
190 ++it; 190 ++it;
191 } 191 }
192} 192}
193 193
194//================================================================================================= 194//=================================================================================================
195CardsCategory::CardsCategory( DevicesView* parent ) 195CardsCategory::CardsCategory( DevicesView* parent )
196 :Category( parent, "3. Removable Cards" ) 196 :Category( parent, "3. Removable Cards" )
197{ 197{
198} 198}
199 199
200CardsCategory::~CardsCategory() 200CardsCategory::~CardsCategory()
201{ 201{
202} 202}
203 203
204void CardsCategory::populate() 204void CardsCategory::populate()
205{ 205{
206 odebug << "CardsCategory::populate()" << oendl; 206 odebug << "CardsCategory::populate()" << oendl;
207 QString fileName; 207 OPcmciaSystem* sys = OPcmciaSystem::instance();
208 if ( QFile::exists( "/var/run/stab" ) ) { fileName = "/var/run/stab"; } 208 OPcmciaSystem::CardIterator it = sys->iterator();
209 else if ( QFile::exists( "/var/state/pcmcia/stab" ) ) { fileName = "/var/state/pcmcia/stab"; } 209 while ( it.current() )
210 else { fileName = "/var/lib/pcmcia/stab"; }
211 QFile cardinfofile( fileName );
212 if ( !cardinfofile.exists() || !cardinfofile.open( IO_ReadOnly ) )
213 {
214 new CardDevice( this, "ERROR: pcmcia info file not found or unaccessible" );
215 return;
216 }
217 QTextStream cardinfo( &cardinfofile );
218 while ( !cardinfo.atEnd() )
219 {
220 QString line = cardinfo.readLine();
221 odebug << "got line '" << line << "'" << oendl;
222 if ( line.startsWith( "Socket" ) )
223 {
224 new CardDevice( this, line );
225 }
226 else
227 { 210 {
228 continue; 211 new CardDevice( this, (const char*) it.currentKey() );
229 } 212 ++it;
230 } 213 }
231} 214}
232 215
233//================================================================================================= 216//=================================================================================================
234UsbCategory::UsbCategory( DevicesView* parent ) 217UsbCategory::UsbCategory( DevicesView* parent )
235 :Category( parent, "4. Universal Serial Bus" ) 218 :Category( parent, "4. Universal Serial Bus" )
236{ 219{
237} 220}
238 221
239UsbCategory::~UsbCategory() 222UsbCategory::~UsbCategory()
240{ 223{
241} 224}
242 225
243void UsbCategory::populate() 226void UsbCategory::populate()
244{ 227{
245 odebug << "UsbCategory::populate()" << oendl; 228 odebug << "UsbCategory::populate()" << oendl;
246 QFile usbinfofile( "/proc/bus/usb/devices" ); 229 QFile usbinfofile( "/proc/bus/usb/devices" );
247 if ( !usbinfofile.exists() || !usbinfofile.open( IO_ReadOnly ) ) 230 if ( !usbinfofile.exists() || !usbinfofile.open( IO_ReadOnly ) )
248 { 231 {
249 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" );
250 return; 233 return;
251 } 234 }
252 QTextStream usbinfo( &usbinfofile ); 235 QTextStream usbinfo( &usbinfofile );
253 236