summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/lib/manager.cc7
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp2
-rw-r--r--noncore/net/opietooth/manager/btconnectionitem.cpp1
3 files changed, 6 insertions, 4 deletions
diff --git a/noncore/net/opietooth/lib/manager.cc b/noncore/net/opietooth/lib/manager.cc
index 1281116..59ade6d 100644
--- a/noncore/net/opietooth/lib/manager.cc
+++ b/noncore/net/opietooth/lib/manager.cc
@@ -70,230 +70,231 @@ void Manager::searchDevices( const QString& device ){
70 emit foundDevices( device, list ); 70 emit foundDevices( device, list );
71 delete hcitool; 71 delete hcitool;
72 } 72 }
73} 73}
74 74
75void Manager::searchDevices(Device* /*d*/ ){ 75void Manager::searchDevices(Device* /*d*/ ){
76 76
77 77
78} 78}
79void Manager::addService(const QString& name ){ 79void Manager::addService(const QString& name ){
80 OProcess proc; 80 OProcess proc;
81 proc << "sdptool" << "add" << name; 81 proc << "sdptool" << "add" << name;
82 bool bo = true; 82 bool bo = true;
83 if (!proc.start(OProcess::DontCare ) ) 83 if (!proc.start(OProcess::DontCare ) )
84 bo = false; 84 bo = false;
85 emit addedService( name, bo ); 85 emit addedService( name, bo );
86} 86}
87void Manager::addServices(const QStringList& list){ 87void Manager::addServices(const QStringList& list){
88 QStringList::ConstIterator it; 88 QStringList::ConstIterator it;
89 for (it = list.begin(); it != list.end(); ++it ) 89 for (it = list.begin(); it != list.end(); ++it )
90 addService( (*it) ); 90 addService( (*it) );
91} 91}
92void Manager::removeService( const QString& name ){ 92void Manager::removeService( const QString& name ){
93 OProcess prc; 93 OProcess prc;
94 prc << "sdptool" << "del" << name; 94 prc << "sdptool" << "del" << name;
95 bool bo = true; 95 bool bo = true;
96 if (!prc.start(OProcess::DontCare ) ) 96 if (!prc.start(OProcess::DontCare ) )
97 bo = false; 97 bo = false;
98 emit removedService( name, bo ); 98 emit removedService( name, bo );
99} 99}
100void Manager::removeServices( const QStringList& list){ 100void Manager::removeServices( const QStringList& list){
101 QStringList::ConstIterator it; 101 QStringList::ConstIterator it;
102 for (it = list.begin(); it != list.end(); ++it ) 102 for (it = list.begin(); it != list.end(); ++it )
103 removeService( (*it) ); 103 removeService( (*it) );
104} 104}
105void Manager::searchServices( const QString& remDevice ){ 105void Manager::searchServices( const QString& remDevice ){
106 OProcess *m_sdp =new OProcess(); 106 OProcess *m_sdp =new OProcess();
107 *m_sdp << "sdptool" << "browse" << remDevice; 107 *m_sdp << "sdptool" << "browse" << remDevice;
108 m_sdp->setName( remDevice.latin1() ); 108 m_sdp->setName( remDevice.latin1() );
109 qWarning("search Services for %s", remDevice.latin1() ); 109 qWarning("search Services for %s", remDevice.latin1() );
110 connect(m_sdp, SIGNAL(processExited(OProcess*) ), 110 connect(m_sdp, SIGNAL(processExited(OProcess*) ),
111 this, SLOT(slotSDPExited(OProcess* ) ) ); 111 this, SLOT(slotSDPExited(OProcess* ) ) );
112 connect(m_sdp, SIGNAL(receivedStdout(OProcess*, char*, int ) ), 112 connect(m_sdp, SIGNAL(receivedStdout(OProcess*, char*, int ) ),
113 this, SLOT(slotSDPOut(OProcess*, char*, int) ) ); 113 this, SLOT(slotSDPOut(OProcess*, char*, int) ) );
114 if (!m_sdp->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { 114 if (!m_sdp->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) {
115 qWarning("could not start sdptool" ); 115 qWarning("could not start sdptool" );
116 delete m_sdp; 116 delete m_sdp;
117 Services::ValueList list; 117 Services::ValueList list;
118 emit foundServices( remDevice, list ); 118 emit foundServices( remDevice, list );
119 } 119 }
120} 120}
121void Manager::searchServices( const RemoteDevice& dev){ 121void Manager::searchServices( const RemoteDevice& dev){
122 searchServices( dev.mac() ); 122 searchServices( dev.mac() );
123} 123}
124QString Manager::toDevice( const QString& /*mac*/ ){ 124QString Manager::toDevice( const QString& /*mac*/ ){
125 return QString::null; 125 return QString::null;
126} 126}
127QString Manager::toMac( const QString &/*device*/ ){ 127QString Manager::toMac( const QString &/*device*/ ){
128 return QString::null; 128 return QString::null;
129} 129}
130void Manager::slotProcessExited(OProcess* proc ) { 130void Manager::slotProcessExited(OProcess* proc ) {
131 bool conn= false; 131 bool conn= false;
132 if (proc->normalExit() && proc->exitStatus() == 0 ) 132 if (proc->normalExit() && proc->exitStatus() == 0 )
133 conn = true; 133 conn = true;
134 134
135 QString name = QString::fromLatin1(proc->name() ); 135 QString name = QString::fromLatin1(proc->name() );
136 emit available( name, conn ); 136 emit available( name, conn );
137 delete proc; 137 delete proc;
138} 138}
139void Manager::slotSDPOut(OProcess* proc, char* ch, int len) 139void Manager::slotSDPOut(OProcess* proc, char* ch, int len)
140{ 140{
141 QCString str(ch, len+1 ); 141 QCString str(ch, len+1 );
142 qWarning("SDP:%s", str.data() ); 142 qWarning("SDP:%s", str.data() );
143 QMap<QString, QString>::Iterator it; 143 QMap<QString, QString>::Iterator it;
144 it = m_out.find(proc->name() ); 144 it = m_out.find(proc->name() );
145 QString string; 145 QString string;
146 if ( it != m_out.end() ) { 146 if ( it != m_out.end() ) {
147 string = it.data(); 147 string = it.data();
148 } 148 }
149 string.append( str ); 149 string.append( str );
150 m_out.replace( proc->name(), string ); 150 m_out.replace( proc->name(), string );
151 151
152} 152}
153void Manager::slotSDPExited( OProcess* proc) 153void Manager::slotSDPExited( OProcess* proc)
154{ 154{
155 qWarning("proc name %s", proc->name() ); 155 qWarning("proc name %s", proc->name() );
156 Services::ValueList list; 156 Services::ValueList list;
157 if (proc->normalExit() ) { 157 if (proc->normalExit() ) {
158 QMap<QString, QString>::Iterator it = m_out.find( proc->name() ); 158 QMap<QString, QString>::Iterator it = m_out.find( proc->name() );
159 if ( it != m_out.end() ) { 159 if ( it != m_out.end() ) {
160 qWarning("found process" ); 160 qWarning("found process" );
161 list = parseSDPOutput( it.data() ); 161 list = parseSDPOutput( it.data() );
162 m_out.remove( it ); 162 m_out.remove( it );
163 } 163 }
164 } 164 }
165 emit foundServices( proc->name(), list ); 165 emit foundServices( proc->name(), list );
166 delete proc; 166 delete proc;
167} 167}
168Services::ValueList Manager::parseSDPOutput( const QString& out ) { 168Services::ValueList Manager::parseSDPOutput( const QString& out ) {
169 Services::ValueList list; 169 Services::ValueList list;
170 qWarning("parsing output" ); 170 qWarning("parsing output" );
171 Parser parser( out ); 171 Parser parser( out );
172 list = parser.services(); 172 list = parser.services();
173 return list; 173 return list;
174} 174}
175 175
176void Manager::slotHCIExited(OProcess* proc ) { 176void Manager::slotHCIExited(OProcess* proc ) {
177 qWarning("process exited"); 177 qWarning("process exited");
178 RemoteDevice::ValueList list; 178 RemoteDevice::ValueList list;
179 if (proc->normalExit() ) { 179 if (proc->normalExit() ) {
180 qWarning("normalExit %s", proc->name() ); 180 qWarning("normalExit %s", proc->name() );
181 QMap<QString, QString>::Iterator it = m_devices.find(proc->name() ); 181 QMap<QString, QString>::Iterator it = m_devices.find(proc->name() );
182 if (it != m_devices.end() ) { 182 if (it != m_devices.end() ) {
183 qWarning("!= end ;)"); 183 qWarning("!= end ;)");
184 list = parseHCIOutput( it.data() ); 184 list = parseHCIOutput( it.data() );
185 m_devices.remove( it ); 185 m_devices.remove( it );
186 } 186 }
187 } 187 }
188 emit foundDevices( proc->name(), list ); 188 emit foundDevices( proc->name(), list );
189 delete proc; 189 delete proc;
190} 190}
191void Manager::slotHCIOut(OProcess* proc, char* ch, int len) { 191void Manager::slotHCIOut(OProcess* proc, char* ch, int len) {
192 QCString str( ch, len+1 ); 192 QCString str( ch, len+1 );
193 qWarning("hci: %s", str.data() ); 193 qWarning("hci: %s", str.data() );
194 QMap<QString, QString>::Iterator it; 194 QMap<QString, QString>::Iterator it;
195 it = m_devices.find( proc->name() ); 195 it = m_devices.find( proc->name() );
196 qWarning("proc->name %s", proc->name() ); 196 qWarning("proc->name %s", proc->name() );
197 QString string; 197 QString string;
198 if (it != m_devices.end() ) { 198 if (it != m_devices.end() ) {
199 qWarning("slotHCIOut "); 199 qWarning("slotHCIOut ");
200 string = it.data(); 200 string = it.data();
201 } 201 }
202 string.append( str ); 202 string.append( str );
203 203
204 m_devices.replace( proc->name(), string ); 204 m_devices.replace( proc->name(), string );
205} 205}
206RemoteDevice::ValueList Manager::parseHCIOutput(const QString& output ) { 206RemoteDevice::ValueList Manager::parseHCIOutput(const QString& output ) {
207 qWarning("parseHCI %s", output.latin1() ); 207 qWarning("parseHCI %s", output.latin1() );
208 RemoteDevice::ValueList list; 208 RemoteDevice::ValueList list;
209 QStringList strList = QStringList::split('\n', output ); 209 QStringList strList = QStringList::split('\n', output );
210 QStringList::Iterator it; 210 QStringList::Iterator it;
211 QString str; 211 QString str;
212 for ( it = strList.begin(); it != strList.end(); ++it ) { 212 for ( it = strList.begin(); it != strList.end(); ++it ) {
213 str = (*it).stripWhiteSpace(); 213 str = (*it).stripWhiteSpace();
214 qWarning("OpieTooth %s", str.latin1() ); 214 qWarning("OpieTooth %s", str.latin1() );
215 int pos = str.findRev(':' ); 215 int pos = str.findRev(':' );
216 if ( pos > 0 ) { 216 if ( pos > 0 ) {
217 QString mac = str.left(17 ); 217 QString mac = str.left(17 );
218 str.remove( 0, 17 ); 218 str.remove( 0, 17 );
219 qWarning("mac %s", mac.latin1() ); 219 qWarning("mac %s", mac.latin1() );
220 qWarning("rest:%s", str.latin1() ); 220 qWarning("rest:%s", str.latin1() );
221 RemoteDevice rem( mac , str.stripWhiteSpace() ); 221 RemoteDevice rem( mac , str.stripWhiteSpace() );
222 list.append( rem ); 222 list.append( rem );
223 } 223 }
224 } 224 }
225 return list; 225 return list;
226} 226}
227 227
228////// hcitool cc and hcitool con 228////// hcitool cc and hcitool con
229 229
230/** 230/**
231 * Create it on the stack as don't care 231 * Create it on the stack as don't care
232 * so we don't need to care for it 232 * so we don't need to care for it
233 * cause hcitool gets reparented 233 * cause hcitool gets reparented
234 */ 234 */
235void Manager::connectTo( const QString& mac) { 235void Manager::connectTo( const QString& mac) {
236 OProcess proc; 236 OProcess proc;
237 proc << "hcitool"; 237 proc << "hcitool";
238 proc << "cc"; 238 proc << "cc";
239 proc << mac; 239 proc << mac;
240 proc.start(OProcess::DontCare); // the lib does not care at this point 240 proc.start(OProcess::DontCare); // the lib does not care at this point
241} 241}
242 242
243 243
244void Manager::searchConnections() { 244void Manager::searchConnections() {
245 qWarning("searching connections?"); 245 qWarning("searching connections?");
246 OProcess* proc = new OProcess(); 246 OProcess* proc = new OProcess();
247 m_hcitoolCon = QString::null; 247 m_hcitoolCon = QString::null;
248 248
249 connect(proc, SIGNAL(processExited(OProcess*) ), 249 connect(proc, SIGNAL(processExited(OProcess*) ),
250 this, SLOT(slotConnectionExited( OProcess*) ) ); 250 this, SLOT(slotConnectionExited( OProcess*) ) );
251 connect(proc, SIGNAL(receivedStdout(OProcess*, char*, int) ), 251 connect(proc, SIGNAL(receivedStdout(OProcess*, char*, int) ),
252 this, SLOT(slotConnectionOutput(OProcess*, char*, int) ) ); 252 this, SLOT(slotConnectionOutput(OProcess*, char*, int) ) );
253 *proc << "hcitool"; 253 *proc << "hcitool";
254 *proc << "con"; 254 *proc << "con";
255 255
256 if (!proc->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { 256 if (!proc->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) {
257 ConnectionState::ValueList list; 257 ConnectionState::ValueList list;
258 emit connections( list ); 258 emit connections( list );
259 delete proc; 259 delete proc;
260 } 260 }
261} 261}
262void Manager::slotConnectionExited( OProcess* /*proc*/ ) { 262void Manager::slotConnectionExited( OProcess* proc ) {
263 qWarning("exited"); 263 qWarning("<<<<<<<<<<<<<<<<<exited");
264 ConnectionState::ValueList list; 264 ConnectionState::ValueList list;
265 list = parseConnections( m_hcitoolCon ); 265 list = parseConnections( m_hcitoolCon );
266 emit connections(list ); 266 emit connections(list );
267 delete proc;
267} 268}
268void Manager::slotConnectionOutput(OProcess* proc, char* cha, int len) { 269void Manager::slotConnectionOutput(OProcess* proc, char* cha, int len) {
269 QCString str(cha, len ); 270 QCString str(cha, len );
270 m_hcitoolCon.append( str ); 271 m_hcitoolCon.append( str );
271 delete proc; 272 //delete proc;
272} 273}
273ConnectionState::ValueList Manager::parseConnections( const QString& out ) { 274ConnectionState::ValueList Manager::parseConnections( const QString& out ) {
274 ConnectionState::ValueList list2; 275 ConnectionState::ValueList list2;
275 QStringList list = QStringList::split('\n', out ); 276 QStringList list = QStringList::split('\n', out );
276 QStringList::Iterator it; 277 QStringList::Iterator it;
277 for (it = list.begin(); it != list.end(); ++it ) { 278 for (it = list.begin(); it != list.end(); ++it ) {
278 QString row = (*it).stripWhiteSpace(); 279 QString row = (*it).stripWhiteSpace();
279 QStringList value = QStringList::split(' ', row ); 280 QStringList value = QStringList::split(' ', row );
280 qWarning("0: %s", value[0].latin1() ); 281 qWarning("0: %s", value[0].latin1() );
281 qWarning("1: %s", value[1].latin1() ); 282 qWarning("1: %s", value[1].latin1() );
282 qWarning("2: %s", value[2].latin1() ); 283 qWarning("2: %s", value[2].latin1() );
283 qWarning("3: %s", value[3].latin1() ); 284 qWarning("3: %s", value[3].latin1() );
284 qWarning("4: %s", value[4].latin1() ); 285 qWarning("4: %s", value[4].latin1() );
285 qWarning("5: %s", value[5].latin1() ); 286 qWarning("5: %s", value[5].latin1() );
286 qWarning("6: %s", value[6].latin1() ); 287 qWarning("6: %s", value[6].latin1() );
287 qWarning("7: %s", value[7].latin1() ); 288 qWarning("7: %s", value[7].latin1() );
288 qWarning("8: %s", value[8].latin1() ); 289 qWarning("8: %s", value[8].latin1() );
289 ConnectionState con; 290 ConnectionState con;
290 con.setDirection( value[0] == QString::fromLatin1("<") ? Outgoing : Incoming ); 291 con.setDirection( value[0] == QString::fromLatin1("<") ? Outgoing : Incoming );
291 con.setConnectionMode( value[1] ); 292 con.setConnectionMode( value[1] );
292 con.setMac( value[2] ); 293 con.setMac( value[2] );
293 con.setHandle( value[4].toInt() ); 294 con.setHandle( value[4].toInt() );
294 con.setState( value[6].toInt() ); 295 con.setState( value[6].toInt() );
295 con.setLinkMode( value[8] == QString::fromLatin1("MASTER") ? Master : Client ); 296 con.setLinkMode( value[8] == QString::fromLatin1("MASTER") ? Master : Client );
296 list2.append( con ); 297 list2.append( con );
297 } 298 }
298 return list2; 299 return list2;
299} 300}
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp
index d3abb54..5c5f069 100644
--- a/noncore/net/opietooth/manager/bluebase.cpp
+++ b/noncore/net/opietooth/manager/bluebase.cpp
@@ -229,312 +229,312 @@ QString BlueBase::status()const{
229void BlueBase::applyConfigChanges() { 229void BlueBase::applyConfigChanges() {
230 m_deviceName = deviceNameLine->text(); 230 m_deviceName = deviceNameLine->text();
231 m_defaultPasskey = passkeyLine->text(); 231 m_defaultPasskey = passkeyLine->text();
232 m_useEncryption = cryptCheckBox->isChecked(); 232 m_useEncryption = cryptCheckBox->isChecked();
233 m_enableAuthentification = authCheckBox->isChecked(); 233 m_enableAuthentification = authCheckBox->isChecked();
234 m_enablePagescan = pagescanCheckBox->isChecked(); 234 m_enablePagescan = pagescanCheckBox->isChecked();
235 m_enableInquiryscan = inquiryscanCheckBox->isChecked(); 235 m_enableInquiryscan = inquiryscanCheckBox->isChecked();
236 236
237 writeConfig(); 237 writeConfig();
238 238
239 QMessageBox::information( this, tr("Test") , tr("Changes were applied.") ); 239 QMessageBox::information( this, tr("Test") , tr("Changes were applied.") );
240} 240}
241 241
242/** 242/**
243 * Add fresh found devices from scan dialog to the listing 243 * Add fresh found devices from scan dialog to the listing
244 * 244 *
245 */ 245 */
246void BlueBase::addSearchedDevices( const QValueList<RemoteDevice> &newDevices ) { 246void BlueBase::addSearchedDevices( const QValueList<RemoteDevice> &newDevices ) {
247 BTDeviceItem * deviceItem; 247 BTDeviceItem * deviceItem;
248 QValueList<RemoteDevice>::ConstIterator it; 248 QValueList<RemoteDevice>::ConstIterator it;
249 249
250 for( it = newDevices.begin(); it != newDevices.end() ; ++it ) { 250 for( it = newDevices.begin(); it != newDevices.end() ; ++it ) {
251 251
252 if (find( (*it) )) // is already inserted 252 if (find( (*it) )) // is already inserted
253 continue; 253 continue;
254 254
255 deviceItem = new BTDeviceItem( ListView2 , (*it) ); 255 deviceItem = new BTDeviceItem( ListView2 , (*it) );
256 deviceItem->setPixmap( 1, m_findPix ); 256 deviceItem->setPixmap( 1, m_findPix );
257 deviceItem->setExpandable ( true ); 257 deviceItem->setExpandable ( true );
258 258
259 // look if device is avail. atm, async 259 // look if device is avail. atm, async
260 deviceActive( (*it) ); 260 deviceActive( (*it) );
261 261
262 // ggf auch hier? 262 // ggf auch hier?
263 addServicesToDevice( deviceItem ); 263 addServicesToDevice( deviceItem );
264 } 264 }
265} 265}
266 266
267 267
268/** 268/**
269 * Action that is toggled on entrys on click 269 * Action that is toggled on entrys on click
270 */ 270 */
271void BlueBase::startServiceActionClicked( QListViewItem */*item*/ ) { 271void BlueBase::startServiceActionClicked( QListViewItem */*item*/ ) {
272} 272}
273 273
274 274
275/** 275/**
276 * Action that are toggled on hold (mostly QPopups i guess) 276 * Action that are toggled on hold (mostly QPopups i guess)
277 */ 277 */
278void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int /*column*/ ) { 278void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int /*column*/ ) {
279 if (!item ) 279 if (!item )
280 return; 280 return;
281 281
282 QPopupMenu *menu = new QPopupMenu(); 282 QPopupMenu *menu = new QPopupMenu();
283 int ret=0; 283 int ret=0;
284 284
285 if ( ((BTListItem*)item)->type() == "device") { 285 if ( ((BTListItem*)item)->type() == "device") {
286 286
287 QPopupMenu *groups = new QPopupMenu(); 287 QPopupMenu *groups = new QPopupMenu();
288 288
289 menu->insertItem( ((BTDeviceItem*)item)->name(),0 ); 289 menu->insertItem( ((BTDeviceItem*)item)->name(),0 );
290 menu->insertSeparator(1); 290 menu->insertSeparator(1);
291 menu->insertItem( tr("rescan sevices"), 2); 291 menu->insertItem( tr("rescan sevices"), 2);
292 menu->insertItem( tr("to group"), groups , 3); 292 menu->insertItem( tr("to group"), groups , 3);
293 menu->insertItem( tr("delete"), 4); 293 menu->insertItem( tr("delete"), 4);
294 294
295 ret = menu->exec( point , 0); 295 ret = menu->exec( point , 0);
296 296
297 switch(ret) { 297 switch(ret) {
298 case -1: 298 case -1:
299 break; 299 break;
300 case 2: 300 case 2:
301 addServicesToDevice( (BTDeviceItem*)item ); 301 addServicesToDevice( (BTDeviceItem*)item );
302 break; 302 break;
303 303
304 case 4: 304 case 4:
305 // deletes childs too 305 // deletes childs too
306 delete item; 306 delete item;
307 break; 307 break;
308 } 308 }
309 delete groups; 309 delete groups;
310 310
311 } 311 }
312 312
313 /* 313 /*
314 * We got service sensitive PopupMenus in our factory 314 * We got service sensitive PopupMenus in our factory
315 * We will create one through the factory and will insert 315 * We will create one through the factory and will insert
316 * our Separator + ShowInfo into the menu or create a new 316 * our Separator + ShowInfo into the menu or create a new
317 * one if the factory returns 0 317 * one if the factory returns 0
318 * PopupMenu deletion is kind of weird. 318 * PopupMenu deletion is kind of weird.
319 * If escaped( -1 ) or any of our items were chosen we'll 319 * If escaped( -1 ) or any of our items were chosen we'll
320 * delete the PopupMenu otherwise it's the responsibility of 320 * delete the PopupMenu otherwise it's the responsibility of
321 * the PopupMenu to delete itself 321 * the PopupMenu to delete itself
322 * 322 *
323 */ 323 */
324 else if ( ((BTListItem*)item)->type() == "service") { 324 else if ( ((BTListItem*)item)->type() == "service") {
325 BTServiceItem* service = (BTServiceItem*)item; 325 BTServiceItem* service = (BTServiceItem*)item;
326 QMap<int, QString> list = service->services().classIdList(); 326 QMap<int, QString> list = service->services().classIdList();
327 QMap<int, QString>::Iterator it = list.begin(); 327 QMap<int, QString>::Iterator it = list.begin();
328 QPopupMenu *popup =0l; 328 QPopupMenu *popup =0l;
329 if ( it != list.end() ) { 329 if ( it != list.end() ) {
330 qWarning("Searching id %d %s", it.key(), it.data().latin1() ); 330 qWarning("Searching id %d %s", it.key(), it.data().latin1() );
331 popup = m_popHelper.find( it.key() /*1*/, 331 popup = m_popHelper.find( it.key() /*1*/,
332 service->services(), 332 service->services(),
333 (BTDeviceItem*)service->parent() ); 333 (BTDeviceItem*)service->parent() );
334 }else { 334 }else {
335 qWarning("Empty"); 335 qWarning("Empty");
336 } 336 }
337 337
338 if ( popup == 0l ) { 338 if ( popup == 0l ) {
339 qWarning("factory returned 0l"); 339 qWarning("factory returned 0l");
340 popup = new QPopupMenu(); 340 popup = new QPopupMenu();
341 } 341 }
342 int test1 = popup->insertItem( tr("Test1:"), 2); 342 int test1 = popup->insertItem( tr("Test1:"), 2);
343 343
344 ret = popup->exec( point ); 344 ret = popup->exec( point );
345 qWarning("returned from exec() "); 345 qWarning("returned from exec() ");
346 if ( ret == -1 ) { 346 if ( ret == -1 ) {
347 ; 347 ;
348 } else if ( ret == test1 ) { 348 } else if ( ret == test1 ) {
349 ; 349 ;
350 } 350 }
351 delete popup; 351 delete popup;
352 } 352 }
353 delete menu; 353 delete menu;
354} 354}
355 355
356 356
357/** 357/**
358 * Search and display avail. services for a device (on expand from device listing) 358 * Search and display avail. services for a device (on expand from device listing)
359 * @param item the service item returned 359 * @param item the service item returned
360 */ 360 */
361void BlueBase::addServicesToDevice( BTDeviceItem * item ) { 361void BlueBase::addServicesToDevice( BTDeviceItem * item ) {
362 qDebug("addServicesToDevice"); 362 qDebug("addServicesToDevice");
363 // row of mac adress text(3) 363 // row of mac adress text(3)
364 RemoteDevice device = item->remoteDevice(); 364 RemoteDevice device = item->remoteDevice();
365 m_deviceList.insert( item->mac() , item ); 365 m_deviceList.insert( item->mac() , item );
366 // and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back 366 // and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back
367 m_localDevice->searchServices( device ); 367 m_localDevice->searchServices( device );
368} 368}
369 369
370 370
371/** 371/**
372 * Overloaded. This one it the one that is connected to the foundServices signal 372 * Overloaded. This one it the one that is connected to the foundServices signal
373 * @param device the mac address of the remote device 373 * @param device the mac address of the remote device
374 * @param servicesList the list with the service the device has. 374 * @param servicesList the list with the service the device has.
375 */ 375 */
376void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) { 376void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) {
377 qDebug("fill services list"); 377 qDebug("fill services list");
378 378
379 QMap<QString,BTDeviceItem*>::Iterator it; 379 QMap<QString,BTDeviceItem*>::Iterator it;
380 BTDeviceItem* deviceItem = 0; 380 BTDeviceItem* deviceItem = 0;
381 381
382 // get the right devices which requested the search 382 // get the right devices which requested the search
383 it = m_deviceList.find( device ); 383 it = m_deviceList.find( device );
384 if( it == m_deviceList.end() ) 384 if( it == m_deviceList.end() )
385 return; 385 return;
386 deviceItem = it.data(); 386 deviceItem = it.data();
387 387
388 QValueList<OpieTooth::Services>::Iterator it2; 388 QValueList<OpieTooth::Services>::Iterator it2;
389 BTServiceItem * serviceItem; 389 BTServiceItem * serviceItem;
390 390
391 if (!servicesList.isEmpty() ) { 391 if (!servicesList.isEmpty() ) {
392 // add services 392 // add services
393 QMap<int, QString> list; 393 QMap<int, QString> list;
394 QMap<int, QString>::Iterator classIt; 394 QMap<int, QString>::Iterator classIt;
395 for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) { 395 for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) {
396 serviceItem = new BTServiceItem( deviceItem , (*it2) ); 396 serviceItem = new BTServiceItem( deviceItem , (*it2) );
397 list = (*it2).classIdList(); 397 list = (*it2).classIdList();
398 classIt = list.begin(); 398 classIt = list.begin();
399 int classId=0; 399 int classId=0;
400 if ( classIt != list.end() ) { 400 if ( classIt != list.end() ) {
401 classId = classIt.key(); 401 classId = classIt.key();
402 } 402 }
403 403
404 serviceItem->setPixmap( 0, m_iconLoader->serviceIcon( classId ) ); 404 serviceItem->setPixmap( 0, m_iconLoader->serviceIcon( classId ) );
405 } 405 }
406 } else { 406 } else {
407 Services s1; 407 Services s1;
408 s1.setServiceName( tr("no serives found") ); 408 s1.setServiceName( tr("no serives found") );
409 serviceItem = new BTServiceItem( deviceItem, s1 ); 409 serviceItem = new BTServiceItem( deviceItem, s1 );
410 } 410 }
411 // now remove them from the list 411 // now remove them from the list
412 m_deviceList.remove( it ); 412 m_deviceList.remove( it );
413} 413}
414 414
415 415
416/** 416/**
417 * Add the existing connections (pairs) to the connections tab. 417 * Add the existing connections (pairs) to the connections tab.
418 * This one triggers the search 418 * This one triggers the search
419 */ 419 */
420void BlueBase::addConnectedDevices() { 420void BlueBase::addConnectedDevices() {
421 m_localDevice->searchConnections(); 421 m_localDevice->searchConnections();
422} 422}
423 423
424 424
425/** 425/**
426 * This adds the found connections to the connection tab. 426 * This adds the found connections to the connection tab.
427 * @param connectionList the ValueList with all current connections 427 * @param connectionList the ValueList with all current connections
428 */ 428 */
429void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList ) { 429void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList ) {
430 430
431 // clear the ListView first 431 // clear the ListView first
432 ListView4->clear(); 432 ListView4->clear();
433 433
434 QValueList<OpieTooth::ConnectionState>::Iterator it; 434 QValueList<OpieTooth::ConnectionState>::Iterator it;
435 BTConnectionItem * connectionItem; 435 BTConnectionItem * connectionItem;
436 436
437 if ( !connectionList.isEmpty() ) { 437 if ( !connectionList.isEmpty() ) {
438 438
439 for (it = connectionList.begin(); it != connectionList.end(); ++it) { 439 for (it = connectionList.begin(); it != connectionList.end(); ++it) {
440 connectionItem = new BTConnectionItem( ListView4 , (*it) ); 440 connectionItem = new BTConnectionItem( ListView4 , (*it) );
441 } 441 }
442 } else { 442 } else {
443 ConnectionState con; 443 ConnectionState con;
444 con.setMac( tr("No connections found") ); 444 con.setMac( tr("No connections found") );
445 connectionItem = new BTConnectionItem( ListView4 , con ); 445 connectionItem = new BTConnectionItem( ListView4 , con );
446 } 446 }
447 447
448 // recall connection search after some time 448 // recall connection search after some time
449 QTimer::singleShot( 20000, this, SLOT( addConnectedDevices() ) ); 449 QTimer::singleShot( 20000, this, SLOT( addConnectedDevices() ) );
450} 450}
451 451
452 452
453/** 453/**
454 * Find out if a device can currently be reached 454 * Find out if a device can currently be reached
455 * @param device 455 * @param device
456 */ 456 */
457void BlueBase::deviceActive( const RemoteDevice &device ) { 457void BlueBase::deviceActive( const RemoteDevice &device ) {
458 // search by mac, async, gets a signal back 458 // search by mac, async, gets a signal back
459 // We should have a BTDeviceItem there or where does it get added to the map -zecke 459 // We should have a BTDeviceItem there or where does it get added to the map -zecke
460 m_localDevice->isAvailable( device.mac() ); 460 m_localDevice->isAvailable( device.mac() );
461} 461}
462 462
463 463
464/** 464/**
465 * The signal catcher. Set the avail. status on device. 465 * The signal catcher. Set the avail. status on device.
466 * @param device - the mac address 466 * @param device - the mac address
467 * @param connected - if it is avail. or not 467 * @param connected - if it is avail. or not
468 */ 468 */
469void BlueBase::deviceActive( const QString& device, bool connected ) { 469void BlueBase::deviceActive( const QString& device, bool connected ) {
470 qDebug("deviceActive slot"); 470 qDebug("deviceActive slot");
471 471
472 QMap<QString,BTDeviceItem*>::Iterator it; 472 QMap<QString,BTDeviceItem*>::Iterator it;
473 473
474 it = m_deviceList.find( device ); 474 it = m_deviceList.find( device );
475 if( it == m_deviceList.end() ) 475 if( it == m_deviceList.end() )
476 return; 476 return;
477 477
478 BTDeviceItem* deviceItem = it.data(); 478 BTDeviceItem* deviceItem = it.data();
479 479
480 480
481 if ( connected ) { 481 if ( connected ) {
482 deviceItem->setPixmap( 1, m_onPix ); 482 deviceItem->setPixmap( 1, m_onPix );
483 } else { 483 } else {
484 deviceItem->setPixmap( 1, m_offPix ); 484 deviceItem->setPixmap( 1, m_offPix );
485 } 485 }
486 m_deviceList.remove( it ); 486 m_deviceList.remove( it );
487} 487}
488 488
489 489
490/** 490/**
491 * Open the "scan for devices" dialog 491 * Open the "scan for devices" dialog
492 */ 492 */
493void BlueBase::startScan() { 493void BlueBase::startScan() {
494 ScanDialog *scan = new ScanDialog( this, "ScanDialog", 494 ScanDialog *scan = new ScanDialog( this, "ScanDialog",
495 true, WDestructiveClose ); 495 true, WDestructiveClose );
496 QObject::connect( scan, SIGNAL( selectedDevices( const QValueList<RemoteDevice>& ) ), 496 QObject::connect( scan, SIGNAL( selectedDevices( const QValueList<RemoteDevice>& ) ),
497 this, SLOT( addSearchedDevices( const QValueList<RemoteDevice>& ) ) ); 497 this, SLOT( addSearchedDevices( const QValueList<RemoteDevice>& ) ) );
498 498
499 scan->showMaximized(); 499 scan->showMaximized();
500} 500}
501 501
502 502
503/** 503/**
504 * Set the informations about the local device in information Tab 504 * Set the informations about the local device in information Tab
505 */ 505 */
506void BlueBase::setInfo() { 506void BlueBase::setInfo() {
507 StatusLabel->setText( status() ); 507 StatusLabel->setText( status() );
508} 508}
509 509
510 510
511/** 511/**
512 * Decontructor 512 * Decontructor
513 */ 513 */
514BlueBase::~BlueBase() { 514BlueBase::~BlueBase() {
515 writeSavedDevices(); 515 writeSavedDevices();
516 delete m_iconLoader; 516 delete m_iconLoader;
517} 517}
518 518
519 519
520/** 520/**
521 * find searches the ListView for a BTDeviceItem containig 521 * find searches the ListView for a BTDeviceItem containig
522 * the same Device if found return true else false 522 * the same Device if found return true else false
523 * @param dev RemoteDevice to find 523 * @param dev RemoteDevice to find
524 * @return returns true if found 524 * @return returns true if found
525 */ 525 */
526bool BlueBase::find( const RemoteDevice& rem ) { 526bool BlueBase::find( const RemoteDevice& rem ) {
527 QListViewItemIterator it( ListView2 ); 527 QListViewItemIterator it( ListView2 );
528 BTListItem* item; 528 BTListItem* item;
529 BTDeviceItem* device; 529 BTDeviceItem* device;
530 for (; it.current(); ++it ) { 530 for (; it.current(); ++it ) {
531 item = (BTListItem*) it.current(); 531 item = (BTListItem*) it.current();
532 if ( item->typeId() != BTListItem::Device ) 532 if ( item->typeId() != BTListItem::Device )
533 continue; 533 continue;
534 534
535 device = (BTDeviceItem*)item; 535 device = (BTDeviceItem*)item;
536 if ( rem.equals( device->remoteDevice() ) ) 536 if ( rem.equals( device->remoteDevice() ) )
537 return true; 537 return true;
538 } 538 }
539 return false; // not found 539 return false; // not found
540} 540}
diff --git a/noncore/net/opietooth/manager/btconnectionitem.cpp b/noncore/net/opietooth/manager/btconnectionitem.cpp
index 6fb9c11..b57d1b3 100644
--- a/noncore/net/opietooth/manager/btconnectionitem.cpp
+++ b/noncore/net/opietooth/manager/btconnectionitem.cpp
@@ -1,23 +1,24 @@
1#include <connection.h> 1#include <connection.h>
2#include "btconnectionitem.h" 2#include "btconnectionitem.h"
3 3
4using namespace OpieTooth; 4using namespace OpieTooth;
5 5
6BTConnectionItem::BTConnectionItem( QListView* parent, const ConnectionState& con ) 6BTConnectionItem::BTConnectionItem( QListView* parent, const ConnectionState& con )
7 : BTListItem( parent ){ 7 : BTListItem( parent ){
8 m_con = con; 8 m_con = con;
9 setText(0, m_con.mac() ); 9 setText(0, m_con.mac() );
10 setText(1, m_con.connectionMode() );
10} 11}
11BTConnectionItem::~BTConnectionItem() { 12BTConnectionItem::~BTConnectionItem() {
12 13
13} 14}
14QString BTConnectionItem::type() const { 15QString BTConnectionItem::type() const {
15 return QString::fromLatin1("connection"); 16 return QString::fromLatin1("connection");
16} 17}
17int BTConnectionItem::typeId() const { 18int BTConnectionItem::typeId() const {
18 return Connection; 19 return Connection;
19} 20}
20ConnectionState BTConnectionItem::connection() const { 21ConnectionState BTConnectionItem::connection() const {
21 return m_con; 22 return m_con;
22} 23}
23 24