author | harlekin <harlekin> | 2002-07-20 23:54:44 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-07-20 23:54:44 (UTC) |
commit | 76d7938ec6b89aa11f54f9fbdad40bb358b4886a (patch) (unidiff) | |
tree | 0dfa86240e9674cefa489d85ac4841a94d43e175 | |
parent | 594dfd3535846a536cebdb3381f4858239404c49 (diff) | |
download | opie-76d7938ec6b89aa11f54f9fbdad40bb358b4886a.zip opie-76d7938ec6b89aa11f54f9fbdad40bb358b4886a.tar.gz opie-76d7938ec6b89aa11f54f9fbdad40bb358b4886a.tar.bz2 |
update
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 19 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/popuphelper.cpp | 11 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/stdpopups.cpp | 15 |
3 files changed, 28 insertions, 17 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index af64663..c81d4d1 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp | |||
@@ -1,98 +1,103 @@ | |||
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" | ||
22 | #include "btconnectionitem.h" | ||
23 | |||
24 | #include <remotedevice.h> | ||
25 | #include <services.h> | ||
21 | 26 | ||
22 | #include <stdlib.h> | 27 | #include <stdlib.h> |
23 | 28 | ||
24 | #include <qframe.h> | 29 | #include <qframe.h> |
25 | #include <qlabel.h> | 30 | #include <qlabel.h> |
26 | #include <qpushbutton.h> | 31 | #include <qpushbutton.h> |
27 | #include <qlayout.h> | 32 | #include <qlayout.h> |
28 | #include <qvariant.h> | 33 | #include <qvariant.h> |
29 | #include <qwhatsthis.h> | ||
30 | #include <qimage.h> | 34 | #include <qimage.h> |
31 | #include <qpixmap.h> | 35 | #include <qpixmap.h> |
32 | #include <qtabwidget.h> | 36 | #include <qtabwidget.h> |
33 | #include <qscrollview.h> | 37 | #include <qscrollview.h> |
34 | #include <qvbox.h> | 38 | #include <qvbox.h> |
35 | #include <qmessagebox.h> | 39 | #include <qmessagebox.h> |
36 | #include <qcheckbox.h> | 40 | #include <qcheckbox.h> |
37 | #include <qlineedit.h> | 41 | #include <qlineedit.h> |
38 | #include <qlistview.h> | 42 | #include <qlistview.h> |
39 | #include <qdir.h> | 43 | #include <qdir.h> |
40 | #include <qpopupmenu.h> | 44 | #include <qpopupmenu.h> |
41 | #include <qtimer.h> | 45 | #include <qtimer.h> |
42 | 46 | ||
47 | #include <qpe/qpeapplication.h> | ||
43 | #include <qpe/resource.h> | 48 | #include <qpe/resource.h> |
44 | #include <qpe/config.h> | 49 | #include <qpe/config.h> |
45 | 50 | ||
46 | #include <remotedevice.h> | ||
47 | #include <services.h> | ||
48 | |||
49 | #include "devicehandler.h" | ||
50 | #include "btconnectionitem.h" | ||
51 | 51 | ||
52 | using namespace OpieTooth; | 52 | using namespace OpieTooth; |
53 | 53 | ||
54 | BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) | 54 | BlueBase::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 | |||
76 | // let hold be rightButtonClicked() | ||
77 | QPEApplication::setStylusOperation( ListView2->viewport(), QPEApplication::RightOnHold); | ||
78 | QPEApplication::setStylusOperation( ListView4->viewport(), QPEApplication::RightOnHold); | ||
79 | |||
75 | //Load all icons needed | 80 | //Load all icons needed |
76 | m_offPix = Resource::loadPixmap( "editdelete" ); | 81 | m_offPix = Resource::loadPixmap( "editdelete" ); |
77 | m_onPix = Resource::loadPixmap( "installed" ); | 82 | m_onPix = Resource::loadPixmap( "installed" ); |
78 | 83 | ||
79 | QPalette pal = this->palette(); | 84 | QPalette pal = this->palette(); |
80 | QColor col = pal.color( QPalette::Active, QColorGroup::Background ); | 85 | QColor col = pal.color( QPalette::Active, QColorGroup::Background ); |
81 | pal.setColor( QPalette::Active, QColorGroup::Button, col ); | 86 | pal.setColor( QPalette::Active, QColorGroup::Button, col ); |
82 | pal.setColor( QPalette::Inactive, QColorGroup::Button, col ); | 87 | pal.setColor( QPalette::Inactive, QColorGroup::Button, col ); |
83 | pal.setColor( QPalette::Normal, QColorGroup::Button, col ); | 88 | pal.setColor( QPalette::Normal, QColorGroup::Button, col ); |
84 | pal.setColor( QPalette::Disabled, QColorGroup::Button, col ); | 89 | pal.setColor( QPalette::Disabled, QColorGroup::Button, col ); |
85 | this->setPalette( pal ); | 90 | this->setPalette( pal ); |
86 | 91 | ||
87 | setCaption( tr( "Bluetooth Manager" ) ); | 92 | setCaption( tr( "Bluetooth Manager" ) ); |
88 | 93 | ||
89 | readConfig(); | 94 | readConfig(); |
90 | initGui(); | 95 | initGui(); |
91 | 96 | ||
92 | //TESTING | 97 | //TESTING |
93 | ListView2->setRootIsDecorated(true); | 98 | ListView2->setRootIsDecorated(true); |
94 | 99 | ||
95 | BTDeviceItem *topLV2 = new BTDeviceItem( ListView2, RemoteDevice("xx:", "Siemens S45" ) ); | 100 | BTDeviceItem *topLV2 = new BTDeviceItem( ListView2, RemoteDevice("xx:", "Siemens S45" ) ); |
96 | topLV2->setPixmap( 1, m_onPix ); | 101 | topLV2->setPixmap( 1, m_onPix ); |
97 | Services s1; | 102 | Services s1; |
98 | s1.setServiceName( "Serial" ); | 103 | s1.setServiceName( "Serial" ); |
@@ -141,63 +146,61 @@ void BlueBase::writeConfig() { | |||
141 | cfg.writeEntry( "enableInquiryscan" , m_enableInquiryscan ); | 146 | cfg.writeEntry( "enableInquiryscan" , m_enableInquiryscan ); |
142 | 147 | ||
143 | writeToHciConfig(); | 148 | writeToHciConfig(); |
144 | } | 149 | } |
145 | 150 | ||
146 | /** | 151 | /** |
147 | * Modify the hcid.conf file to our needs | 152 | * Modify the hcid.conf file to our needs |
148 | */ | 153 | */ |
149 | void BlueBase::writeToHciConfig() { | 154 | void BlueBase::writeToHciConfig() { |
150 | qWarning("writeToHciConfig"); | 155 | qWarning("writeToHciConfig"); |
151 | HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" ); | 156 | HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" ); |
152 | hciconf.load(); | 157 | hciconf.load(); |
153 | hciconf.setPinHelper( "/bin/QtPalmtop/bin/blue-pin" ); | 158 | hciconf.setPinHelper( "/bin/QtPalmtop/bin/blue-pin" ); |
154 | hciconf.setName( m_deviceName ); | 159 | hciconf.setName( m_deviceName ); |
155 | hciconf.setEncrypt( m_useEncryption ); | 160 | hciconf.setEncrypt( m_useEncryption ); |
156 | hciconf.setAuth( m_enableAuthentification ); | 161 | hciconf.setAuth( m_enableAuthentification ); |
157 | hciconf.setPscan( m_enablePagescan ); | 162 | hciconf.setPscan( m_enablePagescan ); |
158 | hciconf.setIscan( m_enableInquiryscan ); | 163 | hciconf.setIscan( m_enableInquiryscan ); |
159 | hciconf.save(); | 164 | hciconf.save(); |
160 | } | 165 | } |
161 | 166 | ||
162 | 167 | ||
163 | /** | 168 | /** |
164 | * Read the list of allready known devices | 169 | * Read the list of allready known devices |
165 | * | ||
166 | */ | 170 | */ |
167 | void BlueBase::readSavedDevices() { | 171 | void BlueBase::readSavedDevices() { |
168 | 172 | ||
169 | QValueList<RemoteDevice> loadedDevices; | 173 | QValueList<RemoteDevice> loadedDevices; |
170 | DeviceHandler handler; | 174 | DeviceHandler handler; |
171 | loadedDevices = handler.load(); | 175 | loadedDevices = handler.load(); |
172 | 176 | ||
173 | addSearchedDevices( loadedDevices ); | 177 | addSearchedDevices( loadedDevices ); |
174 | } | 178 | } |
175 | 179 | ||
176 | 180 | ||
177 | /** | 181 | /** |
178 | * Write the list of allready known devices | 182 | * Write the list of allready known devices |
179 | * | ||
180 | */ | 183 | */ |
181 | void BlueBase::writeSavedDevices() { | 184 | void BlueBase::writeSavedDevices() { |
182 | QListViewItemIterator it( ListView2 ); | 185 | QListViewItemIterator it( ListView2 ); |
183 | BTListItem* item; | 186 | BTListItem* item; |
184 | BTDeviceItem* device; | 187 | BTDeviceItem* device; |
185 | RemoteDevice::ValueList list; | 188 | RemoteDevice::ValueList list; |
186 | for ( ; it.current(); ++it ) { | 189 | for ( ; it.current(); ++it ) { |
187 | item = (BTListItem*)it.current(); | 190 | item = (BTListItem*)it.current(); |
188 | if(item->typeId() != BTListItem::Device ) | 191 | if(item->typeId() != BTListItem::Device ) |
189 | continue; | 192 | continue; |
190 | device = (BTDeviceItem*)item; | 193 | device = (BTDeviceItem*)item; |
191 | 194 | ||
192 | list.append( device->remoteDevice() ); | 195 | list.append( device->remoteDevice() ); |
193 | } | 196 | } |
194 | /* | 197 | /* |
195 | * if not empty save the List through DeviceHandler | 198 | * if not empty save the List through DeviceHandler |
196 | */ | 199 | */ |
197 | if ( list.isEmpty() ) | 200 | if ( list.isEmpty() ) |
198 | return; | 201 | return; |
199 | DeviceHandler handler; | 202 | DeviceHandler handler; |
200 | handler.save( list ); | 203 | handler.save( list ); |
201 | } | 204 | } |
202 | 205 | ||
203 | 206 | ||
diff --git a/noncore/net/opietooth/manager/popuphelper.cpp b/noncore/net/opietooth/manager/popuphelper.cpp index 4ef1ed5..ba91e04 100644 --- a/noncore/net/opietooth/manager/popuphelper.cpp +++ b/noncore/net/opietooth/manager/popuphelper.cpp | |||
@@ -1,30 +1,35 @@ | |||
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 | |||
11 | PopupHelper::~PopupHelper() { | 12 | PopupHelper::~PopupHelper() { |
12 | 13 | ||
13 | } | 14 | } |
15 | |||
14 | void PopupHelper::insert( int id, popupFactory fact ) { | 16 | void PopupHelper::insert( int id, popupFactory fact ) { |
15 | m_map.insert(id, fact ); | 17 | m_map.insert(id, fact ); |
16 | } | 18 | } |
19 | |||
17 | QPopupMenu* PopupHelper::find( int id, const Services& ser, QListViewItem* item ) { | 20 | QPopupMenu* PopupHelper::find( int id, const Services& ser, QListViewItem* item ) { |
18 | //qWarning("find"); | 21 | //qWarning("find"); |
19 | FactoryMap::Iterator it = m_map.find(id ); | 22 | FactoryMap::Iterator it = m_map.find(id ); |
20 | if ( it != m_map.end() ) { | 23 | if ( it != m_map.end() ) { |
21 | //qWarning("found"); | 24 | //qWarning("found"); |
22 | popupFactory fact = it.data(); | 25 | popupFactory fact = it.data(); |
23 | return (*fact)(ser, item); | 26 | return (*fact)(ser, item); |
24 | } | 27 | } |
25 | return 0l; | 28 | return 0l; |
26 | } | 29 | } |
30 | |||
27 | void PopupHelper::init() { | 31 | void PopupHelper::init() { |
28 | insert( 1, newRfcComPopup ); | 32 | insert( 4355, newRfcComPopup ); |
29 | insert(2, newObexPushPopup ); | 33 | insert( 4353, newRfcComPopup ); |
34 | insert( 3, newObexPushPopup ); | ||
30 | } | 35 | } |
diff --git a/noncore/net/opietooth/manager/stdpopups.cpp b/noncore/net/opietooth/manager/stdpopups.cpp index f462368..2290b9a 100644 --- a/noncore/net/opietooth/manager/stdpopups.cpp +++ b/noncore/net/opietooth/manager/stdpopups.cpp | |||
@@ -1,13 +1,16 @@ | |||
1 | 1 | ||
2 | //#include "rfccompopup.h" | 2 | //#include "rfccompopup.h" |
3 | 3 | ||
4 | #include "stdpopups.h" | 4 | #include "stdpopups.h" |
5 | 5 | ||
6 | extern "C" { | ||
7 | |||
8 | QPopupMenu* newRfcComPopup( const OpieTooth::Services& servive, QListViewItem* item ) { | ||
9 | // return OpieTooth::RfcComPopup( servive, item ); | ||
10 | return 0l; | ||
11 | } | ||
12 | QPopupMenu* newObexPushPopup( const OpieTooth::Services&, QListViewItem* ) { | ||
13 | return 0l; | ||
14 | } | ||
6 | 15 | ||
7 | QPopupMenu* newRfcComPopup( const OpieTooth::Services& servive, QListViewItem* item ) { | ||
8 | // return OpieTooth::RfcComPopup( servive, item ); | ||
9 | return 0l; | ||
10 | } | ||
11 | QPopupMenu* newObexPushPopup( const OpieTooth::Services&, QListViewItem* ) { | ||
12 | return 0l; | ||
13 | } | 16 | } |