author | harlekin <harlekin> | 2002-06-17 22:56:55 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-06-17 22:56:55 (UTC) |
commit | 28400a31238af793fe235a0c8d13131eb823037d (patch) (unidiff) | |
tree | b8193328768f802a69dae6d15917fb9c8759e014 /noncore/net/opietooth/manager | |
parent | 0d947c67b05946f535284b31f472bf4e08bf79a1 (diff) | |
download | opie-28400a31238af793fe235a0c8d13131eb823037d.zip opie-28400a31238af793fe235a0c8d13131eb823037d.tar.gz opie-28400a31238af793fe235a0c8d13131eb823037d.tar.bz2 |
got a bit further
Diffstat (limited to 'noncore/net/opietooth/manager') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 162 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.h | 12 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/bluetoothbase.ui | 16 |
3 files changed, 146 insertions, 44 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index c993c7c..d45fbe0 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp | |||
@@ -39,21 +39,31 @@ | |||
39 | #include <qpe/resource.h> | 39 | #include <qpe/resource.h> |
40 | #include <qpe/config.h> | 40 | #include <qpe/config.h> |
41 | 41 | ||
42 | #include <remotedevice.h> | ||
42 | 43 | ||
43 | namespace OpieTooth { | ||
44 | 44 | ||
45 | namespace OpieTooth { | ||
45 | 46 | ||
46 | #include <remotedevice.h> | ||
47 | 47 | ||
48 | BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) | 48 | BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) |
49 | : BluetoothBase( parent, name, fl ) { | 49 | : BluetoothBase( parent, name, fl ) { |
50 | 50 | ||
51 | 51 | ||
52 | QObject::connect( (QObject*) PushButton2, SIGNAL( clicked() ), this, SLOT(startScan())); | 52 | QObject::connect( (QObject*)PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) ); |
53 | QObject::connect((QObject*)configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges())); | 53 | QObject::connect( (QObject*)configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) ); |
54 | QObject::connect( (QObject*)ListView2, SIGNAL( expanded( QListViewItem * item ) ), | ||
55 | this, SLOT( addServicesToDevice( QListViewItem * item ) ) ); | ||
56 | QObject::connect( (QObject*)ListView2, SIGNAL( clicked( QListViewItem * )), | ||
57 | this, SLOT( startServiceActionClicked( QListViewItem * item ) ) ); | ||
58 | |||
59 | // | ||
60 | // QObject::connect( (QObject*) Manager, SIGNAL (foundServices( const QString& device, Services::ValueList ), this () ) ); | ||
54 | 61 | ||
62 | //Load all icons needed | ||
55 | 63 | ||
56 | 64 | ||
65 | QPixmap offPix = Resource::loadPixmap( "editdelete" ); | ||
66 | QPixmap onPix = Resource::loadPixmap( "installed" ); | ||
57 | 67 | ||
58 | QPalette pal = this->palette(); | 68 | QPalette pal = this->palette(); |
59 | QColor col = pal.color(QPalette::Active, QColorGroup::Background); | 69 | QColor col = pal.color(QPalette::Active, QColorGroup::Background); |
@@ -67,11 +77,28 @@ namespace OpieTooth { | |||
67 | 77 | ||
68 | readConfig(); | 78 | readConfig(); |
69 | initGui(); | 79 | initGui(); |
80 | |||
81 | |||
82 | //TESTING | ||
83 | |||
84 | ListView2->setRootIsDecorated(true); | ||
85 | |||
86 | QListViewItem *topLV = new QListViewItem( ListView2, "Harlekins Dongle" , "yes"); | ||
87 | topLV->setPixmap(0, offPix); | ||
88 | (void) new QListViewItem( topLV, "on" ); | ||
89 | (void) new QListViewItem( topLV, "off" ); | ||
90 | |||
91 | QListViewItem *topLV2 = new QListViewItem( ListView2, "Siemens S45" , "no" ); | ||
92 | topLV2->setPixmap(0, onPix); | ||
93 | (void) new QListViewItem( topLV2, "on" ); | ||
94 | (void) new QListViewItem( topLV2, "off" ); | ||
95 | |||
70 | } | 96 | } |
71 | 97 | ||
72 | /** | 98 | |
73 | * Reads all options from the config file | 99 | /** |
74 | */ | 100 | * Reads all options from the config file |
101 | */ | ||
75 | void BlueBase::readConfig() { | 102 | void BlueBase::readConfig() { |
76 | 103 | ||
77 | Config cfg("bluetoothmanager"); | 104 | Config cfg("bluetoothmanager"); |
@@ -87,16 +114,15 @@ namespace OpieTooth { | |||
87 | 114 | ||
88 | } | 115 | } |
89 | 116 | ||
90 | /** | 117 | /** |
91 | * Writes all options to the config file | 118 | * Writes all options to the config file |
92 | */ | 119 | */ |
93 | void BlueBase::writeConfig() { | 120 | void BlueBase::writeConfig() { |
94 | 121 | ||
95 | 122 | ||
96 | Config cfg("bluetoothmanager"); | 123 | Config cfg("bluetoothmanager"); |
97 | cfg.setGroup("bluezsettings"); | 124 | cfg.setGroup("bluezsettings"); |
98 | 125 | ||
99 | |||
100 | cfg.writeEntry("name", deviceName); | 126 | cfg.writeEntry("name", deviceName); |
101 | cfg.writeEntryCrypt("passkey", defaultPasskey); | 127 | cfg.writeEntryCrypt("passkey", defaultPasskey); |
102 | cfg.writeEntry("useEncryption", useEncryption); | 128 | cfg.writeEntry("useEncryption", useEncryption); |
@@ -106,9 +132,27 @@ namespace OpieTooth { | |||
106 | } | 132 | } |
107 | 133 | ||
108 | 134 | ||
109 | /** | 135 | /* |
110 | * Set up the gui | 136 | * Read the list of allready known devices |
111 | */ | 137 | * |
138 | */ | ||
139 | void BlueBase::readSavedDevices() { | ||
140 | |||
141 | } | ||
142 | |||
143 | /* | ||
144 | * Read the list of allready known devices | ||
145 | * | ||
146 | */ | ||
147 | void BlueBase::writeSavedDevices() { | ||
148 | |||
149 | |||
150 | } | ||
151 | |||
152 | |||
153 | /** | ||
154 | * Set up the gui | ||
155 | */ | ||
112 | void BlueBase::initGui() { | 156 | void BlueBase::initGui() { |
113 | 157 | ||
114 | StatusLabel->setText(getStatus()); // maybe move it to getStatus() | 158 | StatusLabel->setText(getStatus()); // maybe move it to getStatus() |
@@ -119,23 +163,29 @@ namespace OpieTooth { | |||
119 | inquiryscanCheckBox->setChecked(enableInquiryscan); | 163 | inquiryscanCheckBox->setChecked(enableInquiryscan); |
120 | deviceNameLine->setText(deviceName); | 164 | deviceNameLine->setText(deviceName); |
121 | passkeyLine->setText(defaultPasskey); | 165 | passkeyLine->setText(defaultPasskey); |
166 | // set info tab | ||
167 | setInfo(); | ||
122 | } | 168 | } |
123 | 169 | ||
124 | 170 | ||
125 | /** | 171 | /** |
126 | * Get the status informations and returns it | 172 | * Get the status informations and returns it |
127 | * @return QString the status informations gathered | 173 | * @return QString the status informations gathered |
128 | */ | 174 | */ |
129 | QString BlueBase::getStatus(){ | 175 | QString BlueBase::getStatus(){ |
130 | 176 | ||
131 | return ("manger.h need also a status method"); | 177 | QString infoString = tr("<b>Device name : </b> Ipaq" ); |
178 | infoString += QString("<br><b>" + tr("MAC adress: ") +"</b> No idea"); | ||
179 | infoString += QString("<br><b>" + tr("Class") + "</b> PDA"); | ||
180 | |||
181 | return (infoString); | ||
132 | 182 | ||
133 | } | 183 | } |
134 | 184 | ||
135 | 185 | ||
136 | /** | 186 | /** |
137 | * Read the current values from the gui and invoke writeConfig() | 187 | * Read the current values from the gui and invoke writeConfig() |
138 | */ | 188 | */ |
139 | void BlueBase::applyConfigChanges() { | 189 | void BlueBase::applyConfigChanges() { |
140 | 190 | ||
141 | deviceName = deviceNameLine->text(); | 191 | deviceName = deviceNameLine->text(); |
@@ -155,6 +205,10 @@ namespace OpieTooth { | |||
155 | } | 205 | } |
156 | 206 | ||
157 | 207 | ||
208 | /* | ||
209 | * Add fresh found devices from scan dialog to the listing | ||
210 | * | ||
211 | */ | ||
158 | void BlueBase::addSearchedDevices( QList<RemoteDevice> &newDevices ) { | 212 | void BlueBase::addSearchedDevices( QList<RemoteDevice> &newDevices ) { |
159 | 213 | ||
160 | QListViewItem * deviceItem; | 214 | QListViewItem * deviceItem; |
@@ -165,16 +219,61 @@ namespace OpieTooth { | |||
165 | 219 | ||
166 | 220 | ||
167 | RemoteDevice *dev = it.current(); | 221 | RemoteDevice *dev = it.current(); |
168 | deviceItem = new QListViewItem( ListView4, dev->name() ); | 222 | deviceItem = new QListViewItem( ListView2, dev->name() ); |
223 | |||
224 | if (deviceActive( dev ) ) { | ||
225 | deviceItem->setPixmap(0, onPix); | ||
226 | } else { | ||
227 | deviceItem->setPixmap(0, offPix); | ||
228 | } | ||
229 | |||
169 | deviceItem->setText(1, dev->mac() ); | 230 | deviceItem->setText(1, dev->mac() ); |
170 | } | 231 | } |
171 | } | 232 | } |
172 | 233 | ||
173 | 234 | ||
174 | /** | 235 | /* |
175 | * Open the "scan for devices" dialog | 236 | * Action that is toggled on entrys on click |
176 | */ | 237 | */ |
238 | void BlueBase::startServiceActionClicked( QListViewItem * item ) { | ||
239 | |||
240 | |||
241 | } | ||
242 | |||
243 | /* | ||
244 | * Action that are toggled on hold (mostly QPopups i guess) | ||
245 | */ | ||
246 | void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int column) { | ||
247 | |||
248 | |||
249 | } | ||
250 | |||
251 | /* | ||
252 | * Search and display avail. services for a device (on expand from device listing) | ||
253 | * | ||
254 | */ | ||
255 | void BlueBase::addServicesToDevice( QListViewItem * item ) { | ||
256 | // row of mac adress | ||
257 | RemoteDevice *device = new RemoteDevice(item->text(1), item->text(0)); | ||
258 | //dann nen manager und darauf dann searchServises, das liefert nen signal, das wieder connected | ||
259 | // werden muss. | ||
260 | |||
261 | // delete | ||
262 | } | ||
263 | |||
264 | /* | ||
265 | * Find out if a device can currently be reached | ||
266 | */ | ||
267 | bool BlueBase::deviceActive( RemoteDevice *device ) { | ||
268 | |||
269 | return true; | ||
270 | } | ||
271 | |||
272 | /** | ||
273 | * Open the "scan for devices" dialog | ||
274 | */ | ||
177 | void BlueBase::startScan() { | 275 | void BlueBase::startScan() { |
276 | |||
178 | ScanDialog *scan = new ScanDialog( this, "", true); | 277 | ScanDialog *scan = new ScanDialog( this, "", true); |
179 | QObject::connect((QObject*)scan, SIGNAL( selectedDevices(QList<RemoteDevice>&) ), | 278 | QObject::connect((QObject*)scan, SIGNAL( selectedDevices(QList<RemoteDevice>&) ), |
180 | this, SLOT( addSearchedDevices(QList<RemoteDevice>& ) )); | 279 | this, SLOT( addSearchedDevices(QList<RemoteDevice>& ) )); |
@@ -182,9 +281,14 @@ namespace OpieTooth { | |||
182 | scan->showMaximized(); | 281 | scan->showMaximized(); |
183 | } | 282 | } |
184 | 283 | ||
185 | /** | 284 | |
186 | * Decontructor | 285 | void BlueBase::setInfo() { |
187 | */ | 286 | StatusLabel->setText(getStatus()); |
287 | } | ||
288 | |||
289 | /** | ||
290 | * Decontructor | ||
291 | */ | ||
188 | BlueBase::~BlueBase(){ | 292 | BlueBase::~BlueBase(){ |
189 | } | 293 | } |
190 | 294 | ||
diff --git a/noncore/net/opietooth/manager/bluebase.h b/noncore/net/opietooth/manager/bluebase.h index c8ceed2..7b03f82 100644 --- a/noncore/net/opietooth/manager/bluebase.h +++ b/noncore/net/opietooth/manager/bluebase.h | |||
@@ -7,6 +7,7 @@ | |||
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 | 11 | ||
11 | #include "bluetoothbase.h" | 12 | #include "bluetoothbase.h" |
12 | 13 | ||
@@ -21,6 +22,7 @@ class QPushButton; | |||
21 | class QTabWidget; | 22 | class QTabWidget; |
22 | class QCheckBox; | 23 | class QCheckBox; |
23 | 24 | ||
25 | |||
24 | namespace OpieTooth { | 26 | namespace OpieTooth { |
25 | 27 | ||
26 | 28 | ||
@@ -41,9 +43,13 @@ namespace OpieTooth { | |||
41 | private: | 43 | private: |
42 | void readConfig(); | 44 | void readConfig(); |
43 | void writeConfig(); | 45 | void writeConfig(); |
46 | void readSavedDevices(); | ||
47 | void writeSavedDevices(); | ||
44 | QString getStatus(); | 48 | QString getStatus(); |
45 | void initGui(); | 49 | void initGui(); |
50 | void setInfo(); | ||
46 | 51 | ||
52 | bool deviceActive( RemoteDevice *device ); | ||
47 | 53 | ||
48 | QString deviceName; | 54 | QString deviceName; |
49 | QString defaultPasskey; | 55 | QString defaultPasskey; |
@@ -52,8 +58,14 @@ namespace OpieTooth { | |||
52 | int enablePagescan; | 58 | int enablePagescan; |
53 | int enableInquiryscan; | 59 | int enableInquiryscan; |
54 | 60 | ||
61 | QPixmap offPix; | ||
62 | QPixmap onPix; | ||
63 | |||
55 | private slots: | 64 | private slots: |
56 | void addSearchedDevices( QList<RemoteDevice> &newDevices ); | 65 | void addSearchedDevices( QList<RemoteDevice> &newDevices ); |
66 | void addServicesToDevice( QListViewItem * item ); | ||
67 | void startServiceActionClicked( QListViewItem * item ); | ||
68 | void startServiceActionHold( QListViewItem * item, const QPoint & point, int column); | ||
57 | void applyConfigChanges(); | 69 | void applyConfigChanges(); |
58 | 70 | ||
59 | }; | 71 | }; |
diff --git a/noncore/net/opietooth/manager/bluetoothbase.ui b/noncore/net/opietooth/manager/bluetoothbase.ui index 61e2bcf..869a9cb 100644 --- a/noncore/net/opietooth/manager/bluetoothbase.ui +++ b/noncore/net/opietooth/manager/bluetoothbase.ui | |||
@@ -91,20 +91,6 @@ | |||
91 | <column> | 91 | <column> |
92 | <property> | 92 | <property> |
93 | <name>text</name> | 93 | <name>text</name> |
94 | <string>Active</string> | ||
95 | </property> | ||
96 | <property> | ||
97 | <name>clickable</name> | ||
98 | <bool>true</bool> | ||
99 | </property> | ||
100 | <property> | ||
101 | <name>resizeable</name> | ||
102 | <bool>true</bool> | ||
103 | </property> | ||
104 | </column> | ||
105 | <column> | ||
106 | <property> | ||
107 | <name>text</name> | ||
108 | <string>Device Name</string> | 94 | <string>Device Name</string> |
109 | </property> | 95 | </property> |
110 | <property> | 96 | <property> |
@@ -119,7 +105,7 @@ | |||
119 | <column> | 105 | <column> |
120 | <property> | 106 | <property> |
121 | <name>text</name> | 107 | <name>text</name> |
122 | <string>Type</string> | 108 | <string>Online</string> |
123 | </property> | 109 | </property> |
124 | <property> | 110 | <property> |
125 | <name>clickable</name> | 111 | <name>clickable</name> |