-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index 0385cb1..3e7e2ab 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp | |||
@@ -167,100 +167,101 @@ namespace OpieTooth { | |||
167 | hciconf->setIscan( false ); | 167 | hciconf->setIscan( false ); |
168 | } | 168 | } |
169 | delete hciconf; | 169 | delete hciconf; |
170 | } | 170 | } |
171 | 171 | ||
172 | 172 | ||
173 | /** | 173 | /** |
174 | * Read the list of allready known devices | 174 | * Read the list of allready known devices |
175 | * | 175 | * |
176 | */ | 176 | */ |
177 | void BlueBase::readSavedDevices() { | 177 | void BlueBase::readSavedDevices() { |
178 | 178 | ||
179 | QList<RemoteDevice> *loadedDevices = new QList<RemoteDevice>; | 179 | QList<RemoteDevice> *loadedDevices = new QList<RemoteDevice>; |
180 | 180 | ||
181 | QDir deviceListSave( QDir::homeDirPath() + "/Settings/bluetooth/"); | 181 | QDir deviceListSave( QDir::homeDirPath() + "/Settings/bluetooth/"); |
182 | // list of .conf files | 182 | // list of .conf files |
183 | QStringList devicesFileList = deviceListSave.entryList(); | 183 | QStringList devicesFileList = deviceListSave.entryList(); |
184 | 184 | ||
185 | // cut .conf of to get the mac and also read the name entry in it. | 185 | // cut .conf of to get the mac and also read the name entry in it. |
186 | 186 | ||
187 | for ( QStringList::Iterator it = devicesFileList.begin(); it != devicesFileList.end(); ++it ) { | 187 | for ( QStringList::Iterator it = devicesFileList.begin(); it != devicesFileList.end(); ++it ) { |
188 | 188 | ||
189 | QString name; | 189 | QString name; |
190 | QString mac; | 190 | QString mac; |
191 | qDebug((*it).latin1() ); | 191 | qDebug((*it).latin1() ); |
192 | Config conf((*it)); | 192 | Config conf((*it)); |
193 | conf.setGroup("Info"); | 193 | conf.setGroup("Info"); |
194 | name = conf.readEntry("name", "Error"); | 194 | name = conf.readEntry("name", "Error"); |
195 | qDebug("MAC: " + mac); | 195 | qDebug("MAC: " + mac); |
196 | qDebug("NAME: " + name); | 196 | qDebug("NAME: " + name); |
197 | RemoteDevice currentDevice = RemoteDevice( mac , name ); | 197 | RemoteDevice currentDevice = RemoteDevice( mac , name ); |
198 | loadedDevices->append( ¤tDevice ); | 198 | loadedDevices->append( ¤tDevice ); |
199 | } | 199 | } |
200 | addSearchedDevices( *loadedDevices ); | 200 | addSearchedDevices( *loadedDevices ); |
201 | } | 201 | } |
202 | 202 | ||
203 | /** | 203 | /** |
204 | * Write the list of allready known devices | 204 | * Write the list of allready known devices |
205 | * | 205 | * |
206 | */ | 206 | */ |
207 | void BlueBase::writeSavedDevices() { | 207 | void BlueBase::writeSavedDevices() { |
208 | 208 | ||
209 | QListViewItemIterator it( ListView2 ); | 209 | QListViewItemIterator it( ListView2 ); |
210 | 210 | ||
211 | for ( ; it.current(); ++it ) { | 211 | for ( ; it.current(); ++it ) { |
212 | 212 | ||
213 | // seperate config file for each device, to store more information in future. | 213 | // seperate config file for each device, to store more information in future. |
214 | // TO FIX: BTLISTITEM!!! | 214 | // TO FIX: BTLISTITEM!!! |
215 | qDebug( "/Settings/bluetooth/" + (((BTListItem*)it.current())->mac()) + ".conf"); | ||
216 | Config conf( QDir::homeDirPath() + "/Settings/bluetooth/" + (((BTListItem*)it.current())->mac()) + ".conf", Config::File ); | ||
215 | 217 | ||
216 | // Config conf( QDir::homeDirPath() + "/Settings/bluetooth/" + (((BTListItem)it.current())->mac()) + ".conf", Config::File ); | 218 | conf.setGroup( "Info" ); |
217 | // conf.setGroup( "Info" ); | 219 | conf.writeEntry( "name", ((BTListItem*)it.current())->name() ); |
218 | // conf.writeEntry( "name", it.current()->name() ); | ||
219 | } | 220 | } |
220 | } | 221 | } |
221 | 222 | ||
222 | 223 | ||
223 | /** | 224 | /** |
224 | * Set up the gui | 225 | * Set up the gui |
225 | */ | 226 | */ |
226 | void BlueBase::initGui() { | 227 | void BlueBase::initGui() { |
227 | 228 | ||
228 | StatusLabel->setText( getStatus() ); // maybe move it to getStatus() | 229 | StatusLabel->setText( getStatus() ); // maybe move it to getStatus() |
229 | 230 | ||
230 | cryptCheckBox->setChecked( useEncryption ); | 231 | cryptCheckBox->setChecked( useEncryption ); |
231 | authCheckBox->setChecked( enableAuthentification ); | 232 | authCheckBox->setChecked( enableAuthentification ); |
232 | pagescanCheckBox->setChecked( enablePagescan ); | 233 | pagescanCheckBox->setChecked( enablePagescan ); |
233 | inquiryscanCheckBox->setChecked( enableInquiryscan ); | 234 | inquiryscanCheckBox->setChecked( enableInquiryscan ); |
234 | deviceNameLine->setText( deviceName ); | 235 | deviceNameLine->setText( deviceName ); |
235 | passkeyLine->setText( defaultPasskey ); | 236 | passkeyLine->setText( defaultPasskey ); |
236 | // set info tab | 237 | // set info tab |
237 | setInfo(); | 238 | setInfo(); |
238 | } | 239 | } |
239 | 240 | ||
240 | 241 | ||
241 | /** | 242 | /** |
242 | * Get the status informations and returns it | 243 | * Get the status informations and returns it |
243 | * @return QString the status informations gathered | 244 | * @return QString the status informations gathered |
244 | */ | 245 | */ |
245 | QString BlueBase::getStatus(){ | 246 | QString BlueBase::getStatus(){ |
246 | 247 | ||
247 | QString infoString = tr( "<b>Device name : </b> Ipaq" ); | 248 | QString infoString = tr( "<b>Device name : </b> Ipaq" ); |
248 | infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" ); | 249 | infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" ); |
249 | infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" ); | 250 | infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" ); |
250 | 251 | ||
251 | return (infoString); | 252 | return (infoString); |
252 | } | 253 | } |
253 | 254 | ||
254 | 255 | ||
255 | /** | 256 | /** |
256 | * Read the current values from the gui and invoke writeConfig() | 257 | * Read the current values from the gui and invoke writeConfig() |
257 | */ | 258 | */ |
258 | void BlueBase::applyConfigChanges() { | 259 | void BlueBase::applyConfigChanges() { |
259 | 260 | ||
260 | deviceName = deviceNameLine->text(); | 261 | deviceName = deviceNameLine->text(); |
261 | defaultPasskey = passkeyLine->text(); | 262 | defaultPasskey = passkeyLine->text(); |
262 | useEncryption = cryptCheckBox->isChecked(); | 263 | useEncryption = cryptCheckBox->isChecked(); |
263 | enableAuthentification = authCheckBox->isChecked(); | 264 | enableAuthentification = authCheckBox->isChecked(); |
264 | enablePagescan = pagescanCheckBox->isChecked(); | 265 | enablePagescan = pagescanCheckBox->isChecked(); |
265 | enableInquiryscan = inquiryscanCheckBox->isChecked(); | 266 | enableInquiryscan = inquiryscanCheckBox->isChecked(); |
266 | 267 | ||