summaryrefslogtreecommitdiff
path: root/noncore/applets/pcmcia
authormickeyl <mickeyl>2005-06-13 20:46:02 (UTC)
committer mickeyl <mickeyl>2005-06-13 20:46:02 (UTC)
commit9e210f138184f9cc93e28dd894243fc7bfea1b0f (patch) (unidiff)
treebff01f476d0b2370d7bfb8b6275677d6ee4d6580 /noncore/applets/pcmcia
parent8e7defdc3c1129f9e0935761ead46d9428306f7f (diff)
downloadopie-9e210f138184f9cc93e28dd894243fc7bfea1b0f.zip
opie-9e210f138184f9cc93e28dd894243fc7bfea1b0f.tar.gz
opie-9e210f138184f9cc93e28dd894243fc7bfea1b0f.tar.bz2
parse possible bindings out of /etc/pcmcia/* and list them in combobox
Diffstat (limited to 'noncore/applets/pcmcia') (more/less context) (show whitespace changes)
-rw-r--r--noncore/applets/pcmcia/configdialog.cpp42
-rw-r--r--noncore/applets/pcmcia/configdialogbase.ui141
2 files changed, 157 insertions, 26 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}
diff --git a/noncore/applets/pcmcia/configdialogbase.ui b/noncore/applets/pcmcia/configdialogbase.ui
index a9682c5..a0760d6 100644
--- a/noncore/applets/pcmcia/configdialogbase.ui
+++ b/noncore/applets/pcmcia/configdialogbase.ui
@@ -13,4 +13,4 @@
13 <y>0</y> 13 <y>0</y>
14 <width>234</width> 14 <width>232</width>
15 <height>130</height> 15 <height>206</height>
16 </rect> 16 </rect>
@@ -30,3 +30,3 @@
30 <name>margin</name> 30 <name>margin</name>
31 <number>7</number> 31 <number>5</number>
32 </property> 32 </property>
@@ -34,3 +34,3 @@
34 <name>spacing</name> 34 <name>spacing</name>
35 <number>4</number> 35 <number>2</number>
36 </property> 36 </property>
@@ -95,15 +95,44 @@
95 </property> 95 </property>
96 <property stdset="1">
97 <name>editable</name>
98 <bool>true</bool>
99 </property>
96 </widget> 100 </widget>
97 <widget row="1" column="0" rowspan="1" colspan="3" > 101 <widget row="3" column="0" >
98 <class>Line</class> 102 <class>QLabel</class>
99 <property stdset="1"> 103 <property stdset="1">
100 <name>name</name> 104 <name>name</name>
101 <cstring>Line1</cstring> 105 <cstring>textBindTo</cstring>
102 </property> 106 </property>
103 <property stdset="1"> 107 <property stdset="1">
104 <name>orientation</name> 108 <name>text</name>
105 <enum>Horizontal</enum> 109 <string>Bind to:</string>
106 </property> 110 </property>
107 </widget> 111 </widget>
108 <widget row="3" column="0" > 112 <widget row="0" column="0" rowspan="1" colspan="3" >
113 <class>QGroupBox</class>
114 <property stdset="1">
115 <name>name</name>
116 <cstring>GroupBox1</cstring>
117 </property>
118 <property stdset="1">
119 <name>title</name>
120 <string>Details</string>
121 </property>
122 <property>
123 <name>layoutMargin</name>
124 </property>
125 <property>
126 <name>layoutSpacing</name>
127 </property>
128 <grid>
129 <property stdset="1">
130 <name>margin</name>
131 <number>6</number>
132 </property>
133 <property stdset="1">
134 <name>spacing</name>
135 <number>4</number>
136 </property>
137 <widget row="0" column="0" >
109 <class>QLabel</class> 138 <class>QLabel</class>
@@ -111,3 +140,3 @@
111 <name>name</name> 140 <name>name</name>
112 <cstring>textBindTo</cstring> 141 <cstring>labelCardName</cstring>
113 </property> 142 </property>
@@ -115,6 +144,6 @@
115 <name>text</name> 144 <name>text</name>
116 <string>Bind to:</string> 145 <string>CardName:</string>
117 </property> 146 </property>
118 </widget> 147 </widget>
119 <widget row="4" column="0" > 148 <widget row="2" column="0" >
120 <class>QLabel</class> 149 <class>QLabel</class>
@@ -122,3 +151,3 @@
122 <name>name</name> 151 <name>name</name>
123 <cstring>textClassName</cstring> 152 <cstring>labelFunction</cstring>
124 </property> 153 </property>
@@ -126,13 +155,35 @@
126 <name>text</name> 155 <name>text</name>
127 <string>Classname:</string> 156 <string>Function:</string>
128 </property> 157 </property>
129 </widget> 158 </widget>
130 <widget row="4" column="1" rowspan="1" colspan="2" > 159 <widget row="1" column="0" >
131 <class>QComboBox</class> 160 <class>QLabel</class>
161 <property stdset="1">
162 <name>name</name>
163 <cstring>labelManufacturer</cstring>
164 </property>
165 <property stdset="1">
166 <name>text</name>
167 <string>Manufacturer:</string>
168 </property>
169 </widget>
170 <widget row="1" column="1" >
171 <class>QLabel</class>
132 <property stdset="1"> 172 <property stdset="1">
133 <name>name</name> 173 <name>name</name>
134 <cstring>cbClassName</cstring> 174 <cstring>txtManfid</cstring>
175 </property>
176 <property stdset="1">
177 <name>sizePolicy</name>
178 <sizepolicy>
179 <hsizetype>7</hsizetype>
180 <vsizetype>1</vsizetype>
181 </sizepolicy>
182 </property>
183 <property stdset="1">
184 <name>text</name>
185 <string>TextLabel6</string>
135 </property> 186 </property>
136 </widget> 187 </widget>
137 <widget row="0" column="0" rowspan="1" colspan="3" > 188 <widget row="2" column="1" >
138 <class>QLabel</class> 189 <class>QLabel</class>
@@ -140,3 +191,10 @@
140 <name>name</name> 191 <name>name</name>
141 <cstring>textCardName</cstring> 192 <cstring>txtFunction</cstring>
193 </property>
194 <property stdset="1">
195 <name>sizePolicy</name>
196 <sizepolicy>
197 <hsizetype>7</hsizetype>
198 <vsizetype>1</vsizetype>
199 </sizepolicy>
142 </property> 200 </property>
@@ -144,5 +202,46 @@
144 <name>text</name> 202 <name>text</name>
145 <string>CardName</string> 203 <string>TextLabel7</string>
146 </property> 204 </property>
147 </widget> 205 </widget>
206 <widget row="0" column="1" >
207 <class>QLabel</class>
208 <property stdset="1">
209 <name>name</name>
210 <cstring>txtCardName</cstring>
211 </property>
212 <property stdset="1">
213 <name>sizePolicy</name>
214 <sizepolicy>
215 <hsizetype>7</hsizetype>
216 <vsizetype>1</vsizetype>
217 </sizepolicy>
218 </property>
219 <property stdset="1">
220 <name>text</name>
221 <string>TextLabel3</string>
222 </property>
223 </widget>
224 </grid>
225 </widget>
226 <spacer row="1" column="1" >
227 <property>
228 <name>name</name>
229 <cstring>Spacer1</cstring>
230 </property>
231 <property stdset="1">
232 <name>orientation</name>
233 <enum>Vertical</enum>
234 </property>
235 <property stdset="1">
236 <name>sizeType</name>
237 <enum>Expanding</enum>
238 </property>
239 <property>
240 <name>sizeHint</name>
241 <size>
242 <width>20</width>
243 <height>20</height>
244 </size>
245 </property>
246 </spacer>
148 </grid> 247 </grid>