summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-07-21 20:02:13 (UTC)
committer harlekin <harlekin>2002-07-21 20:02:13 (UTC)
commit086b00610edfb25fb25cf54a0f8da8a16b55246a (patch) (unidiff)
treee16de393854040440ebc5ceeb6cbd48b27aff605
parent8abe7e0604c930cbb46308febeec67d5bf70d255 (diff)
downloadopie-086b00610edfb25fb25cf54a0f8da8a16b55246a.zip
opie-086b00610edfb25fb25cf54a0f8da8a16b55246a.tar.gz
opie-086b00610edfb25fb25cf54a0f8da8a16b55246a.tar.bz2
connection to popups on services
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp15
-rw-r--r--noncore/net/opietooth/manager/btdeviceitem.h4
-rw-r--r--noncore/net/opietooth/manager/manager.pro5
-rw-r--r--noncore/net/opietooth/manager/obexdialog.cpp2
-rw-r--r--noncore/net/opietooth/manager/obexdialog.h39
-rw-r--r--noncore/net/opietooth/manager/popuphelper.cpp2
-rw-r--r--noncore/net/opietooth/manager/popuphelper.h4
-rw-r--r--noncore/net/opietooth/manager/pppdialog.cpp2
-rw-r--r--noncore/net/opietooth/manager/pppdialog.h35
-rw-r--r--noncore/net/opietooth/manager/stdpopups.cpp11
-rw-r--r--noncore/net/opietooth/manager/stdpopups.h7
11 files changed, 71 insertions, 55 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp
index c81d4d1..ec05a95 100644
--- a/noncore/net/opietooth/manager/bluebase.cpp
+++ b/noncore/net/opietooth/manager/bluebase.cpp
@@ -1,561 +1,564 @@
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#include "devicehandler.h" 21#include "devicehandler.h"
22#include "btconnectionitem.h" 22#include "btconnectionitem.h"
23 23
24#include <remotedevice.h> 24#include <remotedevice.h>
25#include <services.h> 25#include <services.h>
26 26
27#include <stdlib.h> 27#include <stdlib.h>
28 28
29#include <qframe.h> 29#include <qframe.h>
30#include <qlabel.h> 30#include <qlabel.h>
31#include <qpushbutton.h> 31#include <qpushbutton.h>
32#include <qlayout.h> 32#include <qlayout.h>
33#include <qvariant.h> 33#include <qvariant.h>
34#include <qimage.h> 34#include <qimage.h>
35#include <qpixmap.h> 35#include <qpixmap.h>
36#include <qtabwidget.h> 36#include <qtabwidget.h>
37#include <qscrollview.h> 37#include <qscrollview.h>
38#include <qvbox.h> 38#include <qvbox.h>
39#include <qmessagebox.h> 39#include <qmessagebox.h>
40#include <qcheckbox.h> 40#include <qcheckbox.h>
41#include <qlineedit.h> 41#include <qlineedit.h>
42#include <qlistview.h> 42#include <qlistview.h>
43#include <qdir.h> 43#include <qdir.h>
44#include <qpopupmenu.h> 44#include <qpopupmenu.h>
45#include <qtimer.h> 45#include <qtimer.h>
46 46
47#include <qpe/qpeapplication.h> 47#include <qpe/qpeapplication.h>
48#include <qpe/resource.h> 48#include <qpe/resource.h>
49#include <qpe/config.h> 49#include <qpe/config.h>
50 50
51 51
52using namespace OpieTooth; 52using namespace OpieTooth;
53 53
54BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) 54BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl )
55 : BluetoothBase( parent, name, fl ) { 55 : BluetoothBase( parent, name, fl ) {
56 56
57 m_localDevice = new Manager( "hci0" ); 57 m_localDevice = new Manager( "hci0" );
58 58
59 connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) ); 59 connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) );
60 connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) ); 60 connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) );
61 // not good since lib is async 61 // not good since lib is async
62 // connect( ListView2, SIGNAL( expanded ( QListViewItem* ) ), 62 // connect( ListView2, SIGNAL( expanded ( QListViewItem* ) ),
63 // this, SLOT( addServicesToDevice( QListViewItem * ) ) ); 63 // this, SLOT( addServicesToDevice( QListViewItem * ) ) );
64 connect( ListView2, SIGNAL( clicked( QListViewItem* )), 64 connect( ListView2, SIGNAL( clicked( QListViewItem* )),
65 this, SLOT( startServiceActionClicked( QListViewItem* ) ) ); 65 this, SLOT( startServiceActionClicked( QListViewItem* ) ) );
66 connect( ListView2, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int ) ), 66 connect( ListView2, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int ) ),
67 this, SLOT(startServiceActionHold( QListViewItem *, const QPoint &, int) ) ); 67 this, SLOT(startServiceActionHold( QListViewItem *, const QPoint &, int) ) );
68 connect( m_localDevice , SIGNAL( foundServices( const QString& , Services::ValueList ) ), 68 connect( m_localDevice , SIGNAL( foundServices( const QString& , Services::ValueList ) ),
69 this, SLOT( addServicesToDevice( const QString& , Services::ValueList ) ) ); 69 this, SLOT( addServicesToDevice( const QString& , Services::ValueList ) ) );
70 connect( m_localDevice, SIGNAL( available( const QString&, bool ) ), 70 connect( m_localDevice, SIGNAL( available( const QString&, bool ) ),
71 this, SLOT( deviceActive( const QString& , bool ) ) ); 71 this, SLOT( deviceActive( const QString& , bool ) ) );
72 connect( m_localDevice, SIGNAL( connections( ConnectionState::ValueList ) ), 72 connect( m_localDevice, SIGNAL( connections( ConnectionState::ValueList ) ),
73 this, SLOT( addConnectedDevices( ConnectionState::ValueList ) ) ); 73 this, SLOT( addConnectedDevices( ConnectionState::ValueList ) ) );
74 74
75 75
76 // let hold be rightButtonClicked() 76 // let hold be rightButtonClicked()
77 QPEApplication::setStylusOperation( ListView2->viewport(), QPEApplication::RightOnHold); 77 QPEApplication::setStylusOperation( ListView2->viewport(), QPEApplication::RightOnHold);
78 QPEApplication::setStylusOperation( ListView4->viewport(), QPEApplication::RightOnHold); 78 QPEApplication::setStylusOperation( ListView4->viewport(), QPEApplication::RightOnHold);
79 79
80 //Load all icons needed 80 //Load all icons needed
81 m_offPix = Resource::loadPixmap( "editdelete" ); 81 m_offPix = Resource::loadPixmap( "editdelete" );
82 m_onPix = Resource::loadPixmap( "installed" ); 82 m_onPix = Resource::loadPixmap( "installed" );
83 83
84 QPalette pal = this->palette(); 84 QPalette pal = this->palette();
85 QColor col = pal.color( QPalette::Active, QColorGroup::Background ); 85 QColor col = pal.color( QPalette::Active, QColorGroup::Background );
86 pal.setColor( QPalette::Active, QColorGroup::Button, col ); 86 pal.setColor( QPalette::Active, QColorGroup::Button, col );
87 pal.setColor( QPalette::Inactive, QColorGroup::Button, col ); 87 pal.setColor( QPalette::Inactive, QColorGroup::Button, col );
88 pal.setColor( QPalette::Normal, QColorGroup::Button, col ); 88 pal.setColor( QPalette::Normal, QColorGroup::Button, col );
89 pal.setColor( QPalette::Disabled, QColorGroup::Button, col ); 89 pal.setColor( QPalette::Disabled, QColorGroup::Button, col );
90 this->setPalette( pal ); 90 this->setPalette( pal );
91 91
92 setCaption( tr( "Bluetooth Manager" ) ); 92 setCaption( tr( "Bluetooth Manager" ) );
93 93
94 readConfig(); 94 readConfig();
95 initGui(); 95 initGui();
96 96
97 //TESTING 97 //TESTING
98 ListView2->setRootIsDecorated(true); 98 ListView2->setRootIsDecorated(true);
99 99
100 BTDeviceItem *topLV2 = new BTDeviceItem( ListView2, RemoteDevice("xx:", "Siemens S45" ) ); 100 BTDeviceItem *topLV2 = new BTDeviceItem( ListView2, RemoteDevice("xx:", "Siemens S45" ) );
101 topLV2->setPixmap( 1, m_onPix ); 101 topLV2->setPixmap( 1, m_onPix );
102 Services s1; 102 Services s1;
103 s1.setServiceName( "Serial" ); 103 s1.setServiceName( "Serial" );
104 s1.insertClassId(1, "BlueNic"); 104 s1.insertClassId(1, "BlueNic");
105 (void) new BTServiceItem( topLV2, s1 ); 105 (void) new BTServiceItem( topLV2, s1 );
106 s1.setServiceName( "BlueNic" ); 106 s1.setServiceName( "BlueNic" );
107 s1.insertClassId(2, "Obex"); 107 s1.insertClassId(2, "Obex");
108 (void) new BTServiceItem( topLV2, s1 ); 108 (void) new BTServiceItem( topLV2, s1 );
109 109
110 writeToHciConfig(); 110 writeToHciConfig();
111 // search conncetions 111 // search conncetions
112 addConnectedDevices(); 112 addConnectedDevices();
113 m_iconLoader = new BTIconLoader(); 113 m_iconLoader = new BTIconLoader();
114 readSavedDevices(); 114 readSavedDevices();
115} 115}
116 116
117/** 117/**
118 * Reads all options from the config file 118 * Reads all options from the config file
119 */ 119 */
120void BlueBase::readConfig() { 120void BlueBase::readConfig() {
121 121
122 Config cfg( "bluetoothmanager" ); 122 Config cfg( "bluetoothmanager" );
123 cfg.setGroup( "bluezsettings" ); 123 cfg.setGroup( "bluezsettings" );
124 124
125 m_deviceName = cfg.readEntry( "name" , "No name" ); // name the device should identify with 125 m_deviceName = cfg.readEntry( "name" , "No name" ); // name the device should identify with
126 m_defaultPasskey = cfg.readEntryCrypt( "passkey" , "" ); // <- hmm, look up how good the trolls did that, maybe too weak 126 m_defaultPasskey = cfg.readEntryCrypt( "passkey" , "" ); // <- hmm, look up how good the trolls did that, maybe too weak
127 m_useEncryption = cfg.readBoolEntry( "useEncryption" , TRUE ); 127 m_useEncryption = cfg.readBoolEntry( "useEncryption" , TRUE );
128 m_enableAuthentification = cfg.readBoolEntry( "enableAuthentification" , TRUE ); 128 m_enableAuthentification = cfg.readBoolEntry( "enableAuthentification" , TRUE );
129 m_enablePagescan = cfg.readBoolEntry( "enablePagescan" , TRUE ); 129 m_enablePagescan = cfg.readBoolEntry( "enablePagescan" , TRUE );
130 m_enableInquiryscan = cfg.readBoolEntry( "enableInquiryscan" , TRUE ); 130 m_enableInquiryscan = cfg.readBoolEntry( "enableInquiryscan" , TRUE );
131} 131}
132 132
133/** 133/**
134 * Writes all options to the config file 134 * Writes all options to the config file
135 */ 135 */
136void BlueBase::writeConfig() { 136void BlueBase::writeConfig() {
137 137
138 Config cfg( "bluetoothmanager" ); 138 Config cfg( "bluetoothmanager" );
139 cfg.setGroup( "bluezsettings" ); 139 cfg.setGroup( "bluezsettings" );
140 140
141 cfg.writeEntry( "name" , m_deviceName ); 141 cfg.writeEntry( "name" , m_deviceName );
142 cfg.writeEntryCrypt( "passkey" , m_defaultPasskey ); 142 cfg.writeEntryCrypt( "passkey" , m_defaultPasskey );
143 cfg.writeEntry( "useEncryption" , m_useEncryption ); 143 cfg.writeEntry( "useEncryption" , m_useEncryption );
144 cfg.writeEntry( "enableAuthentification" , m_enableAuthentification ); 144 cfg.writeEntry( "enableAuthentification" , m_enableAuthentification );
145 cfg.writeEntry( "enablePagescan" , m_enablePagescan ); 145 cfg.writeEntry( "enablePagescan" , m_enablePagescan );
146 cfg.writeEntry( "enableInquiryscan" , m_enableInquiryscan ); 146 cfg.writeEntry( "enableInquiryscan" , m_enableInquiryscan );
147 147
148 writeToHciConfig(); 148 writeToHciConfig();
149} 149}
150 150
151/** 151/**
152 * Modify the hcid.conf file to our needs 152 * Modify the hcid.conf file to our needs
153 */ 153 */
154void BlueBase::writeToHciConfig() { 154void BlueBase::writeToHciConfig() {
155 qWarning("writeToHciConfig"); 155 qWarning("writeToHciConfig");
156 HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" ); 156 HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" );
157 hciconf.load(); 157 hciconf.load();
158 hciconf.setPinHelper( "/bin/QtPalmtop/bin/blue-pin" ); 158 hciconf.setPinHelper( "/bin/QtPalmtop/bin/blue-pin" );
159 hciconf.setName( m_deviceName ); 159 hciconf.setName( m_deviceName );
160 hciconf.setEncrypt( m_useEncryption ); 160 hciconf.setEncrypt( m_useEncryption );
161 hciconf.setAuth( m_enableAuthentification ); 161 hciconf.setAuth( m_enableAuthentification );
162 hciconf.setPscan( m_enablePagescan ); 162 hciconf.setPscan( m_enablePagescan );
163 hciconf.setIscan( m_enableInquiryscan ); 163 hciconf.setIscan( m_enableInquiryscan );
164 hciconf.save(); 164 hciconf.save();
165} 165}
166 166
167 167
168/** 168/**
169 * Read the list of allready known devices 169 * Read the list of allready known devices
170 */ 170 */
171void BlueBase::readSavedDevices() { 171void BlueBase::readSavedDevices() {
172 172
173 QValueList<RemoteDevice> loadedDevices; 173 QValueList<RemoteDevice> loadedDevices;
174 DeviceHandler handler; 174 DeviceHandler handler;
175 loadedDevices = handler.load(); 175 loadedDevices = handler.load();
176 176
177 addSearchedDevices( loadedDevices ); 177 addSearchedDevices( loadedDevices );
178} 178}
179 179
180 180
181/** 181/**
182 * Write the list of allready known devices 182 * Write the list of allready known devices
183 */ 183 */
184void BlueBase::writeSavedDevices() { 184void BlueBase::writeSavedDevices() {
185 QListViewItemIterator it( ListView2 ); 185 QListViewItemIterator it( ListView2 );
186 BTListItem* item; 186 BTListItem* item;
187 BTDeviceItem* device; 187 BTDeviceItem* device;
188 RemoteDevice::ValueList list; 188 RemoteDevice::ValueList list;
189 for ( ; it.current(); ++it ) { 189 for ( ; it.current(); ++it ) {
190 item = (BTListItem*)it.current(); 190 item = (BTListItem*)it.current();
191 if(item->typeId() != BTListItem::Device ) 191 if(item->typeId() != BTListItem::Device )
192 continue; 192 continue;
193 device = (BTDeviceItem*)item; 193 device = (BTDeviceItem*)item;
194 194
195 list.append( device->remoteDevice() ); 195 list.append( device->remoteDevice() );
196 } 196 }
197 /* 197 /*
198 * if not empty save the List through DeviceHandler 198 * if not empty save the List through DeviceHandler
199 */ 199 */
200 if ( list.isEmpty() ) 200 if ( list.isEmpty() )
201 return; 201 return;
202 DeviceHandler handler; 202 DeviceHandler handler;
203 handler.save( list ); 203 handler.save( list );
204} 204}
205 205
206 206
207/** 207/**
208 * Set up the gui 208 * Set up the gui
209 */ 209 */
210void BlueBase::initGui() { 210void BlueBase::initGui() {
211 StatusLabel->setText( status() ); // maybe move it to getStatus() 211 StatusLabel->setText( status() ); // maybe move it to getStatus()
212 cryptCheckBox->setChecked( m_useEncryption ); 212 cryptCheckBox->setChecked( m_useEncryption );
213 authCheckBox->setChecked( m_enableAuthentification ); 213 authCheckBox->setChecked( m_enableAuthentification );
214 pagescanCheckBox->setChecked( m_enablePagescan ); 214 pagescanCheckBox->setChecked( m_enablePagescan );
215 inquiryscanCheckBox->setChecked( m_enableInquiryscan ); 215 inquiryscanCheckBox->setChecked( m_enableInquiryscan );
216 deviceNameLine->setText( m_deviceName ); 216 deviceNameLine->setText( m_deviceName );
217 passkeyLine->setText( m_defaultPasskey ); 217 passkeyLine->setText( m_defaultPasskey );
218 // set info tab 218 // set info tab
219 setInfo(); 219 setInfo();
220} 220}
221 221
222 222
223/** 223/**
224 * Get the status informations and returns it 224 * Get the status informations and returns it
225 * @return QString the status informations gathered 225 * @return QString the status informations gathered
226 */ 226 */
227QString BlueBase::status()const{ 227QString BlueBase::status()const{
228 QString infoString = tr( "<b>Device name : </b> Ipaq" ); 228 QString infoString = tr( "<b>Device name : </b> Ipaq" );
229 infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" ); 229 infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" );
230 infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" ); 230 infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" );
231 231
232 return (infoString); 232 return (infoString);
233} 233}
234 234
235 235
236/** 236/**
237 * Read the current values from the gui and invoke writeConfig() 237 * Read the current values from the gui and invoke writeConfig()
238 */ 238 */
239void BlueBase::applyConfigChanges() { 239void BlueBase::applyConfigChanges() {
240 m_deviceName = deviceNameLine->text(); 240 m_deviceName = deviceNameLine->text();
241 m_defaultPasskey = passkeyLine->text(); 241 m_defaultPasskey = passkeyLine->text();
242 m_useEncryption = cryptCheckBox->isChecked(); 242 m_useEncryption = cryptCheckBox->isChecked();
243 m_enableAuthentification = authCheckBox->isChecked(); 243 m_enableAuthentification = authCheckBox->isChecked();
244 m_enablePagescan = pagescanCheckBox->isChecked(); 244 m_enablePagescan = pagescanCheckBox->isChecked();
245 m_enableInquiryscan = inquiryscanCheckBox->isChecked(); 245 m_enableInquiryscan = inquiryscanCheckBox->isChecked();
246 246
247 writeConfig(); 247 writeConfig();
248 248
249 QMessageBox::information( this, tr("Test") , tr("Changes were applied.") ); 249 QMessageBox::information( this, tr("Test") , tr("Changes were applied.") );
250} 250}
251 251
252/** 252/**
253 * Add fresh found devices from scan dialog to the listing 253 * Add fresh found devices from scan dialog to the listing
254 * 254 *
255 */ 255 */
256void BlueBase::addSearchedDevices( const QValueList<RemoteDevice> &newDevices ) { 256void BlueBase::addSearchedDevices( const QValueList<RemoteDevice> &newDevices ) {
257 BTDeviceItem * deviceItem; 257 BTDeviceItem * deviceItem;
258 QValueList<RemoteDevice>::ConstIterator it; 258 QValueList<RemoteDevice>::ConstIterator it;
259 259
260 for( it = newDevices.begin(); it != newDevices.end() ; ++it ) { 260 for( it = newDevices.begin(); it != newDevices.end() ; ++it ) {
261 261
262 if (find( (*it) )) // is already inserted 262 if (find( (*it) )) // is already inserted
263 continue; 263 continue;
264 264
265 deviceItem = new BTDeviceItem( ListView2 , (*it) ); 265 deviceItem = new BTDeviceItem( ListView2 , (*it) );
266 deviceItem->setExpandable ( true ); 266 deviceItem->setExpandable ( true );
267 267
268 // look if device is avail. atm, async 268 // look if device is avail. atm, async
269 deviceActive( (*it) ); 269 deviceActive( (*it) );
270 270
271 // ggf auch hier? 271 // ggf auch hier?
272 addServicesToDevice( deviceItem ); 272 addServicesToDevice( deviceItem );
273 } 273 }
274} 274}
275 275
276 276
277/** 277/**
278 * Action that is toggled on entrys on click 278 * Action that is toggled on entrys on click
279 */ 279 */
280void BlueBase::startServiceActionClicked( QListViewItem */*item*/ ) { 280void BlueBase::startServiceActionClicked( QListViewItem */*item*/ ) {
281} 281}
282 282
283 283
284/** 284/**
285 * Action that are toggled on hold (mostly QPopups i guess) 285 * Action that are toggled on hold (mostly QPopups i guess)
286 */ 286 */
287void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int /*column*/ ) { 287void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int /*column*/ ) {
288 if (!item )
289 return;
288 290
289 QPopupMenu *menu = new QPopupMenu(); 291 QPopupMenu *menu = new QPopupMenu();
290 int ret=0; 292 int ret=0;
291 293
292 if ( ((BTListItem*)item)->type() == "device") { 294 if ( ((BTListItem*)item)->type() == "device") {
293 295
294 QPopupMenu *groups = new QPopupMenu(); 296 QPopupMenu *groups = new QPopupMenu();
295 297
296 menu->insertItem( tr("rescan sevices:"), 0); 298 menu->insertItem( tr("rescan sevices:"), 0);
297 menu->insertItem( tr("to group"), groups , 1); 299 menu->insertItem( tr("to group"), groups , 1);
298 // menu->insertItem( tr("bound device"), 2); 300 // menu->insertItem( tr("bound device"), 2);
299 menu->insertItem( tr("delete"), 3); 301 menu->insertItem( tr("delete"), 3);
300 302
301 ret = menu->exec( point , 0); 303 ret = menu->exec( point , 0);
302 304
303 switch(ret) { 305 switch(ret) {
304 case -1: 306 case -1:
305 break; 307 break;
306 case 0: 308 case 0:
307 addServicesToDevice( (BTDeviceItem*)item ); 309 addServicesToDevice( (BTDeviceItem*)item );
308 break; 310 break;
309 case 1: 311 case 1:
310 312
311 break; 313 break;
312 314
313 // NO need to, since hcid does that on the fly 315 // NO need to, since hcid does that on the fly
314 // case 2: 316 // case 2:
315 // make connection 317 // make connection
316 //m_localDevice->connectTo( ((BTDeviceItem*)item)->mac() ); 318 //m_localDevice->connectTo( ((BTDeviceItem*)item)->mac() );
317 //break; 319 //break;
318 case 3: 320 case 3:
319 // deletes childs too 321 // deletes childs too
320 delete item; 322 delete item;
321 break; 323 break;
322 } 324 }
323 delete groups; 325 delete groups;
324 326
325 } 327 }
326 328
327 /* 329 /*
328 * We got service sensitive PopupMenus in our factory 330 * We got service sensitive PopupMenus in our factory
329 * We will create one through the factory and will insert 331 * We will create one through the factory and will insert
330 * our Separator + ShowInfo into the menu or create a new 332 * our Separator + ShowInfo into the menu or create a new
331 * one if the factory returns 0 333 * one if the factory returns 0
332 * PopupMenu deletion is kind of weird. 334 * PopupMenu deletion is kind of weird.
333 * If escaped( -1 ) or any of our items were chosen we'll 335 * If escaped( -1 ) or any of our items were chosen we'll
334 * delete the PopupMenu otherwise it's the responsibility of 336 * delete the PopupMenu otherwise it's the responsibility of
335 * the PopupMenu to delete itself 337 * the PopupMenu to delete itself
336 * 338 *
337 */ 339 */
338 else if ( ((BTListItem*)item)->type() == "service") { 340 else if ( ((BTListItem*)item)->type() == "service") {
339 BTServiceItem* service = (BTServiceItem*)item; 341 BTServiceItem* service = (BTServiceItem*)item;
340 QMap<int, QString> list = service->services().classIdList(); 342 QMap<int, QString> list = service->services().classIdList();
341 QMap<int, QString>::Iterator it = list.begin(); 343 QMap<int, QString>::Iterator it = list.begin();
342 QPopupMenu *popup =0l; 344 QPopupMenu *popup =0l;
343 if ( it != list.end() ) { 345 if ( it != list.end() ) {
344 qWarning("Searching id %d %s", it.key(), it.data().latin1() ); 346 qWarning("Searching id %d %s", it.key(), it.data().latin1() );
345 popup = m_popHelper.find( it.key(), 347 popup = m_popHelper.find( it.key() /*1*/,
346 service->services(), 348 service->services(),
347 service->parent() ); 349 (BTDeviceItem*)service->parent() );
348 }else { 350 }else {
349 qWarning("Empty"); 351 qWarning("Empty");
350 } 352 }
351 353
352 if ( popup == 0l ) { 354 if ( popup == 0l ) {
353 qWarning("factory returned 0l"); 355 qWarning("factory returned 0l");
354 popup = new QPopupMenu(); 356 popup = new QPopupMenu();
355 } 357 }
356 358
357 int test1 = popup->insertItem( tr("Test1:"), 0); 359 int test1 = popup->insertItem( tr("Test1:"), 0);
358 int con = popup->insertItem( tr("connect"), 1); 360 int con = popup->insertItem( tr("connect"), 1);
359 int del = popup->insertItem( tr("delete"), 2); 361 int del = popup->insertItem( tr("delete"), 2);
360 362
361 ret = popup->exec( point ); 363 ret = popup->exec( point );
362 364 qWarning("returned from exec() ");
363 if ( ret == -1 ) 365 if ( ret == -1 )
364 delete popup; 366 ;
365 else if ( ret == test1 ) 367 else if ( ret == test1 )
366 delete popup; 368 ;
367 else if ( ret == con ) 369 else if ( ret == con )
368 delete popup; 370 ;
369 else if ( ret == del ) { 371 else if ( ret == del ) {
370 // take item first? -zecke 372 // take item first? -zecke
371 delete item; 373 delete item;
372 } 374 }
375 delete popup;
373 } 376 }
374 delete menu; 377 delete menu;
375} 378}
376 379
377 380
378/** 381/**
379 * Search and display avail. services for a device (on expand from device listing) 382 * Search and display avail. services for a device (on expand from device listing)
380 * @param item the service item returned 383 * @param item the service item returned
381 */ 384 */
382void BlueBase::addServicesToDevice( BTDeviceItem * item ) { 385void BlueBase::addServicesToDevice( BTDeviceItem * item ) {
383 qDebug("addServicesToDevice"); 386 qDebug("addServicesToDevice");
384 // row of mac adress text(3) 387 // row of mac adress text(3)
385 RemoteDevice device = item->remoteDevice(); 388 RemoteDevice device = item->remoteDevice();
386 m_deviceList.insert( item->mac() , item ); 389 m_deviceList.insert( item->mac() , item );
387 // and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back 390 // and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back
388 m_localDevice->searchServices( device ); 391 m_localDevice->searchServices( device );
389} 392}
390 393
391 394
392/** 395/**
393 * Overloaded. This one it the one that is connected to the foundServices signal 396 * Overloaded. This one it the one that is connected to the foundServices signal
394 * @param device the mac address of the remote device 397 * @param device the mac address of the remote device
395 * @param servicesList the list with the service the device has. 398 * @param servicesList the list with the service the device has.
396 */ 399 */
397void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) { 400void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) {
398 qDebug("fill services list"); 401 qDebug("fill services list");
399 402
400 QMap<QString,BTDeviceItem*>::Iterator it; 403 QMap<QString,BTDeviceItem*>::Iterator it;
401 BTDeviceItem* deviceItem = 0; 404 BTDeviceItem* deviceItem = 0;
402 405
403 // get the right devices which requested the search 406 // get the right devices which requested the search
404 it = m_deviceList.find( device ); 407 it = m_deviceList.find( device );
405 if( it == m_deviceList.end() ) 408 if( it == m_deviceList.end() )
406 return; 409 return;
407 deviceItem = it.data(); 410 deviceItem = it.data();
408 411
409 QValueList<OpieTooth::Services>::Iterator it2; 412 QValueList<OpieTooth::Services>::Iterator it2;
410 BTServiceItem * serviceItem; 413 BTServiceItem * serviceItem;
411 414
412 if (!servicesList.isEmpty() ) { 415 if (!servicesList.isEmpty() ) {
413 // add services 416 // add services
414 QMap<int, QString> list; 417 QMap<int, QString> list;
415 QMap<int, QString>::Iterator classIt; 418 QMap<int, QString>::Iterator classIt;
416 for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) { 419 for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) {
417 serviceItem = new BTServiceItem( deviceItem , (*it2) ); 420 serviceItem = new BTServiceItem( deviceItem , (*it2) );
418 list = (*it2).classIdList(); 421 list = (*it2).classIdList();
419 classIt = list.begin(); 422 classIt = list.begin();
420 int classId=0; 423 int classId=0;
421 if ( classIt != list.end() ) { 424 if ( classIt != list.end() ) {
422 classId = classIt.key(); 425 classId = classIt.key();
423 } 426 }
424 427
425 serviceItem->setPixmap( 0, m_iconLoader->serviceIcon( classId ) ); 428 serviceItem->setPixmap( 0, m_iconLoader->serviceIcon( classId ) );
426 } 429 }
427 } else { 430 } else {
428 Services s1; 431 Services s1;
429 s1.setServiceName( tr("no serives found") ); 432 s1.setServiceName( tr("no serives found") );
430 serviceItem = new BTServiceItem( deviceItem, s1 ); 433 serviceItem = new BTServiceItem( deviceItem, s1 );
431 } 434 }
432 // now remove them from the list 435 // now remove them from the list
433 m_deviceList.remove( it ); 436 m_deviceList.remove( it );
434} 437}
435 438
436 439
437/** 440/**
438 * Add the existing connections (pairs) to the connections tab. 441 * Add the existing connections (pairs) to the connections tab.
439 * This one triggers the search 442 * This one triggers the search
440 */ 443 */
441void BlueBase::addConnectedDevices() { 444void BlueBase::addConnectedDevices() {
442 m_localDevice->searchConnections(); 445 m_localDevice->searchConnections();
443} 446}
444 447
445 448
446/** 449/**
447 * This adds the found connections to the connection tab. 450 * This adds the found connections to the connection tab.
448 * @param connectionList the ValueList with all current connections 451 * @param connectionList the ValueList with all current connections
449 */ 452 */
450void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList ) { 453void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList ) {
451 454
452 // clear the ListView first 455 // clear the ListView first
453 ListView4->clear(); 456 ListView4->clear();
454 457
455 QValueList<OpieTooth::ConnectionState>::Iterator it; 458 QValueList<OpieTooth::ConnectionState>::Iterator it;
456 BTConnectionItem * connectionItem; 459 BTConnectionItem * connectionItem;
457 460
458 if ( !connectionList.isEmpty() ) { 461 if ( !connectionList.isEmpty() ) {
459 462
460 for (it = connectionList.begin(); it != connectionList.end(); ++it) { 463 for (it = connectionList.begin(); it != connectionList.end(); ++it) {
461 connectionItem = new BTConnectionItem( ListView4 , (*it) ); 464 connectionItem = new BTConnectionItem( ListView4 , (*it) );
462 } 465 }
463 } else { 466 } else {
464 ConnectionState con; 467 ConnectionState con;
465 con.setMac( tr("No connections found") ); 468 con.setMac( tr("No connections found") );
466 connectionItem = new BTConnectionItem( ListView4 , con ); 469 connectionItem = new BTConnectionItem( ListView4 , con );
467 } 470 }
468 471
469 // recall connection search after some time 472 // recall connection search after some time
470 QTimer::singleShot( 20000, this, SLOT( addConnectedDevices() ) ); 473 QTimer::singleShot( 20000, this, SLOT( addConnectedDevices() ) );
471} 474}
472 475
473 476
474/** 477/**
475 * Find out if a device can currently be reached 478 * Find out if a device can currently be reached
476 * @param device 479 * @param device
477 */ 480 */
478void BlueBase::deviceActive( const RemoteDevice &device ) { 481void BlueBase::deviceActive( const RemoteDevice &device ) {
479 // search by mac, async, gets a signal back 482 // search by mac, async, gets a signal back
480 // We should have a BTDeviceItem there or where does it get added to the map -zecke 483 // We should have a BTDeviceItem there or where does it get added to the map -zecke
481 m_localDevice->isAvailable( device.mac() ); 484 m_localDevice->isAvailable( device.mac() );
482} 485}
483 486
484 487
485/** 488/**
486 * The signal catcher. Set the avail. status on device. 489 * The signal catcher. Set the avail. status on device.
487 * @param device - the mac address 490 * @param device - the mac address
488 * @param connected - if it is avail. or not 491 * @param connected - if it is avail. or not
489 */ 492 */
490void BlueBase::deviceActive( const QString& device, bool connected ) { 493void BlueBase::deviceActive( const QString& device, bool connected ) {
491 qDebug("deviceActive slot"); 494 qDebug("deviceActive slot");
492 495
493 QMap<QString,BTDeviceItem*>::Iterator it; 496 QMap<QString,BTDeviceItem*>::Iterator it;
494 497
495 it = m_deviceList.find( device ); 498 it = m_deviceList.find( device );
496 if( it == m_deviceList.end() ) 499 if( it == m_deviceList.end() )
497 return; 500 return;
498 501
499 BTDeviceItem* deviceItem = it.data(); 502 BTDeviceItem* deviceItem = it.data();
500 503
501 504
502 if ( connected ) { 505 if ( connected ) {
503 deviceItem->setPixmap( 1, m_onPix ); 506 deviceItem->setPixmap( 1, m_onPix );
504 } else { 507 } else {
505 deviceItem->setPixmap( 1, m_offPix ); 508 deviceItem->setPixmap( 1, m_offPix );
506 } 509 }
507 m_deviceList.remove( it ); 510 m_deviceList.remove( it );
508} 511}
509 512
510 513
511/** 514/**
512 * Open the "scan for devices" dialog 515 * Open the "scan for devices" dialog
513 */ 516 */
514void BlueBase::startScan() { 517void BlueBase::startScan() {
515 ScanDialog *scan = new ScanDialog( this, "ScanDialog", 518 ScanDialog *scan = new ScanDialog( this, "ScanDialog",
516 true, WDestructiveClose ); 519 true, WDestructiveClose );
517 QObject::connect( scan, SIGNAL( selectedDevices( const QValueList<RemoteDevice>& ) ), 520 QObject::connect( scan, SIGNAL( selectedDevices( const QValueList<RemoteDevice>& ) ),
518 this, SLOT( addSearchedDevices( const QValueList<RemoteDevice>& ) ) ); 521 this, SLOT( addSearchedDevices( const QValueList<RemoteDevice>& ) ) );
519 522
520 scan->showMaximized(); 523 scan->showMaximized();
521} 524}
522 525
523 526
524/** 527/**
525 * Set the informations about the local device in information Tab 528 * Set the informations about the local device in information Tab
526 */ 529 */
527void BlueBase::setInfo() { 530void BlueBase::setInfo() {
528 StatusLabel->setText( status() ); 531 StatusLabel->setText( status() );
529} 532}
530 533
531 534
532/** 535/**
533 * Decontructor 536 * Decontructor
534 */ 537 */
535BlueBase::~BlueBase() { 538BlueBase::~BlueBase() {
536 writeSavedDevices(); 539 writeSavedDevices();
537 delete m_iconLoader; 540 delete m_iconLoader;
538} 541}
539 542
540 543
541/** 544/**
542 * find searches the ListView for a BTDeviceItem containig 545 * find searches the ListView for a BTDeviceItem containig
543 * the same Device if found return true else false 546 * the same Device if found return true else false
544 * @param dev RemoteDevice to find 547 * @param dev RemoteDevice to find
545 * @return returns true if found 548 * @return returns true if found
546 */ 549 */
547bool BlueBase::find( const RemoteDevice& rem ) { 550bool BlueBase::find( const RemoteDevice& rem ) {
548 QListViewItemIterator it( ListView2 ); 551 QListViewItemIterator it( ListView2 );
549 BTListItem* item; 552 BTListItem* item;
550 BTDeviceItem* device; 553 BTDeviceItem* device;
551 for (; it.current(); ++it ) { 554 for (; it.current(); ++it ) {
552 item = (BTListItem*) it.current(); 555 item = (BTListItem*) it.current();
553 if ( item->typeId() != BTListItem::Device ) 556 if ( item->typeId() != BTListItem::Device )
554 continue; 557 continue;
555 558
556 device = (BTDeviceItem*)item; 559 device = (BTDeviceItem*)item;
557 if ( rem.equals( device->remoteDevice() ) ) 560 if ( rem.equals( device->remoteDevice() ) )
558 return true; 561 return true;
559 } 562 }
560 return false; // not found 563 return false; // not found
561} 564}
diff --git a/noncore/net/opietooth/manager/btdeviceitem.h b/noncore/net/opietooth/manager/btdeviceitem.h
index ae51483..e4c6ce7 100644
--- a/noncore/net/opietooth/manager/btdeviceitem.h
+++ b/noncore/net/opietooth/manager/btdeviceitem.h
@@ -1,26 +1,26 @@
1 1
2#ifndef OPIE_TOOTH_BT_DEVIVE_ITEM 2#ifndef OPIE_TOOTH_BT_DEVICE_ITEM
3#define OPIE_TOOTH_BT_DEVIVE_ITEM 3#define OPIE_TOOTH_BT_DEVICE_ITEM
4 4
5 5
6#include <remotedevice.h> 6#include <remotedevice.h>
7#include "btlistitem.h" 7#include "btlistitem.h"
8 8
9namespace OpieTooth { 9namespace OpieTooth {
10 class BTDeviceItem : public BTListItem { 10 class BTDeviceItem : public BTListItem {
11 public: 11 public:
12 BTDeviceItem( QListView* parent, const RemoteDevice& dev ); 12 BTDeviceItem( QListView* parent, const RemoteDevice& dev );
13 ~BTDeviceItem(); 13 ~BTDeviceItem();
14 RemoteDevice remoteDevice() const; 14 RemoteDevice remoteDevice() const;
15 QString type()const; 15 QString type()const;
16 int typeId()const; 16 int typeId()const;
17 QString mac()const; 17 QString mac()const;
18 QString name() const; 18 QString name() const;
19 private: 19 private:
20 RemoteDevice m_device; 20 RemoteDevice m_device;
21 }; 21 };
22 22
23}; 23};
24 24
25 25
26#endif 26#endif
diff --git a/noncore/net/opietooth/manager/manager.pro b/noncore/net/opietooth/manager/manager.pro
index 762b028..121c069 100644
--- a/noncore/net/opietooth/manager/manager.pro
+++ b/noncore/net/opietooth/manager/manager.pro
@@ -1,40 +1,41 @@
1TEMPLATE = app 1TEMPLATE = app
2CONFIG = qt warn_on debug 2CONFIG = qt warn_on debug
3#CONFIG = qt warn_on release 3#CONFIG = qt warn_on release
4HEADERS = btconnectionitem.h btdeviceitem.h \ 4HEADERS = btconnectionitem.h btdeviceitem.h \
5 btserviceitem.h stdpopups.h \ 5 btserviceitem.h stdpopups.h \
6 popuphelper.h bluebase.h \ 6 popuphelper.h bluebase.h \
7 scandialog.h btlistitem.h \ 7 scandialog.h btlistitem.h \
8 hciconfwrapper.h bticonloader.h \ 8 hciconfwrapper.h bticonloader.h \
9 pppdialog.h obexdialog.h \ 9 pppdialog.h obexdialog.h \
10 devicehandler.h 10 devicehandler.h rfcpopup.h
11 11
12SOURCES = btconnectionitem.cpp btdeviceitem.cpp \ 12SOURCES = btconnectionitem.cpp btdeviceitem.cpp \
13 btserviceitem.cpp stdpopups.cpp \ 13 btserviceitem.cpp stdpopups.cpp \
14 popuphelper.cpp main.cpp \ 14 popuphelper.cpp main.cpp \
15 bluebase.cpp scandialog.cpp \ 15 bluebase.cpp scandialog.cpp \
16 btlistitem.cpp hciconfwrapper.cpp \ 16 btlistitem.cpp hciconfwrapper.cpp \
17 bticonloader.cpp pppdialog.cpp \ 17 bticonloader.cpp pppdialog.cpp \
18 obexdialog.cpp devicehandler.cpp 18 obexdialog.cpp devicehandler.cpp \
19 rfcpopup.cpp
19INCLUDEPATH += $(OPIEDIR)/include 20INCLUDEPATH += $(OPIEDIR)/include
20INCLUDEPATH += $(OPIEDIR)/noncore/net/opietooth/lib 21INCLUDEPATH += $(OPIEDIR)/noncore/net/opietooth/lib
21DEPENDPATH += $(OPIEDIR)/include 22DEPENDPATH += $(OPIEDIR)/include
22LIBS += -lqpe -lopietooth -lopie 23LIBS += -lqpe -lopietooth -lopie
23INTERFACES = bluetoothbase.ui devicedialog.ui 24INTERFACES = bluetoothbase.ui devicedialog.ui
24DESTDIR = $(OPIEDIR)/bin 25DESTDIR = $(OPIEDIR)/bin
25TARGET = bluetooth-manager 26TARGET = bluetooth-manager
26 27
27TRANSLATIONS = ../../../../i18n/de/bluetooth-manager.ts \ 28TRANSLATIONS = ../../../../i18n/de/bluetooth-manager.ts \
28 ../../../../i18n/en/bluetooth-manager.ts \ 29 ../../../../i18n/en/bluetooth-manager.ts \
29 ../../../../i18n/es/bluetooth-manager.ts \ 30 ../../../../i18n/es/bluetooth-manager.ts \
30 ../../../../i18n/fr/bluetooth-manager.ts \ 31 ../../../../i18n/fr/bluetooth-manager.ts \
31 ../../../../i18n/hu/bluetooth-manager.ts \ 32 ../../../../i18n/hu/bluetooth-manager.ts \
32 ../../../../i18n/ja/bluetooth-manager.ts \ 33 ../../../../i18n/ja/bluetooth-manager.ts \
33 ../../../../i18n/ko/bluetooth-manager.ts \ 34 ../../../../i18n/ko/bluetooth-manager.ts \
34 ../../../../i18n/no/bluetooth-manager.ts \ 35 ../../../../i18n/no/bluetooth-manager.ts \
35 ../../../../i18n/pl/bluetooth-manager.ts \ 36 ../../../../i18n/pl/bluetooth-manager.ts \
36 ../../../../i18n/pt/bluetooth-manager.ts \ 37 ../../../../i18n/pt/bluetooth-manager.ts \
37 ../../../../i18n/pt_BR/bluetooth-manager.ts \ 38 ../../../../i18n/pt_BR/bluetooth-manager.ts \
38 ../../../../i18n/sl/bluetooth-manager.ts \ 39 ../../../../i18n/sl/bluetooth-manager.ts \
39 ../../../../i18n/zh_CN/bluetooth-manager.ts \ 40 ../../../../i18n/zh_CN/bluetooth-manager.ts \
40 ../../../../i18n/zh_TW/bluetooth-manager.ts 41 ../../../../i18n/zh_TW/bluetooth-manager.ts
diff --git a/noncore/net/opietooth/manager/obexdialog.cpp b/noncore/net/opietooth/manager/obexdialog.cpp
index cb142eb..15973d4 100644
--- a/noncore/net/opietooth/manager/obexdialog.cpp
+++ b/noncore/net/opietooth/manager/obexdialog.cpp
@@ -1,84 +1,86 @@
1 1
2#include "obexdialog.h" 2#include "obexdialog.h"
3#include <qpushbutton.h> 3#include <qpushbutton.h>
4#include <qmultilineedit.h> 4#include <qmultilineedit.h>
5#include <qlineedit.h> 5#include <qlineedit.h>
6#include <qlayout.h> 6#include <qlayout.h>
7#include <qlabel.h> 7#include <qlabel.h>
8#include <qfileinfo.h> 8#include <qfileinfo.h>
9 9
10#include <qpe/resource.h> 10#include <qpe/resource.h>
11 11
12#include <opie/oprocess.h> 12#include <opie/oprocess.h>
13#include <opie/ofiledialog.h> 13#include <opie/ofiledialog.h>
14 14
15using namespace OpieTooth;
16
15ObexDialog::ObexDialog( QWidget* parent, const char* name, bool modal, WFlags fl, const QString& device ) 17ObexDialog::ObexDialog( QWidget* parent, const char* name, bool modal, WFlags fl, const QString& device )
16 : QDialog( parent, name, modal, fl ) { 18 : QDialog( parent, name, modal, fl ) {
17 19
18 if ( !name ) 20 if ( !name )
19 setName( "ObexDialog" ); 21 setName( "ObexDialog" );
20 setCaption( tr( "beam files " ) ) ; 22 setCaption( tr( "beam files " ) ) ;
21 23
22 m_device = device; 24 m_device = device;
23 25
24 layout = new QVBoxLayout( this ); 26 layout = new QVBoxLayout( this );
25 27
26 QLabel* info = new QLabel( this ); 28 QLabel* info = new QLabel( this );
27 info->setText( tr("Which file should be beamed?") ); 29 info->setText( tr("Which file should be beamed?") );
28 30
29 cmdLine = new QLineEdit( this ); 31 cmdLine = new QLineEdit( this );
30 32
31 QPushButton *browserButton; 33 QPushButton *browserButton;
32 browserButton = new QPushButton( Resource::loadIconSet("fileopen"),"",this,"BrowseButton"); 34 browserButton = new QPushButton( Resource::loadIconSet("fileopen"),"",this,"BrowseButton");
33 connect( browserButton, SIGNAL(released() ), this , SLOT(browse() ) ); 35 connect( browserButton, SIGNAL(released() ), this , SLOT(browse() ) );
34 36
35 chNameLine = new QLineEdit( this ); 37 chNameLine = new QLineEdit( this );
36 38
37 sendButton = new QPushButton( this ); 39 sendButton = new QPushButton( this );
38 sendButton->setText( tr( "Send" ) ); 40 sendButton->setText( tr( "Send" ) );
39 41
40 layout->addWidget(info); 42 layout->addWidget(info);
41 layout->addWidget(cmdLine); 43 layout->addWidget(cmdLine);
42 layout->addWidget(browserButton); 44 layout->addWidget(browserButton);
43 layout->addWidget(chNameLine); 45 layout->addWidget(chNameLine);
44 layout->addWidget(sendButton); 46 layout->addWidget(sendButton);
45 47
46 connect( sendButton, SIGNAL( clicked() ), this, SLOT( sendData() ) ); 48 connect( sendButton, SIGNAL( clicked() ), this, SLOT( sendData() ) );
47 49
48} 50}
49 51
50ObexDialog::~ObexDialog() { 52ObexDialog::~ObexDialog() {
51} 53}
52 54
53void ObexDialog::browse() { 55void ObexDialog::browse() {
54 56
55 MimeTypes types; 57 MimeTypes types;
56 QStringList all; 58 QStringList all;
57 all << "*/*"; 59 all << "*/*";
58 types.insert("All Files", all ); 60 types.insert("All Files", all );
59 61
60 QString str = OFileDialog::getOpenFileName( 1,"/","", types, 0 ); 62 QString str = OFileDialog::getOpenFileName( 1,"/","", types, 0 );
61 cmdLine->setText( str ); 63 cmdLine->setText( str );
62 64
63} 65}
64 66
65void ObexDialog::sendData() { 67void ObexDialog::sendData() {
66 QString fileURL = cmdLine->text(); 68 QString fileURL = cmdLine->text();
67 QString file = QFileInfo( fileURL ).fileName(); 69 QString file = QFileInfo( fileURL ).fileName();
68 QString modifiedName = chNameLine->text(); 70 QString modifiedName = chNameLine->text();
69 71
70 // vom popupmenu beziehen 72 // vom popupmenu beziehen
71 OProcess* obexSend = new OProcess(); 73 OProcess* obexSend = new OProcess();
72 if ( !modifiedName.isEmpty() ) { 74 if ( !modifiedName.isEmpty() ) {
73 *obexSend << "ussp-push" << m_device << fileURL << modifiedName; 75 *obexSend << "ussp-push" << m_device << fileURL << modifiedName;
74 } else { 76 } else {
75 *obexSend << "ussp-push" << m_device << fileURL << file; 77 *obexSend << "ussp-push" << m_device << fileURL << file;
76 } 78 }
77 if (!obexSend->start(OProcess::DontCare, OProcess::AllOutput) ) { 79 if (!obexSend->start(OProcess::DontCare, OProcess::AllOutput) ) {
78 qWarning("could not start"); 80 qWarning("could not start");
79 delete obexSend; 81 delete obexSend;
80 } 82 }
81 83
82 84
83 85
84} 86}
diff --git a/noncore/net/opietooth/manager/obexdialog.h b/noncore/net/opietooth/manager/obexdialog.h
index 1a73b57..28d2be2 100644
--- a/noncore/net/opietooth/manager/obexdialog.h
+++ b/noncore/net/opietooth/manager/obexdialog.h
@@ -1,36 +1,39 @@
1#ifndef OBEXDIALOG_H 1#ifndef OBEXDIALOG_H
2#define OBEXDIALOG_H 2#define OBEXDIALOG_H
3 3
4 4
5#include <qdialog.h> 5#include <qdialog.h>
6#include <opie/oprocess.h> 6#include <opie/oprocess.h>
7 7
8class QVBoxLayout; 8class QVBoxLayout;
9class QPushButton; 9class QPushButton;
10class QMultiLineEdit; 10class QMultiLineEdit;
11class QLineEdit; 11class QLineEdit;
12 12
13class ObexDialog : public QDialog {
14 13
15 Q_OBJECT 14namespace OpieTooth {
16 15
17public: 16 class ObexDialog : public QDialog {
18 ObexDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0, const QString& device = 0);
19 ~ObexDialog();
20 17
18 Q_OBJECT
19
20 public:
21 ObexDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0, const QString& device = 0);
22 ~ObexDialog();
21 23
22private slots:
23 void browse();
24 void sendData();
25
26protected:
27 QVBoxLayout* layout;
28 QLineEdit* cmdLine;
29 QLineEdit* chNameLine;
30 QPushButton* sendButton;
31private:
32 // Device that is used
33 QString m_device;
34};
35 24
25private slots:
26 void browse();
27 void sendData();
28
29 protected:
30 QVBoxLayout* layout;
31 QLineEdit* cmdLine;
32 QLineEdit* chNameLine;
33 QPushButton* sendButton;
34 private:
35 // Device that is used
36 QString m_device;
37 };
38}
36#endif 39#endif
diff --git a/noncore/net/opietooth/manager/popuphelper.cpp b/noncore/net/opietooth/manager/popuphelper.cpp
index ba91e04..4a4daf2 100644
--- a/noncore/net/opietooth/manager/popuphelper.cpp
+++ b/noncore/net/opietooth/manager/popuphelper.cpp
@@ -1,35 +1,35 @@
1 1
2#include "stdpopups.h" 2#include "stdpopups.h"
3 3
4#include "popuphelper.h" 4#include "popuphelper.h"
5 5
6using namespace OpieTooth; 6using namespace OpieTooth;
7 7
8PopupHelper::PopupHelper() { 8PopupHelper::PopupHelper() {
9 init(); 9 init();
10} 10}
11 11
12PopupHelper::~PopupHelper() { 12PopupHelper::~PopupHelper() {
13 13
14} 14}
15 15
16void PopupHelper::insert( int id, popupFactory fact ) { 16void PopupHelper::insert( int id, popupFactory fact ) {
17 m_map.insert(id, fact ); 17 m_map.insert(id, fact );
18} 18}
19 19
20QPopupMenu* PopupHelper::find( int id, const Services& ser, QListViewItem* item ) { 20QPopupMenu* PopupHelper::find( int id, const Services& ser, BTDeviceItem* item ) {
21 //qWarning("find"); 21 //qWarning("find");
22 FactoryMap::Iterator it = m_map.find(id ); 22 FactoryMap::Iterator it = m_map.find(id );
23 if ( it != m_map.end() ) { 23 if ( it != m_map.end() ) {
24 //qWarning("found"); 24 //qWarning("found");
25 popupFactory fact = it.data(); 25 popupFactory fact = it.data();
26 return (*fact)(ser, item); 26 return (*fact)(ser, item);
27 } 27 }
28 return 0l; 28 return 0l;
29} 29}
30 30
31void PopupHelper::init() { 31void PopupHelper::init() {
32 insert( 4355, newRfcComPopup ); 32 insert( 4355, newRfcComPopup );
33 insert( 4353, newRfcComPopup ); 33 insert( 4353, newRfcComPopup );
34 insert( 3, newObexPushPopup ); 34 insert( 3, newObexPushPopup );
35} 35}
diff --git a/noncore/net/opietooth/manager/popuphelper.h b/noncore/net/opietooth/manager/popuphelper.h
index 7541ac5..6d4d413 100644
--- a/noncore/net/opietooth/manager/popuphelper.h
+++ b/noncore/net/opietooth/manager/popuphelper.h
@@ -1,27 +1,27 @@
1 1
2#ifndef OPIE_TOOTH_POPUP_HELPER 2#ifndef OPIE_TOOTH_POPUP_HELPER
3#define OPIE_TOOTH_POPUP_HELPER 3#define OPIE_TOOTH_POPUP_HELPER
4 4
5#include <qlistview.h> 5#include <qlistview.h>
6#include <qpopupmenu.h> 6#include <qpopupmenu.h>
7#include <qmap.h> 7#include <qmap.h>
8 8
9#include <services.h> 9#include <services.h>
10 10
11namespace OpieTooth { 11namespace OpieTooth {
12 typedef QPopupMenu* (*popupFactory)(const Services&, QListViewItem*); 12 typedef QPopupMenu* (*popupFactory)(const Services&, BTDeviceItem*);
13 typedef QMap<int, popupFactory> FactoryMap; 13 typedef QMap<int, popupFactory> FactoryMap;
14 class PopupHelper { 14 class PopupHelper {
15 public: 15 public:
16 PopupHelper(); 16 PopupHelper();
17 ~PopupHelper(); 17 ~PopupHelper();
18 void insert( int id, popupFactory fact ); 18 void insert( int id, popupFactory fact );
19 QPopupMenu* find( int id, const Services&, QListViewItem* ); 19 QPopupMenu* find( int id, const Services&, BTDeviceItem* );
20 private: 20 private:
21 void init(); 21 void init();
22 FactoryMap m_map; 22 FactoryMap m_map;
23 23
24 }; 24 };
25}; 25};
26 26
27#endif 27#endif
diff --git a/noncore/net/opietooth/manager/pppdialog.cpp b/noncore/net/opietooth/manager/pppdialog.cpp
index 4d926a5..1f347ce 100644
--- a/noncore/net/opietooth/manager/pppdialog.cpp
+++ b/noncore/net/opietooth/manager/pppdialog.cpp
@@ -1,66 +1,68 @@
1 1
2#include "pppdialog.h" 2#include "pppdialog.h"
3#include <qpushbutton.h> 3#include <qpushbutton.h>
4#include <qmultilineedit.h> 4#include <qmultilineedit.h>
5#include <qlineedit.h> 5#include <qlineedit.h>
6#include <qlayout.h> 6#include <qlayout.h>
7#include <qlabel.h> 7#include <qlabel.h>
8#include <opie/oprocess.h> 8#include <opie/oprocess.h>
9 9
10using namespace OpieTooth;
11
10PPPDialog::PPPDialog( QWidget* parent, const char* name, bool modal, WFlags fl, const QString& device ) 12PPPDialog::PPPDialog( QWidget* parent, const char* name, bool modal, WFlags fl, const QString& device )
11 : QDialog( parent, name, modal, fl ) { 13 : QDialog( parent, name, modal, fl ) {
12 14
13 if ( !name ) 15 if ( !name )
14 setName( "PPPDialog" ); 16 setName( "PPPDialog" );
15 setCaption( tr( "ppp connection " ) ) ; 17 setCaption( tr( "ppp connection " ) ) ;
16 18
17 m_device = device; 19 m_device = device;
18 20
19 layout = new QVBoxLayout( this ); 21 layout = new QVBoxLayout( this );
20 22
21 QLabel* info = new QLabel( this ); 23 QLabel* info = new QLabel( this );
22 info->setText( tr("Enter an ppp script name:") ); 24 info->setText( tr("Enter an ppp script name:") );
23 25
24 cmdLine = new QLineEdit( this ); 26 cmdLine = new QLineEdit( this );
25 27
26 outPut = new QMultiLineEdit( this ); 28 outPut = new QMultiLineEdit( this );
27 QFont outPut_font( outPut->font() ); 29 QFont outPut_font( outPut->font() );
28 outPut_font.setPointSize( 8 ); 30 outPut_font.setPointSize( 8 );
29 outPut->setFont( outPut_font ); 31 outPut->setFont( outPut_font );
30 outPut->setWordWrap( QMultiLineEdit::WidgetWidth ); 32 outPut->setWordWrap( QMultiLineEdit::WidgetWidth );
31 33
32 connectButton = new QPushButton( this ); 34 connectButton = new QPushButton( this );
33 connectButton->setText( tr( "Connect" ) ); 35 connectButton->setText( tr( "Connect" ) );
34 36
35 layout->addWidget(info); 37 layout->addWidget(info);
36 layout->addWidget(cmdLine); 38 layout->addWidget(cmdLine);
37 layout->addWidget(outPut); 39 layout->addWidget(outPut);
38 layout->addWidget(connectButton); 40 layout->addWidget(connectButton);
39 41
40 connect( connectButton, SIGNAL( clicked() ), this, SLOT( connectToDevice() ) ); 42 connect( connectButton, SIGNAL( clicked() ), this, SLOT( connectToDevice() ) );
41 43
42} 44}
43 45
44PPPDialog::~PPPDialog() { 46PPPDialog::~PPPDialog() {
45} 47}
46 48
47void PPPDialog::connectToDevice() { 49void PPPDialog::connectToDevice() {
48 outPut->clear(); 50 outPut->clear();
49 // vom popupmenu beziehen 51 // vom popupmenu beziehen
50 QString connectScript = "/etc/ppp/peers/" + cmdLine->text(); 52 QString connectScript = "/etc/ppp/peers/" + cmdLine->text();
51 OProcess* pppDial = new OProcess(); 53 OProcess* pppDial = new OProcess();
52 *pppDial << "pppd" << m_device << "call" << connectScript; 54 *pppDial << "pppd" << m_device << "call" << connectScript;
53 connect( pppDial, SIGNAL(receivedStdout(OProcess*, char*, int ) ), 55 connect( pppDial, SIGNAL(receivedStdout(OProcess*, char*, int ) ),
54 this, SLOT(fillOutPut(OProcess*, char*, int ) ) ); 56 this, SLOT(fillOutPut(OProcess*, char*, int ) ) );
55 if (!pppDial->start(OProcess::DontCare, OProcess::AllOutput) ) { 57 if (!pppDial->start(OProcess::DontCare, OProcess::AllOutput) ) {
56 qWarning("could not start"); 58 qWarning("could not start");
57 delete pppDial; 59 delete pppDial;
58 } 60 }
59} 61}
60 62
61void PPPDialog::fillOutPut( OProcess* pppDial, char* cha, int len ) { 63void PPPDialog::fillOutPut( OProcess* pppDial, char* cha, int len ) {
62 QCString str(cha, len ); 64 QCString str(cha, len );
63 outPut->insertLine( str ); 65 outPut->insertLine( str );
64 delete pppDial; 66 delete pppDial;
65} 67}
66 68
diff --git a/noncore/net/opietooth/manager/pppdialog.h b/noncore/net/opietooth/manager/pppdialog.h
index b80b73d..6fdc90a 100644
--- a/noncore/net/opietooth/manager/pppdialog.h
+++ b/noncore/net/opietooth/manager/pppdialog.h
@@ -1,34 +1,37 @@
1#ifndef PPPDIALOG_H 1#ifndef PPPDIALOG_H
2#define PPPDIALOG_H 2#define PPPDIALOG_H
3 3
4 4
5#include <qdialog.h> 5#include <qdialog.h>
6#include <opie/oprocess.h> 6#include <opie/oprocess.h>
7 7
8class QVBoxLayout; 8class QVBoxLayout;
9class QPushButton; 9class QPushButton;
10class QMultiLineEdit; 10class QMultiLineEdit;
11class QLineEdit; 11class QLineEdit;
12 12
13class PPPDialog : public QDialog {
14 13
15 Q_OBJECT 14namespace OpieTooth {
16 15
17public: 16 class PPPDialog : public QDialog {
18 PPPDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0, const QString& device = 0);
19 ~PPPDialog();
20 17
18 Q_OBJECT
21 19
22private slots: 20 public:
23 void connectToDevice(); 21 PPPDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0, const QString& device = 0);
24 void fillOutPut( OProcess* pppDial, char* cha, int len ); 22 ~PPPDialog();
25protected:
26 QVBoxLayout* layout;
27 QLineEdit* cmdLine;
28 QPushButton* connectButton;
29 QMultiLineEdit* outPut;
30 23
31private: 24 private slots:
32 QString m_device; 25 void connectToDevice();
33}; 26 void fillOutPut( OProcess* pppDial, char* cha, int len );
27 protected:
28 QVBoxLayout* layout;
29 QLineEdit* cmdLine;
30 QPushButton* connectButton;
31 QMultiLineEdit* outPut;
32
33 private:
34 QString m_device;
35 };
36}
34#endif 37#endif
diff --git a/noncore/net/opietooth/manager/stdpopups.cpp b/noncore/net/opietooth/manager/stdpopups.cpp
index 2290b9a..750365e 100644
--- a/noncore/net/opietooth/manager/stdpopups.cpp
+++ b/noncore/net/opietooth/manager/stdpopups.cpp
@@ -1,16 +1,15 @@
1 1
2//#include "rfccompopup.h" 2#include "rfcpopup.h"
3 3
4#include "stdpopups.h" 4#include "stdpopups.h"
5 5
6extern "C" { 6extern "C" {
7 7
8 QPopupMenu* newRfcComPopup( const OpieTooth::Services& servive, QListViewItem* item ) { 8 QPopupMenu* newRfcComPopup( const OpieTooth::Services& servive, OpieTooth::BTDeviceItem* item ) {
9 // return OpieTooth::RfcComPopup( servive, item ); 9 return new OpieTooth::RfcCommPopup(/* servive, item*/ ); // fix spellin RfComm vs. RfcComm and paramaters
10 return 0l; 10 //return 0l;
11 } 11 }
12 QPopupMenu* newObexPushPopup( const OpieTooth::Services&, QListViewItem* ) { 12 QPopupMenu* newObexPushPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* ) {
13 return 0l; 13 return 0l;
14 } 14 }
15
16} 15}
diff --git a/noncore/net/opietooth/manager/stdpopups.h b/noncore/net/opietooth/manager/stdpopups.h
index 185d68d..b57d4de 100644
--- a/noncore/net/opietooth/manager/stdpopups.h
+++ b/noncore/net/opietooth/manager/stdpopups.h
@@ -1,15 +1,18 @@
1 1
2#ifndef OPIE_TOOTH_STD_POPUPS 2#ifndef OPIE_TOOTH_STD_POPUPS
3#define OPIE_TOOTH_STD_POPUPS 3#define OPIE_TOOTH_STD_POPUPS
4 4
5#include <qlistview.h> 5#include <qlistview.h>
6#include <qpopupmenu.h> 6#include <qpopupmenu.h>
7 7
8#include <services.h> 8#include <services.h>
9 9
10#include "btdeviceitem.h"
11
10extern "C" { 12extern "C" {
11QPopupMenu* newRfcComPopup( const OpieTooth::Services&, QListViewItem* ); 13
12QPopupMenu* newObexPushPopup( const OpieTooth::Services&, QListViewItem* ); 14 QPopupMenu* newRfcComPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* );
15 QPopupMenu* newObexPushPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* );
13} 16}
14 17
15#endif 18#endif