-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 | |||
@@ -30,16 +30,17 @@ | |||
30 | #include <qtabwidget.h> | 30 | #include <qtabwidget.h> |
31 | #include <qscrollview.h> | 31 | #include <qscrollview.h> |
32 | #include <qvbox.h> | 32 | #include <qvbox.h> |
33 | #include <qmessagebox.h> | 33 | #include <qmessagebox.h> |
34 | #include <qapplication.h> | 34 | #include <qapplication.h> |
35 | #include <qcheckbox.h> | 35 | #include <qcheckbox.h> |
36 | #include <qlineedit.h> | 36 | #include <qlineedit.h> |
37 | #include <qlistview.h> | 37 | #include <qlistview.h> |
38 | #include <qdir.h> | ||
38 | 39 | ||
39 | #include <qpe/resource.h> | 40 | #include <qpe/resource.h> |
40 | #include <qpe/config.h> | 41 | #include <qpe/config.h> |
41 | 42 | ||
42 | #include <remotedevice.h> | 43 | #include <remotedevice.h> |
43 | 44 | ||
44 | 45 | ||
45 | namespace OpieTooth { | 46 | namespace OpieTooth { |
@@ -133,25 +134,50 @@ namespace OpieTooth { | |||
133 | 134 | ||
134 | 135 | ||
135 | /* | 136 | /* |
136 | * Read the list of allready known devices | 137 | * Read the list of allready known devices |
137 | * | 138 | * |
138 | */ | 139 | */ |
139 | void BlueBase::readSavedDevices() { | 140 | void BlueBase::readSavedDevices() { |
140 | 141 | ||
142 | QList<RemoteDevice> *loadedDevices = new QList<RemoteDevice>; | ||
143 | |||
144 | Config deviceList( QDir::homeDirPath() + "/Settings/bluetooth/devicelist.conf", Config::File ); | ||
145 | |||
146 | |||
147 | // RemoteDevice *currentDevice = RemoteDevice( , ); | ||
148 | //loadedDevices->append( currentDevice ); | ||
149 | |||
150 | addSearchedDevices( *loadedDevices ); | ||
141 | } | 151 | } |
142 | 152 | ||
143 | /* | 153 | /* |
144 | * Read the list of allready known devices | 154 | * Write the list of allready known devices |
145 | * | 155 | * |
146 | */ | 156 | */ |
147 | void BlueBase::writeSavedDevices() { | 157 | void BlueBase::writeSavedDevices() { |
148 | 158 | ||
159 | QListViewItemIterator it( ListView2 ); | ||
160 | |||
161 | // one top conf file with all decices (by mac adress) | ||
162 | Config deviceList( QDir::homeDirPath() + "/Settings/bluetooth/devicelist.conf", Config::File ); | ||
149 | 163 | ||
164 | for ( ; it.current(); ++it ) { | ||
165 | |||
166 | // MAC adress as group | ||
167 | deviceList.setGroup( it.current()->text(1) ); | ||
168 | deviceList.writeEntry("inList", 1); | ||
169 | |||
170 | // seperate config file for each device, to store more information in future. | ||
171 | |||
172 | Config conf( QDir::homeDirPath() + "/Settings/bluetooth/" + (it.current()->text(1)) + ".conf", Config::File ); | ||
173 | conf.setGroup("Info"); | ||
174 | conf.writeEntry("name", it.current()->text(0) ); | ||
175 | } | ||
150 | } | 176 | } |
151 | 177 | ||
152 | 178 | ||
153 | /** | 179 | /** |
154 | * Set up the gui | 180 | * Set up the gui |
155 | */ | 181 | */ |
156 | void BlueBase::initGui() { | 182 | void BlueBase::initGui() { |
157 | 183 | ||
@@ -160,17 +186,17 @@ namespace OpieTooth { | |||
160 | cryptCheckBox->setChecked(useEncryption); | 186 | cryptCheckBox->setChecked(useEncryption); |
161 | authCheckBox->setChecked(enableAuthentification); | 187 | authCheckBox->setChecked(enableAuthentification); |
162 | pagescanCheckBox->setChecked(enablePagescan); | 188 | pagescanCheckBox->setChecked(enablePagescan); |
163 | inquiryscanCheckBox->setChecked(enableInquiryscan); | 189 | inquiryscanCheckBox->setChecked(enableInquiryscan); |
164 | deviceNameLine->setText(deviceName); | 190 | deviceNameLine->setText(deviceName); |
165 | passkeyLine->setText(defaultPasskey); | 191 | passkeyLine->setText(defaultPasskey); |
166 | // set info tab | 192 | // set info tab |
167 | setInfo(); | 193 | setInfo(); |
168 | } | 194 | } |
169 | 195 | ||
170 | 196 | ||
171 | /** | 197 | /** |
172 | * Get the status informations and returns it | 198 | * Get the status informations and returns it |
173 | * @return QString the status informations gathered | 199 | * @return QString the status informations gathered |
174 | */ | 200 | */ |
175 | QString BlueBase::getStatus(){ | 201 | QString BlueBase::getStatus(){ |
176 | 202 | ||
@@ -285,12 +311,13 @@ namespace OpieTooth { | |||
285 | void BlueBase::setInfo() { | 311 | void BlueBase::setInfo() { |
286 | StatusLabel->setText(getStatus()); | 312 | StatusLabel->setText(getStatus()); |
287 | } | 313 | } |
288 | 314 | ||
289 | /** | 315 | /** |
290 | * Decontructor | 316 | * Decontructor |
291 | */ | 317 | */ |
292 | BlueBase::~BlueBase(){ | 318 | BlueBase::~BlueBase(){ |
319 | writeSavedDevices(); | ||
293 | } | 320 | } |
294 | 321 | ||
295 | } | 322 | } |
296 | 323 | ||