author | harlekin <harlekin> | 2002-06-18 22:44:14 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-06-18 22:44:14 (UTC) |
commit | fac9ec9b389bc82d9d3027f801aaceea72c0d63e (patch) (side-by-side diff) | |
tree | b307d882ba03796aa1a31a2e646ba0989adc8a40 | |
parent | 4de1ff479f7a9d163940715b5a9e8b92967322b1 (diff) | |
download | opie-fac9ec9b389bc82d9d3027f801aaceea72c0d63e.zip opie-fac9ec9b389bc82d9d3027f801aaceea72c0d63e.tar.gz opie-fac9ec9b389bc82d9d3027f801aaceea72c0d63e.tar.bz2 |
update
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 29 |
1 files changed, 28 insertions, 1 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 @@ -14,48 +14,49 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "bluebase.h" #include "scandialog.h" #include <qframe.h> #include <qlabel.h> #include <qpushbutton.h> #include <qlayout.h> #include <qvariant.h> #include <qwhatsthis.h> #include <qimage.h> #include <qpixmap.h> #include <qtabwidget.h> #include <qscrollview.h> #include <qvbox.h> #include <qmessagebox.h> #include <qapplication.h> #include <qcheckbox.h> #include <qlineedit.h> #include <qlistview.h> +#include <qdir.h> #include <qpe/resource.h> #include <qpe/config.h> #include <remotedevice.h> namespace OpieTooth { BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) : BluetoothBase( parent, name, fl ) { QObject::connect( (QObject*)PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) ); QObject::connect( (QObject*)configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) ); QObject::connect( (QObject*)ListView2, SIGNAL( expanded( QListViewItem * item ) ), this, SLOT( addServicesToDevice( QListViewItem * item ) ) ); QObject::connect( (QObject*)ListView2, SIGNAL( clicked( QListViewItem * )), this, SLOT( startServiceActionClicked( QListViewItem * item ) ) ); // // QObject::connect( (QObject*) Manager, SIGNAL (foundServices( const QString& device, Services::ValueList ), this () ) ); @@ -117,57 +118,82 @@ namespace OpieTooth { /** * Writes all options to the config file */ void BlueBase::writeConfig() { Config cfg("bluetoothmanager"); cfg.setGroup("bluezsettings"); cfg.writeEntry("name", deviceName); cfg.writeEntryCrypt("passkey", defaultPasskey); cfg.writeEntry("useEncryption", useEncryption); cfg.writeEntry("enableAuthentification", enableAuthentification); cfg.writeEntry("enablePagescan",enablePagescan); cfg.writeEntry("enableInquiryscan", enableInquiryscan); } /* * Read the list of allready known devices * */ 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) ); + } } /** * Set up the gui */ void BlueBase::initGui() { StatusLabel->setText(getStatus()); // maybe move it to getStatus() cryptCheckBox->setChecked(useEncryption); authCheckBox->setChecked(enableAuthentification); pagescanCheckBox->setChecked(enablePagescan); inquiryscanCheckBox->setChecked(enableInquiryscan); deviceNameLine->setText(deviceName); passkeyLine->setText(defaultPasskey); // set info tab setInfo(); } /** * Get the status informations and returns it * @return QString the status informations gathered @@ -269,28 +295,29 @@ namespace OpieTooth { return true; } /** * Open the "scan for devices" dialog */ void BlueBase::startScan() { ScanDialog *scan = new ScanDialog( this, "", true); QObject::connect((QObject*)scan, SIGNAL( selectedDevices(QList<RemoteDevice>&) ), this, SLOT( addSearchedDevices(QList<RemoteDevice>& ) )); scan->showMaximized(); } void BlueBase::setInfo() { StatusLabel->setText(getStatus()); } /** * Decontructor */ BlueBase::~BlueBase(){ + writeSavedDevices(); } } |