summaryrefslogtreecommitdiff
path: root/noncore/applets/pcmcia/configdialog.cpp
Unidiff
Diffstat (limited to 'noncore/applets/pcmcia/configdialog.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/applets/pcmcia/configdialog.cpp42
1 files changed, 37 insertions, 5 deletions
diff --git a/noncore/applets/pcmcia/configdialog.cpp b/noncore/applets/pcmcia/configdialog.cpp
index e7c97c1..e161d18 100644
--- a/noncore/applets/pcmcia/configdialog.cpp
+++ b/noncore/applets/pcmcia/configdialog.cpp
@@ -39,3 +39,5 @@ using namespace Opie::Core;
39#include <qdir.h> 39#include <qdir.h>
40#include <qfile.h>
40#include <qlabel.h> 41#include <qlabel.h>
42#include <qtextstream.h>
41 43
@@ -45,3 +47,3 @@ ConfigDialog::ConfigDialog( const QString& cardname, QWidget* parent )
45 //setCaption( tr( "Configure %1" ).arg( cardname ) ); 47 //setCaption( tr( "Configure %1" ).arg( cardname ) );
46 textCardName->setText( cardname ); 48 txtCardName->setText( cardname );
47 49
@@ -72,5 +74,5 @@ ConfigDialog::ConfigDialog( const QString& cardname, QWidget* parent )
72 74
73 // parse possible device and class names out of /etc/pcmcia/*.conf 75 // parse possible bind entries out of /etc/pcmcia/*.conf
74 QStringList deviceNames; 76 typedef QMap<QString,QString> StringMap;
75 QStringList classNames; 77 StringMap bindEntries;
76 78
@@ -79,4 +81,34 @@ ConfigDialog::ConfigDialog( const QString& cardname, QWidget* parent )
79 for ( int i = 0; i < pcmciaconfdir.count(); ++i ) 81 for ( int i = 0; i < pcmciaconfdir.count(); ++i )
80 odebug << "found conf file '" << pcmciaconfdir[i] << "'" << oendl; 82 {
83 odebug << "processing conf file '" << pcmciaconfdir[i] << "'" << oendl;
84 QString conffilename = QString( "%1/%2" ).arg( pcmciaconfdir.absPath() ).arg( pcmciaconfdir[i] );
85 QFile conffile( conffilename );
86 if ( conffile.open( IO_ReadOnly ) )
87 {
88 QTextStream ts( &conffile );
89 while ( !ts.atEnd() )
90 {
91 QString word;
92 ts >> word;
93 if ( word == "bind" )
94 {
95 word = ts.readLine();
96 bindEntries[ word.stripWhiteSpace() ] = conffilename;
97 continue;
98 }
99 ts.readLine();
100 }
101 }
102 else
103 {
104 owarn << "couldn't open '" << conffile.name() << "' for reading" << oendl;
105 continue;
106 }
107 }
81 108
109 for ( StringMap::Iterator it = bindEntries.begin(); it != bindEntries.end(); ++it )
110 {
111 odebug << "found device '" << it.key() << "' defined in '" << it.data().latin1() << "'" << oendl;
112 cbBindTo->insertItem( it.key() );
113 }
82} 114}