-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index 5d742b7..cc51405 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp @@ -70,25 +70,24 @@ namespace OpieTooth { QColor col = pal.color( QPalette::Active, QColorGroup::Background ); pal.setColor( QPalette::Active, QColorGroup::Button, col ); pal.setColor( QPalette::Inactive, QColorGroup::Button, col ); pal.setColor( QPalette::Normal, QColorGroup::Button, col ); pal.setColor( QPalette::Disabled, QColorGroup::Button, col ); this->setPalette( pal ); setCaption( tr( "Bluetooth Manager" ) ); readConfig(); initGui(); - //TESTING ListView2->setRootIsDecorated(true); QListViewItem *topLV2 = new QListViewItem( ListView2, "Siemens S45" , "no" ); topLV2->setPixmap( 1, onPix ); (void) new QListViewItem( topLV2, "Serial" ); (void) new QListViewItem( topLV2, "BlueNiC" ); } /** * Reads all options from the config file @@ -125,30 +124,43 @@ namespace OpieTooth { cfg.writeEntry( "enableInquiryscan" , enableInquiryscan ); } /** * Read the list of allready known devices * */ void BlueBase::readSavedDevices() { QList<RemoteDevice> *loadedDevices = new QList<RemoteDevice>; - Config deviceListSave( QDir::homeDirPath() + "/Settings/bluetooth/devicelist.conf", Config::File ); + QDir deviceListSave( QDir::homeDirPath() + "/Settings/bluetooth/"); + // list of .conf files + QStringList devicesFileList = deviceListSave.entryList(); + // cut .conf of to get the mac and also read the name entry in it. - // RemoteDevice *currentDevice = RemoteDevice( , ); - //loadedDevices->append( currentDevice ); + for ( QStringList::Iterator it = devicesFileList.begin(); it != devicesFileList.end(); ++it ) { + QString name; + QString mac; + qDebug((*it).latin1() ); + Config conf((*it)); + conf.setGroup("Info"); + name = conf.readEntry("name", "Error"); + qDebug("MAC: " + mac); + qDebug("NAME: " + name); + RemoteDevice currentDevice = RemoteDevice( mac , name ); + loadedDevices->append( ¤tDevice ); + } addSearchedDevices( *loadedDevices ); } /** * Write the list of allready known devices * */ void BlueBase::writeSavedDevices() { QListViewItemIterator it( ListView2 ); for ( ; it.current(); ++it ) { @@ -182,46 +194,44 @@ namespace OpieTooth { /** * Get the status informations and returns it * @return QString the status informations gathered */ QString BlueBase::getStatus(){ QString infoString = tr( "<b>Device name : </b> Ipaq" ); infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" ); infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" ); return (infoString); - } /** * Read the current values from the gui and invoke writeConfig() */ void BlueBase::applyConfigChanges() { deviceName = deviceNameLine->text(); defaultPasskey = passkeyLine->text(); useEncryption = cryptCheckBox->isChecked(); enableAuthentification = authCheckBox->isChecked(); enablePagescan = pagescanCheckBox->isChecked(); enableInquiryscan = inquiryscanCheckBox->isChecked(); writeConfig(); QMessageBox* box = new QMessageBox( this, "Test" ); box->setText( tr( "Changes applied" ) ); box->show(); - // falls nötig hcid killhupen - die funktionalität adden } /** * Add fresh found devices from scan dialog to the listing * */ void BlueBase::addSearchedDevices( QList<RemoteDevice> &newDevices ) { QListViewItem * deviceItem; @@ -252,25 +262,24 @@ namespace OpieTooth { * Action that is toggled on entrys on click */ void BlueBase::startServiceActionClicked( QListViewItem *item ) { } /** * Action that are toggled on hold (mostly QPopups i guess) */ void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int column ) { - } /** * Search and display avail. services for a device (on expand from device listing) * */ void BlueBase::addServicesToDevice( QListViewItem * item ) { qDebug("addServicesToDevice"); // row of mac adress RemoteDevice *device = new RemoteDevice( item->text(3), item->text(0) ); @@ -296,26 +305,24 @@ namespace OpieTooth { QMap<QString,QListViewItem*>::Iterator it; QListViewItem* deviceItem; for( it = deviceList.begin(); it != deviceList.end(); ++it ) { if ( it.key() == device ) { deviceItem = it.data(); } } QValueList<OpieTooth::Services>::Iterator it2; - - QListViewItem * serviceItem; for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) { serviceItem = new QListViewItem( deviceItem , (*it2).serviceName() ); } } /** * Add the existing connections (pairs) to the connections tab. * */ @@ -323,25 +330,24 @@ namespace OpieTooth { //mac address } /** * Find out if a device can currently be reached */ bool BlueBase::deviceActive( RemoteDevice *device ) { // search by mac - // localDevice->isAvailable( device->mac() ); return true; } /** * Open the "scan for devices" dialog */ void BlueBase::startScan() { ScanDialog *scan = new ScanDialog( this, "", true); @@ -356,15 +362,14 @@ namespace OpieTooth { * Set the informations about the local device in information Tab */ void BlueBase::setInfo() { StatusLabel->setText( getStatus() ); } /** * Decontructor */ BlueBase::~BlueBase() { writeSavedDevices(); } - } |