-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index d45fbe0..4d476ac 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp @@ -34,8 +34,9 @@ #include <qapplication.h> #include <qcheckbox.h> #include <qlineedit.h> #include <qlistview.h> +#include <qdir.h> #include <qpe/resource.h> #include <qpe/config.h> @@ -137,17 +138,42 @@ namespace OpieTooth { * */ void BlueBase::readSavedDevices() { + QList<RemoteDevice> *loadedDevices = new QList<RemoteDevice>; + + Config deviceList( QDir::homeDirPath() + "/Settings/bluetooth/devicelist.conf", Config::File ); + + + // RemoteDevice *currentDevice = RemoteDevice( , ); + //loadedDevices->append( currentDevice ); + + addSearchedDevices( *loadedDevices ); } /* - * Read the list of allready known devices + * Write the list of allready known devices * */ void BlueBase::writeSavedDevices() { + QListViewItemIterator it( ListView2 ); + + // one top conf file with all decices (by mac adress) + Config deviceList( QDir::homeDirPath() + "/Settings/bluetooth/devicelist.conf", Config::File ); + for ( ; it.current(); ++it ) { + + // MAC adress as group + deviceList.setGroup( it.current()->text(1) ); + deviceList.writeEntry("inList", 1); + + // seperate config file for each device, to store more information in future. + + Config conf( QDir::homeDirPath() + "/Settings/bluetooth/" + (it.current()->text(1)) + ".conf", Config::File ); + conf.setGroup("Info"); + conf.writeEntry("name", it.current()->text(0) ); + } } /** @@ -164,9 +190,9 @@ namespace OpieTooth { deviceNameLine->setText(deviceName); passkeyLine->setText(defaultPasskey); // set info tab setInfo(); -} + } /** * Get the status informations and returns it @@ -289,8 +315,9 @@ namespace OpieTooth { /** * Decontructor */ BlueBase::~BlueBase(){ + writeSavedDevices(); } } |