Diffstat (limited to 'noncore/net/opietooth/manager') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opietooth/manager/devicehandler.cpp | 89 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/devicehandler.h | 41 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/manager.pro | 4 |
3 files changed, 2 insertions, 132 deletions
diff --git a/noncore/net/opietooth/manager/devicehandler.cpp b/noncore/net/opietooth/manager/devicehandler.cpp deleted file mode 100644 index 320ad44..0000000 --- a/noncore/net/opietooth/manager/devicehandler.cpp +++ b/dev/null @@ -1,89 +0,0 @@ - -#include <stdlib.h> - -#include <qdir.h> -#include <qpe/config.h> -#include <opie2/odebug.h> -using namespace Opie::Core; - -#include "devicehandler.h" - -using namespace OpieTooth; - -DeviceHandler::DeviceHandler() { - -}; -DeviceHandler::~DeviceHandler() { - -} - -RemoteDevice::ValueList DeviceHandler::load() { - RemoteDevice::ValueList list; -QString path = QDir::homeDirPath() + "/Settings/bluetooth"; - QDir deviceListSave( path); - - // list of .conf files - QStringList devicesFileList = deviceListSave.entryList(); - - - // cut .conf of to get the mac and also read the name entry in it. - if (!devicesFileList.isEmpty() ) { - QString name; - QString mac; - QStringList::Iterator it; - for (it = devicesFileList.begin(); it != devicesFileList.end(); ++it ) { - if ( (*it) == "." || (*it) == ".." ) - continue; - - odebug << (*it).latin1() << oendl; - Config conf(path + "/"+(*it), Config::File); - conf.setGroup("Info"); - name = conf.readEntry("name", "Error"); - mac = conf.readEntry("mac", QString::null); - odebug << "MAC: " + mac << oendl; - odebug << "NAME: " + name << oendl; - if (mac.isEmpty() ) - continue; - RemoteDevice currentDevice( mac , name ); - list.append( currentDevice ); - } - } - return list; -}; -/* - * This is some how rude but make sure all old devices - * are getting deleted - */ -void DeviceHandler::save( const RemoteDevice::ValueList& list) { - QCString rm; - rm += "rm -rf "; - rm += QDir::homeDirPath() + "/Settings/bluetooth"; - system ( rm.data() ); - - if (list.isEmpty() ) // no need to create the dir - return; - - /** - * Create a new dir - */ - rm = "mkdir "; - rm += QDir::homeDirPath() + "/Settings/bluetooth"; - owarn << "out " << rm.data() << "" << oendl; - system( rm.data() ); - - RemoteDevice::ValueList::ConstIterator it; - // write the config - - for ( it = list.begin(); it != list.end(); ++it ) { - odebug << "/Settings/bluetooth/" + (*it).mac() + ".conf" << oendl; - - Config conf( QDir::homeDirPath() + - "/Settings/bluetooth/" + - (*it).mac() + ".conf", Config::File ); - - conf.setGroup( "Info" ); - conf.writeEntry( "name", (*it).name() ); - conf.writeEntry( "mac", (*it).mac() ); - } - -} diff --git a/noncore/net/opietooth/manager/devicehandler.h b/noncore/net/opietooth/manager/devicehandler.h deleted file mode 100644 index 5cfe048..0000000 --- a/noncore/net/opietooth/manager/devicehandler.h +++ b/dev/null @@ -1,41 +0,0 @@ - -#ifndef OPIE_TOOTH_DEVICE_HANDLER_H -#define OPIE_TOOTH_DEVICE_HANDLER_H - -#include <qvaluelist.h> - -#include <remotedevice.h> - -namespace OpieTooth { - /** - * DeviceHandler is responsible for loading - * and saving devices from a config File - */ - class DeviceHandler { - public: - /** - * c'tor - */ - DeviceHandler(); - - /** - * d'tor - */ - ~DeviceHandler(); - - /** - * loads from $HOME/Settings/bluetooth/ * - */ - RemoteDevice::ValueList load(); - - /** - * Saves to $HOME/Settings/bluetooth - */ - void save( const RemoteDevice::ValueList & ); - - }; - - -}; - -#endif diff --git a/noncore/net/opietooth/manager/manager.pro b/noncore/net/opietooth/manager/manager.pro index dc048c4..567932e 100644 --- a/noncore/net/opietooth/manager/manager.pro +++ b/noncore/net/opietooth/manager/manager.pro @@ -8,5 +8,5 @@ HEADERS = btconnectionitem.h btdeviceitem.h \ obexdialog.h obexftpdialog.h \ rfcommassigndialogimpl.h rfcommassigndialogitem.h \ - devicehandler.h rfcpopup.h obexpopup.h obexftpopup.h \ + rfcpopup.h obexpopup.h obexftpopup.h \ rfcommhelper.h panpopup.h dunpopup.h rfcommconfhandler.h \ servicesdialog.h btconfhandler.h hidpopup.h @@ -19,5 +19,5 @@ SOURCES = btconnectionitem.cpp btdeviceitem.cpp \ bticonloader.cpp pppdialog.cpp dundialog.cpp pandialog.cpp \ rfcommassigndialogimpl.cpp rfcommassigndialogitem.cpp \ - obexdialog.cpp devicehandler.cpp \ + obexdialog.cpp \ rfcpopup.cpp obexpopup.cpp obexftpopup.cpp obexftpdialog.cpp \ rfcommhelper.cpp panpopup.cpp dunpopup.cpp rfcommconfhandler.cpp \ |