-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 654 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.h | 1 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/bticonloader.cpp | 2 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/devicehandler.cpp | 87 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/devicehandler.h | 41 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/hciconfwrapper.cpp | 74 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/hciconfwrapper.h | 4 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/manager.pro | 17 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/popuphelper.cpp | 4 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/scandialog.cpp | 37 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/scandialog.h | 8 |
11 files changed, 568 insertions, 361 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index 3f2f138..598ce16 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp | |||
@@ -1,512 +1,534 @@ | |||
1 | /* | 1 | /* |
2 | * bluebase.cpp * | 2 | * bluebase.cpp * |
3 | * --------------------- | 3 | * --------------------- |
4 | * | 4 | * |
5 | * copyright : (c) 2002 by Maximilian Reiß | 5 | * copyright : (c) 2002 by Maximilian Reiß |
6 | * email : max.reiss@gmx.de | 6 | * email : max.reiss@gmx.de |
7 | * | 7 | * |
8 | */ | 8 | */ |
9 | /*************************************************************************** | 9 | /*************************************************************************** |
10 | * * | 10 | * * |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | * This program is free software; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * (at your option) any later version. * | 14 | * (at your option) any later version. * |
15 | * * | 15 | * * |
16 | ***************************************************************************/ | 16 | ***************************************************************************/ |
17 | 17 | ||
18 | #include "bluebase.h" | 18 | #include "bluebase.h" |
19 | #include "scandialog.h" | 19 | #include "scandialog.h" |
20 | #include "hciconfwrapper.h" | 20 | #include "hciconfwrapper.h" |
21 | 21 | ||
22 | #include <stdlib.h> | ||
23 | |||
22 | #include <qframe.h> | 24 | #include <qframe.h> |
23 | #include <qlabel.h> | 25 | #include <qlabel.h> |
24 | #include <qpushbutton.h> | 26 | #include <qpushbutton.h> |
25 | #include <qlayout.h> | 27 | #include <qlayout.h> |
26 | #include <qvariant.h> | 28 | #include <qvariant.h> |
27 | #include <qwhatsthis.h> | 29 | #include <qwhatsthis.h> |
28 | #include <qimage.h> | 30 | #include <qimage.h> |
29 | #include <qpixmap.h> | 31 | #include <qpixmap.h> |
30 | #include <qtabwidget.h> | 32 | #include <qtabwidget.h> |
31 | #include <qscrollview.h> | 33 | #include <qscrollview.h> |
32 | #include <qvbox.h> | 34 | #include <qvbox.h> |
33 | #include <qmessagebox.h> | 35 | #include <qmessagebox.h> |
34 | #include <qcheckbox.h> | 36 | #include <qcheckbox.h> |
35 | #include <qlineedit.h> | 37 | #include <qlineedit.h> |
36 | #include <qlistview.h> | 38 | #include <qlistview.h> |
37 | #include <qdir.h> | 39 | #include <qdir.h> |
38 | #include <qpopupmenu.h> | 40 | #include <qpopupmenu.h> |
39 | #include <qtimer.h> | 41 | #include <qtimer.h> |
40 | 42 | ||
41 | #include <qpe/resource.h> | 43 | #include <qpe/resource.h> |
42 | #include <qpe/config.h> | 44 | #include <qpe/config.h> |
43 | 45 | ||
44 | #include <remotedevice.h> | 46 | #include <remotedevice.h> |
45 | #include <services.h> | 47 | #include <services.h> |
46 | 48 | ||
49 | #include "devicehandler.h" | ||
47 | #include "btconnectionitem.h" | 50 | #include "btconnectionitem.h" |
48 | 51 | ||
49 | using namespace OpieTooth; | 52 | using namespace OpieTooth; |
50 | 53 | ||
51 | BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) | 54 | BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) |
52 | : BluetoothBase( parent, name, fl ) { | 55 | : BluetoothBase( parent, name, fl ) { |
53 | 56 | ||
54 | m_localDevice = new Manager( "hci0" ); | 57 | m_localDevice = new Manager( "hci0" ); |
55 | 58 | ||
56 | connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) ); | 59 | connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) ); |
57 | connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) ); | 60 | connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) ); |
58 | // not good since lib is async | 61 | // not good since lib is async |
59 | // connect( ListView2, SIGNAL( expanded ( QListViewItem* ) ), | 62 | // connect( ListView2, SIGNAL( expanded ( QListViewItem* ) ), |
60 | // this, SLOT( addServicesToDevice( QListViewItem * ) ) ); | 63 | // this, SLOT( addServicesToDevice( QListViewItem * ) ) ); |
61 | connect( ListView2, SIGNAL( clicked( QListViewItem* )), | 64 | connect( ListView2, SIGNAL( clicked( QListViewItem* )), |
62 | this, SLOT( startServiceActionClicked( QListViewItem* ) ) ); | 65 | this, SLOT( startServiceActionClicked( QListViewItem* ) ) ); |
63 | connect( ListView2, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int ) ), | 66 | connect( ListView2, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int ) ), |
64 | this, SLOT(startServiceActionHold( QListViewItem *, const QPoint &, int) ) ); | 67 | this, SLOT(startServiceActionHold( QListViewItem *, const QPoint &, int) ) ); |
65 | connect( m_localDevice , SIGNAL( foundServices( const QString& , Services::ValueList ) ), | 68 | connect( m_localDevice , SIGNAL( foundServices( const QString& , Services::ValueList ) ), |
66 | this, SLOT( addServicesToDevice( const QString& , Services::ValueList ) ) ); | 69 | this, SLOT( addServicesToDevice( const QString& , Services::ValueList ) ) ); |
67 | connect( m_localDevice, SIGNAL( available( const QString&, bool ) ), | 70 | connect( m_localDevice, SIGNAL( available( const QString&, bool ) ), |
68 | this, SLOT( deviceActive( const QString& , bool ) ) ); | 71 | this, SLOT( deviceActive( const QString& , bool ) ) ); |
69 | connect( m_localDevice, SIGNAL( connections( Connection::ValueList ) ), | 72 | connect( m_localDevice, SIGNAL( connections( ConnectionState::ValueList ) ), |
70 | this, SLOT( addConnectedDevices( Connection::ValueList ) ) ); | 73 | this, SLOT( addConnectedDevices( ConnectionState::ValueList ) ) ); |
71 | 74 | ||
72 | //Load all icons needed | 75 | //Load all icons needed |
73 | m_offPix = Resource::loadPixmap( "editdelete" ); | 76 | m_offPix = Resource::loadPixmap( "editdelete" ); |
74 | m_onPix = Resource::loadPixmap( "installed" ); | 77 | m_onPix = Resource::loadPixmap( "installed" ); |
75 | 78 | ||
76 | QPalette pal = this->palette(); | 79 | QPalette pal = this->palette(); |
77 | QColor col = pal.color( QPalette::Active, QColorGroup::Background ); | 80 | QColor col = pal.color( QPalette::Active, QColorGroup::Background ); |
78 | pal.setColor( QPalette::Active, QColorGroup::Button, col ); | 81 | pal.setColor( QPalette::Active, QColorGroup::Button, col ); |
79 | pal.setColor( QPalette::Inactive, QColorGroup::Button, col ); | 82 | pal.setColor( QPalette::Inactive, QColorGroup::Button, col ); |
80 | pal.setColor( QPalette::Normal, QColorGroup::Button, col ); | 83 | pal.setColor( QPalette::Normal, QColorGroup::Button, col ); |
81 | pal.setColor( QPalette::Disabled, QColorGroup::Button, col ); | 84 | pal.setColor( QPalette::Disabled, QColorGroup::Button, col ); |
82 | this->setPalette( pal ); | 85 | this->setPalette( pal ); |
83 | 86 | ||
84 | setCaption( tr( "Bluetooth Manager" ) ); | 87 | setCaption( tr( "Bluetooth Manager" ) ); |
85 | 88 | ||
86 | readConfig(); | 89 | readConfig(); |
87 | initGui(); | 90 | initGui(); |
88 | 91 | ||
89 | //TESTING | 92 | //TESTING |
90 | ListView2->setRootIsDecorated(true); | 93 | ListView2->setRootIsDecorated(true); |
91 | 94 | ||
92 | BTDeviceItem *topLV2 = new BTDeviceItem( ListView2, RemoteDevice("xx:", "Siemens S45" ) ); | 95 | BTDeviceItem *topLV2 = new BTDeviceItem( ListView2, RemoteDevice("xx:", "Siemens S45" ) ); |
93 | topLV2->setPixmap( 1, m_onPix ); | 96 | topLV2->setPixmap( 1, m_onPix ); |
94 | Services s1; | 97 | Services s1; |
95 | s1.setServiceName( "Serial" ); | 98 | s1.setServiceName( "Serial" ); |
96 | s1.insertClassId(1, "BlueNic"); | 99 | s1.insertClassId(1, "BlueNic"); |
97 | (void) new BTServiceItem( topLV2, s1 ); | 100 | (void) new BTServiceItem( topLV2, s1 ); |
98 | s1.setServiceName( "BlueNic" ); | 101 | s1.setServiceName( "BlueNic" ); |
99 | s1.insertClassId(2, "Obex"); | 102 | s1.insertClassId(2, "Obex"); |
100 | (void) new BTServiceItem( topLV2, s1 ); | 103 | (void) new BTServiceItem( topLV2, s1 ); |
101 | 104 | ||
102 | writeToHciConfig(); | 105 | writeToHciConfig(); |
103 | // search conncetions | 106 | // search conncetions |
104 | addConnectedDevices(); | 107 | addConnectedDevices(); |
105 | m_iconLoader = new BTIconLoader(); | 108 | m_iconLoader = new BTIconLoader(); |
106 | } | 109 | readSavedDevices(); |
107 | 110 | } | |
108 | /** | ||
109 | * Reads all options from the config file | ||
110 | */ | ||
111 | void BlueBase::readConfig() { | ||
112 | |||
113 | Config cfg( "bluetoothmanager" ); | ||
114 | cfg.setGroup( "bluezsettings" ); | ||
115 | |||
116 | m_deviceName = cfg.readEntry( "name" , "No name" ); // name the device should identify with | ||
117 | m_defaultPasskey = cfg.readEntryCrypt( "passkey" , "" ); // <- hmm, look up how good the trolls did that, maybe too weak | ||
118 | m_useEncryption = cfg.readBoolEntry( "useEncryption" , TRUE ); | ||
119 | m_enableAuthentification = cfg.readBoolEntry( "enableAuthentification" , TRUE ); | ||
120 | m_enablePagescan = cfg.readBoolEntry( "enablePagescan" , TRUE ); | ||
121 | m_enableInquiryscan = cfg.readBoolEntry( "enableInquiryscan" , TRUE ); | ||
122 | } | ||
123 | 111 | ||
124 | /** | 112 | /** |
125 | * Writes all options to the config file | 113 | * Reads all options from the config file |
126 | */ | 114 | */ |
127 | void BlueBase::writeConfig() { | 115 | void BlueBase::readConfig() { |
128 | 116 | ||
129 | Config cfg( "bluetoothmanager" ); | 117 | Config cfg( "bluetoothmanager" ); |
130 | cfg.setGroup( "bluezsettings" ); | 118 | cfg.setGroup( "bluezsettings" ); |
131 | 119 | ||
132 | cfg.writeEntry( "name" , m_deviceName ); | 120 | m_deviceName = cfg.readEntry( "name" , "No name" ); // name the device should identify with |
133 | cfg.writeEntryCrypt( "passkey" , m_defaultPasskey ); | 121 | m_defaultPasskey = cfg.readEntryCrypt( "passkey" , "" ); // <- hmm, look up how good the trolls did that, maybe too weak |
134 | cfg.writeEntry( "useEncryption" , m_useEncryption ); | 122 | m_useEncryption = cfg.readBoolEntry( "useEncryption" , TRUE ); |
135 | cfg.writeEntry( "enableAuthentification" , m_enableAuthentification ); | 123 | m_enableAuthentification = cfg.readBoolEntry( "enableAuthentification" , TRUE ); |
136 | cfg.writeEntry( "enablePagescan" , m_enablePagescan ); | 124 | m_enablePagescan = cfg.readBoolEntry( "enablePagescan" , TRUE ); |
137 | cfg.writeEntry( "enableInquiryscan" , m_enableInquiryscan ); | 125 | m_enableInquiryscan = cfg.readBoolEntry( "enableInquiryscan" , TRUE ); |
126 | } | ||
138 | 127 | ||
139 | writeToHciConfig(); | 128 | /** |
140 | } | 129 | * Writes all options to the config file |
130 | */ | ||
131 | void BlueBase::writeConfig() { | ||
141 | 132 | ||
142 | void BlueBase::writeToHciConfig() { | 133 | Config cfg( "bluetoothmanager" ); |
134 | cfg.setGroup( "bluezsettings" ); | ||
143 | 135 | ||
144 | HciConfWrapper hciconf ( "/tmp/hcid.conf" ); | 136 | cfg.writeEntry( "name" , m_deviceName ); |
145 | hciconf.setPinHelper( "/bin/QtPalmtop/bin/blue-pin" ); | 137 | cfg.writeEntryCrypt( "passkey" , m_defaultPasskey ); |
138 | cfg.writeEntry( "useEncryption" , m_useEncryption ); | ||
139 | cfg.writeEntry( "enableAuthentification" , m_enableAuthentification ); | ||
140 | cfg.writeEntry( "enablePagescan" , m_enablePagescan ); | ||
141 | cfg.writeEntry( "enableInquiryscan" , m_enableInquiryscan ); | ||
146 | 142 | ||
143 | writeToHciConfig(); | ||
144 | } | ||
147 | 145 | ||
148 | // hciconf->setPinHelper( "/bin/QtPalmtop/bin/blue-pin" ); | 146 | void BlueBase::writeToHciConfig() { |
147 | qWarning("writeToHciConfig"); | ||
148 | HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" ); | ||
149 | hciconf.load(); | ||
150 | hciconf.setPinHelper( "/bin/QtPalmtop/bin/blue-pin" ); | ||
149 | 151 | ||
150 | hciconf.setName( m_deviceName ); | ||
151 | hciconf.setEncrypt( m_useEncryption ); | ||
152 | hciconf.setAuth( m_enableAuthentification ); | ||
153 | hciconf.setPscan( m_enablePagescan ); | ||
154 | hciconf.setIscan( m_enableInquiryscan ); | ||
155 | } | ||
156 | 152 | ||
153 | // hciconf->setPinHelper( "/bin/QtPalmtop/bin/blue-pin" ); | ||
157 | 154 | ||
158 | /** | 155 | hciconf.setName( m_deviceName ); |
159 | * Read the list of allready known devices | 156 | hciconf.setEncrypt( m_useEncryption ); |
160 | * | 157 | hciconf.setAuth( m_enableAuthentification ); |
161 | */ | 158 | hciconf.setPscan( m_enablePagescan ); |
162 | void BlueBase::readSavedDevices() { | 159 | hciconf.setIscan( m_enableInquiryscan ); |
160 | hciconf.save(); | ||
161 | } | ||
163 | 162 | ||
164 | QValueList<RemoteDevice> loadedDevices; | ||
165 | 163 | ||
166 | QDir deviceListSave( QDir::homeDirPath() + "/Settings/bluetooth/"); | 164 | /** |
167 | // list of .conf files | 165 | * Read the list of allready known devices |
168 | QStringList devicesFileList = deviceListSave.entryList(); | 166 | * |
167 | */ | ||
168 | void BlueBase::readSavedDevices() { | ||
169 | 169 | ||
170 | // cut .conf of to get the mac and also read the name entry in it. | 170 | QValueList<RemoteDevice> loadedDevices; |
171 | DeviceHandler handler; | ||
172 | loadedDevices = handler.load(); | ||
171 | 173 | ||
172 | for ( QStringList::Iterator it = devicesFileList.begin(); it != devicesFileList.end(); ++it ) { | 174 | addSearchedDevices( loadedDevices ); |
175 | } | ||
173 | 176 | ||
174 | QString name; | 177 | /** |
175 | QString mac; | 178 | * Write the list of allready known devices |
176 | qDebug((*it).latin1() ); | 179 | * |
177 | Config conf((*it)); | 180 | */ |
178 | conf.setGroup("Info"); | 181 | void BlueBase::writeSavedDevices() { |
179 | name = conf.readEntry("name", "Error"); | 182 | QListViewItemIterator it( ListView2 ); |
180 | qDebug("MAC: " + mac); | 183 | BTListItem* item; |
181 | qDebug("NAME: " + name); | 184 | BTDeviceItem* device; |
182 | RemoteDevice currentDevice( mac , name ); | 185 | RemoteDevice::ValueList list; |
183 | loadedDevices.append( currentDevice ); | 186 | for ( ; it.current(); ++it ) { |
184 | } | 187 | item = (BTListItem*)it.current(); |
185 | addSearchedDevices( loadedDevices ); | 188 | if(item->typeId() != BTListItem::Device ) |
189 | continue; | ||
190 | device = (BTDeviceItem*)item; | ||
191 | |||
192 | list.append( device->remoteDevice() ); | ||
186 | } | 193 | } |
187 | 194 | /* | |
188 | /** | 195 | * if not empty save the List through DeviceHandler |
189 | * Write the list of allready known devices | ||
190 | * | ||
191 | */ | 196 | */ |
192 | void BlueBase::writeSavedDevices() { | 197 | if ( list.isEmpty() ) |
193 | QListViewItemIterator it( ListView2 ); | 198 | return; |
194 | BTListItem* item; | 199 | DeviceHandler handler; |
195 | BTDeviceItem* device; | 200 | handler.save( list ); |
196 | 201 | } | |
197 | for ( ; it.current(); ++it ) { | ||
198 | item = (BTListItem*)it.current(); | ||
199 | if(item->typeId() != BTListItem::Device ) | ||
200 | continue; | ||
201 | device = (BTDeviceItem*)item; | ||
202 | // seperate config file for each device, to store more information in future. | ||
203 | qDebug( "/Settings/bluetooth/" + device->mac() + ".conf"); | ||
204 | Config conf( QDir::homeDirPath() + "/Settings/bluetooth/" + device->mac() + ".conf", Config::File ); | ||
205 | conf.setGroup( "Info" ); | ||
206 | conf.writeEntry( "name", device->name() ); | ||
207 | } | ||
208 | } | ||
209 | 202 | ||
210 | 203 | ||
211 | /** | 204 | /** |
212 | * Set up the gui | 205 | * Set up the gui |
213 | */ | 206 | */ |
214 | void BlueBase::initGui() { | 207 | void BlueBase::initGui() { |
215 | StatusLabel->setText( status() ); // maybe move it to getStatus() | 208 | StatusLabel->setText( status() ); // maybe move it to getStatus() |
216 | cryptCheckBox->setChecked( m_useEncryption ); | 209 | cryptCheckBox->setChecked( m_useEncryption ); |
217 | authCheckBox->setChecked( m_enableAuthentification ); | 210 | authCheckBox->setChecked( m_enableAuthentification ); |
218 | pagescanCheckBox->setChecked( m_enablePagescan ); | 211 | pagescanCheckBox->setChecked( m_enablePagescan ); |
219 | inquiryscanCheckBox->setChecked( m_enableInquiryscan ); | 212 | inquiryscanCheckBox->setChecked( m_enableInquiryscan ); |
220 | deviceNameLine->setText( m_deviceName ); | 213 | deviceNameLine->setText( m_deviceName ); |
221 | passkeyLine->setText( m_defaultPasskey ); | 214 | passkeyLine->setText( m_defaultPasskey ); |
222 | // set info tab | 215 | // set info tab |
223 | setInfo(); | 216 | setInfo(); |
224 | } | 217 | } |
225 | 218 | ||
226 | 219 | ||
227 | /** | 220 | /** |
228 | * Get the status informations and returns it | 221 | * Get the status informations and returns it |
229 | * @return QString the status informations gathered | 222 | * @return QString the status informations gathered |
230 | */ | 223 | */ |
231 | QString BlueBase::status()const{ | 224 | QString BlueBase::status()const{ |
232 | QString infoString = tr( "<b>Device name : </b> Ipaq" ); | 225 | QString infoString = tr( "<b>Device name : </b> Ipaq" ); |
233 | infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" ); | 226 | infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" ); |
234 | infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" ); | 227 | infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" ); |
235 | 228 | ||
236 | return (infoString); | 229 | return (infoString); |
237 | } | 230 | } |
238 | 231 | ||
239 | 232 | ||
240 | /** | 233 | /** |
241 | * Read the current values from the gui and invoke writeConfig() | 234 | * Read the current values from the gui and invoke writeConfig() |
242 | */ | 235 | */ |
243 | void BlueBase::applyConfigChanges() { | 236 | void BlueBase::applyConfigChanges() { |
244 | m_deviceName = deviceNameLine->text(); | 237 | m_deviceName = deviceNameLine->text(); |
245 | m_defaultPasskey = passkeyLine->text(); | 238 | m_defaultPasskey = passkeyLine->text(); |
246 | m_useEncryption = cryptCheckBox->isChecked(); | 239 | m_useEncryption = cryptCheckBox->isChecked(); |
247 | m_enableAuthentification = authCheckBox->isChecked(); | 240 | m_enableAuthentification = authCheckBox->isChecked(); |
248 | m_enablePagescan = pagescanCheckBox->isChecked(); | 241 | m_enablePagescan = pagescanCheckBox->isChecked(); |
249 | m_enableInquiryscan = inquiryscanCheckBox->isChecked(); | 242 | m_enableInquiryscan = inquiryscanCheckBox->isChecked(); |
250 | 243 | ||
251 | writeConfig(); | 244 | writeConfig(); |
252 | 245 | ||
253 | QMessageBox::information( this, tr("Test") , tr("Changes were applied.") ); | 246 | QMessageBox::information( this, tr("Test") , tr("Changes were applied.") ); |
254 | } | 247 | } |
255 | 248 | ||
256 | /** | 249 | /** |
257 | * Add fresh found devices from scan dialog to the listing | 250 | * Add fresh found devices from scan dialog to the listing |
258 | * | 251 | * |
259 | */ | 252 | */ |
260 | void BlueBase::addSearchedDevices( const QValueList<RemoteDevice> &newDevices ) { | 253 | void BlueBase::addSearchedDevices( const QValueList<RemoteDevice> &newDevices ) { |
261 | BTDeviceItem * deviceItem; | 254 | BTDeviceItem * deviceItem; |
262 | QValueList<RemoteDevice>::ConstIterator it; | 255 | QValueList<RemoteDevice>::ConstIterator it; |
263 | 256 | ||
264 | for( it = newDevices.begin(); it != newDevices.end() ; ++it ) { | 257 | for( it = newDevices.begin(); it != newDevices.end() ; ++it ) { |
265 | 258 | ||
266 | deviceItem = new BTDeviceItem( ListView2 , (*it) ); | 259 | if (find( (*it) )) // is already inserted |
267 | deviceItem->setExpandable ( true ); | 260 | continue; |
268 | 261 | ||
269 | // look if device is avail. atm, async | 262 | deviceItem = new BTDeviceItem( ListView2 , (*it) ); |
270 | deviceActive( (*it) ); | 263 | deviceItem->setExpandable ( true ); |
271 | 264 | ||
272 | // ggf auch hier? | 265 | // look if device is avail. atm, async |
273 | addServicesToDevice( deviceItem ); | 266 | deviceActive( (*it) ); |
274 | } | 267 | |
268 | // ggf auch hier? | ||
269 | addServicesToDevice( deviceItem ); | ||
275 | } | 270 | } |
271 | } | ||
276 | 272 | ||
277 | 273 | ||
278 | /** | 274 | /** |
279 | * Action that is toggled on entrys on click | 275 | * Action that is toggled on entrys on click |
280 | */ | 276 | */ |
281 | void BlueBase::startServiceActionClicked( QListViewItem */*item*/ ) { | 277 | void BlueBase::startServiceActionClicked( QListViewItem */*item*/ ) { |
282 | } | 278 | } |
283 | 279 | ||
284 | /** | 280 | /** |
285 | * Action that are toggled on hold (mostly QPopups i guess) | 281 | * Action that are toggled on hold (mostly QPopups i guess) |
286 | */ | 282 | */ |
287 | void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int /*column*/ ) { | 283 | void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int /*column*/ ) { |
288 | 284 | ||
289 | QPopupMenu *menu = new QPopupMenu(); | 285 | QPopupMenu *menu = new QPopupMenu(); |
290 | int ret=0; | 286 | int ret=0; |
291 | 287 | ||
292 | if ( ((BTListItem*)item)->type() == "device") { | 288 | if ( ((BTListItem*)item)->type() == "device") { |
293 | 289 | ||
294 | QPopupMenu *groups = new QPopupMenu(); | 290 | QPopupMenu *groups = new QPopupMenu(); |
295 | 291 | ||
296 | menu->insertItem( tr("rescan sevices:"), 0); | 292 | menu->insertItem( tr("rescan sevices:"), 0); |
297 | menu->insertItem( tr("to group"), groups , 1); | 293 | menu->insertItem( tr("to group"), groups , 1); |
298 | menu->insertItem( tr("bound device"), 2); | 294 | menu->insertItem( tr("bound device"), 2); |
299 | menu->insertItem( tr("delete"), 3); | 295 | menu->insertItem( tr("delete"), 3); |
300 | 296 | ||
301 | ret = menu->exec( point , 0); | 297 | ret = menu->exec( point , 0); |
302 | 298 | ||
303 | switch(ret) { | 299 | switch(ret) { |
304 | case -1: | 300 | case -1: |
305 | 301 | ||
306 | break; | 302 | break; |
307 | case 1: | 303 | case 1: |
308 | break; | 304 | break; |
309 | case 2: | 305 | case 2: |
310 | // make connection | 306 | // make connection |
311 | break; | 307 | break; |
312 | case 3: | 308 | case 3: |
313 | // delete childs too | 309 | // delete childs too |
314 | delete item; | 310 | delete item; |
315 | break; | 311 | break; |
316 | } | 312 | } |
317 | delete groups; | 313 | delete groups; |
318 | 314 | ||
319 | } | 315 | } |
320 | /** | 316 | /** |
321 | * We got service sensitive PopupMenus in our factory | 317 | * We got service sensitive PopupMenus in our factory |
322 | * We will create one through the factory and will insert | 318 | * We will create one through the factory and will insert |
323 | * our Separator + ShowInfo into the menu or create a new | 319 | * our Separator + ShowInfo into the menu or create a new |
324 | * one if the factory returns 0 | 320 | * one if the factory returns 0 |
325 | * PopupMenu deletion is kind of weird. | 321 | * PopupMenu deletion is kind of weird. |
326 | * If escaped( -1 ) or any of our items were chosen we'll | 322 | * If escaped( -1 ) or any of our items were chosen we'll |
327 | * delete the PopupMenu otherwise it's the responsibility of | 323 | * delete the PopupMenu otherwise it's the responsibility of |
328 | * the PopupMenu to delete itself | 324 | * the PopupMenu to delete itself |
329 | * | 325 | * |
330 | */ | 326 | */ |
331 | else if ( ((BTListItem*)item)->type() == "service") { | 327 | else if ( ((BTListItem*)item)->type() == "service") { |
332 | BTServiceItem* service = (BTServiceItem*)item; | 328 | BTServiceItem* service = (BTServiceItem*)item; |
333 | QMap<int, QString> list = service->services().classIdList(); | 329 | QMap<int, QString> list = service->services().classIdList(); |
334 | QMap<int, QString>::Iterator it = list.begin(); | 330 | QMap<int, QString>::Iterator it = list.begin(); |
335 | QPopupMenu *popup =0l; | 331 | QPopupMenu *popup =0l; |
336 | if ( it != list.end() ) | 332 | if ( it != list.end() ) { |
333 | qWarning("Searching id %d %s", it.key(), it.data().latin1() ); | ||
337 | popup = m_popHelper.find( it.key(), | 334 | popup = m_popHelper.find( it.key(), |
338 | service->services(), | 335 | service->services(), |
339 | service->parent() ); | 336 | service->parent() ); |
337 | }else { | ||
338 | qWarning("Empty"); | ||
339 | } | ||
340 | 340 | ||
341 | if ( popup == 0l ) { | 341 | if ( popup == 0l ) { |
342 | qWarning("factory returned 0l"); | 342 | qWarning("factory returned 0l"); |
343 | popup = new QPopupMenu(); | 343 | popup = new QPopupMenu(); |
344 | } | 344 | } |
345 | 345 | ||
346 | int test1 = popup->insertItem( tr("Test1:"), 0); | 346 | int test1 = popup->insertItem( tr("Test1:"), 0); |
347 | int con = popup->insertItem( tr("connect"), 1); | 347 | int con = popup->insertItem( tr("connect"), 1); |
348 | int del = popup->insertItem( tr("delete"), 2); | 348 | int del = popup->insertItem( tr("delete"), 2); |
349 | 349 | ||
350 | ret = popup->exec( point ); | 350 | ret = popup->exec( point ); |
351 | 351 | ||
352 | if ( ret == -1 ) | 352 | if ( ret == -1 ) |
353 | delete popup; | 353 | delete popup; |
354 | else if ( ret == test1 ) | 354 | else if ( ret == test1 ) |
355 | delete popup; | 355 | delete popup; |
356 | else if ( ret == con ) | 356 | else if ( ret == con ) |
357 | delete popup; | 357 | delete popup; |
358 | else if ( ret == del ) { | 358 | else if ( ret == del ) { |
359 | // take item first? -zecke | 359 | // take item first? -zecke |
360 | delete item; | 360 | delete item; |
361 | } | 361 | } |
362 | } | 362 | } |
363 | delete menu; | 363 | delete menu; |
364 | } | 364 | } |
365 | 365 | ||
366 | /** | 366 | /** |
367 | * Search and display avail. services for a device (on expand from device listing) | 367 | * Search and display avail. services for a device (on expand from device listing) |
368 | * | 368 | * |
369 | */ | 369 | */ |
370 | void BlueBase::addServicesToDevice( BTDeviceItem * item ) { | 370 | void BlueBase::addServicesToDevice( BTDeviceItem * item ) { |
371 | qDebug("addServicesToDevice"); | 371 | qDebug("addServicesToDevice"); |
372 | // row of mac adress text(3) | 372 | // row of mac adress text(3) |
373 | RemoteDevice device = item->remoteDevice(); | 373 | RemoteDevice device = item->remoteDevice(); |
374 | m_deviceList.insert( item->mac() , item ); | 374 | m_deviceList.insert( item->mac() , item ); |
375 | // and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back | 375 | // and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back |
376 | m_localDevice->searchServices( device ); | 376 | m_localDevice->searchServices( device ); |
377 | } | 377 | } |
378 | 378 | ||
379 | 379 | ||
380 | /** | 380 | /** |
381 | * Overloaded. This one it the one that is connected to the foundServices signal | 381 | * Overloaded. This one it the one that is connected to the foundServices signal |
382 | * @param device the mac address of the remote device | 382 | * @param device the mac address of the remote device |
383 | * @param servicesList the list with the service the device has. | 383 | * @param servicesList the list with the service the device has. |
384 | */ | 384 | */ |
385 | void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) { | 385 | void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) { |
386 | qDebug("fill services list"); | 386 | qDebug("fill services list"); |
387 | 387 | ||
388 | QMap<QString,BTDeviceItem*>::Iterator it; | 388 | QMap<QString,BTDeviceItem*>::Iterator it; |
389 | BTDeviceItem* deviceItem = 0; | 389 | BTDeviceItem* deviceItem = 0; |
390 | 390 | ||
391 | // get the right devices which requested the search | 391 | // get the right devices which requested the search |
392 | it = m_deviceList.find( device ); | 392 | it = m_deviceList.find( device ); |
393 | if( it == m_deviceList.end() ) | 393 | if( it == m_deviceList.end() ) |
394 | return; | 394 | return; |
395 | deviceItem = it.data(); | 395 | deviceItem = it.data(); |
396 | 396 | ||
397 | QValueList<OpieTooth::Services>::Iterator it2; | 397 | QValueList<OpieTooth::Services>::Iterator it2; |
398 | BTServiceItem * serviceItem; | 398 | BTServiceItem * serviceItem; |
399 | 399 | ||
400 | if (!servicesList.isEmpty() ) { | 400 | if (!servicesList.isEmpty() ) { |
401 | // add services | 401 | // add services |
402 | QMap<int, QString> list; | 402 | QMap<int, QString> list; |
403 | QMap<int, QString>::Iterator classIt; | 403 | QMap<int, QString>::Iterator classIt; |
404 | for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) { | 404 | for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) { |
405 | serviceItem = new BTServiceItem( deviceItem , (*it2) ); | 405 | serviceItem = new BTServiceItem( deviceItem , (*it2) ); |
406 | list = (*it2).classIdList(); | 406 | list = (*it2).classIdList(); |
407 | classIt = list.begin(); | 407 | classIt = list.begin(); |
408 | int classId; | 408 | int classId=0; |
409 | if ( classIt != list.end() ) | 409 | if ( classIt != list.end() ) |
410 | classId = classIt.key(); | 410 | classId = classIt.key(); |
411 | serviceItem->setPixmap( 0, m_iconLoader->serviceIcon( classId ) ); | 411 | |
412 | } | 412 | serviceItem->setPixmap( 0, m_iconLoader->serviceIcon( classId ) ); |
413 | } else { | ||
414 | Services s1; | ||
415 | s1.setServiceName( tr("no serives found") ); | ||
416 | serviceItem = new BTServiceItem( deviceItem, s1 ); | ||
417 | } | 413 | } |
418 | // now remove them from the list | 414 | } else { |
419 | m_deviceList.remove( it ); | 415 | Services s1; |
416 | s1.setServiceName( tr("no serives found") ); | ||
417 | serviceItem = new BTServiceItem( deviceItem, s1 ); | ||
420 | } | 418 | } |
419 | // now remove them from the list | ||
420 | m_deviceList.remove( it ); | ||
421 | } | ||
421 | 422 | ||
422 | 423 | ||
423 | /** | 424 | /** |
424 | * Add the existing connections (pairs) to the connections tab. | 425 | * Add the existing connections (pairs) to the connections tab. |
425 | * This one triggers the search | 426 | * This one triggers the search |
426 | */ | 427 | */ |
427 | void BlueBase::addConnectedDevices() { | 428 | void BlueBase::addConnectedDevices() { |
428 | m_localDevice->searchConnections(); | 429 | m_localDevice->searchConnections(); |
429 | } | 430 | } |
430 | 431 | ||
431 | 432 | ||
432 | void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList ) { | 433 | void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList ) { |
433 | QValueList<OpieTooth::ConnectionState>::Iterator it; | 434 | QValueList<OpieTooth::ConnectionState>::Iterator it; |
434 | BTConnectionItem * connectionItem; | 435 | BTConnectionItem * connectionItem; |
435 | 436 | ||
436 | if ( !connectionList.isEmpty() ) { | 437 | if ( !connectionList.isEmpty() ) { |
437 | 438 | ||
438 | for (it = connectionList.begin(); it != connectionList.end(); ++it) { | 439 | for (it = connectionList.begin(); it != connectionList.end(); ++it) { |
439 | connectionItem = new BTConnectionItem( ListView4 , (*it) ); | 440 | connectionItem = new BTConnectionItem( ListView4 , (*it) ); |
440 | } | ||
441 | } else { | ||
442 | ConnectionState con; | ||
443 | con.setMac( tr("No connections found") ); | ||
444 | connectionItem = new BTConnectionItem( ListView4 , con ); | ||
445 | } | 441 | } |
446 | 442 | } else { | |
447 | // recall connection search after some time | 443 | ConnectionState con; |
448 | QTimer::singleShot( 20000, this, SLOT( addConnectedDevices() ) ); | 444 | con.setMac( tr("No connections found") ); |
445 | connectionItem = new BTConnectionItem( ListView4 , con ); | ||
449 | } | 446 | } |
450 | 447 | ||
451 | /** | 448 | // recall connection search after some time |
452 | * Find out if a device can currently be reached | 449 | QTimer::singleShot( 20000, this, SLOT( addConnectedDevices() ) ); |
453 | */ | 450 | } |
454 | void BlueBase::deviceActive( const RemoteDevice &device ) { | ||
455 | // search by mac, async, gets a signal back | ||
456 | // We should have a BTDeviceItem there or where does it get added to the map -zecke | ||
457 | m_localDevice->isAvailable( device.mac() ); | ||
458 | } | ||
459 | 451 | ||
460 | /** | 452 | /** |
461 | * The signal catcher. Set the avail. status on device. | 453 | * Find out if a device can currently be reached |
462 | * @param device - the mac address | 454 | */ |
463 | * @param connected - if it is avail. or not | 455 | void BlueBase::deviceActive( const RemoteDevice &device ) { |
464 | */ | 456 | // search by mac, async, gets a signal back |
465 | void BlueBase::deviceActive( const QString& device, bool connected ) { | 457 | // We should have a BTDeviceItem there or where does it get added to the map -zecke |
466 | qDebug("deviceActive slot"); | 458 | m_localDevice->isAvailable( device.mac() ); |
459 | } | ||
467 | 460 | ||
468 | QMap<QString,BTDeviceItem*>::Iterator it; | 461 | /** |
462 | * The signal catcher. Set the avail. status on device. | ||
463 | * @param device - the mac address | ||
464 | * @param connected - if it is avail. or not | ||
465 | */ | ||
466 | void BlueBase::deviceActive( const QString& device, bool connected ) { | ||
467 | qDebug("deviceActive slot"); | ||
469 | 468 | ||
470 | it = m_deviceList.find( device ); | 469 | QMap<QString,BTDeviceItem*>::Iterator it; |
471 | if( it == m_deviceList.end() ) | ||
472 | return; | ||
473 | 470 | ||
474 | BTDeviceItem* deviceItem = it.data(); | 471 | it = m_deviceList.find( device ); |
472 | if( it == m_deviceList.end() ) | ||
473 | return; | ||
475 | 474 | ||
475 | BTDeviceItem* deviceItem = it.data(); | ||
476 | 476 | ||
477 | if ( connected ) { | 477 | |
478 | deviceItem->setPixmap( 1, m_onPix ); | 478 | if ( connected ) { |
479 | } else { | 479 | deviceItem->setPixmap( 1, m_onPix ); |
480 | deviceItem->setPixmap( 1, m_offPix ); | 480 | } else { |
481 | } | 481 | deviceItem->setPixmap( 1, m_offPix ); |
482 | m_deviceList.remove( it ); | ||
483 | } | 482 | } |
483 | m_deviceList.remove( it ); | ||
484 | } | ||
484 | 485 | ||
485 | /** | 486 | /** |
486 | * Open the "scan for devices" dialog | 487 | * Open the "scan for devices" dialog |
487 | */ | 488 | */ |
488 | void BlueBase::startScan() { | 489 | void BlueBase::startScan() { |
489 | ScanDialog *scan = new ScanDialog( this, "ScanDialog", | 490 | ScanDialog *scan = new ScanDialog( this, "ScanDialog", |
490 | true, WDestructiveClose ); | 491 | true, WDestructiveClose ); |
491 | QObject::connect( scan, SIGNAL( selectedDevices( const QValueList<RemoteDevice>& ) ), | 492 | QObject::connect( scan, SIGNAL( selectedDevices( const QValueList<RemoteDevice>& ) ), |
492 | this, SLOT( addSearchedDevices( const QValueList<RemoteDevice>& ) ) ); | 493 | this, SLOT( addSearchedDevices( const QValueList<RemoteDevice>& ) ) ); |
493 | 494 | ||
494 | scan->showMaximized(); | 495 | scan->showMaximized(); |
495 | } | 496 | } |
496 | 497 | ||
497 | 498 | ||
498 | /** | 499 | /** |
499 | * Set the informations about the local device in information Tab | 500 | * Set the informations about the local device in information Tab |
500 | */ | 501 | */ |
501 | void BlueBase::setInfo() { | 502 | void BlueBase::setInfo() { |
502 | StatusLabel->setText( status() ); | 503 | StatusLabel->setText( status() ); |
503 | } | 504 | } |
504 | 505 | ||
505 | /** | 506 | /** |
506 | * Decontructor | 507 | * Decontructor |
507 | */ | 508 | */ |
508 | BlueBase::~BlueBase() { | 509 | BlueBase::~BlueBase() { |
509 | writeSavedDevices(); | 510 | writeSavedDevices(); |
510 | delete m_iconLoader; | 511 | delete m_iconLoader; |
511 | } | 512 | } |
512 | 513 | ||
514 | /** | ||
515 | * find searches the ListView for a BTDeviceItem containig | ||
516 | * the same Device if found return true else false | ||
517 | * @param dev RemoteDevice to find | ||
518 | * @return returns true if found | ||
519 | */ | ||
520 | bool BlueBase::find( const RemoteDevice& rem ) { | ||
521 | QListViewItemIterator it( ListView2 ); | ||
522 | BTListItem* item; | ||
523 | BTDeviceItem* device; | ||
524 | for (; it.current(); ++it ) { | ||
525 | item = (BTListItem*) it.current(); | ||
526 | if ( item->typeId() != BTListItem::Device ) | ||
527 | continue; | ||
528 | |||
529 | device = (BTDeviceItem*)item; | ||
530 | if ( rem.equals( device->remoteDevice() ) ) | ||
531 | return true; | ||
532 | } | ||
533 | return false; // not found | ||
534 | } | ||
diff --git a/noncore/net/opietooth/manager/bluebase.h b/noncore/net/opietooth/manager/bluebase.h index bbc519c..a68a04b 100644 --- a/noncore/net/opietooth/manager/bluebase.h +++ b/noncore/net/opietooth/manager/bluebase.h | |||
@@ -1,90 +1,91 @@ | |||
1 | 1 | ||
2 | #ifndef BLUEBASE_H | 2 | #ifndef BLUEBASE_H |
3 | #define BLUEBASE_H | 3 | #define BLUEBASE_H |
4 | 4 | ||
5 | #include <qvariant.h> | 5 | #include <qvariant.h> |
6 | #include <qwidget.h> | 6 | #include <qwidget.h> |
7 | #include <qscrollview.h> | 7 | #include <qscrollview.h> |
8 | #include <qsplitter.h> | 8 | #include <qsplitter.h> |
9 | #include <qlist.h> | 9 | #include <qlist.h> |
10 | #include <qpixmap.h> | 10 | #include <qpixmap.h> |
11 | 11 | ||
12 | #include "bluetoothbase.h" | 12 | #include "bluetoothbase.h" |
13 | 13 | ||
14 | #include "btserviceitem.h" | 14 | #include "btserviceitem.h" |
15 | #include "btdeviceitem.h" | 15 | #include "btdeviceitem.h" |
16 | #include "popuphelper.h" | 16 | #include "popuphelper.h" |
17 | 17 | ||
18 | #include "bticonloader.h" | 18 | #include "bticonloader.h" |
19 | 19 | ||
20 | #include <remotedevice.h> | 20 | #include <remotedevice.h> |
21 | #include <manager.h> | 21 | #include <manager.h> |
22 | 22 | ||
23 | class QVBox; | 23 | class QVBox; |
24 | class QHBoxLayout; | 24 | class QHBoxLayout; |
25 | class QGridLayout; | 25 | class QGridLayout; |
26 | class QFrame; | 26 | class QFrame; |
27 | class QLabel; | 27 | class QLabel; |
28 | class QPushButton; | 28 | class QPushButton; |
29 | class QTabWidget; | 29 | class QTabWidget; |
30 | class QCheckBox; | 30 | class QCheckBox; |
31 | 31 | ||
32 | 32 | ||
33 | namespace OpieTooth { | 33 | namespace OpieTooth { |
34 | 34 | ||
35 | class BlueBase : public BluetoothBase { | 35 | class BlueBase : public BluetoothBase { |
36 | Q_OBJECT | 36 | Q_OBJECT |
37 | 37 | ||
38 | public: | 38 | public: |
39 | BlueBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 39 | BlueBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
40 | ~BlueBase(); | 40 | ~BlueBase(); |
41 | 41 | ||
42 | protected: | 42 | protected: |
43 | 43 | ||
44 | 44 | ||
45 | private slots: | 45 | private slots: |
46 | void startScan(); | 46 | void startScan(); |
47 | 47 | ||
48 | private: | 48 | private: |
49 | bool find( const RemoteDevice& device ); | ||
49 | void readConfig(); | 50 | void readConfig(); |
50 | void writeConfig(); | 51 | void writeConfig(); |
51 | void readSavedDevices(); | 52 | void readSavedDevices(); |
52 | void writeSavedDevices(); | 53 | void writeSavedDevices(); |
53 | void writeToHciConfig(); | 54 | void writeToHciConfig(); |
54 | QString status()const; | 55 | QString status()const; |
55 | void initGui(); | 56 | void initGui(); |
56 | void setInfo(); | 57 | void setInfo(); |
57 | PopupHelper m_popHelper; | 58 | PopupHelper m_popHelper; |
58 | Manager *m_localDevice; | 59 | Manager *m_localDevice; |
59 | QMap<QString,BTDeviceItem*> m_deviceList; | 60 | QMap<QString,BTDeviceItem*> m_deviceList; |
60 | 61 | ||
61 | void deviceActive( const RemoteDevice &device ); | 62 | void deviceActive( const RemoteDevice &device ); |
62 | 63 | ||
63 | QString m_deviceName; | 64 | QString m_deviceName; |
64 | QString m_defaultPasskey; | 65 | QString m_defaultPasskey; |
65 | bool m_useEncryption; | 66 | bool m_useEncryption; |
66 | bool m_enableAuthentification; | 67 | bool m_enableAuthentification; |
67 | bool m_enablePagescan; | 68 | bool m_enablePagescan; |
68 | bool m_enableInquiryscan; | 69 | bool m_enableInquiryscan; |
69 | 70 | ||
70 | QPixmap m_offPix; | 71 | QPixmap m_offPix; |
71 | QPixmap m_onPix; | 72 | QPixmap m_onPix; |
72 | 73 | ||
73 | BTIconLoader *m_iconLoader; | 74 | BTIconLoader *m_iconLoader; |
74 | 75 | ||
75 | private slots: | 76 | private slots: |
76 | void addSearchedDevices( const QValueList<RemoteDevice> &newDevices ); | 77 | void addSearchedDevices( const QValueList<RemoteDevice> &newDevices ); |
77 | void addServicesToDevice( BTDeviceItem *item ); | 78 | void addServicesToDevice( BTDeviceItem *item ); |
78 | void addServicesToDevice( const QString& device, Services::ValueList ); | 79 | void addServicesToDevice( const QString& device, Services::ValueList ); |
79 | void addConnectedDevices(); | 80 | void addConnectedDevices(); |
80 | void addConnectedDevices( ConnectionState::ValueList ); | 81 | void addConnectedDevices( ConnectionState::ValueList ); |
81 | void startServiceActionClicked( QListViewItem *item ); | 82 | void startServiceActionClicked( QListViewItem *item ); |
82 | void startServiceActionHold( QListViewItem *, const QPoint &, int ); | 83 | void startServiceActionHold( QListViewItem *, const QPoint &, int ); |
83 | void deviceActive( const QString& mac, bool connected ); | 84 | void deviceActive( const QString& mac, bool connected ); |
84 | void applyConfigChanges(); | 85 | void applyConfigChanges(); |
85 | 86 | ||
86 | }; | 87 | }; |
87 | 88 | ||
88 | } | 89 | } |
89 | 90 | ||
90 | #endif | 91 | #endif |
diff --git a/noncore/net/opietooth/manager/bticonloader.cpp b/noncore/net/opietooth/manager/bticonloader.cpp index f299117..a26af54 100644 --- a/noncore/net/opietooth/manager/bticonloader.cpp +++ b/noncore/net/opietooth/manager/bticonloader.cpp | |||
@@ -5,74 +5,74 @@ | |||
5 | #include <qpe/resource.h> | 5 | #include <qpe/resource.h> |
6 | 6 | ||
7 | namespace OpieTooth { | 7 | namespace OpieTooth { |
8 | 8 | ||
9 | 9 | ||
10 | BTIconLoader::BTIconLoader() { | 10 | BTIconLoader::BTIconLoader() { |
11 | 11 | ||
12 | // still need to find out real ids | 12 | // still need to find out real ids |
13 | deviceIcons.insert( 100 , "computer_16" ); | 13 | deviceIcons.insert( 100 , "computer_16" ); |
14 | deviceIcons.insert( 101 , "phone_16" ); | 14 | deviceIcons.insert( 101 , "phone_16" ); |
15 | deviceIcons.insert( 102 , "brain_16" ); | 15 | deviceIcons.insert( 102 , "brain_16" ); |
16 | deviceIcons.insert( 103 , "conduit_16" ); | 16 | deviceIcons.insert( 103 , "conduit_16" ); |
17 | 17 | ||
18 | 18 | ||
19 | serviceIcons.insert( 4357 , "obex_16" ); //OBEXObjectPush | 19 | serviceIcons.insert( 4357 , "obex_16" ); //OBEXObjectPush |
20 | serviceIcons.insert( 4358 , "obex_16" ); //OBEXFileTransfer | 20 | serviceIcons.insert( 4358 , "obex_16" ); //OBEXFileTransfer |
21 | serviceIcons.insert( 4369 , "print_16" ); //Fax | 21 | serviceIcons.insert( 4369 , "print_16" ); //Fax |
22 | serviceIcons.insert( 4353 , "serial_16" ); //SerialPort | 22 | serviceIcons.insert( 4353 , "serial_16" ); //SerialPort |
23 | serviceIcons.insert( 4356 , "sync_16" ); //IrMCSync | 23 | serviceIcons.insert( 4356 , "sync_16" ); //IrMCSync |
24 | serviceIcons.insert( 4359 , "sync_16" ); //IrMCSyncCommand | 24 | serviceIcons.insert( 4359 , "sync_16" ); //IrMCSyncCommand |
25 | serviceIcons.insert( 4354 , "network_16" ); //LANAccessUsingPPP | 25 | serviceIcons.insert( 4354 , "network_16" ); //LANAccessUsingPPP |
26 | serviceIcons.insert( 4355 , "network_16"); //DialupNetworking | 26 | serviceIcons.insert( 4355 , "network_16"); //DialupNetworking |
27 | serviceIcons.insert( 4360 , "phone_16"); // Headset | 27 | serviceIcons.insert( 4360 , "phone_16"); // Headset |
28 | serviceIcons.insert( 4370 , "audio_16"); //HeadsetAudioGateway | 28 | serviceIcons.insert( 4370 , "audio_16"); //HeadsetAudioGateway |
29 | serviceIcons.insert( 4361 , "phone_16"); // CordlessTelephony | 29 | serviceIcons.insert( 4361 , "phone_16"); // CordlessTelephony |
30 | serviceIcons.insert( 4362 , "audio_16"); // AudioSource | 30 | serviceIcons.insert( 4362 , "audio_16"); // AudioSource |
31 | serviceIcons.insert( 4363 , "audio_16"); // AudioSink | 31 | serviceIcons.insert( 4363 , "audio_16"); // AudioSink |
32 | serviceIcons.insert( 4390 , "print_16" ); //HCR_Print | 32 | serviceIcons.insert( 4390 , "print_16" ); //HCR_Print |
33 | serviceIcons.insert( 4392 , "phone_16" ); //Common_ISDN_Access | 33 | serviceIcons.insert( 4392 , "phone_16" ); //Common_ISDN_Access |
34 | 34 | ||
35 | serviceIcons.insert( 4609 , "network_16" ); //GenericNetworking | 35 | serviceIcons.insert( 4609 , "network_16" ); //GenericNetworking |
36 | serviceIcons.insert( 4610 , "folder_16" ); //GenericFileTransfer | 36 | serviceIcons.insert( 4610 , "folder_16" ); //GenericFileTransfer |
37 | serviceIcons.insert( 4392 , "audio_16" ); //GenericAudio | 37 | serviceIcons.insert( 4392 , "audio_16" ); //GenericAudio |
38 | // serviceIcons.insert( 4392 , "phone_16" ); //GenericTelephony | 38 | // serviceIcons.insert( 4392 , "phone_16" ); //GenericTelephony |
39 | // the above is duplicated? -zecke | 39 | // the above is duplicated? -zecke |
40 | 40 | ||
41 | //serviceIcons.insert( "106" , "link_16" ); | 41 | //serviceIcons.insert( "106" , "link_16" ); |
42 | //serviceIcons.insert( "107" , "misc_16" ); | 42 | //serviceIcons.insert( "107" , "misc_16" ); |
43 | } | 43 | } |
44 | 44 | ||
45 | BTIconLoader::~BTIconLoader() { | 45 | BTIconLoader::~BTIconLoader() { |
46 | } | 46 | } |
47 | 47 | ||
48 | QPixmap BTIconLoader::deviceIcon( int deviceClass ) { | 48 | QPixmap BTIconLoader::deviceIcon( int deviceClass ) { |
49 | 49 | ||
50 | QString iconName; | 50 | QString iconName; |
51 | 51 | ||
52 | QMap<int, QString>::Iterator it; | 52 | QMap<int, QString>::Iterator it; |
53 | 53 | ||
54 | it = deviceIcons.find( deviceClass ); | 54 | it = deviceIcons.find( deviceClass ); |
55 | iconName = it.data(); | 55 | iconName = it.data(); |
56 | 56 | ||
57 | if ( iconName.isEmpty() ) { | 57 | if ( iconName.isEmpty() ) { |
58 | iconName = "unknown_16"; | 58 | iconName = "unknown_16"; |
59 | } | 59 | } |
60 | return( Resource::loadPixmap( "opietooth/icons/" + iconName ) ); | 60 | return( Resource::loadPixmap( "opietooth/icons/" + iconName ) ); |
61 | } | 61 | } |
62 | 62 | ||
63 | QPixmap BTIconLoader::serviceIcon( int serviceClass ) { | 63 | QPixmap BTIconLoader::serviceIcon( int serviceClass ) { |
64 | 64 | ||
65 | QString iconName; | 65 | QString iconName; |
66 | 66 | ||
67 | QMap<int, QString>::Iterator it; | 67 | QMap<int, QString>::Iterator it; |
68 | 68 | ||
69 | it = deviceIcons.find( serviceClass ); | 69 | it = serviceIcons.find( serviceClass ); |
70 | iconName = it.data(); | 70 | iconName = it.data(); |
71 | 71 | ||
72 | if ( iconName.isEmpty() ) { | 72 | if ( iconName.isEmpty() ) { |
73 | iconName = "unknown_16"; | 73 | iconName = "unknown_16"; |
74 | } | 74 | } |
75 | return( Resource::loadPixmap( "opietooth/icons/" + iconName ) ); | 75 | return( Resource::loadPixmap( "opietooth/icons/" + iconName ) ); |
76 | } | 76 | } |
77 | 77 | ||
78 | } | 78 | } |
diff --git a/noncore/net/opietooth/manager/devicehandler.cpp b/noncore/net/opietooth/manager/devicehandler.cpp new file mode 100644 index 0000000..9c5b817 --- a/dev/null +++ b/noncore/net/opietooth/manager/devicehandler.cpp | |||
@@ -0,0 +1,87 @@ | |||
1 | |||
2 | #include <stdlib.h> | ||
3 | |||
4 | #include <qdir.h> | ||
5 | #include <qpe/config.h> | ||
6 | |||
7 | #include "devicehandler.h" | ||
8 | |||
9 | using namespace OpieTooth; | ||
10 | |||
11 | DeviceHandler::DeviceHandler() { | ||
12 | |||
13 | }; | ||
14 | DeviceHandler::~DeviceHandler() { | ||
15 | |||
16 | } | ||
17 | |||
18 | RemoteDevice::ValueList DeviceHandler::load() { | ||
19 | RemoteDevice::ValueList list; | ||
20 | QString path = QDir::homeDirPath() + "/Settings/bluetooth"; | ||
21 | QDir deviceListSave( path); | ||
22 | |||
23 | // list of .conf files | ||
24 | QStringList devicesFileList = deviceListSave.entryList(); | ||
25 | |||
26 | |||
27 | // cut .conf of to get the mac and also read the name entry in it. | ||
28 | if (!devicesFileList.isEmpty() ) { | ||
29 | QString name; | ||
30 | QString mac; | ||
31 | QStringList::Iterator it; | ||
32 | for (it = devicesFileList.begin(); it != devicesFileList.end(); ++it ) { | ||
33 | if ( (*it) == "." || (*it) == ".." ) | ||
34 | continue; | ||
35 | |||
36 | qDebug((*it).latin1() ); | ||
37 | Config conf(path + "/"+(*it), Config::File); | ||
38 | conf.setGroup("Info"); | ||
39 | name = conf.readEntry("name", "Error"); | ||
40 | mac = conf.readEntry("mac", QString::null); | ||
41 | qDebug("MAC: " + mac); | ||
42 | qDebug("NAME: " + name); | ||
43 | if (mac.isEmpty() ) | ||
44 | continue; | ||
45 | RemoteDevice currentDevice( mac , name ); | ||
46 | list.append( currentDevice ); | ||
47 | } | ||
48 | } | ||
49 | return list; | ||
50 | }; | ||
51 | /* | ||
52 | * This is some how rude but make sure all old devices | ||
53 | * are getting deleted | ||
54 | */ | ||
55 | void DeviceHandler::save( const RemoteDevice::ValueList& list) { | ||
56 | QCString rm; | ||
57 | rm += "rm -rf "; | ||
58 | rm += QDir::homeDirPath() + "/Settings/bluetooth"; | ||
59 | system ( rm.data() ); | ||
60 | |||
61 | if (list.isEmpty() ) // no need to create the dir | ||
62 | return; | ||
63 | |||
64 | /** | ||
65 | * Create a new dir | ||
66 | */ | ||
67 | rm = "mkdir "; | ||
68 | rm += QDir::homeDirPath() + "/Settings/bluetooth"; | ||
69 | qWarning("out %s", rm.data() ); | ||
70 | system( rm.data() ); | ||
71 | |||
72 | RemoteDevice::ValueList::ConstIterator it; | ||
73 | // write the config | ||
74 | |||
75 | for ( it = list.begin(); it != list.end(); ++it ) { | ||
76 | qDebug( "/Settings/bluetooth/" + (*it).mac() + ".conf"); | ||
77 | |||
78 | Config conf( QDir::homeDirPath() + | ||
79 | "/Settings/bluetooth/" + | ||
80 | (*it).mac() + ".conf", Config::File ); | ||
81 | |||
82 | conf.setGroup( "Info" ); | ||
83 | conf.writeEntry( "name", (*it).name() ); | ||
84 | conf.writeEntry( "mac", (*it).mac() ); | ||
85 | } | ||
86 | |||
87 | } | ||
diff --git a/noncore/net/opietooth/manager/devicehandler.h b/noncore/net/opietooth/manager/devicehandler.h new file mode 100644 index 0000000..5cfe048 --- a/dev/null +++ b/noncore/net/opietooth/manager/devicehandler.h | |||
@@ -0,0 +1,41 @@ | |||
1 | |||
2 | #ifndef OPIE_TOOTH_DEVICE_HANDLER_H | ||
3 | #define OPIE_TOOTH_DEVICE_HANDLER_H | ||
4 | |||
5 | #include <qvaluelist.h> | ||
6 | |||
7 | #include <remotedevice.h> | ||
8 | |||
9 | namespace OpieTooth { | ||
10 | /** | ||
11 | * DeviceHandler is responsible for loading | ||
12 | * and saving devices from a config File | ||
13 | */ | ||
14 | class DeviceHandler { | ||
15 | public: | ||
16 | /** | ||
17 | * c'tor | ||
18 | */ | ||
19 | DeviceHandler(); | ||
20 | |||
21 | /** | ||
22 | * d'tor | ||
23 | */ | ||
24 | ~DeviceHandler(); | ||
25 | |||
26 | /** | ||
27 | * loads from $HOME/Settings/bluetooth/ * | ||
28 | */ | ||
29 | RemoteDevice::ValueList load(); | ||
30 | |||
31 | /** | ||
32 | * Saves to $HOME/Settings/bluetooth | ||
33 | */ | ||
34 | void save( const RemoteDevice::ValueList & ); | ||
35 | |||
36 | }; | ||
37 | |||
38 | |||
39 | }; | ||
40 | |||
41 | #endif | ||
diff --git a/noncore/net/opietooth/manager/hciconfwrapper.cpp b/noncore/net/opietooth/manager/hciconfwrapper.cpp index 5f74fee..46eed42 100644 --- a/noncore/net/opietooth/manager/hciconfwrapper.cpp +++ b/noncore/net/opietooth/manager/hciconfwrapper.cpp | |||
@@ -5,108 +5,136 @@ | |||
5 | #include <qstringlist.h> | 5 | #include <qstringlist.h> |
6 | #include <qregexp.h> | 6 | #include <qregexp.h> |
7 | 7 | ||
8 | namespace OpieTooth { | 8 | namespace OpieTooth { |
9 | 9 | ||
10 | 10 | ||
11 | HciConfWrapper::HciConfWrapper( const QString &fileName) { | 11 | HciConfWrapper::HciConfWrapper( const QString &fileName) { |
12 | m_fileName = fileName; | 12 | m_fileName = fileName; |
13 | } | 13 | } |
14 | 14 | ||
15 | HciConfWrapper::~HciConfWrapper() { | 15 | HciConfWrapper::~HciConfWrapper() { |
16 | } | 16 | } |
17 | 17 | ||
18 | 18 | ||
19 | void HciConfWrapper::setPinHelper( const QString& app ) { | 19 | void HciConfWrapper::setPinHelper( const QString& app ) { |
20 | setValue( "pin_helper" , app ); | 20 | setValue( "pin_helper" , app ); |
21 | } | 21 | } |
22 | 22 | ||
23 | void HciConfWrapper::setName( const QString &name ) { | 23 | void HciConfWrapper::setName( const QString &name ) { |
24 | qDebug ("NAME : " + name); | 24 | qDebug ("NAME : " + name); |
25 | setValue( "name" , "\"" + name + "\"" ); | 25 | setValue( "name" , "\"" + name + "\"" ); |
26 | } | 26 | } |
27 | 27 | ||
28 | void HciConfWrapper::setIscan( bool enable) { | 28 | void HciConfWrapper::setIscan( bool enable) { |
29 | 29 | ||
30 | if ( enable ) { | 30 | if ( enable ) { |
31 | setValue( "iscan" , "enable" ); | 31 | setValue( "iscan" , "enable" ); |
32 | } else { | 32 | } else { |
33 | setValue( "iscan" , "disable" ); | 33 | setValue( "iscan" , "disable" ); |
34 | } | 34 | } |
35 | } | 35 | } |
36 | 36 | ||
37 | void HciConfWrapper::setPscan( bool enable) { | 37 | void HciConfWrapper::setPscan( bool enable) { |
38 | 38 | ||
39 | if ( enable ) { | 39 | if ( enable ) { |
40 | setValue( "pscan" , "enable" ); | 40 | setValue( "pscan" , "enable" ); |
41 | } else { | 41 | } else { |
42 | setValue( "pscan" , "disable" ); | 42 | setValue( "pscan" , "disable" ); |
43 | } | 43 | } |
44 | } | 44 | } |
45 | 45 | ||
46 | 46 | ||
47 | void HciConfWrapper::setAuth( bool enable) { | 47 | void HciConfWrapper::setAuth( bool enable) { |
48 | 48 | ||
49 | if ( enable ) { | 49 | if ( enable ) { |
50 | setValue( "auth" , "enable" ); | 50 | setValue( "auth" , "enable" ); |
51 | } else { | 51 | } else { |
52 | setValue( "auth" , "disable" ); | 52 | setValue( "auth" , "disable" ); |
53 | } | 53 | } |
54 | } | 54 | } |
55 | 55 | ||
56 | 56 | ||
57 | void HciConfWrapper::setEncrypt( bool enable) { | 57 | void HciConfWrapper::setEncrypt( bool enable) { |
58 | 58 | ||
59 | if ( enable ) { | 59 | if ( enable ) { |
60 | setValue( "encrypt" , "enable" ); | 60 | setValue( "encrypt" , "enable" ); |
61 | } else { | 61 | } else { |
62 | setValue( "encrypt" , "disable" ); | 62 | setValue( "encrypt" , "disable" ); |
63 | } | 63 | } |
64 | } | 64 | } |
65 | 65 | ||
66 | 66 | ||
67 | void HciConfWrapper::setValue(const QString &key, const QString &value ) { | 67 | void HciConfWrapper::setValue(const QString &key, const QString &value ) { |
68 | 68 | ||
69 | QFile f( m_fileName ); | 69 | if (m_file.isEmpty() ) // load first |
70 | QFile f2( m_fileName ); | ||
71 | |||
72 | if ( !f.open( IO_ReadOnly) ) { | ||
73 | qDebug("Could not open readonly"); | ||
74 | return; | 70 | return; |
75 | } | ||
76 | |||
77 | if ( !f2.open( IO_ReadWrite ) ) { | ||
78 | qDebug("Just readonly - not enough"); | ||
79 | return; | ||
80 | } | ||
81 | 71 | ||
82 | QStringList list; | 72 | QStringList::Iterator it; |
83 | qDebug(m_fileName); | ||
84 | QTextStream stream ( &f); | ||
85 | QTextStream outstream (&f2); | ||
86 | 73 | ||
87 | QString str; | 74 | QString str; |
88 | while ( !(str=stream.readLine()).isNull() ) { | 75 | for (it = m_file.begin(); it != m_file.end(); ++it ) { |
89 | 76 | str = (*it); | |
90 | |||
91 | //qDebug(str); | ||
92 | if( (str.contains(key)) > 0 ) { | 77 | if( (str.contains(key)) > 0 ) { |
93 | qDebug("Found"); | 78 | qDebug("Found"); |
94 | // still need to look if its commented out!!! | 79 | // still need to look if its commented out!!! |
95 | str.simplifyWhiteSpace(); | 80 | str.simplifyWhiteSpace(); |
96 | qDebug( key ); | 81 | qDebug( key ); |
97 | if (str.startsWith("#")) { | 82 | if (str.startsWith("#")) { |
98 | str = (key + " " + value + ";"); | 83 | str = (key + " " + value + ";"); |
99 | } else { | 84 | } else { |
100 | str = str.replace( QRegExp( "\\s*"+key+"\\s+[^\\s][^;]*;" ), key + " " + value + ";"); | 85 | str = str.replace( QRegExp( "\\s*"+key+"\\s+[^\\s][^;]*;" ), key + " " + value + ";"); |
101 | } | 86 | } |
102 | qDebug( str ); | 87 | qDebug( str ); |
88 | it = m_file.remove( it ); | ||
89 | it = m_file.insert( it, str ); | ||
90 | //return; the regexp is too wide -zecke // all set | ||
103 | } | 91 | } |
104 | outstream << str << endl; | ||
105 | } | 92 | } |
106 | 93 | ||
107 | f.close(); | ||
108 | 94 | ||
109 | f2.flush(); | ||
110 | f2.close(); | ||
111 | } | 95 | } |
96 | |||
97 | /** | ||
98 | * This loads the config file and stores it inside | ||
99 | * the m_file | ||
100 | */ | ||
101 | void HciConfWrapper::load() { | ||
102 | qWarning("loaded"); | ||
103 | m_file.clear(); | ||
104 | QFile file( m_fileName ); | ||
105 | if (!file.open( IO_ReadOnly ) ) { | ||
106 | qDebug("Could not open"); | ||
107 | return; | ||
108 | } | ||
109 | |||
110 | /** | ||
111 | * readAll() into a QByteArray | ||
112 | * QStringList::split('\n', array ) | ||
113 | * would this be faster? -zecke | ||
114 | */ | ||
115 | QTextStream stream(&file ); | ||
116 | QString tmp; | ||
117 | while ( !stream.atEnd() ) { | ||
118 | tmp = stream.readLine(); | ||
119 | m_file.append( tmp ); | ||
120 | } | ||
121 | } | ||
122 | void HciConfWrapper::save() { | ||
123 | qWarning("save"); | ||
124 | if (m_file.isEmpty() ) // load first | ||
125 | return; | ||
126 | |||
127 | QFile file( m_fileName ); | ||
128 | if ( !file.open(IO_WriteOnly ) ) { | ||
129 | qWarning("could not open %s", m_fileName.latin1() ); | ||
130 | return; | ||
131 | } | ||
132 | |||
133 | QTextStream stream(&file ); | ||
134 | QStringList::Iterator it; | ||
135 | for ( it = m_file.begin(); it != m_file.end(); ++it ) { | ||
136 | stream << (*it) << endl; | ||
137 | } | ||
138 | qWarning("saved"); | ||
139 | }; | ||
112 | } | 140 | } |
diff --git a/noncore/net/opietooth/manager/hciconfwrapper.h b/noncore/net/opietooth/manager/hciconfwrapper.h index de8c9a8..0c4b290 100644 --- a/noncore/net/opietooth/manager/hciconfwrapper.h +++ b/noncore/net/opietooth/manager/hciconfwrapper.h | |||
@@ -1,30 +1,34 @@ | |||
1 | #ifndef HCICONFWRAPPER_H | 1 | #ifndef HCICONFWRAPPER_H |
2 | #define HCICONFWRAPPER_H | 2 | #define HCICONFWRAPPER_H |
3 | 3 | ||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | #include <qstringlist.h> | ||
5 | 6 | ||
6 | namespace OpieTooth { | 7 | namespace OpieTooth { |
7 | 8 | ||
8 | class HciConfWrapper { | 9 | class HciConfWrapper { |
9 | 10 | ||
10 | public: | 11 | public: |
11 | HciConfWrapper( const QString &fileName ); | 12 | HciConfWrapper( const QString &fileName ); |
12 | ~HciConfWrapper(); | 13 | ~HciConfWrapper(); |
14 | void load(); | ||
15 | void save(); | ||
13 | 16 | ||
14 | void setPinHelper( const QString& app ); | 17 | void setPinHelper( const QString& app ); |
15 | void setName( const QString& name ); | 18 | void setName( const QString& name ); |
16 | void setIscan( bool enable ); | 19 | void setIscan( bool enable ); |
17 | void setPscan( bool enable ); | 20 | void setPscan( bool enable ); |
18 | void setAuth( bool enable); | 21 | void setAuth( bool enable); |
19 | void setEncrypt( bool enable); | 22 | void setEncrypt( bool enable); |
20 | 23 | ||
21 | private: | 24 | private: |
22 | 25 | ||
23 | void setValue(const QString &entry, const QString &value ); | 26 | void setValue(const QString &entry, const QString &value ); |
24 | 27 | ||
25 | QString m_fileName; | 28 | QString m_fileName; |
29 | QStringList m_file; | ||
26 | }; | 30 | }; |
27 | 31 | ||
28 | } | 32 | } |
29 | 33 | ||
30 | #endif | 34 | #endif |
diff --git a/noncore/net/opietooth/manager/manager.pro b/noncore/net/opietooth/manager/manager.pro index 0bdd6b9..762b028 100644 --- a/noncore/net/opietooth/manager/manager.pro +++ b/noncore/net/opietooth/manager/manager.pro | |||
@@ -1,27 +1,40 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | CONFIG = qt warn_on debug | 2 | CONFIG = qt warn_on debug |
3 | #CONFIG = qt warn_on release | 3 | #CONFIG = qt warn_on release |
4 | HEADERS = btconnectionitem.h btdeviceitem.h btserviceitem.h stdpopups.h popuphelper.h bluebase.h scandialog.h btlistitem.h hciconfwrapper.h bticonloader.h pppdialog.h obexdialog.h | 4 | HEADERS = btconnectionitem.h btdeviceitem.h \ |
5 | SOURCES = btconnectionitem.cpp btdeviceitem.cpp btserviceitem.h stdpopups.cpp popuphelper.cpp main.cpp bluebase.cpp scandialog.cpp btlistitem.cpp hciconfwrapper.cpp bticonloader.cpp pppdialog.cpp obexdialog.cpp | 5 | btserviceitem.h stdpopups.h \ |
6 | popuphelper.h bluebase.h \ | ||
7 | scandialog.h btlistitem.h \ | ||
8 | hciconfwrapper.h bticonloader.h \ | ||
9 | pppdialog.h obexdialog.h \ | ||
10 | devicehandler.h | ||
11 | |||
12 | SOURCES = btconnectionitem.cpp btdeviceitem.cpp \ | ||
13 | btserviceitem.cpp stdpopups.cpp \ | ||
14 | popuphelper.cpp main.cpp \ | ||
15 | bluebase.cpp scandialog.cpp \ | ||
16 | btlistitem.cpp hciconfwrapper.cpp \ | ||
17 | bticonloader.cpp pppdialog.cpp \ | ||
18 | obexdialog.cpp devicehandler.cpp | ||
6 | INCLUDEPATH += $(OPIEDIR)/include | 19 | INCLUDEPATH += $(OPIEDIR)/include |
7 | INCLUDEPATH += $(OPIEDIR)/noncore/net/opietooth/lib | 20 | INCLUDEPATH += $(OPIEDIR)/noncore/net/opietooth/lib |
8 | DEPENDPATH += $(OPIEDIR)/include | 21 | DEPENDPATH += $(OPIEDIR)/include |
9 | LIBS += -lqpe -lopietooth -lopie | 22 | LIBS += -lqpe -lopietooth -lopie |
10 | INTERFACES = bluetoothbase.ui devicedialog.ui | 23 | INTERFACES = bluetoothbase.ui devicedialog.ui |
11 | DESTDIR = $(OPIEDIR)/bin | 24 | DESTDIR = $(OPIEDIR)/bin |
12 | TARGET = bluetooth-manager | 25 | TARGET = bluetooth-manager |
13 | 26 | ||
14 | TRANSLATIONS = ../../../../i18n/de/bluetooth-manager.ts \ | 27 | TRANSLATIONS = ../../../../i18n/de/bluetooth-manager.ts \ |
15 | ../../../../i18n/en/bluetooth-manager.ts \ | 28 | ../../../../i18n/en/bluetooth-manager.ts \ |
16 | ../../../../i18n/es/bluetooth-manager.ts \ | 29 | ../../../../i18n/es/bluetooth-manager.ts \ |
17 | ../../../../i18n/fr/bluetooth-manager.ts \ | 30 | ../../../../i18n/fr/bluetooth-manager.ts \ |
18 | ../../../../i18n/hu/bluetooth-manager.ts \ | 31 | ../../../../i18n/hu/bluetooth-manager.ts \ |
19 | ../../../../i18n/ja/bluetooth-manager.ts \ | 32 | ../../../../i18n/ja/bluetooth-manager.ts \ |
20 | ../../../../i18n/ko/bluetooth-manager.ts \ | 33 | ../../../../i18n/ko/bluetooth-manager.ts \ |
21 | ../../../../i18n/no/bluetooth-manager.ts \ | 34 | ../../../../i18n/no/bluetooth-manager.ts \ |
22 | ../../../../i18n/pl/bluetooth-manager.ts \ | 35 | ../../../../i18n/pl/bluetooth-manager.ts \ |
23 | ../../../../i18n/pt/bluetooth-manager.ts \ | 36 | ../../../../i18n/pt/bluetooth-manager.ts \ |
24 | ../../../../i18n/pt_BR/bluetooth-manager.ts \ | 37 | ../../../../i18n/pt_BR/bluetooth-manager.ts \ |
25 | ../../../../i18n/sl/bluetooth-manager.ts \ | 38 | ../../../../i18n/sl/bluetooth-manager.ts \ |
26 | ../../../../i18n/zh_CN/bluetooth-manager.ts \ | 39 | ../../../../i18n/zh_CN/bluetooth-manager.ts \ |
27 | ../../../../i18n/zh_TW/bluetooth-manager.ts | 40 | ../../../../i18n/zh_TW/bluetooth-manager.ts |
diff --git a/noncore/net/opietooth/manager/popuphelper.cpp b/noncore/net/opietooth/manager/popuphelper.cpp index 26c4b02..4ef1ed5 100644 --- a/noncore/net/opietooth/manager/popuphelper.cpp +++ b/noncore/net/opietooth/manager/popuphelper.cpp | |||
@@ -1,30 +1,30 @@ | |||
1 | 1 | ||
2 | #include "stdpopups.h" | 2 | #include "stdpopups.h" |
3 | 3 | ||
4 | #include "popuphelper.h" | 4 | #include "popuphelper.h" |
5 | 5 | ||
6 | using namespace OpieTooth; | 6 | using namespace OpieTooth; |
7 | 7 | ||
8 | PopupHelper::PopupHelper() { | 8 | PopupHelper::PopupHelper() { |
9 | init(); | 9 | init(); |
10 | } | 10 | } |
11 | PopupHelper::~PopupHelper() { | 11 | PopupHelper::~PopupHelper() { |
12 | 12 | ||
13 | } | 13 | } |
14 | void PopupHelper::insert( int id, popupFactory fact ) { | 14 | void PopupHelper::insert( int id, popupFactory fact ) { |
15 | m_map.insert(id, fact ); | 15 | m_map.insert(id, fact ); |
16 | } | 16 | } |
17 | QPopupMenu* PopupHelper::find( int id, const Services& ser, QListViewItem* item ) { | 17 | QPopupMenu* PopupHelper::find( int id, const Services& ser, QListViewItem* item ) { |
18 | qWarning("find"); | 18 | //qWarning("find"); |
19 | FactoryMap::Iterator it = m_map.find(id ); | 19 | FactoryMap::Iterator it = m_map.find(id ); |
20 | if ( it != m_map.end() ) { | 20 | if ( it != m_map.end() ) { |
21 | qWarning("found"); | 21 | //qWarning("found"); |
22 | popupFactory fact = it.data(); | 22 | popupFactory fact = it.data(); |
23 | return (*fact)(ser, item); | 23 | return (*fact)(ser, item); |
24 | } | 24 | } |
25 | return 0l; | 25 | return 0l; |
26 | } | 26 | } |
27 | void PopupHelper::init() { | 27 | void PopupHelper::init() { |
28 | insert( 1, newRfcComPopup ); | 28 | insert( 1, newRfcComPopup ); |
29 | insert(2, newObexPushPopup ); | 29 | insert(2, newObexPushPopup ); |
30 | } | 30 | } |
diff --git a/noncore/net/opietooth/manager/scandialog.cpp b/noncore/net/opietooth/manager/scandialog.cpp index 3d6c928..9ce1b6a 100644 --- a/noncore/net/opietooth/manager/scandialog.cpp +++ b/noncore/net/opietooth/manager/scandialog.cpp | |||
@@ -4,178 +4,187 @@ | |||
4 | * | 4 | * |
5 | * copyright : (c) 2002 by Maximilian Reiß | 5 | * copyright : (c) 2002 by Maximilian Reiß |
6 | * email : max.reiss@gmx.de | 6 | * email : max.reiss@gmx.de |
7 | * | 7 | * |
8 | */ | 8 | */ |
9 | /*************************************************************************** | 9 | /*************************************************************************** |
10 | * * | 10 | * * |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | * This program is free software; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * (at your option) any later version. * | 14 | * (at your option) any later version. * |
15 | * * | 15 | * * |
16 | ***************************************************************************/ | 16 | ***************************************************************************/ |
17 | 17 | ||
18 | 18 | ||
19 | #include "scandialog.h" | 19 | #include "scandialog.h" |
20 | 20 | ||
21 | #include <qframe.h> | 21 | #include <qframe.h> |
22 | #include <qheader.h> | 22 | #include <qheader.h> |
23 | #include <qlabel.h> | 23 | #include <qlabel.h> |
24 | #include <qlistview.h> | 24 | #include <qlistview.h> |
25 | #include <qpushbutton.h> | 25 | #include <qpushbutton.h> |
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qvariant.h> | 27 | #include <qvariant.h> |
28 | #include <qtooltip.h> | 28 | #include <qtooltip.h> |
29 | #include <qwhatsthis.h> | 29 | #include <qwhatsthis.h> |
30 | #include <qprogressbar.h> | 30 | #include <qprogressbar.h> |
31 | #include <qlist.h> | 31 | #include <qlist.h> |
32 | 32 | ||
33 | #include <manager.h> | 33 | #include <manager.h> |
34 | #include <device.h> | 34 | #include <device.h> |
35 | 35 | ||
36 | 36 | ||
37 | 37 | ||
38 | namespace OpieTooth { | 38 | namespace OpieTooth { |
39 | 39 | ||
40 | #include <remotedevice.h> | 40 | #include <remotedevice.h> |
41 | 41 | ||
42 | /* | 42 | /* |
43 | */ | 43 | */ |
44 | ScanDialog::ScanDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) | 44 | ScanDialog::ScanDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) |
45 | : QDialog( parent, name, modal, fl ) { | 45 | : QDialog( parent, name, modal, fl ) { |
46 | 46 | ||
47 | if ( !name ) | 47 | if ( !name ) |
48 | setName( "ScanDialog" ); | 48 | setName( "ScanDialog" ); |
49 | resize( 240, 320 ); | 49 | resize( 240, 320 ); |
50 | setCaption( tr( "Scan for devices" ) ); | 50 | setCaption( tr( "Scan for devices" ) ); |
51 | 51 | ||
52 | Frame7 = new QFrame( this, "Frame7" ); | 52 | Frame7 = new QFrame( this, "Frame7" ); |
53 | Frame7->setGeometry( QRect( 0, 0, 240, 331 ) ); | 53 | Frame7->setGeometry( QRect( 0, 0, 240, 331 ) ); |
54 | Frame7->setFrameShape( QFrame::StyledPanel ); | 54 | Frame7->setFrameShape( QFrame::StyledPanel ); |
55 | Frame7->setFrameShadow( QFrame::Raised ); | 55 | Frame7->setFrameShadow( QFrame::Raised ); |
56 | 56 | ||
57 | QWidget* privateLayoutWidget = new QWidget( Frame7, "Layout11" ); | 57 | QWidget* privateLayoutWidget = new QWidget( Frame7, "Layout11" ); |
58 | privateLayoutWidget->setGeometry( QRect( 10, 9, 221, 280 ) ); | 58 | privateLayoutWidget->setGeometry( QRect( 10, 9, 221, 280 ) ); |
59 | Layout11 = new QVBoxLayout( privateLayoutWidget ); | 59 | Layout11 = new QVBoxLayout( privateLayoutWidget ); |
60 | Layout11->setSpacing( 6 ); | 60 | Layout11->setSpacing( 6 ); |
61 | Layout11->setMargin( 0 ); | 61 | Layout11->setMargin( 0 ); |
62 | 62 | ||
63 | progress = new QProgressBar(privateLayoutWidget, "progbar"); | 63 | progress = new QProgressBar(privateLayoutWidget, "progbar"); |
64 | progress->setTotalSteps(20); | 64 | progress->setTotalSteps(20); |
65 | 65 | ||
66 | QFrame *buttonFrame = new QFrame(Frame7, ""); | 66 | QFrame *buttonFrame = new QFrame(Frame7, ""); |
67 | 67 | ||
68 | StartButton = new QPushButton( buttonFrame, "StartButton" ); | 68 | StartStopButton = new QPushButton( buttonFrame, "StartButton" ); |
69 | StartButton->setText( tr( "Start scan" ) ); | 69 | StartStopButton->setText( tr( "Start scan" ) ); |
70 | 70 | ||
71 | StopButton = new QPushButton( buttonFrame, "StopButton" ); | ||
72 | StopButton->setText( tr( "Cancel scan" ) ); | ||
73 | 71 | ||
74 | QHBoxLayout *buttonLayout = new QHBoxLayout(buttonFrame); | 72 | QHBoxLayout *buttonLayout = new QHBoxLayout(buttonFrame); |
75 | 73 | ||
76 | buttonLayout->addWidget(StartButton); | 74 | buttonLayout->addWidget(StartStopButton); |
77 | buttonLayout->addWidget(StopButton); | 75 | //buttonLayout->addWidget(StopButton); |
78 | 76 | ||
79 | ListView1 = new QListView( privateLayoutWidget, "ListView1" ); | 77 | ListView1 = new QListView( privateLayoutWidget, "ListView1" ); |
80 | 78 | ||
81 | //ListView1->addColumn( tr( "Add" ) ); | 79 | //ListView1->addColumn( tr( "Add" ) ); |
82 | ListView1->addColumn( tr( "Add Device" ) ); | 80 | ListView1->addColumn( tr( "Add Device" ) ); |
83 | //ListView1->addColumn( tr( "Type" ) ); | 81 | //ListView1->addColumn( tr( "Type" ) ); |
84 | 82 | ||
85 | Layout11->addWidget( ListView1); | 83 | Layout11->addWidget( ListView1); |
86 | Layout11->addWidget(progress); | 84 | Layout11->addWidget(progress); |
87 | Layout11->addWidget( buttonFrame); | 85 | Layout11->addWidget( buttonFrame); |
88 | 86 | ||
89 | localDevice = new Manager( "hci0" ); | 87 | localDevice = new Manager( "hci0" ); |
90 | 88 | ||
91 | connect( StartButton, SIGNAL( clicked() ), this, SLOT( startSearch() ) ); | 89 | connect( StartStopButton, SIGNAL( clicked() ), this, SLOT( startSearch() ) ); |
92 | connect( StopButton, SIGNAL( clicked() ), this, SLOT( stopSearch() ) ); | ||
93 | connect( localDevice, SIGNAL( foundDevices( const QString& , RemoteDevice::ValueList ) ), | 90 | connect( localDevice, SIGNAL( foundDevices( const QString& , RemoteDevice::ValueList ) ), |
94 | this, SLOT(fillList(const QString& , RemoteDevice::ValueList ) ) ) ; | 91 | this, SLOT(fillList(const QString& , RemoteDevice::ValueList ) ) ) ; |
95 | // connect( this, SIGNAL( accept() ), this, SLOT( emitToManager() )); | 92 | // connect( this, SIGNAL( accept() ), this, SLOT( emitToManager() )); |
96 | progressStat = 0; | 93 | progressStat = 0; |
94 | m_search = false; | ||
97 | } | 95 | } |
98 | 96 | ||
99 | // hack, make cleaner later | 97 | // hack, make cleaner later |
100 | void ScanDialog::progressTimer() { | 98 | void ScanDialog::progressTimer() { |
101 | 99 | ||
102 | progressStat++; | 100 | progressStat++; |
103 | if (progressStat++ < 20) { | 101 | if (progressStat++ < 20 && m_search ) { |
104 | QTimer::singleShot( 2000, this, SLOT(progressTimer() ) ); | 102 | QTimer::singleShot( 2000, this, SLOT(progressTimer() ) ); |
105 | } | ||
106 | progress->setProgress(progressStat++); | 103 | progress->setProgress(progressStat++); |
104 | } | ||
107 | 105 | ||
108 | } | 106 | } |
109 | 107 | ||
110 | void ScanDialog::accept() { | 108 | void ScanDialog::accept() { |
111 | emitToManager(); | 109 | emitToManager(); |
112 | QDialog::accept(); | 110 | QDialog::accept(); |
113 | } | 111 | } |
114 | 112 | ||
115 | 113 | ||
116 | void ScanDialog::startSearch() { | 114 | void ScanDialog::startSearch() { |
115 | if ( m_search ) { | ||
116 | stopSearch(); | ||
117 | return; | ||
118 | } | ||
119 | m_search = true; | ||
117 | progress->setProgress(0); | 120 | progress->setProgress(0); |
118 | progressStat = 0; | 121 | progressStat = 0; |
119 | 122 | ||
120 | // empty list before a new scan | 123 | // empty list before a new scan |
121 | ListView1->clear(); | 124 | ListView1->clear(); |
122 | 125 | ||
123 | QCheckListItem *deviceItem2 = new QCheckListItem( ListView1, "Test1", QCheckListItem::CheckBox ); | 126 | QCheckListItem *deviceItem2 = new QCheckListItem( ListView1, "Test1", QCheckListItem::CheckBox ); |
124 | deviceItem2->setText(1, "BLAH" ); | 127 | deviceItem2->setText(1, "BLAH" ); |
125 | 128 | ||
126 | progressTimer(); | 129 | progressTimer(); |
127 | // when finished, it emmite foundDevices() | 130 | // when finished, it emmite foundDevices() |
128 | // checken ob initialisiert , qcop ans applet. | 131 | // checken ob initialisiert , qcop ans applet. |
132 | StartStopButton->setText( tr("Stop scan")); | ||
133 | |||
129 | localDevice->searchDevices(); | 134 | localDevice->searchDevices(); |
130 | 135 | ||
131 | } | 136 | } |
132 | 137 | ||
133 | void ScanDialog::stopSearch() { | 138 | void ScanDialog::stopSearch() { |
134 | 139 | m_search = true; | |
135 | } | 140 | } |
136 | 141 | ||
137 | void ScanDialog::fillList(const QString& device, RemoteDevice::ValueList deviceList) { | 142 | void ScanDialog::fillList(const QString&, RemoteDevice::ValueList deviceList) { |
138 | 143 | progress->setProgress(0); | |
144 | progressStat = 0; | ||
139 | qDebug("fill List"); | 145 | qDebug("fill List"); |
140 | QCheckListItem * deviceItem; | 146 | QCheckListItem * deviceItem; |
141 | 147 | ||
142 | RemoteDevice::ValueList::Iterator it; | 148 | RemoteDevice::ValueList::Iterator it; |
143 | for( it = deviceList.begin(); it != deviceList.end(); ++it ) { | 149 | for( it = deviceList.begin(); it != deviceList.end(); ++it ) { |
144 | 150 | ||
145 | deviceItem = new QCheckListItem( ListView1, (*it).name(), QCheckListItem::CheckBox ); | 151 | deviceItem = new QCheckListItem( ListView1, (*it).name(), QCheckListItem::CheckBox ); |
146 | deviceItem->setText(1, (*it).mac() ); | 152 | deviceItem->setText(1, (*it).mac() ); |
147 | } | 153 | } |
154 | m_search = false; | ||
155 | StartStopButton->setText(tr ("Start scan") ); | ||
148 | } | 156 | } |
149 | 157 | ||
150 | /* | 158 | /* |
151 | * Iterates trough the items, and collects the checked items. | 159 | * Iterates trough the items, and collects the checked items. |
152 | * Then it emits it, so the manager can connect to the signal to fill the listing. | 160 | * Then it emits it, so the manager can connect to the signal to fill the listing. |
153 | */ | 161 | */ |
154 | void ScanDialog::emitToManager() { | 162 | void ScanDialog::emitToManager() { |
155 | qDebug("vor liste durchsuchen"); | 163 | qDebug("vor liste durchsuchen"); |
156 | 164 | ||
157 | if (!ListView1) { | 165 | if (!ListView1) { |
158 | return; | 166 | return; |
159 | } | 167 | } |
160 | 168 | ||
161 | QValueList<RemoteDevice> deviceList; | 169 | QValueList<RemoteDevice> deviceList; |
162 | 170 | ||
163 | QListViewItemIterator it( ListView1 ); | 171 | QListViewItemIterator it( ListView1 ); |
164 | for ( ; it.current(); ++it ) { | 172 | for ( ; it.current(); ++it ) { |
165 | if ( ((QCheckListItem*)it.current())->isOn() ) { | 173 | if ( ((QCheckListItem*)it.current())->isOn() ) { |
166 | RemoteDevice device( it.current()->text(1), it.current()->text(0)); | 174 | RemoteDevice device( it.current()->text(1), it.current()->text(0)); |
167 | deviceList.append( device ); | 175 | deviceList.append( device ); |
168 | } | 176 | } |
169 | } | 177 | } |
170 | qDebug("vor emit"); | 178 | qDebug("vor emit"); |
171 | emit selectedDevices( deviceList ); | 179 | emit selectedDevices( deviceList ); |
172 | } | 180 | } |
173 | 181 | ||
174 | /* | 182 | /* |
175 | * Cleanup | 183 | * Cleanup |
176 | */ | 184 | */ |
177 | ScanDialog::~ScanDialog() { | 185 | ScanDialog::~ScanDialog() { |
186 | qWarning("delete scan dialog"); | ||
178 | delete localDevice; | 187 | delete localDevice; |
179 | } | 188 | } |
180 | 189 | ||
181 | } | 190 | } |
diff --git a/noncore/net/opietooth/manager/scandialog.h b/noncore/net/opietooth/manager/scandialog.h index f18784d..8f8d39a 100644 --- a/noncore/net/opietooth/manager/scandialog.h +++ b/noncore/net/opietooth/manager/scandialog.h | |||
@@ -1,79 +1,81 @@ | |||
1 | /* main.cpp | 1 | /* main.cpp |
2 | * | 2 | * |
3 | * copyright : (c) 2002 by Maximilian Reiß | 3 | * copyright : (c) 2002 by Maximilian Reiß |
4 | * email : max.reiss@gmx.de | 4 | * email : max.reiss@gmx.de |
5 | * | 5 | * |
6 | */ | 6 | */ |
7 | /*************************************************************************** | 7 | /*************************************************************************** |
8 | * * | 8 | * * |
9 | * This program is free software; you can redistribute it and/or modify * | 9 | * This program is free software; you can redistribute it and/or modify * |
10 | * it under the terms of the GNU General Public License as published by * | 10 | * it under the terms of the GNU General Public License as published by * |
11 | * the Free Software Foundation; either version 2 of the License, or * | 11 | * the Free Software Foundation; either version 2 of the License, or * |
12 | * (at your option) any later version. * | 12 | * (at your option) any later version. * |
13 | * * | 13 | * * |
14 | ***************************************************************************/ | 14 | ***************************************************************************/ |
15 | 15 | ||
16 | 16 | ||
17 | #ifndef SCANDIALOG_H | 17 | #ifndef SCANDIALOG_H |
18 | #define SCANDIALOG_H | 18 | #define SCANDIALOG_H |
19 | 19 | ||
20 | #include <qvariant.h> | 20 | #include <qvariant.h> |
21 | #include <qdialog.h> | 21 | #include <qdialog.h> |
22 | #include <qlist.h> | 22 | #include <qlist.h> |
23 | 23 | ||
24 | #include <remotedevice.h> | 24 | #include <remotedevice.h> |
25 | class QVBoxLayout; | 25 | class QVBoxLayout; |
26 | class QHBoxLayout; | 26 | class QHBoxLayout; |
27 | class QGridLayout; | 27 | class QGridLayout; |
28 | class QFrame; | 28 | class QFrame; |
29 | class QLabel; | 29 | class QLabel; |
30 | class QListView; | 30 | class QListView; |
31 | class QListViewItem; | 31 | class QListViewItem; |
32 | class QPushButton; | 32 | class QPushButton; |
33 | class QProgressBar; | 33 | class QProgressBar; |
34 | 34 | ||
35 | 35 | ||
36 | namespace OpieTooth { | 36 | namespace OpieTooth { |
37 | 37 | ||
38 | 38 | ||
39 | class Manager; | 39 | class Manager; |
40 | class Device; | 40 | class Device; |
41 | 41 | ||
42 | class ScanDialog : public QDialog { | 42 | class ScanDialog : public QDialog { |
43 | Q_OBJECT | 43 | Q_OBJECT |
44 | 44 | ||
45 | public: | 45 | public: |
46 | ScanDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); | 46 | ScanDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); |
47 | ~ScanDialog(); | 47 | ~ScanDialog(); |
48 | 48 | ||
49 | private: // make them private -zecke | ||
49 | QFrame* Frame7; | 50 | QFrame* Frame7; |
50 | QProgressBar* progress; | 51 | QProgressBar* progress; |
51 | QPushButton* StartButton; | 52 | QPushButton* StartStopButton; |
52 | QPushButton* StopButton; | 53 | // QPushButton* StopButton; |
53 | QListView* ListView1; | 54 | QListView* ListView1; |
54 | 55 | ||
55 | public slots: | 56 | public slots: |
56 | void accept(); | 57 | void accept(); |
57 | 58 | ||
58 | protected: | 59 | protected: |
59 | QVBoxLayout* Layout11; | 60 | QVBoxLayout* Layout11; |
60 | 61 | ||
61 | private slots: | 62 | private slots: |
62 | void stopSearch(); | 63 | void stopSearch(); |
63 | void startSearch(); | 64 | void startSearch(); |
64 | void progressTimer(); | 65 | void progressTimer(); |
65 | void fillList(const QString& device, RemoteDevice::ValueList list); | 66 | void fillList(const QString& device, RemoteDevice::ValueList list); |
66 | 67 | ||
67 | private: | 68 | private: |
69 | bool m_search:1; | ||
68 | void emitToManager(); | 70 | void emitToManager(); |
69 | Manager *localDevice; | 71 | Manager *localDevice; |
70 | int progressStat; | 72 | int progressStat; |
71 | 73 | ||
72 | signals: | 74 | signals: |
73 | void selectedDevices(const QValueList<RemoteDevice>&); | 75 | void selectedDevices(const QValueList<RemoteDevice>&); |
74 | }; | 76 | }; |
75 | 77 | ||
76 | 78 | ||
77 | } | 79 | } |
78 | 80 | ||
79 | #endif // SCANDIALOG_H | 81 | #endif // SCANDIALOG_H |