summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/lib/connection.cpp4
-rw-r--r--noncore/net/opietooth/lib/connection.h31
-rw-r--r--noncore/net/opietooth/lib/lib.pro4
-rw-r--r--noncore/net/opietooth/lib/startpanconnection.cpp67
-rw-r--r--noncore/net/opietooth/lib/startpanconnection.h40
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp2
-rw-r--r--noncore/net/opietooth/manager/bluetoothbase.ui665
-rw-r--r--noncore/net/opietooth/manager/panpopup.cpp46
-rw-r--r--noncore/net/opietooth/manager/panpopup.h11
9 files changed, 480 insertions, 390 deletions
diff --git a/noncore/net/opietooth/lib/connection.cpp b/noncore/net/opietooth/lib/connection.cpp
index ef7d925..5e35463 100644
--- a/noncore/net/opietooth/lib/connection.cpp
+++ b/noncore/net/opietooth/lib/connection.cpp
@@ -1,90 +1,94 @@
1 1
2#include "connection.h" 2#include "connection.h"
3 3
4using namespace OpieTooth; 4using namespace OpieTooth;
5 5
6
7
8
9
6ConnectionState::ConnectionState() { 10ConnectionState::ConnectionState() {
7 m_direction = Incoming; 11 m_direction = Incoming;
8 m_handle = -1; 12 m_handle = -1;
9 m_state = -1; 13 m_state = -1;
10 m_linkMode = -1; 14 m_linkMode = -1;
11}; 15};
12 16
13ConnectionState::ConnectionState( const ConnectionState& con1 ) { 17ConnectionState::ConnectionState( const ConnectionState& con1 ) {
14 (*this) = con1; 18 (*this) = con1;
15} 19}
16 20
17 21
18ConnectionState::ConnectionState( bool in, 22ConnectionState::ConnectionState( bool in,
19 const QString& conType, 23 const QString& conType,
20 const QString& mac, 24 const QString& mac,
21 int handle, 25 int handle,
22 int state, 26 int state,
23 int linkMode ) { 27 int linkMode ) {
24 m_direction = in; 28 m_direction = in;
25 m_contype = conType; 29 m_contype = conType;
26 m_mac = mac; 30 m_mac = mac;
27 m_handle = handle; 31 m_handle = handle;
28 m_state = state; 32 m_state = state;
29 m_linkMode = linkMode; 33 m_linkMode = linkMode;
30 34
31} 35}
32 36
33void ConnectionState::setDirection( bool incoming ) { 37void ConnectionState::setDirection( bool incoming ) {
34 m_direction = incoming; 38 m_direction = incoming;
35} 39}
36 40
37bool ConnectionState::direction() const { 41bool ConnectionState::direction() const {
38 return m_direction; 42 return m_direction;
39} 43}
40 44
41void ConnectionState::setConnectionMode( const QString& conType ) { 45void ConnectionState::setConnectionMode( const QString& conType ) {
42 m_contype = conType; 46 m_contype = conType;
43} 47}
44 48
45QString ConnectionState::connectionMode() const { 49QString ConnectionState::connectionMode() const {
46 return m_contype; 50 return m_contype;
47} 51}
48 52
49void ConnectionState::setMac( const QString& mac ) { 53void ConnectionState::setMac( const QString& mac ) {
50 m_mac = mac; 54 m_mac = mac;
51} 55}
52 56
53QString ConnectionState::mac() const{ 57QString ConnectionState::mac() const{
54 return m_mac; 58 return m_mac;
55} 59}
56 60
57void ConnectionState::setHandle( int handle ) { 61void ConnectionState::setHandle( int handle ) {
58 m_handle = handle; 62 m_handle = handle;
59} 63}
60 64
61int ConnectionState::handle() const{ 65int ConnectionState::handle() const{
62 return m_handle; 66 return m_handle;
63} 67}
64 68
65void ConnectionState::setState( int state ) { 69void ConnectionState::setState( int state ) {
66 m_state = state; 70 m_state = state;
67} 71}
68 72
69int ConnectionState::state()const { 73int ConnectionState::state()const {
70 return m_state; 74 return m_state;
71} 75}
72 76
73void ConnectionState::setLinkMode( int linkMode ) { 77void ConnectionState::setLinkMode( int linkMode ) {
74 m_linkMode = linkMode; 78 m_linkMode = linkMode;
75} 79}
76 80
77int ConnectionState::linkMode()const{ 81int ConnectionState::linkMode()const{
78 return m_linkMode; 82 return m_linkMode;
79} 83}
80 84
81ConnectionState &ConnectionState::operator=( const ConnectionState& con1 ) { 85ConnectionState &ConnectionState::operator=( const ConnectionState& con1 ) {
82 m_direction = con1.m_direction; 86 m_direction = con1.m_direction;
83 m_contype = con1.m_contype; 87 m_contype = con1.m_contype;
84 m_mac = con1.m_mac; 88 m_mac = con1.m_mac;
85 m_handle = con1.m_handle; 89 m_handle = con1.m_handle;
86 m_state = con1.m_state; 90 m_state = con1.m_state;
87 m_linkMode = con1.m_linkMode; 91 m_linkMode = con1.m_linkMode;
88 92
89 return (*this); 93 return (*this);
90} 94}
diff --git a/noncore/net/opietooth/lib/connection.h b/noncore/net/opietooth/lib/connection.h
index 76e5dad..a0c50f2 100644
--- a/noncore/net/opietooth/lib/connection.h
+++ b/noncore/net/opietooth/lib/connection.h
@@ -1,150 +1,181 @@
1 1
2#ifndef OpieTooth_Connection_H 2#ifndef OpieTooth_Connection_H
3#define OpieTooth_Connection_H 3#define OpieTooth_Connection_H
4 4
5#include <qstring.h> 5#include <qstring.h>
6#include <qvaluelist.h> 6#include <qvaluelist.h>
7#include <qobject.h>
7 8
8namespace OpieTooth { 9namespace OpieTooth {
9 10
11
12
13
14 /**
15 * Parent class for all kinds of starting connection
16 * subclasses
17 *
18 */
19 class StartConnection : public QObject {
20
21 protected:
22
23 enum ConnectionType{
24 Pan = 0,
25 Rfcomm,
26 Obex,
27 Hci
28 };
29
30 virtual ~StartConnection() {};
31
32 virtual QString name() = 0;
33 virtual void setName( QString name ) = 0;
34 virtual ConnectionType type() = 0;
35 virtual void setConnectionType() = 0;
36 virtual void start() = 0;
37 virtual void stop() = 0;
38
39 };
40
10 enum LinkDirection { Incoming= true, Outgoing = false }; 41 enum LinkDirection { Incoming= true, Outgoing = false };
11 enum LinkMode { Master =0, Client }; 42 enum LinkMode { Master =0, Client };
12 43
13 44
14 /** 45 /**
15 * The Connection class stores 46 * The Connection class stores
16 * the output of hcitool con 47 * the output of hcitool con
17 * in a OO way 48 * in a OO way
18 */ 49 */
19 50
20 class ConnectionState { 51 class ConnectionState {
21 public: 52 public:
22 /** 53 /**
23 * typedef for a list of 54 * typedef for a list of
24 * Connections 55 * Connections
25 */ 56 */
26 typedef QValueList<ConnectionState> ValueList; 57 typedef QValueList<ConnectionState> ValueList;
27 58
28 /** 59 /**
29 * Copy c'tor. 60 * Copy c'tor.
30 */ 61 */
31 ConnectionState( const ConnectionState& ); 62 ConnectionState( const ConnectionState& );
32 63
33 /** 64 /**
34 * Main c'tor 65 * Main c'tor
35 * Basicly it holds all values 66 * Basicly it holds all values
36 * a blueZ connections can have 67 * a blueZ connections can have
37 * @param in If the connection is either incoming or outgoing 68 * @param in If the connection is either incoming or outgoing
38 * @param conType Either ACL or SCO for connection type 69 * @param conType Either ACL or SCO for connection type
39 * @param mac The BD Address( mac ) of the peer 70 * @param mac The BD Address( mac ) of the peer
40 * @param handle the blueZ handle 71 * @param handle the blueZ handle
41 * @param state the State of the connection 72 * @param state the State of the connection
42 * @param linkMode the linkmode of the connection MASTER or not 73 * @param linkMode the linkmode of the connection MASTER or not
43 * 74 *
44 * < ACL 00:02:C7:09:2B:53 handle 1 state 1 lm MASTER 75 * < ACL 00:02:C7:09:2B:53 handle 1 state 1 lm MASTER
45 * 76 *
46 */ 77 */
47 ConnectionState( bool in, 78 ConnectionState( bool in,
48 const QString& conType, 79 const QString& conType,
49 const QString& mac, 80 const QString& mac,
50 int handle, 81 int handle,
51 int state, 82 int state,
52 int linkMode ); 83 int linkMode );
53 84
54 /** 85 /**
55 * C'tor for compability with QValueList 86 * C'tor for compability with QValueList
56 * QValueList needs this c'tor. 87 * QValueList needs this c'tor.
57 */ 88 */
58 ConnectionState(); 89 ConnectionState();
59 90
60 /** 91 /**
61 * Set if the connection is incoming or 92 * Set if the connection is incoming or
62 * outgoing 93 * outgoing
63 * @param in Whether or not the connection is ingoing or not. 94 * @param in Whether or not the connection is ingoing or not.
64 * for param use either Incoming or Outgoing 95 * for param use either Incoming or Outgoing
65 * 96 *
66 */ 97 */
67 void setDirection( bool incoming = Incoming ); 98 void setDirection( bool incoming = Incoming );
68 99
69 /** 100 /**
70 * direction() will return Incoming( true ) 101 * direction() will return Incoming( true )
71 * if the direction is incomoning or Outgoing( false) 102 * if the direction is incomoning or Outgoing( false)
72 * if outgoing 103 * if outgoing
73 */ 104 */
74 bool direction() const; 105 bool direction() const;
75 106
76 /** 107 /**
77 * sets the ConnectionMode 108 * sets the ConnectionMode
78 * @param comMode I know that SCO and ACL exists so far 109 * @param comMode I know that SCO and ACL exists so far
79 */ 110 */
80 void setConnectionMode( const QString& comMode ); 111 void setConnectionMode( const QString& comMode );
81 112
82 /** 113 /**
83 * linkMode returns the linkMode 114 * linkMode returns the linkMode
84 * MASTER for example 115 * MASTER for example
85 */ 116 */
86 QString connectionMode() const; 117 QString connectionMode() const;
87 118
88 /** 119 /**
89 * The Bluetooth Address or mac 120 * The Bluetooth Address or mac
90 * is set by this function 121 * is set by this function
91 * @param mac the BluetoothAddress( mac) 122 * @param mac the BluetoothAddress( mac)
92 */ 123 */
93 void setMac( const QString& mac); 124 void setMac( const QString& mac);
94 125
95 /** 126 /**
96 * returns the mac 127 * returns the mac
97 */ 128 */
98 QString mac() const; 129 QString mac() const;
99 130
100 131
101 /** 132 /**
102 * Set the handle of the bt connection 133 * Set the handle of the bt connection
103 */ 134 */
104 void setHandle(int handle ); 135 void setHandle(int handle );
105 136
106 /** 137 /**
107 * @return the handle of the connection 138 * @return the handle of the connection
108 */ 139 */
109 int handle() const; 140 int handle() const;
110 141
111 /** 142 /**
112 * sets the state 143 * sets the state
113 */ 144 */
114 void setState( int state ); 145 void setState( int state );
115 146
116 /** 147 /**
117 * return the state 148 * return the state
118 */ 149 */
119 int state() const; 150 int state() const;
120 151
121 /** 152 /**
122 * Sets the link mode of the Connection 153 * Sets the link mode of the Connection
123 */ 154 */
124 void setLinkMode( int linkMode = Master ); 155 void setLinkMode( int linkMode = Master );
125 156
126 /** 157 /**
127 * returns the linkMode 158 * returns the linkMode
128 */ 159 */
129 int linkMode()const; 160 int linkMode()const;
130 161
131 /** 162 /**
132 * copy c'tor 163 * copy c'tor
133 */ 164 */
134 ConnectionState &operator=( const ConnectionState& ); 165 ConnectionState &operator=( const ConnectionState& );
135 166
136 private: 167 private:
137 class ConnectionStatePrivate; 168 class ConnectionStatePrivate;
138 ConnectionStatePrivate *d; 169 ConnectionStatePrivate *d;
139 bool m_direction : 1; 170 bool m_direction : 1;
140 QString m_contype; 171 QString m_contype;
141 QString m_mac; 172 QString m_mac;
142 int m_handle; 173 int m_handle;
143 int m_state; 174 int m_state;
144 int m_linkMode; 175 int m_linkMode;
145 176
146 }; 177 };
147}; 178};
148 179
149 180
150#endif 181#endif
diff --git a/noncore/net/opietooth/lib/lib.pro b/noncore/net/opietooth/lib/lib.pro
index 88df1fb..d081b5c 100644
--- a/noncore/net/opietooth/lib/lib.pro
+++ b/noncore/net/opietooth/lib/lib.pro
@@ -1,30 +1,30 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qte warn_on release 2CONFIG += qte warn_on release
3 HEADERS = connection.h parser.h device.h manager.h remotedevice.h services.h 3 HEADERS = connection.h parser.h device.h manager.h remotedevice.h services.h startpanconnection.h
4 SOURCES = connection.cpp parser.cc device.cc manager.cc remotedevice.cc services.cc 4 SOURCES = connection.cpp parser.cc device.cc manager.cc remotedevice.cc services.cc startpanconnection.cpp
5 TARGET = opietooth 5 TARGET = opietooth
6INCLUDEPATH += $(OPIEDIR)/include . 6INCLUDEPATH += $(OPIEDIR)/include .
7 DESTDIR = $(OPIEDIR)/lib$(PROJMAK) 7 DESTDIR = $(OPIEDIR)/lib$(PROJMAK)
8LIBS += -lopie 8LIBS += -lopie
9#VERSION = 0.0.0 9#VERSION = 0.0.0
10 10
11TRANSLATIONS = ../../../../i18n/de/libopietooth.ts \ 11TRANSLATIONS = ../../../../i18n/de/libopietooth.ts \
12 ../../../../i18n/da/libopietooth.ts \ 12 ../../../../i18n/da/libopietooth.ts \
13 ../../../../i18n/xx/libopietooth.ts \ 13 ../../../../i18n/xx/libopietooth.ts \
14 ../../../../i18n/en/libopietooth.ts \ 14 ../../../../i18n/en/libopietooth.ts \
15 ../../../../i18n/es/libopietooth.ts \ 15 ../../../../i18n/es/libopietooth.ts \
16 ../../../../i18n/fr/libopietooth.ts \ 16 ../../../../i18n/fr/libopietooth.ts \
17 ../../../../i18n/hu/libopietooth.ts \ 17 ../../../../i18n/hu/libopietooth.ts \
18 ../../../../i18n/ja/libopietooth.ts \ 18 ../../../../i18n/ja/libopietooth.ts \
19 ../../../../i18n/ko/libopietooth.ts \ 19 ../../../../i18n/ko/libopietooth.ts \
20 ../../../../i18n/no/libopietooth.ts \ 20 ../../../../i18n/no/libopietooth.ts \
21 ../../../../i18n/pl/libopietooth.ts \ 21 ../../../../i18n/pl/libopietooth.ts \
22 ../../../../i18n/pt/libopietooth.ts \ 22 ../../../../i18n/pt/libopietooth.ts \
23 ../../../../i18n/pt_BR/libopietooth.ts \ 23 ../../../../i18n/pt_BR/libopietooth.ts \
24 ../../../../i18n/sl/libopietooth.ts \ 24 ../../../../i18n/sl/libopietooth.ts \
25 ../../../../i18n/zh_CN/libopietooth.ts \ 25 ../../../../i18n/zh_CN/libopietooth.ts \
26 ../../../../i18n/zh_TW/libopietooth.ts 26 ../../../../i18n/zh_TW/libopietooth.ts
27 27
28 28
29 29
30include ( $(OPIEDIR)/include.pro ) 30include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/net/opietooth/lib/startpanconnection.cpp b/noncore/net/opietooth/lib/startpanconnection.cpp
new file mode 100644
index 0000000..b68f02d
--- a/dev/null
+++ b/noncore/net/opietooth/lib/startpanconnection.cpp
@@ -0,0 +1,67 @@
1
2#include "startpanconnection.h"
3
4using namespace OpieTooth;
5
6
7StartPanConnection::StartPanConnection() {
8 m_panConnect = 0l;
9 setConnectionType();
10}
11
12StartPanConnection::~StartPanConnection() {
13 delete m_panConnect;
14}
15
16StartPanConnection::StartPanConnection( QString mac ) {
17 m_panConnect = 0l;
18 m_mac = mac;
19 setConnectionType();
20}
21
22void StartPanConnection::setName( QString name ) {
23 m_name = name;
24}
25
26QString StartPanConnection::name() {
27 return m_name;
28}
29
30void StartPanConnection::setConnectionType() {
31 m_connectionType = Pan;
32}
33
34StartConnection::ConnectionType StartPanConnection::type() {
35 return m_connectionType;
36}
37
38void StartPanConnection::start() {
39 m_panConnect = new OProcess();
40 *m_panConnect << "pand" << "--connect" << m_mac;
41
42 connect( m_panConnect, SIGNAL( processExited( OProcess* ) ) ,
43 this, SLOT( slotExited( OProcess* ) ) );
44 connect( m_panConnect, SIGNAL( receivedStdout( OProcess*, char*, int ) ),
45 this, SLOT( slotStdOut( OProcess*, char*, int ) ) );
46 if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) {
47 qWarning( "could not start" );
48 delete m_panConnect;
49 }
50}
51
52
53void StartPanConnection::slotExited( OProcess* proc ) {
54 delete m_panConnect;
55}
56
57void StartPanConnection::slotStdOut(OProcess* proc, char* chars, int len)
58{}
59
60
61void StartPanConnection::stop() {
62 if ( m_panConnect ) {
63 delete m_panConnect;
64 m_panConnect = 0l;
65 }
66}
67
diff --git a/noncore/net/opietooth/lib/startpanconnection.h b/noncore/net/opietooth/lib/startpanconnection.h
new file mode 100644
index 0000000..7e5bd95
--- a/dev/null
+++ b/noncore/net/opietooth/lib/startpanconnection.h
@@ -0,0 +1,40 @@
1#ifndef startpanconnection_h
2#define startpanconnection_h
3
4#include <qobject.h>
5#include "connection.h"
6#include <opie/oprocess.h>
7
8namespace OpieTooth {
9
10 class StartPanConnection : StartConnection {
11
12 Q_OBJECT
13
14 public:
15 StartPanConnection();
16 StartPanConnection( QString mac );
17 ~StartPanConnection();
18
19 QString name();
20 void setName( QString name );
21 StartConnection::ConnectionType type();
22 void setConnectionType( );
23 void start();
24 void stop();
25
26 private:
27 QString m_name;
28 QString m_mac;
29 ConnectionType m_connectionType;
30 OProcess* m_panConnect;
31
32 private slots:
33 void slotExited( OProcess* proc );
34 void slotStdOut( OProcess* proc, char* chars, int len );
35 };
36
37
38}
39
40#endif
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp
index b5a09e5..04fa117 100644
--- a/noncore/net/opietooth/manager/bluebase.cpp
+++ b/noncore/net/opietooth/manager/bluebase.cpp
@@ -1,610 +1,610 @@
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#include <qlist.h> 46#include <qlist.h>
47 47
48#include <qpe/qpeapplication.h> 48#include <qpe/qpeapplication.h>
49#include <qpe/resource.h> 49#include <qpe/resource.h>
50#include <qpe/config.h> 50#include <qpe/config.h>
51 51
52 52
53using namespace OpieTooth; 53using namespace OpieTooth;
54 54
55BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) 55BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl )
56 : BluetoothBase( parent, name, fl ) { 56 : BluetoothBase( parent, name, fl ) {
57 57
58 m_localDevice = new Manager( "hci0" ); 58 m_localDevice = new Manager( "hci0" );
59 59
60 connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) ); 60 connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) );
61 connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) ); 61 connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) );
62 // not good since lib is async 62 // not good since lib is async
63 // connect( ListView2, SIGNAL( expanded ( QListViewItem* ) ), 63 // connect( ListView2, SIGNAL( expanded ( QListViewItem* ) ),
64 // this, SLOT( addServicesToDevice( QListViewItem * ) ) ); 64 // this, SLOT( addServicesToDevice( QListViewItem * ) ) );
65 connect( ListView2, SIGNAL( clicked( QListViewItem* )), 65 connect( ListView2, SIGNAL( clicked( QListViewItem* )),
66 this, SLOT( startServiceActionClicked( QListViewItem* ) ) ); 66 this, SLOT( startServiceActionClicked( QListViewItem* ) ) );
67 connect( ListView2, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int ) ), 67 connect( ListView2, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int ) ),
68 this, SLOT(startServiceActionHold( QListViewItem *, const QPoint &, int) ) ); 68 this, SLOT(startServiceActionHold( QListViewItem *, const QPoint &, int) ) );
69 connect( m_localDevice , SIGNAL( foundServices( const QString& , Services::ValueList ) ), 69 connect( m_localDevice , SIGNAL( foundServices( const QString& , Services::ValueList ) ),
70 this, SLOT( addServicesToDevice( const QString& , Services::ValueList ) ) ); 70 this, SLOT( addServicesToDevice( const QString& , Services::ValueList ) ) );
71 connect( m_localDevice, SIGNAL( available( const QString&, bool ) ), 71 connect( m_localDevice, SIGNAL( available( const QString&, bool ) ),
72 this, SLOT( deviceActive( const QString& , bool ) ) ); 72 this, SLOT( deviceActive( const QString& , bool ) ) );
73 connect( m_localDevice, SIGNAL( connections( ConnectionState::ValueList ) ), 73 connect( m_localDevice, SIGNAL( connections( ConnectionState::ValueList ) ),
74 this, SLOT( addConnectedDevices( ConnectionState::ValueList ) ) ); 74 this, SLOT( addConnectedDevices( ConnectionState::ValueList ) ) );
75 connect( m_localDevice, SIGNAL( signalStrength( const QString&, const QString& ) ), 75 connect( m_localDevice, SIGNAL( signalStrength( const QString&, const QString& ) ),
76 this, SLOT( addSignalStrength( const QString&, const QString& ) ) ); 76 this, SLOT( addSignalStrength( const QString&, const QString& ) ) );
77 77
78 78
79 // let hold be rightButtonClicked() 79 // let hold be rightButtonClicked()
80 QPEApplication::setStylusOperation( ListView2->viewport(), QPEApplication::RightOnHold); 80 QPEApplication::setStylusOperation( ListView2->viewport(), QPEApplication::RightOnHold);
81 QPEApplication::setStylusOperation( ListView4->viewport(), QPEApplication::RightOnHold); 81 QPEApplication::setStylusOperation( ListView4->viewport(), QPEApplication::RightOnHold);
82 82
83 //Load all icons needed 83 //Load all icons needed
84 m_offPix = Resource::loadPixmap( "opietooth/notconnected" ); 84 m_offPix = Resource::loadPixmap( "opietooth/notconnected" );
85 m_onPix = Resource::loadPixmap( "opietooth/connected" ); 85 m_onPix = Resource::loadPixmap( "opietooth/connected" );
86 m_findPix = Resource::loadPixmap( "opietooth/find" ); 86 m_findPix = Resource::loadPixmap( "opietooth/find" );
87 87
88 QPalette pal = this->palette(); 88 QPalette pal = this->palette();
89 QColor col = pal.color( QPalette::Active, QColorGroup::Background ); 89 QColor col = pal.color( QPalette::Active, QColorGroup::Background );
90 pal.setColor( QPalette::Active, QColorGroup::Button, col ); 90 pal.setColor( QPalette::Active, QColorGroup::Button, col );
91 pal.setColor( QPalette::Inactive, QColorGroup::Button, col ); 91 pal.setColor( QPalette::Inactive, QColorGroup::Button, col );
92 pal.setColor( QPalette::Normal, QColorGroup::Button, col ); 92 pal.setColor( QPalette::Normal, QColorGroup::Button, col );
93 pal.setColor( QPalette::Disabled, QColorGroup::Button, col ); 93 pal.setColor( QPalette::Disabled, QColorGroup::Button, col );
94 this->setPalette( pal ); 94 this->setPalette( pal );
95 95
96 setCaption( tr( "Bluetooth Manager" ) ); 96 setCaption( tr( "Bluetooth Manager" ) );
97 97
98 readConfig(); 98 readConfig();
99 initGui(); 99 initGui();
100 100
101 ListView2->setRootIsDecorated(true); 101 ListView2->setRootIsDecorated(true);
102 102
103 103
104 writeToHciConfig(); 104 writeToHciConfig();
105 // search conncetions 105 // search conncetions
106 addConnectedDevices(); 106 addConnectedDevices();
107 addSignalStrength(); 107 addSignalStrength();
108 m_iconLoader = new BTIconLoader(); 108 m_iconLoader = new BTIconLoader();
109 readSavedDevices(); 109 readSavedDevices();
110} 110}
111 111
112/** 112/**
113 * Reads all options from the config file 113 * Reads all options from the config file
114 */ 114 */
115void BlueBase::readConfig() { 115void BlueBase::readConfig() {
116 116
117 Config cfg( "bluetoothmanager" ); 117 Config cfg( "bluetoothmanager" );
118 cfg.setGroup( "bluezsettings" ); 118 cfg.setGroup( "bluezsettings" );
119 119
120 m_deviceName = cfg.readEntry( "name" , "No name" ); // name the device should identify with 120 m_deviceName = cfg.readEntry( "name" , "No name" ); // name the device should identify with
121 m_defaultPasskey = cfg.readEntryCrypt( "passkey" , "" ); // <- hmm, look up how good the trolls did that, maybe too weak 121 m_defaultPasskey = cfg.readEntryCrypt( "passkey" , "" ); // <- hmm, look up how good the trolls did that, maybe too weak
122 m_useEncryption = cfg.readBoolEntry( "useEncryption" , TRUE ); 122 m_useEncryption = cfg.readBoolEntry( "useEncryption" , TRUE );
123 m_enableAuthentification = cfg.readBoolEntry( "enableAuthentification" , TRUE ); 123 m_enableAuthentification = cfg.readBoolEntry( "enableAuthentification" , TRUE );
124 m_enablePagescan = cfg.readBoolEntry( "enablePagescan" , TRUE ); 124 m_enablePagescan = cfg.readBoolEntry( "enablePagescan" , TRUE );
125 m_enableInquiryscan = cfg.readBoolEntry( "enableInquiryscan" , TRUE ); 125 m_enableInquiryscan = cfg.readBoolEntry( "enableInquiryscan" , TRUE );
126} 126}
127 127
128/** 128/**
129 * Writes all options to the config file 129 * Writes all options to the config file
130 */ 130 */
131void BlueBase::writeConfig() { 131void BlueBase::writeConfig() {
132 132
133 Config cfg( "bluetoothmanager" ); 133 Config cfg( "bluetoothmanager" );
134 cfg.setGroup( "bluezsettings" ); 134 cfg.setGroup( "bluezsettings" );
135 135
136 cfg.writeEntry( "name" , m_deviceName ); 136 cfg.writeEntry( "name" , m_deviceName );
137 cfg.writeEntryCrypt( "passkey" , m_defaultPasskey ); 137 cfg.writeEntryCrypt( "passkey" , m_defaultPasskey );
138 cfg.writeEntry( "useEncryption" , m_useEncryption ); 138 cfg.writeEntry( "useEncryption" , m_useEncryption );
139 cfg.writeEntry( "enableAuthentification" , m_enableAuthentification ); 139 cfg.writeEntry( "enableAuthentification" , m_enableAuthentification );
140 cfg.writeEntry( "enablePagescan" , m_enablePagescan ); 140 cfg.writeEntry( "enablePagescan" , m_enablePagescan );
141 cfg.writeEntry( "enableInquiryscan" , m_enableInquiryscan ); 141 cfg.writeEntry( "enableInquiryscan" , m_enableInquiryscan );
142 142
143 writeToHciConfig(); 143 writeToHciConfig();
144} 144}
145 145
146/** 146/**
147 * Modify the hcid.conf file to our needs 147 * Modify the hcid.conf file to our needs
148 */ 148 */
149void BlueBase::writeToHciConfig() { 149void BlueBase::writeToHciConfig() {
150 qWarning("writeToHciConfig"); 150 qWarning("writeToHciConfig");
151 HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" ); 151 HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" );
152 hciconf.load(); 152 hciconf.load();
153 hciconf.setPinHelper( "/bin/QtPalmtop/bin/blue-pin" ); 153 hciconf.setPinHelper( "/bin/QtPalmtop/bin/blue-pin" );
154 hciconf.setName( m_deviceName ); 154 hciconf.setName( m_deviceName );
155 hciconf.setEncrypt( m_useEncryption ); 155 hciconf.setEncrypt( m_useEncryption );
156 hciconf.setAuth( m_enableAuthentification ); 156 hciconf.setAuth( m_enableAuthentification );
157 hciconf.setPscan( m_enablePagescan ); 157 hciconf.setPscan( m_enablePagescan );
158 hciconf.setIscan( m_enableInquiryscan ); 158 hciconf.setIscan( m_enableInquiryscan );
159 hciconf.save(); 159 hciconf.save();
160} 160}
161 161
162 162
163/** 163/**
164 * Read the list of allready known devices 164 * Read the list of allready known devices
165 */ 165 */
166void BlueBase::readSavedDevices() { 166void BlueBase::readSavedDevices() {
167 167
168 QValueList<RemoteDevice> loadedDevices; 168 QValueList<RemoteDevice> loadedDevices;
169 DeviceHandler handler; 169 DeviceHandler handler;
170 loadedDevices = handler.load(); 170 loadedDevices = handler.load();
171 171
172 addSearchedDevices( loadedDevices ); 172 addSearchedDevices( loadedDevices );
173} 173}
174 174
175 175
176/** 176/**
177 * Write the list of allready known devices 177 * Write the list of allready known devices
178 */ 178 */
179void BlueBase::writeSavedDevices() { 179void BlueBase::writeSavedDevices() {
180 QListViewItemIterator it( ListView2 ); 180 QListViewItemIterator it( ListView2 );
181 BTListItem* item; 181 BTListItem* item;
182 BTDeviceItem* device; 182 BTDeviceItem* device;
183 RemoteDevice::ValueList list; 183 RemoteDevice::ValueList list;
184 for ( ; it.current(); ++it ) { 184 for ( ; it.current(); ++it ) {
185 item = (BTListItem*)it.current(); 185 item = (BTListItem*)it.current();
186 if(item->typeId() != BTListItem::Device ) 186 if(item->typeId() != BTListItem::Device )
187 continue; 187 continue;
188 device = (BTDeviceItem*)item; 188 device = (BTDeviceItem*)item;
189 189
190 list.append( device->remoteDevice() ); 190 list.append( device->remoteDevice() );
191 } 191 }
192 /* 192 /*
193 * if not empty save the List through DeviceHandler 193 * if not empty save the List through DeviceHandler
194 */ 194 */
195 if ( list.isEmpty() ) 195 if ( list.isEmpty() )
196 return; 196 return;
197 DeviceHandler handler; 197 DeviceHandler handler;
198 handler.save( list ); 198 handler.save( list );
199} 199}
200 200
201 201
202/** 202/**
203 * Set up the gui 203 * Set up the gui
204 */ 204 */
205void BlueBase::initGui() { 205void BlueBase::initGui() {
206 StatusLabel->setText( status() ); // maybe move it to getStatus() 206 StatusLabel->setText( status() ); // maybe move it to getStatus()
207 cryptCheckBox->setChecked( m_useEncryption ); 207 cryptCheckBox->setChecked( m_useEncryption );
208 authCheckBox->setChecked( m_enableAuthentification ); 208 authCheckBox->setChecked( m_enableAuthentification );
209 pagescanCheckBox->setChecked( m_enablePagescan ); 209 pagescanCheckBox->setChecked( m_enablePagescan );
210 inquiryscanCheckBox->setChecked( m_enableInquiryscan ); 210 inquiryscanCheckBox->setChecked( m_enableInquiryscan );
211 deviceNameLine->setText( m_deviceName ); 211 deviceNameLine->setText( m_deviceName );
212 passkeyLine->setText( m_defaultPasskey ); 212 passkeyLine->setText( m_defaultPasskey );
213 // set info tab 213 // set info tab
214 setInfo(); 214 setInfo();
215} 215}
216 216
217 217
218/** 218/**
219 * Get the status informations and returns it 219 * Get the status informations and returns it
220 * @return QString the status informations gathered 220 * @return QString the status informations gathered
221 */ 221 */
222QString BlueBase::status()const{ 222QString BlueBase::status()const{
223 QString infoString = tr( "<b>Device name : </b> Ipaq" ); 223 QString infoString = tr( "<b>Device name : </b> Ipaq" );
224 infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" ); 224 infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" );
225 infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" ); 225 infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" );
226 226
227 return (infoString); 227 return (infoString);
228} 228}
229 229
230 230
231/** 231/**
232 * Read the current values from the gui and invoke writeConfig() 232 * Read the current values from the gui and invoke writeConfig()
233 */ 233 */
234void BlueBase::applyConfigChanges() { 234void BlueBase::applyConfigChanges() {
235 m_deviceName = deviceNameLine->text(); 235 m_deviceName = deviceNameLine->text();
236 m_defaultPasskey = passkeyLine->text(); 236 m_defaultPasskey = passkeyLine->text();
237 m_useEncryption = cryptCheckBox->isChecked(); 237 m_useEncryption = cryptCheckBox->isChecked();
238 m_enableAuthentification = authCheckBox->isChecked(); 238 m_enableAuthentification = authCheckBox->isChecked();
239 m_enablePagescan = pagescanCheckBox->isChecked(); 239 m_enablePagescan = pagescanCheckBox->isChecked();
240 m_enableInquiryscan = inquiryscanCheckBox->isChecked(); 240 m_enableInquiryscan = inquiryscanCheckBox->isChecked();
241 241
242 writeConfig(); 242 writeConfig();
243 243
244 QMessageBox::information( this, tr("Test") , tr("Changes were applied.") ); 244 QMessageBox::information( this, tr("Test") , tr("Changes were applied.") );
245} 245}
246 246
247/** 247/**
248 * Add fresh found devices from scan dialog to the listing 248 * Add fresh found devices from scan dialog to the listing
249 * 249 *
250 */ 250 */
251void BlueBase::addSearchedDevices( const QValueList<RemoteDevice> &newDevices ) { 251void BlueBase::addSearchedDevices( const QValueList<RemoteDevice> &newDevices ) {
252 BTDeviceItem * deviceItem; 252 BTDeviceItem * deviceItem;
253 QValueList<RemoteDevice>::ConstIterator it; 253 QValueList<RemoteDevice>::ConstIterator it;
254 254
255 for( it = newDevices.begin(); it != newDevices.end() ; ++it ) { 255 for( it = newDevices.begin(); it != newDevices.end() ; ++it ) {
256 256
257 if (find( (*it) )) // is already inserted 257 if (find( (*it) )) // is already inserted
258 continue; 258 continue;
259 259
260 deviceItem = new BTDeviceItem( ListView2 , (*it) ); 260 deviceItem = new BTDeviceItem( ListView2 , (*it) );
261 deviceItem->setPixmap( 1, m_findPix ); 261 deviceItem->setPixmap( 1, m_findPix );
262 deviceItem->setExpandable ( true ); 262 deviceItem->setExpandable ( true );
263 263
264 // look if device is avail. atm, async 264 // look if device is avail. atm, async
265 deviceActive( (*it) ); 265 deviceActive( (*it) );
266 266
267 // ggf auch hier? 267 // ggf auch hier?
268 addServicesToDevice( deviceItem ); 268 addServicesToDevice( deviceItem );
269 } 269 }
270} 270}
271 271
272 272
273/** 273/**
274 * Action that is toggled on entrys on click 274 * Action that is toggled on entrys on click
275 */ 275 */
276void BlueBase::startServiceActionClicked( QListViewItem */*item*/ ) { 276void BlueBase::startServiceActionClicked( QListViewItem */*item*/ ) {
277} 277}
278 278
279 279
280/** 280/**
281 * Action that are toggled on hold (mostly QPopups i guess) 281 * Action that are toggled on hold (mostly QPopups i guess)
282 */ 282 */
283void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int /*column*/ ) { 283void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int /*column*/ ) {
284 if (!item ) 284 if (!item )
285 return; 285 return;
286 286
287 QPopupMenu *menu = new QPopupMenu(); 287 QPopupMenu *menu = new QPopupMenu();
288 int ret=0; 288 int ret=0;
289 289
290 if ( ((BTListItem*)item)->type() == "device") { 290 if ( ((BTListItem*)item)->type() == "device") {
291 291
292 QPopupMenu *groups = new QPopupMenu(); 292 QPopupMenu *groups = new QPopupMenu();
293 293
294 menu->insertItem( ((BTDeviceItem*)item)->name(),0 ); 294 menu->insertItem( ((BTDeviceItem*)item)->name(),0 );
295 menu->insertSeparator(1); 295 menu->insertSeparator(1);
296 menu->insertItem( tr("rescan sevices"), 2); 296 menu->insertItem( tr("rescan sevices"), 2);
297 menu->insertItem( tr("to group"), groups , 3); 297 menu->insertItem( tr("to group"), groups , 3);
298 menu->insertItem( tr("delete"), 4); 298 menu->insertItem( tr("delete"), 4);
299 299
300 ret = menu->exec( point , 0); 300 ret = menu->exec( point , 0);
301 301
302 switch(ret) { 302 switch(ret) {
303 case -1: 303 case -1:
304 break; 304 break;
305 case 2: 305 case 2:
306 addServicesToDevice( (BTDeviceItem*)item ); 306 addServicesToDevice( (BTDeviceItem*)item );
307 break; 307 break;
308 308
309 case 4: 309 case 4:
310 // deletes childs too 310 // deletes childs too
311 delete item; 311 delete item;
312 break; 312 break;
313 } 313 }
314 delete groups; 314 delete groups;
315 315
316 } 316 }
317 317
318 /* 318 /*
319 * We got service sensitive PopupMenus in our factory 319 * We got service sensitive PopupMenus in our factory
320 * We will create one through the factory and will insert 320 * We will create one through the factory and will insert
321 * our Separator + ShowInfo into the menu or create a new 321 * our Separator + ShowInfo into the menu or create a new
322 * one if the factory returns 0 322 * one if the factory returns 0
323 * PopupMenu deletion is kind of weird. 323 * PopupMenu deletion is kind of weird.
324 * If escaped( -1 ) or any of our items were chosen we'll 324 * If escaped( -1 ) or any of our items were chosen we'll
325 * delete the PopupMenu otherwise it's the responsibility of 325 * delete the PopupMenu otherwise it's the responsibility of
326 * the PopupMenu to delete itself 326 * the PopupMenu to delete itself
327 * 327 *
328 */ 328 */
329 else if ( ((BTListItem*)item)->type() == "service") { 329 else if ( ((BTListItem*)item)->type() == "service") {
330 BTServiceItem* service = (BTServiceItem*)item; 330 BTServiceItem* service = (BTServiceItem*)item;
331 QMap<int, QString> list = service->services().classIdList(); 331 QMap<int, QString> list = service->services().classIdList();
332 QMap<int, QString>::Iterator it = list.begin(); 332 QMap<int, QString>::Iterator it = list.begin();
333 QPopupMenu *popup =0l; 333 QPopupMenu *popup =0l;
334 if ( it != list.end() ) { 334 if ( it != list.end() ) {
335 qWarning("Searching id %d %s", it.key(), it.data().latin1() ); 335 qWarning("Searching id %d %s", it.key(), it.data().latin1() );
336 popup = m_popHelper.find( it.key() /*1*/, 336 popup = m_popHelper.find( 4358,
337 service->services(), 337 service->services(),
338 (BTDeviceItem*)service->parent() ); 338 (BTDeviceItem*)service->parent() );
339 }else { 339 }else {
340 qWarning("Empty"); 340 qWarning("Empty");
341 } 341 }
342 342
343 if ( popup == 0l ) { 343 if ( popup == 0l ) {
344 qWarning("factory returned 0l"); 344 qWarning("factory returned 0l");
345 popup = new QPopupMenu(); 345 popup = new QPopupMenu();
346 } 346 }
347 int test1 = popup->insertItem( tr("Test1:"), 2); 347 int test1 = popup->insertItem( tr("Test1:"), 2);
348 348
349 ret = popup->exec( point ); 349 ret = popup->exec( point );
350 qWarning("returned from exec() "); 350 qWarning("returned from exec() ");
351 if ( ret == -1 ) { 351 if ( ret == -1 ) {
352 ; 352 ;
353 } else if ( ret == test1 ) { 353 } else if ( ret == test1 ) {
354 ; 354 ;
355 } 355 }
356 delete popup; 356 delete popup;
357 } 357 }
358 delete menu; 358 delete menu;
359} 359}
360 360
361 361
362/** 362/**
363 * Search and display avail. services for a device (on expand from device listing) 363 * Search and display avail. services for a device (on expand from device listing)
364 * @param item the service item returned 364 * @param item the service item returned
365 */ 365 */
366void BlueBase::addServicesToDevice( BTDeviceItem * item ) { 366void BlueBase::addServicesToDevice( BTDeviceItem * item ) {
367 qDebug("addServicesToDevice"); 367 qDebug("addServicesToDevice");
368 // row of mac adress text(3) 368 // row of mac adress text(3)
369 RemoteDevice device = item->remoteDevice(); 369 RemoteDevice device = item->remoteDevice();
370 m_deviceList.insert( item->mac() , item ); 370 m_deviceList.insert( item->mac() , item );
371 // and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back 371 // and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back
372 m_localDevice->searchServices( device ); 372 m_localDevice->searchServices( device );
373} 373}
374 374
375 375
376/** 376/**
377 * Overloaded. This one it the one that is 377 * Overloaded. This one it the one that is
378 ted to the foundServices signal 378 ted to the foundServices signal
379 * @param device the mac address of the remote device 379 * @param device the mac address of the remote device
380 * @param servicesList the list with the service the device has. 380 * @param servicesList the list with the service the device has.
381 */ 381 */
382void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) { 382void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) {
383 qDebug("fill services list"); 383 qDebug("fill services list");
384 384
385 QMap<QString,BTDeviceItem*>::Iterator it; 385 QMap<QString,BTDeviceItem*>::Iterator it;
386 BTDeviceItem* deviceItem = 0; 386 BTDeviceItem* deviceItem = 0;
387 387
388 // get the right devices which requested the search 388 // get the right devices which requested the search
389 it = m_deviceList.find( device ); 389 it = m_deviceList.find( device );
390 if( it == m_deviceList.end() ) 390 if( it == m_deviceList.end() )
391 return; 391 return;
392 deviceItem = it.data(); 392 deviceItem = it.data();
393 393
394 // remove previous entries 394 // remove previous entries
395 QList<QListViewItem> tempList; 395 QList<QListViewItem> tempList;
396 tempList.setAutoDelete( true ); 396 tempList.setAutoDelete( true );
397 QListViewItem * child = deviceItem->firstChild(); 397 QListViewItem * child = deviceItem->firstChild();
398 while( child ) { 398 while( child ) {
399 tempList.append( child ); 399 tempList.append( child );
400 child = child->nextSibling(); 400 child = child->nextSibling();
401 } 401 }
402 tempList.clear(); 402 tempList.clear();
403 403
404 QValueList<OpieTooth::Services>::Iterator it2; 404 QValueList<OpieTooth::Services>::Iterator it2;
405 BTServiceItem* serviceItem; 405 BTServiceItem* serviceItem;
406 406
407 407
408 if (!servicesList.isEmpty() ) { 408 if (!servicesList.isEmpty() ) {
409 // add services 409 // add services
410 QMap<int, QString> list; 410 QMap<int, QString> list;
411 QMap<int, QString>::Iterator classIt; 411 QMap<int, QString>::Iterator classIt;
412 for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) { 412 for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) {
413 serviceItem = new BTServiceItem( deviceItem, (*it2) ); 413 serviceItem = new BTServiceItem( deviceItem, (*it2) );
414 list = (*it2).classIdList(); 414 list = (*it2).classIdList();
415 classIt = list.begin(); 415 classIt = list.begin();
416 int classId=0; 416 int classId=0;
417 if ( classIt != list.end() ) { 417 if ( classIt != list.end() ) {
418 classId = classIt.key(); 418 classId = classIt.key();
419 } 419 }
420 420
421 serviceItem->setPixmap( 0, m_iconLoader->serviceIcon( classId ) ); 421 serviceItem->setPixmap( 0, m_iconLoader->serviceIcon( classId ) );
422 } 422 }
423 } else { 423 } else {
424 Services s1; 424 Services s1;
425 s1.setServiceName( tr("no services found") ); 425 s1.setServiceName( tr("no services found") );
426 serviceItem = new BTServiceItem( deviceItem, s1 ); 426 serviceItem = new BTServiceItem( deviceItem, s1 );
427 } 427 }
428 // now remove them from the list 428 // now remove them from the list
429 m_deviceList.remove( it ); 429 m_deviceList.remove( it );
430} 430}
431 431
432 432
433 433
434 434
435 435
436void BlueBase::addSignalStrength() { 436void BlueBase::addSignalStrength() {
437 437
438 QListViewItemIterator it( ListView4 ); 438 QListViewItemIterator it( ListView4 );
439 for ( ; it.current(); ++it ) { 439 for ( ; it.current(); ++it ) {
440 m_localDevice->signalStrength( ((BTConnectionItem*)it.current() )->connection().mac() ); 440 m_localDevice->signalStrength( ((BTConnectionItem*)it.current() )->connection().mac() );
441 } 441 }
442 442
443 QTimer::singleShot( 5000, this, SLOT( addSignalStrength() ) ); 443 QTimer::singleShot( 5000, this, SLOT( addSignalStrength() ) );
444} 444}
445 445
446void BlueBase::addSignalStrength( const QString& mac, const QString& strength ) { 446void BlueBase::addSignalStrength( const QString& mac, const QString& strength ) {
447 447
448 QListViewItemIterator it( ListView4 ); 448 QListViewItemIterator it( ListView4 );
449 for ( ; it.current(); ++it ) { 449 for ( ; it.current(); ++it ) {
450 if( ((BTConnectionItem*)it.current())->connection().mac() == mac ) { 450 if( ((BTConnectionItem*)it.current())->connection().mac() == mac ) {
451 ((BTConnectionItem*)it.current() )->setSignalStrength( strength ); 451 ((BTConnectionItem*)it.current() )->setSignalStrength( strength );
452 } 452 }
453 } 453 }
454} 454}
455 455
456/** 456/**
457 * Add the existing connections (pairs) to the connections tab. 457 * Add the existing connections (pairs) to the connections tab.
458 * This one triggers the search 458 * This one triggers the search
459 */ 459 */
460void BlueBase::addConnectedDevices() { 460void BlueBase::addConnectedDevices() {
461 m_localDevice->searchConnections(); 461 m_localDevice->searchConnections();
462} 462}
463 463
464/** 464/**
465 * This adds the found connections to the connection tab. 465 * This adds the found connections to the connection tab.
466 * @param connectionList the ValueList with all current connections 466 * @param connectionList the ValueList with all current connections
467 */ 467 */
468void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList ) { 468void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList ) {
469 469
470 QValueList<OpieTooth::ConnectionState>::Iterator it; 470 QValueList<OpieTooth::ConnectionState>::Iterator it;
471 BTConnectionItem * connectionItem; 471 BTConnectionItem * connectionItem;
472 472
473 if ( !connectionList.isEmpty() ) { 473 if ( !connectionList.isEmpty() ) {
474 474
475 for (it = connectionList.begin(); it != connectionList.end(); ++it) { 475 for (it = connectionList.begin(); it != connectionList.end(); ++it) {
476 476
477 QListViewItemIterator it2( ListView4 ); 477 QListViewItemIterator it2( ListView4 );
478 bool found = false; 478 bool found = false;
479 for ( ; it2.current(); ++it2 ) { 479 for ( ; it2.current(); ++it2 ) {
480 if( ( (BTConnectionItem*)it2.current())->connection().mac() == (*it).mac() ) { 480 if( ( (BTConnectionItem*)it2.current())->connection().mac() == (*it).mac() ) {
481 found = true; 481 found = true;
482 } 482 }
483 } 483 }
484 484
485 if ( found == false ) { 485 if ( found == false ) {
486 connectionItem = new BTConnectionItem( ListView4, (*it) ); 486 connectionItem = new BTConnectionItem( ListView4, (*it) );
487 487
488 if( m_deviceList.find((*it).mac()).data() ) { 488 if( m_deviceList.find((*it).mac()).data() ) {
489 connectionItem->setName( m_deviceList.find( (*it).mac()).data()->name() ); 489 connectionItem->setName( m_deviceList.find( (*it).mac()).data()->name() );
490 } 490 }
491 } 491 }
492 492
493 } 493 }
494 494
495 QListViewItemIterator it2( ListView4 ); 495 QListViewItemIterator it2( ListView4 );
496 for ( ; it2.current(); ++it2 ) { 496 for ( ; it2.current(); ++it2 ) {
497 bool found = false; 497 bool found = false;
498 for (it = connectionList.begin(); it != connectionList.end(); ++it) { 498 for (it = connectionList.begin(); it != connectionList.end(); ++it) {
499 if( ( ((BTConnectionItem*)it2.current())->connection().mac() ) == (*it).mac() ) { 499 if( ( ((BTConnectionItem*)it2.current())->connection().mac() ) == (*it).mac() ) {
500 found = true; 500 found = true;
501 } 501 }
502 } 502 }
503 503
504 if ( !found ) { 504 if ( !found ) {
505 delete it2.current(); 505 delete it2.current();
506 } 506 }
507 507
508 } 508 }
509 509
510 510
511 } else { 511 } else {
512 ListView4->clear(); 512 ListView4->clear();
513 ConnectionState con; 513 ConnectionState con;
514 con.setMac( tr("No connections found") ); 514 con.setMac( tr("No connections found") );
515 connectionItem = new BTConnectionItem( ListView4 , con ); 515 connectionItem = new BTConnectionItem( ListView4 , con );
516 } 516 }
517 517
518 // recall connection search after some time 518 // recall connection search after some time
519 QTimer::singleShot( 15000, this, SLOT( addConnectedDevices() ) ); 519 QTimer::singleShot( 15000, this, SLOT( addConnectedDevices() ) );
520} 520}
521 521
522 522
523/** 523/**
524 * Find out if a device can currently be reached 524 * Find out if a device can currently be reached
525 * @param device 525 * @param device
526 */ 526 */
527void BlueBase::deviceActive( const RemoteDevice &device ) { 527void BlueBase::deviceActive( const RemoteDevice &device ) {
528 // search by mac, async, gets a signal back 528 // search by mac, async, gets a signal back
529 // We should have a BTDeviceItem there or where does it get added to the map -zecke 529 // We should have a BTDeviceItem there or where does it get added to the map -zecke
530 m_localDevice->isAvailable( device.mac() ); 530 m_localDevice->isAvailable( device.mac() );
531} 531}
532 532
533 533
534/** 534/**
535 * The signal catcher. Set the avail. status on device. 535 * The signal catcher. Set the avail. status on device.
536 * @param device - the mac address 536 * @param device - the mac address
537 * @param connected - if it is avail. or not 537 * @param connected - if it is avail. or not
538 */ 538 */
539void BlueBase::deviceActive( const QString& device, bool connected ) { 539void BlueBase::deviceActive( const QString& device, bool connected ) {
540 qDebug("deviceActive slot"); 540 qDebug("deviceActive slot");
541 541
542 QMap<QString,BTDeviceItem*>::Iterator it; 542 QMap<QString,BTDeviceItem*>::Iterator it;
543 543
544 it = m_deviceList.find( device ); 544 it = m_deviceList.find( device );
545 if( it == m_deviceList.end() ) 545 if( it == m_deviceList.end() )
546 return; 546 return;
547 547
548 BTDeviceItem* deviceItem = it.data(); 548 BTDeviceItem* deviceItem = it.data();
549 549
550 550
551 if ( connected ) { 551 if ( connected ) {
552 deviceItem->setPixmap( 1, m_onPix ); 552 deviceItem->setPixmap( 1, m_onPix );
553 } else { 553 } else {
554 deviceItem->setPixmap( 1, m_offPix ); 554 deviceItem->setPixmap( 1, m_offPix );
555 } 555 }
556 m_deviceList.remove( it ); 556 m_deviceList.remove( it );
557} 557}
558 558
559 559
560/** 560/**
561 * Open the "scan for devices" dialog 561 * Open the "scan for devices" dialog
562 */ 562 */
563void BlueBase::startScan() { 563void BlueBase::startScan() {
564 ScanDialog *scan = new ScanDialog( this, "ScanDialog", 564 ScanDialog *scan = new ScanDialog( this, "ScanDialog",
565 true, WDestructiveClose ); 565 true, WDestructiveClose );
566 QObject::connect( scan, SIGNAL( selectedDevices( const QValueList<RemoteDevice>& ) ), 566 QObject::connect( scan, SIGNAL( selectedDevices( const QValueList<RemoteDevice>& ) ),
567 this, SLOT( addSearchedDevices( const QValueList<RemoteDevice>& ) ) ); 567 this, SLOT( addSearchedDevices( const QValueList<RemoteDevice>& ) ) );
568 568
569 scan->showMaximized(); 569 scan->showMaximized();
570} 570}
571 571
572 572
573/** 573/**
574 * Set the informations about the local device in information Tab 574 * Set the informations about the local device in information Tab
575 */ 575 */
576void BlueBase::setInfo() { 576void BlueBase::setInfo() {
577 StatusLabel->setText( status() ); 577 StatusLabel->setText( status() );
578} 578}
579 579
580 580
581/** 581/**
582 * Decontructor 582 * Decontructor
583 */ 583 */
584BlueBase::~BlueBase() { 584BlueBase::~BlueBase() {
585 writeSavedDevices(); 585 writeSavedDevices();
586 delete m_iconLoader; 586 delete m_iconLoader;
587} 587}
588 588
589 589
590/** 590/**
591 * find searches the ListView for a BTDeviceItem containig 591 * find searches the ListView for a BTDeviceItem containig
592 * the same Device if found return true else false 592 * the same Device if found return true else false
593 * @param dev RemoteDevice to find 593 * @param dev RemoteDevice to find
594 * @return returns true if found 594 * @return returns true if found
595 */ 595 */
596bool BlueBase::find( const RemoteDevice& rem ) { 596bool BlueBase::find( const RemoteDevice& rem ) {
597 QListViewItemIterator it( ListView2 ); 597 QListViewItemIterator it( ListView2 );
598 BTListItem* item; 598 BTListItem* item;
599 BTDeviceItem* device; 599 BTDeviceItem* device;
600 for (; it.current(); ++it ) { 600 for (; it.current(); ++it ) {
601 item = (BTListItem*) it.current(); 601 item = (BTListItem*) it.current();
602 if ( item->typeId() != BTListItem::Device ) 602 if ( item->typeId() != BTListItem::Device )
603 continue; 603 continue;
604 604
605 device = (BTDeviceItem*)item; 605 device = (BTDeviceItem*)item;
606 if ( rem.equals( device->remoteDevice() ) ) 606 if ( rem.equals( device->remoteDevice() ) )
607 return true; 607 return true;
608 } 608 }
609 return false; // not found 609 return false; // not found
610} 610}
diff --git a/noncore/net/opietooth/manager/bluetoothbase.ui b/noncore/net/opietooth/manager/bluetoothbase.ui
index b51c8c6..9ff970f 100644
--- a/noncore/net/opietooth/manager/bluetoothbase.ui
+++ b/noncore/net/opietooth/manager/bluetoothbase.ui
@@ -1,440 +1,395 @@
1<!DOCTYPE UI><UI> 1<!DOCTYPE UI><UI>
2<class>BluetoothBase</class> 2<class>BluetoothBase</class>
3<widget> 3<widget>
4 <class>QWidget</class> 4 <class>QWidget</class>
5 <property stdset="1"> 5 <property stdset="1">
6 <name>name</name> 6 <name>name</name>
7 <cstring>BluetoothBase</cstring> 7 <cstring>BluetoothBase</cstring>
8 </property> 8 </property>
9 <property stdset="1"> 9 <property stdset="1">
10 <name>geometry</name> 10 <name>geometry</name>
11 <rect> 11 <rect>
12 <x>0</x> 12 <x>0</x>
13 <y>0</y> 13 <y>0</y>
14 <width>228</width> 14 <width>224</width>
15 <height>320</height> 15 <height>320</height>
16 </rect> 16 </rect>
17 </property> 17 </property>
18 <property stdset="1"> 18 <property stdset="1">
19 <name>caption</name> 19 <name>caption</name>
20 <string>Form1</string> 20 <string>Form1</string>
21 </property> 21 </property>
22 <widget> 22 <property>
23 <class>QTabWidget</class> 23 <name>layoutMargin</name>
24 </property>
25 <property>
26 <name>layoutSpacing</name>
27 </property>
28 <vbox>
24 <property stdset="1"> 29 <property stdset="1">
25 <name>name</name> 30 <name>margin</name>
26 <cstring>Status</cstring> 31 <number>0</number>
27 </property> 32 </property>
28 <property stdset="1"> 33 <property stdset="1">
29 <name>geometry</name> 34 <name>spacing</name>
30 <rect> 35 <number>0</number>
31 <x>0</x>
32 <y>0</y>
33 <width>260</width>
34 <height>350</height>
35 </rect>
36 </property> 36 </property>
37 <widget> 37 <widget>
38 <class>QWidget</class> 38 <class>QTabWidget</class>
39 <property stdset="1"> 39 <property stdset="1">
40 <name>name</name> 40 <name>name</name>
41 <cstring>tab</cstring> 41 <cstring>Status</cstring>
42 </property> 42 </property>
43 <attribute> 43 <property>
44 <name>title</name> 44 <name>layoutMargin</name>
45 <string>Devices</string> 45 </property>
46 </attribute> 46 <property>
47 <spacer> 47 <name>layoutSpacing</name>
48 <property> 48 </property>
49 <name>name</name> 49 <widget>
50 <cstring>Spacer3</cstring> 50 <class>QWidget</class>
51 </property>
52 <property stdset="1">
53 <name>orientation</name>
54 <enum>Vertical</enum>
55 </property>
56 <property stdset="1"> 51 <property stdset="1">
57 <name>sizeType</name>
58 <enum>Expanding</enum>
59 </property>
60 <property>
61 <name>sizeHint</name>
62 <size>
63 <width>20</width>
64 <height>20</height>
65 </size>
66 </property>
67 </spacer>
68 <spacer>
69 <property>
70 <name>name</name> 52 <name>name</name>
71 <cstring>Spacer1</cstring> 53 <cstring>tab</cstring>
72 </property> 54 </property>
73 <property stdset="1"> 55 <attribute>
74 <name>orientation</name> 56 <name>title</name>
75 <enum>Vertical</enum> 57 <string>Devices</string>
76 </property> 58 </attribute>
77 <property stdset="1"> 59 <vbox>
78 <name>sizeType</name> 60 <property stdset="1">
79 <enum>Fixed</enum> 61 <name>margin</name>
80 </property> 62 <number>2</number>
81 <property>
82 <name>sizeHint</name>
83 <size>
84 <width>20</width>
85 <height>20</height>
86 </size>
87 </property>
88 </spacer>
89 <widget>
90 <class>QListView</class>
91 <column>
92 <property>
93 <name>text</name>
94 <string>Device Name</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>Online</string>
109 </property>
110 <property>
111 <name>clickable</name>
112 <bool>true</bool>
113 </property> 63 </property>
114 <property> 64 <property stdset="1">
115 <name>resizeable</name> 65 <name>spacing</name>
116 <bool>true</bool> 66 <number>2</number>
117 </property> 67 </property>
118 </column> 68 <widget>
119 <property stdset="1"> 69 <class>QListView</class>
120 <name>name</name> 70 <column>
121 <cstring>ListView2</cstring> 71 <property>
122 </property> 72 <name>text</name>
123 <property stdset="1"> 73 <string>Device Name</string>
124 <name>geometry</name> 74 </property>
125 <rect> 75 <property>
126 <x>0</x> 76 <name>clickable</name>
127 <y>0</y> 77 <bool>true</bool>
128 <width>230</width> 78 </property>
129 <height>230</height> 79 <property>
130 </rect> 80 <name>resizeable</name>
131 </property> 81 <bool>true</bool>
82 </property>
83 </column>
84 <column>
85 <property>
86 <name>text</name>
87 <string>Online</string>
88 </property>
89 <property>
90 <name>clickable</name>
91 <bool>true</bool>
92 </property>
93 <property>
94 <name>resizeable</name>
95 <bool>true</bool>
96 </property>
97 </column>
98 <property stdset="1">
99 <name>name</name>
100 <cstring>ListView2</cstring>
101 </property>
102 </widget>
103 <widget>
104 <class>QPushButton</class>
105 <property stdset="1">
106 <name>name</name>
107 <cstring>PushButton2</cstring>
108 </property>
109 <property stdset="1">
110 <name>sizePolicy</name>
111 <sizepolicy>
112 <hsizetype>0</hsizetype>
113 <vsizetype>0</vsizetype>
114 </sizepolicy>
115 </property>
116 <property stdset="1">
117 <name>text</name>
118 <string>Scan for Devices</string>
119 </property>
120 </widget>
121 </vbox>
132 </widget> 122 </widget>
133 <widget> 123 <widget>
134 <class>QPushButton</class> 124 <class>QWidget</class>
135 <property stdset="1"> 125 <property stdset="1">
136 <name>name</name> 126 <name>name</name>
137 <cstring>PushButton2</cstring> 127 <cstring>tab</cstring>
138 </property>
139 <property stdset="1">
140 <name>geometry</name>
141 <rect>
142 <x>40</x>
143 <y>231</y>
144 <width>154</width>
145 <height>30</height>
146 </rect>
147 </property>
148 <property stdset="1">
149 <name>sizePolicy</name>
150 <sizepolicy>
151 <hsizetype>0</hsizetype>
152 <vsizetype>0</vsizetype>
153 </sizepolicy>
154 </property>
155 <property stdset="1">
156 <name>text</name>
157 <string>Scan for Devices</string>
158 </property> 128 </property>
159 </widget> 129 <attribute>
160 </widget> 130 <name>title</name>
161 <widget> 131 <string>Connections</string>
162 <class>QWidget</class> 132 </attribute>
163 <property stdset="1"> 133 <vbox>
164 <name>name</name> 134 <property stdset="1">
165 <cstring>tab</cstring> 135 <name>margin</name>
166 </property> 136 <number>2</number>
167 <attribute>
168 <name>title</name>
169 <string>Connections</string>
170 </attribute>
171 <widget>
172 <class>QListView</class>
173 <column>
174 <property>
175 <name>text</name>
176 <string>Device Name</string>
177 </property>
178 <property>
179 <name>clickable</name>
180 <bool>true</bool>
181 </property>
182 <property>
183 <name>resizeable</name>
184 <bool>true</bool>
185 </property>
186 </column>
187 <column>
188 <property>
189 <name>text</name>
190 <string>Connection type</string>
191 </property>
192 <property>
193 <name>clickable</name>
194 <bool>true</bool>
195 </property>
196 <property>
197 <name>resizeable</name>
198 <bool>true</bool>
199 </property>
200 </column>
201 <column>
202 <property>
203 <name>text</name>
204 <string>Signal</string>
205 </property>
206 <property>
207 <name>clickable</name>
208 <bool>true</bool>
209 </property> 137 </property>
210 <property> 138 <property stdset="1">
211 <name>resizeable</name> 139 <name>spacing</name>
212 <bool>true</bool> 140 <number>2</number>
213 </property> 141 </property>
214 </column> 142 <widget>
215 <property stdset="1"> 143 <class>QListView</class>
216 <name>name</name> 144 <column>
217 <cstring>ListView4</cstring> 145 <property>
218 </property> 146 <name>text</name>
219 <property stdset="1"> 147 <string>Device Name</string>
220 <name>geometry</name> 148 </property>
221 <rect> 149 <property>
222 <x>0</x> 150 <name>clickable</name>
223 <y>0</y> 151 <bool>true</bool>
224 <width>240</width> 152 </property>
225 <height>240</height> 153 <property>
226 </rect> 154 <name>resizeable</name>
227 </property> 155 <bool>true</bool>
228 </widget> 156 </property>
229 </widget> 157 </column>
230 <widget> 158 <column>
231 <class>QWidget</class> 159 <property>
232 <property stdset="1"> 160 <name>text</name>
233 <name>name</name> 161 <string>Connection type</string>
234 <cstring>tab</cstring> 162 </property>
235 </property> 163 <property>
236 <attribute> 164 <name>clickable</name>
237 <name>title</name> 165 <bool>true</bool>
238 <string>Config</string> 166 </property>
239 </attribute> 167 <property>
240 <widget> 168 <name>resizeable</name>
241 <class>QLabel</class> 169 <bool>true</bool>
242 <property stdset="1"> 170 </property>
243 <name>name</name> 171 </column>
244 <cstring>deviceNameLabel</cstring> 172 <column>
245 </property> 173 <property>
246 <property stdset="1"> 174 <name>text</name>
247 <name>geometry</name> 175 <string>Signal</string>
248 <rect> 176 </property>
249 <x>10</x> 177 <property>
250 <y>10</y> 178 <name>clickable</name>
251 <width>70</width> 179 <bool>true</bool>
252 <height>20</height> 180 </property>
253 </rect> 181 <property>
254 </property> 182 <name>resizeable</name>
255 <property stdset="1"> 183 <bool>true</bool>
256 <name>text</name> 184 </property>
257 <string>Device Name</string> 185 </column>
258 </property> 186 <property stdset="1">
259 </widget> 187 <name>name</name>
260 <widget> 188 <cstring>ListView4</cstring>
261 <class>QLabel</class> 189 </property>
262 <property stdset="1"> 190 </widget>
263 <name>name</name> 191 </vbox>
264 <cstring>passkeyLabel</cstring>
265 </property>
266 <property stdset="1">
267 <name>geometry</name>
268 <rect>
269 <x>10</x>
270 <y>50</y>
271 <width>80</width>
272 <height>20</height>
273 </rect>
274 </property>
275 <property stdset="1">
276 <name>text</name>
277 <string>Default Passkey</string>
278 </property>
279 </widget>
280 <widget>
281 <class>QLineEdit</class>
282 <property stdset="1">
283 <name>name</name>
284 <cstring>passkeyLine</cstring>
285 </property>
286 <property stdset="1">
287 <name>geometry</name>
288 <rect>
289 <x>98</x>
290 <y>53</y>
291 <width>120</width>
292 <height>22</height>
293 </rect>
294 </property>
295 <property stdset="1">
296 <name>echoMode</name>
297 <enum>Password</enum>
298 </property>
299 </widget> 192 </widget>
300 <widget> 193 <widget>
301 <class>QLayoutWidget</class> 194 <class>QWidget</class>
302 <property stdset="1"> 195 <property stdset="1">
303 <name>name</name> 196 <name>name</name>
304 <cstring>Layout5</cstring> 197 <cstring>tab</cstring>
305 </property>
306 <property stdset="1">
307 <name>geometry</name>
308 <rect>
309 <x>10</x>
310 <y>100</y>
311 <width>188</width>
312 <height>120</height>
313 </rect>
314 </property> 198 </property>
199 <attribute>
200 <name>title</name>
201 <string>Config</string>
202 </attribute>
315 <vbox> 203 <vbox>
316 <property stdset="1"> 204 <property stdset="1">
317 <name>margin</name> 205 <name>margin</name>
318 <number>0</number> 206 <number>2</number>
319 </property> 207 </property>
320 <property stdset="1"> 208 <property stdset="1">
321 <name>spacing</name> 209 <name>spacing</name>
322 <number>6</number> 210 <number>2</number>
323 </property> 211 </property>
324 <widget> 212 <widget>
325 <class>QCheckBox</class> 213 <class>QLayoutWidget</class>
326 <property stdset="1"> 214 <property stdset="1">
327 <name>name</name> 215 <name>name</name>
328 <cstring>authCheckBox</cstring> 216 <cstring>Layout2</cstring>
329 </property>
330 <property stdset="1">
331 <name>text</name>
332 <string>enable authentification</string>
333 </property> 217 </property>
218 <hbox>
219 <property stdset="1">
220 <name>margin</name>
221 <number>0</number>
222 </property>
223 <property stdset="1">
224 <name>spacing</name>
225 <number>6</number>
226 </property>
227 <widget>
228 <class>QLabel</class>
229 <property stdset="1">
230 <name>name</name>
231 <cstring>deviceNameLabel</cstring>
232 </property>
233 <property stdset="1">
234 <name>text</name>
235 <string>Device Name</string>
236 </property>
237 </widget>
238 <widget>
239 <class>QLineEdit</class>
240 <property stdset="1">
241 <name>name</name>
242 <cstring>deviceNameLine</cstring>
243 </property>
244 </widget>
245 </hbox>
334 </widget> 246 </widget>
335 <widget> 247 <widget>
336 <class>QCheckBox</class> 248 <class>QLayoutWidget</class>
337 <property stdset="1"> 249 <property stdset="1">
338 <name>name</name> 250 <name>name</name>
339 <cstring>cryptCheckBox</cstring> 251 <cstring>Layout3</cstring>
340 </property>
341 <property stdset="1">
342 <name>text</name>
343 <string>enable encryption</string>
344 </property> 252 </property>
253 <hbox>
254 <property stdset="1">
255 <name>margin</name>
256 <number>0</number>
257 </property>
258 <property stdset="1">
259 <name>spacing</name>
260 <number>6</number>
261 </property>
262 <widget>
263 <class>QLabel</class>
264 <property stdset="1">
265 <name>name</name>
266 <cstring>passkeyLabel</cstring>
267 </property>
268 <property stdset="1">
269 <name>text</name>
270 <string>Default Passkey</string>
271 </property>
272 </widget>
273 <widget>
274 <class>QLineEdit</class>
275 <property stdset="1">
276 <name>name</name>
277 <cstring>passkeyLine</cstring>
278 </property>
279 <property stdset="1">
280 <name>echoMode</name>
281 <enum>Password</enum>
282 </property>
283 </widget>
284 </hbox>
345 </widget> 285 </widget>
346 <widget> 286 <widget>
347 <class>QCheckBox</class> 287 <class>QLayoutWidget</class>
348 <property stdset="1"> 288 <property stdset="1">
349 <name>name</name> 289 <name>name</name>
350 <cstring>pagescanCheckBox</cstring> 290 <cstring>Layout5</cstring>
351 </property>
352 <property stdset="1">
353 <name>text</name>
354 <string>Enable Page scan</string>
355 </property> 291 </property>
292 <vbox>
293 <property stdset="1">
294 <name>margin</name>
295 <number>0</number>
296 </property>
297 <property stdset="1">
298 <name>spacing</name>
299 <number>6</number>
300 </property>
301 <widget>
302 <class>QCheckBox</class>
303 <property stdset="1">
304 <name>name</name>
305 <cstring>authCheckBox</cstring>
306 </property>
307 <property stdset="1">
308 <name>text</name>
309 <string>enable authentification</string>
310 </property>
311 </widget>
312 <widget>
313 <class>QCheckBox</class>
314 <property stdset="1">
315 <name>name</name>
316 <cstring>cryptCheckBox</cstring>
317 </property>
318 <property stdset="1">
319 <name>text</name>
320 <string>enable encryption</string>
321 </property>
322 </widget>
323 <widget>
324 <class>QCheckBox</class>
325 <property stdset="1">
326 <name>name</name>
327 <cstring>pagescanCheckBox</cstring>
328 </property>
329 <property stdset="1">
330 <name>text</name>
331 <string>Enable Page scan</string>
332 </property>
333 </widget>
334 <widget>
335 <class>QCheckBox</class>
336 <property stdset="1">
337 <name>name</name>
338 <cstring>inquiryscanCheckBox</cstring>
339 </property>
340 <property stdset="1">
341 <name>text</name>
342 <string>Enable Inquiry scan</string>
343 </property>
344 </widget>
345 </vbox>
356 </widget> 346 </widget>
357 <widget> 347 <widget>
358 <class>QCheckBox</class> 348 <class>QPushButton</class>
359 <property stdset="1"> 349 <property stdset="1">
360 <name>name</name> 350 <name>name</name>
361 <cstring>inquiryscanCheckBox</cstring> 351 <cstring>configApplyButton</cstring>
362 </property> 352 </property>
363 <property stdset="1"> 353 <property stdset="1">
364 <name>text</name> 354 <name>text</name>
365 <string>Enable Inquiry scan</string> 355 <string>Apply</string>
366 </property> 356 </property>
367 </widget> 357 </widget>
368 </vbox> 358 </vbox>
369 </widget> 359 </widget>
370 <widget> 360 <widget>
371 <class>QLineEdit</class> 361 <class>QWidget</class>
372 <property stdset="1"> 362 <property stdset="1">
373 <name>name</name> 363 <name>name</name>
374 <cstring>deviceNameLine</cstring> 364 <cstring>tab</cstring>
375 </property>
376 <property stdset="1">
377 <name>geometry</name>
378 <rect>
379 <x>98</x>
380 <y>13</y>
381 <width>120</width>
382 <height>22</height>
383 </rect>
384 </property>
385 </widget>
386 <widget>
387 <class>QPushButton</class>
388 <property stdset="1">
389 <name>name</name>
390 <cstring>configApplyButton</cstring>
391 </property>
392 <property stdset="1">
393 <name>geometry</name>
394 <rect>
395 <x>60</x>
396 <y>230</y>
397 <width>99</width>
398 <height>32</height>
399 </rect>
400 </property>
401 <property stdset="1">
402 <name>text</name>
403 <string>Apply</string>
404 </property>
405 </widget>
406 </widget>
407 <widget>
408 <class>QWidget</class>
409 <property stdset="1">
410 <name>name</name>
411 <cstring>tab</cstring>
412 </property>
413 <attribute>
414 <name>title</name>
415 <string>Status</string>
416 </attribute>
417 <widget>
418 <class>QLabel</class>
419 <property stdset="1">
420 <name>name</name>
421 <cstring>StatusLabel</cstring>
422 </property>
423 <property stdset="1">
424 <name>geometry</name>
425 <rect>
426 <x>10</x>
427 <y>10</y>
428 <width>220</width>
429 <height>250</height>
430 </rect>
431 </property>
432 <property stdset="1">
433 <name>text</name>
434 <string>Status Label</string>
435 </property> 365 </property>
366 <attribute>
367 <name>title</name>
368 <string>Status</string>
369 </attribute>
370 <vbox>
371 <property stdset="1">
372 <name>margin</name>
373 <number>2</number>
374 </property>
375 <property stdset="1">
376 <name>spacing</name>
377 <number>2</number>
378 </property>
379 <widget>
380 <class>QLabel</class>
381 <property stdset="1">
382 <name>name</name>
383 <cstring>StatusLabel</cstring>
384 </property>
385 <property stdset="1">
386 <name>text</name>
387 <string>Status Label</string>
388 </property>
389 </widget>
390 </vbox>
436 </widget> 391 </widget>
437 </widget> 392 </widget>
438 </widget> 393 </vbox>
439</widget> 394</widget>
440</UI> 395</UI>
diff --git a/noncore/net/opietooth/manager/panpopup.cpp b/noncore/net/opietooth/manager/panpopup.cpp
index d3d1347..61e632b 100644
--- a/noncore/net/opietooth/manager/panpopup.cpp
+++ b/noncore/net/opietooth/manager/panpopup.cpp
@@ -1,70 +1,62 @@
1#include <qpe/qcopenvelope_qws.h> 1#include <qpe/qcopenvelope_qws.h>
2 2
3#include <qtimer.h> 3#include <qtimer.h>
4 4
5#include "panpopup.h" 5#include "panpopup.h"
6 6
7using namespace OpieTooth; 7using namespace OpieTooth;
8 8
9/* 9/*
10 * c'tor init the QAction 10 * c'tor init the QAction
11 */ 11 */
12PanPopup::PanPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() { 12PanPopup::PanPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() {
13 13
14 qWarning("PanPopup c'tor"); 14 qWarning("PanPopup c'tor");
15 15
16 m_item = item; 16 m_item = item;
17 m_panconnect = 0l; 17 QAction *a, *b, *c;
18 QAction *a, *b;
19 18
19 m_panconnection = 0l;
20 /* connect action */ 20 /* connect action */
21 a = new QAction( ); // so it's get deleted 21
22 a->setText( "connect" ); 22
23 a = new QAction(); // so it's get deleted
24 a->setText( tr("connect") );
23 a->addTo( this ); 25 a->addTo( this );
24 connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) ); 26 connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) );
25 27
28
26 b = new QAction(); 29 b = new QAction();
27 b->setText( "connect+conf" ); 30 b->setText( tr( "connect+conf" ) );
28 b->addTo( this ); 31 b->addTo( this );
29 connect( b, SIGNAL( activated() ), this, SLOT( slotConnectAndConfig() ) ); 32 connect( b, SIGNAL( activated() ), this, SLOT( slotConnectAndConfig() ) );
33
34 c = new QAction();
35 c->setText( tr( "disconnect" ) );
36 c->addTo( this );
37 connect( c, SIGNAL( activated() ), this, SLOT( slotDisconnect() ) );
38
30}; 39};
31 40
32PanPopup::~PanPopup() { 41PanPopup::~PanPopup() {
33 delete m_panconnect; 42
34} 43}
35 44
36void PanPopup::slotConnect() { 45void PanPopup::slotConnect() {
37 46 m_panconnection = new StartPanConnection( m_item->mac() );
38 47 m_panconnection->start();
39 // SHOULD move to lib
40 // before pand must be in "pand --listen --role panu" mode ( client )
41
42 m_panconnect = new OProcess();
43 *m_panconnect << "pand" << "--connect" << m_item->mac();
44
45 connect( m_panconnect, SIGNAL( processExited( OProcess* ) ) ,
46 this, SLOT( slotConnectExited( OProcess* ) ) );
47 connect( m_panconnect, SIGNAL( receivedStdout( OProcess*, char*, int ) ),
48 this, SLOT( slotConnectOut( OProcess*, char*, int ) ) );
49 if (!m_panconnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) {
50 qWarning( "could not start" );
51 delete m_panconnect;
52 }
53} 48}
54 49
55void PanPopup::slotExited( OProcess* proc ) { 50void PanPopup::slotDisconnect() {
56 delete m_panconnect; 51 m_panconnection->stop();
57} 52}
58 53
59void PanPopup::slotStdOut(OProcess* proc, char* chars, int len)
60{}
61
62 54
63void PanPopup::slotConnectAndConfig() { 55void PanPopup::slotConnectAndConfig() {
64 slotConnect(); 56 slotConnect();
65 57
66 // more intelligence here later like passing the device ( bnepX ) 58 // more intelligence here later like passing the device ( bnepX )
67 QCopEnvelope e( "QPE/System", "execute(QString)" ); 59 QCopEnvelope e( "QPE/System", "execute(QString)" );
68 e << QString( "networksetup" ); 60 e << QString( "networksetup" );
69 61
70} 62}
diff --git a/noncore/net/opietooth/manager/panpopup.h b/noncore/net/opietooth/manager/panpopup.h
index 9d99f5e..1496f3a 100644
--- a/noncore/net/opietooth/manager/panpopup.h
+++ b/noncore/net/opietooth/manager/panpopup.h
@@ -1,32 +1,33 @@
1#ifndef PANPOPUP_H 1#ifndef PANPOPUP_H
2#define PANPOPUP_H 2#define PANPOPUP_H
3 3
4#include <qpopupmenu.h> 4#include <qpopupmenu.h>
5#include <qaction.h> 5#include <qaction.h>
6#include <opie/oprocess.h> 6
7#include <startpanconnection.h>
7 8
8#include "btdeviceitem.h" 9#include "btdeviceitem.h"
9 10
11
10namespace OpieTooth { 12namespace OpieTooth {
11 13
12 class PanPopup : public QPopupMenu { 14 class PanPopup : public QPopupMenu {
13 15
14 Q_OBJECT 16 Q_OBJECT
15 17
16 public: 18 public:
17 PanPopup( OpieTooth::BTDeviceItem* ); 19 PanPopup( OpieTooth::BTDeviceItem* );
18 ~PanPopup(); 20 ~PanPopup();
19 21
20 private: 22 private:
21 QAction* m_push; 23 QAction* m_push;
22 OProcess* m_panconnect; 24 OpieTooth::StartPanConnection* m_panconnection;
23 OpieTooth::BTDeviceItem *m_item; 25 OpieTooth::BTDeviceItem *m_item;
24 private slots: 26 private slots:
25 void slotConnect(); 27 void slotConnect();
28 void slotDisconnect();
26 void slotConnectAndConfig(); 29 void slotConnectAndConfig();
27 void slotExited( OProcess* proc ); 30 };
28 void slotStdOut( OProcess* proc, char* chars, int len );
29 };
30}; 31};
31 32
32#endif 33#endif