summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp7
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
@@ -119,196 +119,197 @@ namespace OpieTooth {
119 void BlueBase::writeConfig() { 119 void BlueBase::writeConfig() {
120 120
121 121
122 Config cfg( "bluetoothmanager" ); 122 Config cfg( "bluetoothmanager" );
123 cfg.setGroup( "bluezsettings" ); 123 cfg.setGroup( "bluezsettings" );
124 124
125 cfg.writeEntry( "name" , deviceName ); 125 cfg.writeEntry( "name" , deviceName );
126 cfg.writeEntryCrypt( "passkey" , defaultPasskey ); 126 cfg.writeEntryCrypt( "passkey" , defaultPasskey );
127 cfg.writeEntry( "useEncryption" , useEncryption ); 127 cfg.writeEntry( "useEncryption" , useEncryption );
128 cfg.writeEntry( "enableAuthentification" , enableAuthentification ); 128 cfg.writeEntry( "enableAuthentification" , enableAuthentification );
129 cfg.writeEntry( "enablePagescan" , enablePagescan ); 129 cfg.writeEntry( "enablePagescan" , enablePagescan );
130 cfg.writeEntry( "enableInquiryscan" , enableInquiryscan ); 130 cfg.writeEntry( "enableInquiryscan" , enableInquiryscan );
131 131
132 writeToHciConfig(); 132 writeToHciConfig();
133 } 133 }
134 134
135 void BlueBase::writeToHciConfig() { 135 void BlueBase::writeToHciConfig() {
136 136
137 HciConfWrapper *hciconf = new HciConfWrapper( "/tmp/hcid.conf" ); 137 HciConfWrapper *hciconf = new HciConfWrapper( "/tmp/hcid.conf" );
138 hciconf->setPinHelper( "/bin/QtPalmtop/bin/blue-pin" ); 138 hciconf->setPinHelper( "/bin/QtPalmtop/bin/blue-pin" );
139 139
140 140
141 // hciconf->setPinHelper( "/bin/QtPalmtop/bin/blue-pin" ); 141 // hciconf->setPinHelper( "/bin/QtPalmtop/bin/blue-pin" );
142 142
143 hciconf->setName( deviceName ); 143 hciconf->setName( deviceName );
144 144
145 if ( useEncryption == 1) { 145 if ( useEncryption == 1) {
146 hciconf->setEncrypt( true ); 146 hciconf->setEncrypt( true );
147 } else { 147 } else {
148 hciconf->setEncrypt( false ); 148 hciconf->setEncrypt( false );
149 } 149 }
150 150
151 151
152 if ( enableAuthentification == 1) { 152 if ( enableAuthentification == 1) {
153 hciconf->setAuth( true ); 153 hciconf->setAuth( true );
154 } else { 154 } else {
155 hciconf->setAuth( false ); 155 hciconf->setAuth( false );
156 } 156 }
157 157
158 if ( enablePagescan == 1) { 158 if ( enablePagescan == 1) {
159 hciconf->setPscan( true ); 159 hciconf->setPscan( true );
160 } else { 160 } else {
161 hciconf->setPscan( false ); 161 hciconf->setPscan( false );
162 } 162 }
163 163
164 if ( enableInquiryscan == 1) { 164 if ( enableInquiryscan == 1) {
165 hciconf->setIscan( true ); 165 hciconf->setIscan( true );
166 } else { 166 } else {
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( &currentDevice ); 198 loadedDevices->append( &currentDevice );
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
267 writeConfig(); 268 writeConfig();
268 269
269 270
270 QMessageBox* box = new QMessageBox( this, "Test" ); 271 QMessageBox* box = new QMessageBox( this, "Test" );
271 box->setText( tr( "Changes applied" ) ); 272 box->setText( tr( "Changes applied" ) );
272 box->show(); 273 box->show();
273 // falls nötig hcid killhupen - die funktionalität adden 274 // falls nötig hcid killhupen - die funktionalität adden
274 } 275 }
275 276
276 277
277 /** 278 /**
278 * Add fresh found devices from scan dialog to the listing 279 * Add fresh found devices from scan dialog to the listing
279 * 280 *
280 */ 281 */
281 void BlueBase::addSearchedDevices( QList<RemoteDevice> &newDevices ) { 282 void BlueBase::addSearchedDevices( QList<RemoteDevice> &newDevices ) {
282 283
283 BTListItem * deviceItem; 284 BTListItem * deviceItem;
284 285
285 QListIterator<RemoteDevice> it( newDevices ); 286 QListIterator<RemoteDevice> it( newDevices );
286 287
287 for( ; it.current() ; ++it ) { 288 for( ; it.current() ; ++it ) {
288 289
289 290
290 RemoteDevice *dev = it.current(); 291 RemoteDevice *dev = it.current();
291 deviceItem = new BTListItem( ListView2 , dev->name(), dev->mac(), "device" ); 292 deviceItem = new BTListItem( ListView2 , dev->name(), dev->mac(), "device" );
292 deviceItem->setExpandable ( true ); 293 deviceItem->setExpandable ( true );
293 294
294 // look if device is avail. atm, async 295 // look if device is avail. atm, async
295 deviceActive( dev ); 296 deviceActive( dev );
296 297
297 // move into the c'tor 298 // move into the c'tor
298 // deviceItem->setMac( dev->mac() ); 299 // deviceItem->setMac( dev->mac() );
299 // what kind of entry is it. 300 // what kind of entry is it.
300 //deviceItem->setType( "device"); 301 //deviceItem->setType( "device");
301 302
302 // ggf auch hier? 303 // ggf auch hier?
303 addServicesToDevice( deviceItem ); 304 addServicesToDevice( deviceItem );
304 } 305 }
305 } 306 }
306 307
307 308
308 /** 309 /**
309 * Action that is toggled on entrys on click 310 * Action that is toggled on entrys on click
310 */ 311 */
311 void BlueBase::startServiceActionClicked( QListViewItem *item ) { 312 void BlueBase::startServiceActionClicked( QListViewItem *item ) {
312 313
313 314
314 } 315 }