summaryrefslogtreecommitdiff
authorwimpie <wimpie>2004-04-07 01:06:27 (UTC)
committer wimpie <wimpie>2004-04-07 01:06:27 (UTC)
commit453109d9dafc25fdaf82197ef8a3f4e34c9272af (patch) (unidiff)
treebc8fe8e54f52425e6b478be69b979f0a8ab910f5
parent88b862c2356a7e75136282524b6856f1fcd10066 (diff)
downloadopie-453109d9dafc25fdaf82197ef8a3f4e34c9272af.zip
opie-453109d9dafc25fdaf82197ef8a3f4e34c9272af.tar.gz
opie-453109d9dafc25fdaf82197ef8a3f4e34c9272af.tar.bz2
Added some odebug includes and namespaces refs
opiepim links with opiedb2 -> needs depend in config.in qlibrary_unix -> print dlopen errors ALWAYS not only indebug BTmanager.pro needs opieui2
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/config.in2
-rw-r--r--library/qlibrary_unix.cpp4
-rw-r--r--noncore/net/opietooth/applet/bluezapplet.cpp1
-rw-r--r--noncore/net/opietooth/lib/startdunconnection.cpp1
-rw-r--r--noncore/net/opietooth/lib/startpanconnection.cpp2
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp2
-rw-r--r--noncore/net/opietooth/manager/config.in2
-rw-r--r--noncore/net/opietooth/manager/devicehandler.cpp2
-rw-r--r--noncore/net/opietooth/manager/dunpopup.cpp2
-rw-r--r--noncore/net/opietooth/manager/hciconfwrapper.cpp3
-rw-r--r--noncore/net/opietooth/manager/manager.pro2
-rw-r--r--noncore/net/opietooth/manager/obexdialog.cpp2
-rw-r--r--noncore/net/opietooth/manager/obexpopup.cpp2
-rw-r--r--noncore/net/opietooth/manager/panpopup.cpp2
-rw-r--r--noncore/net/opietooth/manager/pppdialog.cpp2
-rw-r--r--noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp2
-rw-r--r--noncore/net/opietooth/manager/rfcommconfhandler.cpp2
-rw-r--r--noncore/net/opietooth/manager/rfcpopup.cpp2
-rw-r--r--noncore/net/opietooth/manager/scandialog.cpp3
19 files changed, 34 insertions, 6 deletions
diff --git a/libopie2/opiepim/config.in b/libopie2/opiepim/config.in
index 33ef9b2..8ac8ad6 100644
--- a/libopie2/opiepim/config.in
+++ b/libopie2/opiepim/config.in
@@ -1,21 +1,21 @@
1 config LIBOPIE2PIM 1 config LIBOPIE2PIM
2 boolean "libopie2pim (pim related classes)" 2 boolean "libopie2pim (pim related classes)"
3 default "y" 3 default "y"
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIEDB2
5 comment "libopie2pim needs a libqpe and libopie2core" 5 comment "libopie2pim needs a libqpe and libopie2core"
6 depends !(( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE ) 6 depends !(( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE )
7 7
8 config SQL_PIM_BACKEND 8 config SQL_PIM_BACKEND
9 boolean "Enable SQL Backend for libopie2pim" 9 boolean "Enable SQL Backend for libopie2pim"
10 default n 10 default n
11 help 11 help
12 This adds the SQL-Support, using SQLite. Which database is used 12 This adds the SQL-Support, using SQLite. Which database is used
13 by the backends is defined by the file "pimaccess.conf" in the 13 by the backends is defined by the file "pimaccess.conf" in the
14 directory "Settings". 14 directory "Settings".
15 There currently do exist to groups "[contact]" and "[todo]". You can 15 There currently do exist to groups "[contact]" and "[todo]". You can
16 select the used backend by the variable "usebackend=<type>", where 16 select the used backend by the variable "usebackend=<type>", where
17 <type> is "sql" or "xml". "xml" is the default ! 17 <type> is "sql" or "xml". "xml" is the default !
18 Important: The SQLite-library "libsqlite.so" must be installed ! 18 Important: The SQLite-library "libsqlite.so" must be installed !
19 depends ( LIBOPIE2DB ) 19 depends ( LIBOPIE2DB )
20 comment "SQL-Support needs libopie2db (and libsqlite)" 20 comment "SQL-Support needs libopie2db (and libsqlite)"
21 depends !( LIBOPIE2DB ) 21 depends !( LIBOPIE2DB )
diff --git a/library/qlibrary_unix.cpp b/library/qlibrary_unix.cpp
index ff69286..2181153 100644
--- a/library/qlibrary_unix.cpp
+++ b/library/qlibrary_unix.cpp
@@ -10,234 +10,234 @@
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "qlibrary_p.h" 21#include "qlibrary_p.h"
22 22
23#ifndef QT_NO_COMPONENT 23#ifndef QT_NO_COMPONENT
24 24
25/* 25/*
26 The platform dependent implementations of 26 The platform dependent implementations of
27 - loadLibrary 27 - loadLibrary
28 - freeLibrary 28 - freeLibrary
29 - resolveSymbol 29 - resolveSymbol
30 30
31 It's not too hard to guess what the functions do. 31 It's not too hard to guess what the functions do.
32*/ 32*/
33#if defined(Q_OS_HPUX) 33#if defined(Q_OS_HPUX)
34// for HP-UX < 11.x and 32 bit 34// for HP-UX < 11.x and 32 bit
35#include <dl.h> 35#include <dl.h>
36 36
37bool QLibraryPrivate::loadLibrary() 37bool QLibraryPrivate::loadLibrary()
38{ 38{
39 if ( pHnd ) 39 if ( pHnd )
40 return TRUE; 40 return TRUE;
41 41
42 QString filename = library->library(); 42 QString filename = library->library();
43 43
44 pHnd = (void*)shl_load( filename.latin1(), BIND_DEFERRED | BIND_NONFATAL | DYNAMIC_PATH, 0 ); 44 pHnd = (void*)shl_load( filename.latin1(), BIND_DEFERRED | BIND_NONFATAL | DYNAMIC_PATH, 0 );
45#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) 45#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT)
46 if ( !pHnd ) 46 if ( !pHnd )
47 qDebug( "Failed to load library %s!", filename.latin1() ); 47 qDebug( "Failed to load library %s!", filename.latin1() );
48#endif 48#endif
49 return pHnd != 0; 49 return pHnd != 0;
50} 50}
51 51
52bool QLibraryPrivate::freeLibrary() 52bool QLibraryPrivate::freeLibrary()
53{ 53{
54 if ( !pHnd ) 54 if ( !pHnd )
55 return TRUE; 55 return TRUE;
56 56
57 if ( !shl_unload( (shl_t)pHnd ) ) { 57 if ( !shl_unload( (shl_t)pHnd ) ) {
58 pHnd = 0; 58 pHnd = 0;
59 return TRUE; 59 return TRUE;
60 } 60 }
61 return FALSE; 61 return FALSE;
62} 62}
63 63
64void* QLibraryPrivate::resolveSymbol( const char* symbol ) 64void* QLibraryPrivate::resolveSymbol( const char* symbol )
65{ 65{
66 if ( !pHnd ) 66 if ( !pHnd )
67 return 0; 67 return 0;
68 68
69 void* address = 0; 69 void* address = 0;
70 if ( shl_findsym( (shl_t*)&pHnd, symbol, TYPE_UNDEFINED, address ) < 0 ) { 70 if ( shl_findsym( (shl_t*)&pHnd, symbol, TYPE_UNDEFINED, address ) < 0 ) {
71#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) 71#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT)
72 qDebug( "Couldn't resolve symbol \"%s\"", symbol ); 72 qDebug( "Couldn't resolve symbol \"%s\"", symbol );
73#endif 73#endif
74 return 0; 74 return 0;
75 } 75 }
76 return address; 76 return address;
77} 77}
78 78
79#elif defined(_NULL_LIB_) 79#elif defined(_NULL_LIB_)
80 80
81bool QLibraryPrivate::loadLibrary() 81bool QLibraryPrivate::loadLibrary()
82{ 82{
83 //qDebug("QLibraryPrivate::loadLibrary\n"); 83 //qDebug("QLibraryPrivate::loadLibrary\n");
84 return FALSE; 84 return FALSE;
85} 85}
86bool QLibraryPrivate::freeLibrary() 86bool QLibraryPrivate::freeLibrary()
87{ 87{
88 //qDebug("QLibraryPrivate::freeLibrary\n"); 88 //qDebug("QLibraryPrivate::freeLibrary\n");
89 return FALSE; 89 return FALSE;
90} 90}
91void* QLibraryPrivate::resolveSymbol( const char* symbol ) 91void* QLibraryPrivate::resolveSymbol( const char* symbol )
92{ 92{
93 //qDebug("QLibraryPrivate::resolveSymbol\n"); 93 //qDebug("QLibraryPrivate::resolveSymbol\n");
94 return FALSE; 94 return FALSE;
95} 95}
96 96
97#elif defined(Q_OS_MACX) 97#elif defined(Q_OS_MACX)
98 98
99#define ENUM_DYLD_BOOL 99#define ENUM_DYLD_BOOL
100enum DYLD_BOOL { 100enum DYLD_BOOL {
101 DYLD_FALSE, 101 DYLD_FALSE,
102 DYLD_TRUE 102 DYLD_TRUE
103}; 103};
104#include <mach-o/dyld.h> 104#include <mach-o/dyld.h>
105typedef struct { 105typedef struct {
106 NSObjectFileImage img; 106 NSObjectFileImage img;
107 NSModule mod; 107 NSModule mod;
108} DyldLibDesc; 108} DyldLibDesc;
109 109
110bool QLibraryPrivate::loadLibrary() 110bool QLibraryPrivate::loadLibrary()
111{ 111{
112 // qDebug("QLibraryPrivate::loadLibrary\n"); 112 // qDebug("QLibraryPrivate::loadLibrary\n");
113 // return FALSE; 113 // return FALSE;
114 if ( pHnd ) 114 if ( pHnd )
115 return TRUE; 115 return TRUE;
116 116
117 QString filename = library->library(); 117 QString filename = library->library();
118 118
119 NSObjectFileImage img = 0; 119 NSObjectFileImage img = 0;
120 NSModule mod = 0; 120 NSModule mod = 0;
121 NSObjectFileImageReturnCode ret = NSCreateObjectFileImageFromFile( filename.latin1() , &img ); 121 NSObjectFileImageReturnCode ret = NSCreateObjectFileImageFromFile( filename.latin1() , &img );
122 if ( ret != NSObjectFileImageSuccess ) { 122 if ( ret != NSObjectFileImageSuccess ) {
123 qWarning( "Error in NSCreateObjectFileImageFromFile(): %d; Filename: %s", ret, filename.latin1() ); 123 qWarning( "Error in NSCreateObjectFileImageFromFile(): %d; Filename: %s", ret, filename.latin1() );
124 if (ret == NSObjectFileImageAccess) { 124 if (ret == NSObjectFileImageAccess) {
125 qWarning ("(NSObjectFileImageAccess)" ); 125 qWarning ("(NSObjectFileImageAccess)" );
126 } 126 }
127 } else { 127 } else {
128 mod = NSLinkModule(img, filename.latin1(), NSLINKMODULE_OPTION_BINDNOW | 128 mod = NSLinkModule(img, filename.latin1(), NSLINKMODULE_OPTION_BINDNOW |
129 NSLINKMODULE_OPTION_PRIVATE | 129 NSLINKMODULE_OPTION_PRIVATE |
130 NSLINKMODULE_OPTION_RETURN_ON_ERROR); 130 NSLINKMODULE_OPTION_RETURN_ON_ERROR);
131 if (mod == 0) { 131 if (mod == 0) {
132 qWarning( "Error in NSLinkModule()" ); 132 qWarning( "Error in NSLinkModule()" );
133 NSDestroyObjectFileImage(img); 133 NSDestroyObjectFileImage(img);
134 } 134 }
135 } 135 }
136 DyldLibDesc* desc = 0; 136 DyldLibDesc* desc = 0;
137 if (img != 0 && mod != 0) { 137 if (img != 0 && mod != 0) {
138 desc = new DyldLibDesc; 138 desc = new DyldLibDesc;
139 desc->img = img; 139 desc->img = img;
140 desc->mod = mod; 140 desc->mod = mod;
141 } 141 }
142 pHnd = desc; 142 pHnd = desc;
143 return pHnd != 0; 143 return pHnd != 0;
144} 144}
145 145
146bool QLibraryPrivate::freeLibrary() 146bool QLibraryPrivate::freeLibrary()
147{ 147{
148 //qDebug("QLibraryPrivate::freeLibrary\n"); 148 //qDebug("QLibraryPrivate::freeLibrary\n");
149 //return FALSE; 149 //return FALSE;
150 if ( !pHnd ) 150 if ( !pHnd )
151 return TRUE; 151 return TRUE;
152 152
153 DyldLibDesc* desc = (DyldLibDesc*) pHnd; 153 DyldLibDesc* desc = (DyldLibDesc*) pHnd;
154 NSModule mod = desc->mod; 154 NSModule mod = desc->mod;
155 NSObjectFileImage img = desc->img; 155 NSObjectFileImage img = desc->img;
156 DYLD_BOOL success = NSUnLinkModule(mod, NSUNLINKMODULE_OPTION_NONE); 156 DYLD_BOOL success = NSUnLinkModule(mod, NSUNLINKMODULE_OPTION_NONE);
157 if ( success ) { 157 if ( success ) {
158 NSDestroyObjectFileImage(img); 158 NSDestroyObjectFileImage(img);
159 delete desc; 159 delete desc;
160 pHnd = 0; 160 pHnd = 0;
161 } 161 }
162#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) 162#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT)
163 else { 163 else {
164 qWarning( "Error in NSUnLinkModule()" ); 164 qWarning( "Error in NSUnLinkModule()" );
165 } 165 }
166#endif 166#endif
167 return pHnd == 0; 167 return pHnd == 0;
168} 168}
169 169
170void* QLibraryPrivate::resolveSymbol( const char* symbol ) 170void* QLibraryPrivate::resolveSymbol( const char* symbol )
171{ 171{
172 //qDebug("QLibraryPrivate::resolveSymbol\n"); 172 //qDebug("QLibraryPrivate::resolveSymbol\n");
173 //return FALSE; 173 //return FALSE;
174 if ( !pHnd ) 174 if ( !pHnd )
175 return 0; 175 return 0;
176 176
177 DyldLibDesc* desc = (DyldLibDesc*) pHnd; 177 DyldLibDesc* desc = (DyldLibDesc*) pHnd;
178 NSSymbol sym = NSLookupSymbolInModule(desc->mod, symbol); 178 NSSymbol sym = NSLookupSymbolInModule(desc->mod, symbol);
179 void* address = 0; 179 void* address = 0;
180 if (sym != 0) { 180 if (sym != 0) {
181 address = NSAddressOfSymbol(sym); 181 address = NSAddressOfSymbol(sym);
182 } 182 }
183#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) 183#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT)
184 if ( address == 0 ) 184 if ( address == 0 )
185 qWarning( "Cannot find symbol: %s", symbol ); 185 qWarning( "Cannot find symbol: %s", symbol );
186#endif 186#endif
187 return address; 187 return address;
188} 188}
189 189
190#else 190#else
191// Something else, assuming POSIX 191// Something else, assuming POSIX
192#include <dlfcn.h> 192#include <dlfcn.h>
193 193
194bool QLibraryPrivate::loadLibrary() 194bool QLibraryPrivate::loadLibrary()
195{ 195{
196 if ( pHnd ) 196 if ( pHnd )
197 return TRUE; 197 return TRUE;
198 198
199 QString filename = library->library(); 199 QString filename = library->library();
200 200
201 pHnd = dlopen( filename.latin1() , RTLD_LAZY ); 201 pHnd = dlopen( filename.latin1() , RTLD_LAZY );
202#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) 202// #if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT)
203 if ( !pHnd ) 203 if ( !pHnd )
204 qWarning( "%s", dlerror() ); 204 qWarning( "%s", dlerror() );
205#endif 205// #endif
206 return pHnd != 0; 206 return pHnd != 0;
207} 207}
208 208
209bool QLibraryPrivate::freeLibrary() 209bool QLibraryPrivate::freeLibrary()
210{ 210{
211 if ( !pHnd ) 211 if ( !pHnd )
212 return TRUE; 212 return TRUE;
213 213
214 int ec = dlclose( pHnd ); 214 int ec = dlclose( pHnd );
215 if ( !ec ) 215 if ( !ec )
216 pHnd = 0; 216 pHnd = 0;
217#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) 217#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT)
218 else { 218 else {
219 const char* error = dlerror(); 219 const char* error = dlerror();
220 if ( error ) 220 if ( error )
221 qWarning( "%s", error ); 221 qWarning( "%s", error );
222 } 222 }
223#endif 223#endif
224 return pHnd == 0; 224 return pHnd == 0;
225} 225}
226 226
227void* QLibraryPrivate::resolveSymbol( const char* f ) 227void* QLibraryPrivate::resolveSymbol( const char* f )
228{ 228{
229 if ( !pHnd ) 229 if ( !pHnd )
230 return 0; 230 return 0;
231 231
232 void* address = dlsym( pHnd, f ); 232 void* address = dlsym( pHnd, f );
233#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) 233#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT)
234 const char* error = dlerror(); 234 const char* error = dlerror();
235 if ( error ) 235 if ( error )
236 qWarning( "%s", error ); 236 qWarning( "%s", error );
237#endif 237#endif
238 return address; 238 return address;
239} 239}
240 240
241#endif // POSIX 241#endif // POSIX
242 242
243#endif // QT_NO_COMPONENT 243#endif // QT_NO_COMPONENT
diff --git a/noncore/net/opietooth/applet/bluezapplet.cpp b/noncore/net/opietooth/applet/bluezapplet.cpp
index 1d93f5c..66e8f01 100644
--- a/noncore/net/opietooth/applet/bluezapplet.cpp
+++ b/noncore/net/opietooth/applet/bluezapplet.cpp
@@ -1,221 +1,222 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 Maximilian Reiss <max.reiss@gmx.de> 3             .=l. Copyright (c) 2002 Maximilian Reiss <max.reiss@gmx.de>
4           .>+-= 4           .>+-=
5 _;:,     .>    :=|. This library is free software; you can 5 _;:,     .>    :=|. This library is free software; you can
6.> <,   >  .   <= redistribute it and/or modify it under 6.> <,   >  .   <= redistribute it and/or modify it under
7:=1 )Y*s>-.--   : the terms of the GNU Library General Public 7:=1 )Y*s>-.--   : the terms of the GNU Library General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%+i>       _;_. 11    .%+i>       _;_.
12    .i_,=:_.      -<s. This library is distributed in the hope that 12    .i_,=:_.      -<s. This library is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=| MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=| MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>: PARTICULAR PURPOSE. See the GNU 16  _.=:.       :    :=>: PARTICULAR PURPOSE. See the GNU
17..}^=.=       =       ; Library General Public License for more 17..}^=.=       =       ; Library General Public License for more
18++=   -.     .     .: details. 18++=   -.     .     .: details.
19 :     =  ...= . :.=- 19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU 20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = Library General Public License along with 21  -_. . .   )=.  = Library General Public License along with
22    --        :-= this library; see the file COPYING.LIB. 22    --        :-= this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29 29
30#include "bluezapplet.h" 30#include "bluezapplet.h"
31#include <qapplication.h> 31#include <qapplication.h>
32 32
33#include <qpe/qcopenvelope_qws.h> 33#include <qpe/qcopenvelope_qws.h>
34#include <qpe/config.h> 34#include <qpe/config.h>
35#include <qpe/resource.h> 35#include <qpe/resource.h>
36 36
37#include <opie2/odevice.h> 37#include <opie2/odevice.h>
38#include <opie2/odebug.h>
38 39
39#include <qpoint.h> 40#include <qpoint.h>
40#include <qpainter.h> 41#include <qpainter.h>
41#include <qlayout.h> 42#include <qlayout.h>
42#include <qframe.h> 43#include <qframe.h>
43#include <qpixmap.h> 44#include <qpixmap.h>
44#include <qstring.h> 45#include <qstring.h>
45#include <qtimer.h> 46#include <qtimer.h>
46#include <qpopupmenu.h> 47#include <qpopupmenu.h>
47 48
48#include <device.h> 49#include <device.h>
49 50
50using namespace Opie::Core; 51using namespace Opie::Core;
51 52
52namespace OpieTooth { 53namespace OpieTooth {
53 54
54 BluezApplet::BluezApplet( QWidget *parent, const char *name ) : QWidget( parent, name ) { 55 BluezApplet::BluezApplet( QWidget *parent, const char *name ) : QWidget( parent, name ) {
55 setFixedHeight( 18 ); 56 setFixedHeight( 18 );
56 setFixedWidth( 14 ); 57 setFixedWidth( 14 );
57 bluezOnPixmap = Resource::loadPixmap( "bluetoothapplet/bluezon" ); 58 bluezOnPixmap = Resource::loadPixmap( "bluetoothapplet/bluezon" );
58 bluezOffPixmap = Resource::loadPixmap( "bluetoothapplet/bluezoff" ); 59 bluezOffPixmap = Resource::loadPixmap( "bluetoothapplet/bluezoff" );
59 // bluezDiscoveryOnPixmap = Resource::loadPixmap( "bluetoothapplet/magglass" ); 60 // bluezDiscoveryOnPixmap = Resource::loadPixmap( "bluetoothapplet/magglass" );
60 startTimer(4000); 61 startTimer(4000);
61 btDevice = 0; 62 btDevice = 0;
62 bluezactive = false; 63 bluezactive = false;
63 bluezDiscoveryActive = false; 64 bluezDiscoveryActive = false;
64 65
65 } 66 }
66 67
67 BluezApplet::~BluezApplet() { 68 BluezApplet::~BluezApplet() {
68 if ( btDevice ) { 69 if ( btDevice ) {
69 delete btDevice; 70 delete btDevice;
70 } 71 }
71 } 72 }
72 73
73 bool BluezApplet::checkBluezStatus() { 74 bool BluezApplet::checkBluezStatus() {
74 if (btDevice) { 75 if (btDevice) {
75 if (btDevice->isLoaded() ) { 76 if (btDevice->isLoaded() ) {
76 return true; 77 return true;
77 } else { 78 } else {
78 return false; 79 return false;
79 } 80 }
80 } else { 81 } else {
81 return false; 82 return false;
82 } 83 }
83 } 84 }
84 85
85 int BluezApplet::setBluezStatus(int c) { 86 int BluezApplet::setBluezStatus(int c) {
86 87
87 if ( c == 1 ) { 88 if ( c == 1 ) {
88 switch ( ODevice::inst()->model() ) { 89 switch ( ODevice::inst()->model() ) {
89 case Model_iPAQ_H39xx: 90 case Model_iPAQ_H39xx:
90 btDevice = new Device( "/dev/tts/1", "bcsp", "921600" ); 91 btDevice = new Device( "/dev/tts/1", "bcsp", "921600" );
91 break; 92 break;
92 93
93 case Model_iPAQ_H5xxx: 94 case Model_iPAQ_H5xxx:
94 btDevice = new Device( "/dev/tts/1", "any", "921600" ); 95 btDevice = new Device( "/dev/tts/1", "any", "921600" );
95 break; 96 break;
96 97
97 default: 98 default:
98 btDevice = new Device( "/dev/ttySB0", "bcsp", "230400" ); 99 btDevice = new Device( "/dev/ttySB0", "bcsp", "230400" );
99 break; 100 break;
100 } 101 }
101 } else { 102 } else {
102 if ( btDevice ) { 103 if ( btDevice ) {
103 delete btDevice; 104 delete btDevice;
104 btDevice = 0; 105 btDevice = 0;
105 } 106 }
106 } 107 }
107 return 0; 108 return 0;
108 } 109 }
109 110
110 int BluezApplet::checkBluezDiscoveryStatus() { 111 int BluezApplet::checkBluezDiscoveryStatus() {
111 } 112 }
112 113
113 int BluezApplet::setBluezDiscoveryStatus(int d) { 114 int BluezApplet::setBluezDiscoveryStatus(int d) {
114 } 115 }
115 116
116 void BluezApplet::mousePressEvent( QMouseEvent *) { 117 void BluezApplet::mousePressEvent( QMouseEvent *) {
117 118
118 QPopupMenu *menu = new QPopupMenu(); 119 QPopupMenu *menu = new QPopupMenu();
119 QPopupMenu *signal = new QPopupMenu(); 120 QPopupMenu *signal = new QPopupMenu();
120 int ret=0; 121 int ret=0;
121 122
122 /* Refresh active state */ 123 /* Refresh active state */
123 timerEvent( 0 ); 124 timerEvent( 0 );
124 125
125 126
126 if (bluezactive) { 127 if (bluezactive) {
127 menu->insertItem( tr("Disable Bluetooth"), 0 ); 128 menu->insertItem( tr("Disable Bluetooth"), 0 );
128 } else { 129 } else {
129 menu->insertItem( tr("Enable Bluetooth"), 1 ); 130 menu->insertItem( tr("Enable Bluetooth"), 1 );
130 } 131 }
131 132
132 menu->insertItem( tr("Launch manager"), 2 ); 133 menu->insertItem( tr("Launch manager"), 2 );
133 134
134 menu->insertSeparator(6); 135 menu->insertSeparator(6);
135 //menu->insertItem( tr("Signal strength"), signal, 5); 136 //menu->insertItem( tr("Signal strength"), signal, 5);
136 //menu->insertSeparator(8); 137 //menu->insertSeparator(8);
137 138
138 if (bluezDiscoveryActive) { 139 if (bluezDiscoveryActive) {
139 menu->insertItem( tr("Disable discovery"), 3 ); 140 menu->insertItem( tr("Disable discovery"), 3 );
140 } else { 141 } else {
141 menu->insertItem( tr("Enable discovery"), 4 ); 142 menu->insertItem( tr("Enable discovery"), 4 );
142 } 143 }
143 144
144 145
145 QPoint p = mapToGlobal( QPoint(1, -menu->sizeHint().height()-1) ); 146 QPoint p = mapToGlobal( QPoint(1, -menu->sizeHint().height()-1) );
146 ret = menu->exec(p, 0); 147 ret = menu->exec(p, 0);
147 148
148 switch(ret) { 149 switch(ret) {
149 case 0: 150 case 0:
150 setBluezStatus(0); 151 setBluezStatus(0);
151 timerEvent( 0 ); 152 timerEvent( 0 );
152 break; 153 break;
153 case 1: 154 case 1:
154 setBluezStatus(1); 155 setBluezStatus(1);
155 timerEvent( 0 ); 156 timerEvent( 0 );
156 break; 157 break;
157 case 2: 158 case 2:
158 // start bluetoothmanager 159 // start bluetoothmanager
159 launchManager(); 160 launchManager();
160 timerEvent( 0 ); 161 timerEvent( 0 );
161 break; 162 break;
162 case 3: 163 case 3:
163 setBluezDiscoveryStatus(0); 164 setBluezDiscoveryStatus(0);
164 timerEvent( 0 ); 165 timerEvent( 0 );
165 break; 166 break;
166 case 4: 167 case 4:
167 setBluezDiscoveryStatus(1); 168 setBluezDiscoveryStatus(1);
168 timerEvent(0 ); 169 timerEvent(0 );
169 break; 170 break;
170 //case 7: 171 //case 7:
171 // With table of currently-detected devices. 172 // With table of currently-detected devices.
172 } 173 }
173 174
174 delete signal; 175 delete signal;
175 delete menu; 176 delete menu;
176 } 177 }
177 178
178 179
179/** 180/**
180 * Launches the bluetooth manager 181 * Launches the bluetooth manager
181 */ 182 */
182 void BluezApplet::launchManager() { 183 void BluezApplet::launchManager() {
183 QCopEnvelope e("QPE/System", "execute(QString)"); 184 QCopEnvelope e("QPE/System", "execute(QString)");
184 e << QString("bluetooth-manager"); 185 e << QString("bluetooth-manager");
185 } 186 }
186 187
187/** 188/**
188 * Refresh timer 189 * Refresh timer
189 * @param the timer event 190 * @param the timer event
190 */ 191 */
191 void BluezApplet::timerEvent( QTimerEvent * ) { 192 void BluezApplet::timerEvent( QTimerEvent * ) {
192 bool oldactive = bluezactive; 193 bool oldactive = bluezactive;
193 int olddiscovery = bluezDiscoveryActive; 194 int olddiscovery = bluezDiscoveryActive;
194 195
195 bluezactive = checkBluezStatus(); 196 bluezactive = checkBluezStatus();
196 bluezDiscoveryActive = checkBluezDiscoveryStatus(); 197 bluezDiscoveryActive = checkBluezDiscoveryStatus();
197 198
198 if ((bluezactive != oldactive) || (bluezDiscoveryActive != olddiscovery)) { 199 if ((bluezactive != oldactive) || (bluezDiscoveryActive != olddiscovery)) {
199 update(); 200 update();
200 } 201 }
201 } 202 }
202 203
203/** 204/**
204 * Implementation of the paint event 205 * Implementation of the paint event
205 * @param the QPaintEvent 206 * @param the QPaintEvent
206 */ 207 */
207 void BluezApplet::paintEvent( QPaintEvent* ) { 208 void BluezApplet::paintEvent( QPaintEvent* ) {
208 QPainter p(this); 209 QPainter p(this);
209 odebug << "paint bluetooth pixmap" << oendl; 210 odebug << "paint bluetooth pixmap" << oendl;
210 211
211 if (bluezactive > 0) { 212 if (bluezactive > 0) {
212 p.drawPixmap( 0, 1, bluezOnPixmap ); 213 p.drawPixmap( 0, 1, bluezOnPixmap );
213 } else { 214 } else {
214 p.drawPixmap( 0, 1, bluezOffPixmap ); 215 p.drawPixmap( 0, 1, bluezOffPixmap );
215 } 216 }
216 217
217 if (bluezDiscoveryActive > 0) { 218 if (bluezDiscoveryActive > 0) {
218 p.drawPixmap( 0, 1, bluezDiscoveryOnPixmap ); 219 p.drawPixmap( 0, 1, bluezDiscoveryOnPixmap );
219 } 220 }
220 } 221 }
221}; 222};
diff --git a/noncore/net/opietooth/lib/startdunconnection.cpp b/noncore/net/opietooth/lib/startdunconnection.cpp
index 37f2ae7..2d23b3a 100644
--- a/noncore/net/opietooth/lib/startdunconnection.cpp
+++ b/noncore/net/opietooth/lib/startdunconnection.cpp
@@ -1,68 +1,69 @@
1#include <opie2/odebug.h>
1 2
2#include "startdunconnection.h" 3#include "startdunconnection.h"
3 4
4using namespace OpieTooth; 5using namespace OpieTooth;
5 6
6 7
7using namespace Opie::Core; 8using namespace Opie::Core;
8StartDunConnection::StartDunConnection() { 9StartDunConnection::StartDunConnection() {
9 m_dunConnect = 0l; 10 m_dunConnect = 0l;
10 setConnectionType(); 11 setConnectionType();
11} 12}
12 13
13StartDunConnection::~StartDunConnection() { 14StartDunConnection::~StartDunConnection() {
14 delete m_dunConnect; 15 delete m_dunConnect;
15} 16}
16 17
17StartDunConnection::StartDunConnection( QString mac ) { 18StartDunConnection::StartDunConnection( QString mac ) {
18 m_dunConnect = 0l; 19 m_dunConnect = 0l;
19 m_mac = mac; 20 m_mac = mac;
20 setConnectionType(); 21 setConnectionType();
21} 22}
22 23
23void StartDunConnection::setName( QString name ) { 24void StartDunConnection::setName( QString name ) {
24 m_name = name; 25 m_name = name;
25} 26}
26 27
27QString StartDunConnection::name() { 28QString StartDunConnection::name() {
28 return m_name; 29 return m_name;
29} 30}
30 31
31void StartDunConnection::setConnectionType() { 32void StartDunConnection::setConnectionType() {
32 m_connectionType = Pan; 33 m_connectionType = Pan;
33} 34}
34 35
35StartConnection::ConnectionType StartDunConnection::type() { 36StartConnection::ConnectionType StartDunConnection::type() {
36 return m_connectionType; 37 return m_connectionType;
37} 38}
38 39
39void StartDunConnection::start() { 40void StartDunConnection::start() {
40 m_dunConnect = new OProcess(); 41 m_dunConnect = new OProcess();
41 *m_dunConnect << "dund" << "--listen" << "--connect" << m_mac; 42 *m_dunConnect << "dund" << "--listen" << "--connect" << m_mac;
42 43
43 connect( m_dunConnect, SIGNAL( processExited(Opie::Core::OProcess*) ) , 44 connect( m_dunConnect, SIGNAL( processExited(Opie::Core::OProcess*) ) ,
44 this, SLOT( slotExited(Opie::Core::OProcess*) ) ); 45 this, SLOT( slotExited(Opie::Core::OProcess*) ) );
45 connect( m_dunConnect, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ), 46 connect( m_dunConnect, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ),
46 this, SLOT( slotStdOut(Opie::Core::OProcess*,char*,int) ) ); 47 this, SLOT( slotStdOut(Opie::Core::OProcess*,char*,int) ) );
47 if (!m_dunConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { 48 if (!m_dunConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) {
48 owarn << "could not start" << oendl; 49 owarn << "could not start" << oendl;
49 delete m_dunConnect; 50 delete m_dunConnect;
50 } 51 }
51} 52}
52 53
53 54
54void StartDunConnection::slotExited( OProcess* proc ) { 55void StartDunConnection::slotExited( OProcess* proc ) {
55 delete m_dunConnect; 56 delete m_dunConnect;
56} 57}
57 58
58void StartDunConnection::slotStdOut(OProcess* proc, char* chars, int len) 59void StartDunConnection::slotStdOut(OProcess* proc, char* chars, int len)
59{} 60{}
60 61
61 62
62void StartDunConnection::stop() { 63void StartDunConnection::stop() {
63 if ( m_dunConnect ) { 64 if ( m_dunConnect ) {
64 delete m_dunConnect; 65 delete m_dunConnect;
65 m_dunConnect = 0l; 66 m_dunConnect = 0l;
66 } 67 }
67} 68}
68 69
diff --git a/noncore/net/opietooth/lib/startpanconnection.cpp b/noncore/net/opietooth/lib/startpanconnection.cpp
index 50afc9f..29b95e9 100644
--- a/noncore/net/opietooth/lib/startpanconnection.cpp
+++ b/noncore/net/opietooth/lib/startpanconnection.cpp
@@ -1,84 +1,84 @@
1 1#include <opie2/odebug.h>
2#include "startpanconnection.h" 2#include "startpanconnection.h"
3 3
4using namespace OpieTooth; 4using namespace OpieTooth;
5 5
6 6
7using namespace Opie::Core; 7using namespace Opie::Core;
8using namespace Opie::Core; 8using namespace Opie::Core;
9StartPanConnection::StartPanConnection() { 9StartPanConnection::StartPanConnection() {
10 m_panConnect = 0l; 10 m_panConnect = 0l;
11 setConnectionType(); 11 setConnectionType();
12} 12}
13 13
14StartPanConnection::~StartPanConnection() { 14StartPanConnection::~StartPanConnection() {
15 delete m_panConnect; 15 delete m_panConnect;
16} 16}
17 17
18StartPanConnection::StartPanConnection( QString mac ) { 18StartPanConnection::StartPanConnection( QString mac ) {
19 m_panConnect = 0l; 19 m_panConnect = 0l;
20 m_mac = mac; 20 m_mac = mac;
21 setConnectionType(); 21 setConnectionType();
22} 22}
23 23
24void StartPanConnection::setName( QString name ) { 24void StartPanConnection::setName( QString name ) {
25 m_name = name; 25 m_name = name;
26} 26}
27 27
28QString StartPanConnection::name() { 28QString StartPanConnection::name() {
29 return m_name; 29 return m_name;
30} 30}
31 31
32void StartPanConnection::setConnectionType() { 32void StartPanConnection::setConnectionType() {
33 m_connectionType = Pan; 33 m_connectionType = Pan;
34} 34}
35 35
36StartConnection::ConnectionType StartPanConnection::type() { 36StartConnection::ConnectionType StartPanConnection::type() {
37 return m_connectionType; 37 return m_connectionType;
38} 38}
39 39
40void StartPanConnection::start() { 40void StartPanConnection::start() {
41 m_panConnect = new OProcess(); 41 m_panConnect = new OProcess();
42 odebug << "IM START " + m_mac << oendl; 42 odebug << "IM START " + m_mac << oendl;
43 *m_panConnect << "pand" << "--connect" << m_mac; 43 *m_panConnect << "pand" << "--connect" << m_mac;
44 44
45 connect( m_panConnect, SIGNAL( processExited(Opie::Core::OProcess*) ) , 45 connect( m_panConnect, SIGNAL( processExited(Opie::Core::OProcess*) ) ,
46 this, SLOT( slotExited(Opie::Core::OProcess*) ) ); 46 this, SLOT( slotExited(Opie::Core::OProcess*) ) );
47 connect( m_panConnect, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ), 47 connect( m_panConnect, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ),
48 this, SLOT( slotStdOut(Opie::Core::OProcess*,char*,int) ) ); 48 this, SLOT( slotStdOut(Opie::Core::OProcess*,char*,int) ) );
49 if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { 49 if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) {
50 owarn << "could not start" << oendl; 50 owarn << "could not start" << oendl;
51 delete m_panConnect; 51 delete m_panConnect;
52 } 52 }
53} 53}
54 54
55 55
56void StartPanConnection::slotExited( OProcess* proc ) { 56void StartPanConnection::slotExited( OProcess* proc ) {
57 delete m_panConnect; 57 delete m_panConnect;
58 m_panConnect = 0l; 58 m_panConnect = 0l;
59} 59}
60 60
61void StartPanConnection::slotStdOut(OProcess* proc, char* chars, int len) 61void StartPanConnection::slotStdOut(OProcess* proc, char* chars, int len)
62{} 62{}
63 63
64 64
65void StartPanConnection::stop() { 65void StartPanConnection::stop() {
66 if ( m_panConnect ) { 66 if ( m_panConnect ) {
67 delete m_panConnect; 67 delete m_panConnect;
68 m_panConnect = 0l; 68 m_panConnect = 0l;
69 } 69 }
70 m_panConnect = new OProcess(); 70 m_panConnect = new OProcess();
71 odebug << "IM STOP " + m_mac << oendl; 71 odebug << "IM STOP " + m_mac << oendl;
72 72
73 *m_panConnect << "pand" << "--kill" << m_mac; 73 *m_panConnect << "pand" << "--kill" << m_mac;
74 74
75 connect( m_panConnect, SIGNAL( processExited(Opie::Core::OProcess*) ) , 75 connect( m_panConnect, SIGNAL( processExited(Opie::Core::OProcess*) ) ,
76 this, SLOT( slotExited(Opie::Core::OProcess*) ) ); 76 this, SLOT( slotExited(Opie::Core::OProcess*) ) );
77 connect( m_panConnect, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ), 77 connect( m_panConnect, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ),
78 this, SLOT( slotStdOut(Opie::Core::OProcess*,char*,int) ) ); 78 this, SLOT( slotStdOut(Opie::Core::OProcess*,char*,int) ) );
79 if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { 79 if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) {
80 owarn << "could not stop" << oendl; 80 owarn << "could not stop" << oendl;
81 delete m_panConnect; 81 delete m_panConnect;
82 } 82 }
83} 83}
84 84
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp
index b1cddd2..ee01b61 100644
--- a/noncore/net/opietooth/manager/bluebase.cpp
+++ b/noncore/net/opietooth/manager/bluebase.cpp
@@ -1,220 +1,222 @@
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#include "rfcommassigndialogimpl.h" 23#include "rfcommassigndialogimpl.h"
24 24
25/* OPIE */ 25/* OPIE */
26#include <qpe/qpeapplication.h> 26#include <qpe/qpeapplication.h>
27#include <qpe/resource.h> 27#include <qpe/resource.h>
28#include <qpe/config.h> 28#include <qpe/config.h>
29#include <opie2/odebug.h>
30using namespace Opie::Core;
29 31
30/* QT */ 32/* QT */
31#include <qframe.h> 33#include <qframe.h>
32#include <qlabel.h> 34#include <qlabel.h>
33#include <qpushbutton.h> 35#include <qpushbutton.h>
34#include <qlayout.h> 36#include <qlayout.h>
35#include <qvariant.h> 37#include <qvariant.h>
36#include <qimage.h> 38#include <qimage.h>
37#include <qpixmap.h> 39#include <qpixmap.h>
38#include <qtabwidget.h> 40#include <qtabwidget.h>
39#include <qscrollview.h> 41#include <qscrollview.h>
40#include <qvbox.h> 42#include <qvbox.h>
41#include <qmessagebox.h> 43#include <qmessagebox.h>
42#include <qcheckbox.h> 44#include <qcheckbox.h>
43#include <qlineedit.h> 45#include <qlineedit.h>
44#include <qlistview.h> 46#include <qlistview.h>
45#include <qdir.h> 47#include <qdir.h>
46#include <qpopupmenu.h> 48#include <qpopupmenu.h>
47#include <qtimer.h> 49#include <qtimer.h>
48#include <qlist.h> 50#include <qlist.h>
49 51
50/* STD */ 52/* STD */
51#include <remotedevice.h> 53#include <remotedevice.h>
52#include <services.h> 54#include <services.h>
53#include <stdlib.h> 55#include <stdlib.h>
54 56
55using namespace OpieTooth; 57using namespace OpieTooth;
56 58
57BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) 59BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl )
58 : BluetoothBase( parent, name, fl ) 60 : BluetoothBase( parent, name, fl )
59{ 61{
60 62
61 m_localDevice = new Manager( "hci0" ); 63 m_localDevice = new Manager( "hci0" );
62 64
63 connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) ); 65 connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) );
64 connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) ); 66 connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) );
65 67
66 connect( rfcommBindButton, SIGNAL( clicked() ), this, SLOT( rfcommDialog() ) ); 68 connect( rfcommBindButton, SIGNAL( clicked() ), this, SLOT( rfcommDialog() ) );
67 // not good since lib is async 69 // not good since lib is async
68 // connect( ListView2, SIGNAL( expanded(QListViewItem*) ), 70 // connect( ListView2, SIGNAL( expanded(QListViewItem*) ),
69 // this, SLOT( addServicesToDevice(QListViewItem*) ) ); 71 // this, SLOT( addServicesToDevice(QListViewItem*) ) );
70 connect( ListView2, SIGNAL( clicked(QListViewItem*)), 72 connect( ListView2, SIGNAL( clicked(QListViewItem*)),
71 this, SLOT( startServiceActionClicked(QListViewItem*) ) ); 73 this, SLOT( startServiceActionClicked(QListViewItem*) ) );
72 connect( ListView2, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ), 74 connect( ListView2, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ),
73 this, SLOT(startServiceActionHold(QListViewItem*,const QPoint&,int) ) ); 75 this, SLOT(startServiceActionHold(QListViewItem*,const QPoint&,int) ) );
74 connect( m_localDevice , SIGNAL( foundServices(const QString&,Services::ValueList) ), 76 connect( m_localDevice , SIGNAL( foundServices(const QString&,Services::ValueList) ),
75 this, SLOT( addServicesToDevice(const QString&,Services::ValueList) ) ); 77 this, SLOT( addServicesToDevice(const QString&,Services::ValueList) ) );
76 connect( m_localDevice, SIGNAL( available(const QString&,bool) ), 78 connect( m_localDevice, SIGNAL( available(const QString&,bool) ),
77 this, SLOT( deviceActive(const QString&,bool) ) ); 79 this, SLOT( deviceActive(const QString&,bool) ) );
78 connect( m_localDevice, SIGNAL( connections(ConnectionState::ValueList) ), 80 connect( m_localDevice, SIGNAL( connections(ConnectionState::ValueList) ),
79 this, SLOT( addConnectedDevices(ConnectionState::ValueList) ) ); 81 this, SLOT( addConnectedDevices(ConnectionState::ValueList) ) );
80 connect( m_localDevice, SIGNAL( signalStrength(const QString&,const QString&) ), 82 connect( m_localDevice, SIGNAL( signalStrength(const QString&,const QString&) ),
81 this, SLOT( addSignalStrength(const QString&,const QString&) ) ); 83 this, SLOT( addSignalStrength(const QString&,const QString&) ) );
82 84
83 85
84 // let hold be rightButtonClicked() 86 // let hold be rightButtonClicked()
85 QPEApplication::setStylusOperation( ListView2->viewport(), QPEApplication::RightOnHold); 87 QPEApplication::setStylusOperation( ListView2->viewport(), QPEApplication::RightOnHold);
86 QPEApplication::setStylusOperation( ListView4->viewport(), QPEApplication::RightOnHold); 88 QPEApplication::setStylusOperation( ListView4->viewport(), QPEApplication::RightOnHold);
87 89
88 //Load all icons needed 90 //Load all icons needed
89 m_offPix = Resource::loadPixmap( "opietooth/notconnected" ); 91 m_offPix = Resource::loadPixmap( "opietooth/notconnected" );
90 m_onPix = Resource::loadPixmap( "opietooth/connected" ); 92 m_onPix = Resource::loadPixmap( "opietooth/connected" );
91 m_findPix = Resource::loadPixmap( "opietooth/find" ); 93 m_findPix = Resource::loadPixmap( "opietooth/find" );
92 94
93 QPalette pal = this->palette(); 95 QPalette pal = this->palette();
94 QColor col = pal.color( QPalette::Active, QColorGroup::Background ); 96 QColor col = pal.color( QPalette::Active, QColorGroup::Background );
95 pal.setColor( QPalette::Active, QColorGroup::Button, col ); 97 pal.setColor( QPalette::Active, QColorGroup::Button, col );
96 pal.setColor( QPalette::Inactive, QColorGroup::Button, col ); 98 pal.setColor( QPalette::Inactive, QColorGroup::Button, col );
97 pal.setColor( QPalette::Normal, QColorGroup::Button, col ); 99 pal.setColor( QPalette::Normal, QColorGroup::Button, col );
98 pal.setColor( QPalette::Disabled, QColorGroup::Button, col ); 100 pal.setColor( QPalette::Disabled, QColorGroup::Button, col );
99 this->setPalette( pal ); 101 this->setPalette( pal );
100 102
101 setCaption( tr( "Bluetooth Manager" ) ); 103 setCaption( tr( "Bluetooth Manager" ) );
102 104
103 readConfig(); 105 readConfig();
104 initGui(); 106 initGui();
105 107
106 ListView2->setRootIsDecorated(true); 108 ListView2->setRootIsDecorated(true);
107 109
108 110
109 writeToHciConfig(); 111 writeToHciConfig();
110 // search conncetions 112 // search conncetions
111 addConnectedDevices(); 113 addConnectedDevices();
112 addSignalStrength(); 114 addSignalStrength();
113 m_iconLoader = new BTIconLoader(); 115 m_iconLoader = new BTIconLoader();
114 readSavedDevices(); 116 readSavedDevices();
115} 117}
116 118
117/** 119/**
118 * Reads all options from the config file 120 * Reads all options from the config file
119 */ 121 */
120void BlueBase::readConfig() 122void BlueBase::readConfig()
121{ 123{
122 124
123 Config cfg( "bluetoothmanager" ); 125 Config cfg( "bluetoothmanager" );
124 cfg.setGroup( "bluezsettings" ); 126 cfg.setGroup( "bluezsettings" );
125 127
126 m_deviceName = cfg.readEntry( "name" , "No name" ); // name the device should identify with 128 m_deviceName = cfg.readEntry( "name" , "No name" ); // name the device should identify with
127 m_defaultPasskey = cfg.readEntryCrypt( "passkey" , "" ); // <- hmm, look up how good the trolls did that, maybe too weak 129 m_defaultPasskey = cfg.readEntryCrypt( "passkey" , "" ); // <- hmm, look up how good the trolls did that, maybe too weak
128 m_useEncryption = cfg.readBoolEntry( "useEncryption" , TRUE ); 130 m_useEncryption = cfg.readBoolEntry( "useEncryption" , TRUE );
129 m_enableAuthentification = cfg.readBoolEntry( "enableAuthentification" , TRUE ); 131 m_enableAuthentification = cfg.readBoolEntry( "enableAuthentification" , TRUE );
130 m_enablePagescan = cfg.readBoolEntry( "enablePagescan" , TRUE ); 132 m_enablePagescan = cfg.readBoolEntry( "enablePagescan" , TRUE );
131 m_enableInquiryscan = cfg.readBoolEntry( "enableInquiryscan" , TRUE ); 133 m_enableInquiryscan = cfg.readBoolEntry( "enableInquiryscan" , TRUE );
132} 134}
133 135
134/** 136/**
135 * Writes all options to the config file 137 * Writes all options to the config file
136 */ 138 */
137void BlueBase::writeConfig() 139void BlueBase::writeConfig()
138{ 140{
139 141
140 Config cfg( "bluetoothmanager" ); 142 Config cfg( "bluetoothmanager" );
141 cfg.setGroup( "bluezsettings" ); 143 cfg.setGroup( "bluezsettings" );
142 144
143 cfg.writeEntry( "name" , m_deviceName ); 145 cfg.writeEntry( "name" , m_deviceName );
144 cfg.writeEntryCrypt( "passkey" , m_defaultPasskey ); 146 cfg.writeEntryCrypt( "passkey" , m_defaultPasskey );
145 cfg.writeEntry( "useEncryption" , m_useEncryption ); 147 cfg.writeEntry( "useEncryption" , m_useEncryption );
146 cfg.writeEntry( "enableAuthentification" , m_enableAuthentification ); 148 cfg.writeEntry( "enableAuthentification" , m_enableAuthentification );
147 cfg.writeEntry( "enablePagescan" , m_enablePagescan ); 149 cfg.writeEntry( "enablePagescan" , m_enablePagescan );
148 cfg.writeEntry( "enableInquiryscan" , m_enableInquiryscan ); 150 cfg.writeEntry( "enableInquiryscan" , m_enableInquiryscan );
149 151
150 writeToHciConfig(); 152 writeToHciConfig();
151} 153}
152 154
153/** 155/**
154 * Modify the hcid.conf file to our needs 156 * Modify the hcid.conf file to our needs
155 */ 157 */
156void BlueBase::writeToHciConfig() 158void BlueBase::writeToHciConfig()
157{ 159{
158 owarn << "writeToHciConfig" << oendl; 160 owarn << "writeToHciConfig" << oendl;
159 HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" ); 161 HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" );
160 hciconf.load(); 162 hciconf.load();
161 hciconf.setPinHelper( "/opt/QtPalmtop/bin/bluepin" ); 163 hciconf.setPinHelper( "/opt/QtPalmtop/bin/bluepin" );
162 hciconf.setName( m_deviceName ); 164 hciconf.setName( m_deviceName );
163 hciconf.setEncrypt( m_useEncryption ); 165 hciconf.setEncrypt( m_useEncryption );
164 hciconf.setAuth( m_enableAuthentification ); 166 hciconf.setAuth( m_enableAuthentification );
165 hciconf.setPscan( m_enablePagescan ); 167 hciconf.setPscan( m_enablePagescan );
166 hciconf.setIscan( m_enableInquiryscan ); 168 hciconf.setIscan( m_enableInquiryscan );
167 hciconf.save(); 169 hciconf.save();
168} 170}
169 171
170 172
171/** 173/**
172 * Read the list of allready known devices 174 * Read the list of allready known devices
173 */ 175 */
174void BlueBase::readSavedDevices() 176void BlueBase::readSavedDevices()
175{ 177{
176 178
177 QValueList<RemoteDevice> loadedDevices; 179 QValueList<RemoteDevice> loadedDevices;
178 DeviceHandler handler; 180 DeviceHandler handler;
179 loadedDevices = handler.load(); 181 loadedDevices = handler.load();
180 182
181 addSearchedDevices( loadedDevices ); 183 addSearchedDevices( loadedDevices );
182} 184}
183 185
184 186
185/** 187/**
186 * Write the list of allready known devices 188 * Write the list of allready known devices
187 */ 189 */
188void BlueBase::writeSavedDevices() 190void BlueBase::writeSavedDevices()
189{ 191{
190 QListViewItemIterator it( ListView2 ); 192 QListViewItemIterator it( ListView2 );
191 BTListItem* item; 193 BTListItem* item;
192 BTDeviceItem* device; 194 BTDeviceItem* device;
193 RemoteDevice::ValueList list; 195 RemoteDevice::ValueList list;
194 for ( ; it.current(); ++it ) 196 for ( ; it.current(); ++it )
195 { 197 {
196 item = (BTListItem*)it.current(); 198 item = (BTListItem*)it.current();
197 if(item->typeId() != BTListItem::Device ) 199 if(item->typeId() != BTListItem::Device )
198 continue; 200 continue;
199 device = (BTDeviceItem*)item; 201 device = (BTDeviceItem*)item;
200 202
201 list.append( device->remoteDevice() ); 203 list.append( device->remoteDevice() );
202 } 204 }
203 /* 205 /*
204 * if not empty save the List through DeviceHandler 206 * if not empty save the List through DeviceHandler
205 */ 207 */
206 if ( list.isEmpty() ) 208 if ( list.isEmpty() )
207 return; 209 return;
208 DeviceHandler handler; 210 DeviceHandler handler;
209 handler.save( list ); 211 handler.save( list );
210} 212}
211 213
212 214
213/** 215/**
214 * Set up the gui 216 * Set up the gui
215 */ 217 */
216void BlueBase::initGui() 218void BlueBase::initGui()
217{ 219{
218 StatusLabel->setText( status() ); // maybe move it to getStatus() 220 StatusLabel->setText( status() ); // maybe move it to getStatus()
219 cryptCheckBox->setChecked( m_useEncryption ); 221 cryptCheckBox->setChecked( m_useEncryption );
220 authCheckBox->setChecked( m_enableAuthentification ); 222 authCheckBox->setChecked( m_enableAuthentification );
diff --git a/noncore/net/opietooth/manager/config.in b/noncore/net/opietooth/manager/config.in
index ecebb9b..56d8b78 100644
--- a/noncore/net/opietooth/manager/config.in
+++ b/noncore/net/opietooth/manager/config.in
@@ -1,4 +1,4 @@
1 config OPIETOOTH-MANAGER 1 config OPIETOOTH-MANAGER
2 boolean "opie-bluetoothmanager (Bluetooth manager)" 2 boolean "opie-bluetoothmanager (Bluetooth manager)"
3 default "y" 3 default "y"
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && OPIETOOTH && LIBOPIETOOTH 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && OPIETOOTH && LIBOPIETOOTH && LIBOPIE2UI
diff --git a/noncore/net/opietooth/manager/devicehandler.cpp b/noncore/net/opietooth/manager/devicehandler.cpp
index bd34351..320ad44 100644
--- a/noncore/net/opietooth/manager/devicehandler.cpp
+++ b/noncore/net/opietooth/manager/devicehandler.cpp
@@ -1,87 +1,89 @@
1 1
2#include <stdlib.h> 2#include <stdlib.h>
3 3
4#include <qdir.h> 4#include <qdir.h>
5#include <qpe/config.h> 5#include <qpe/config.h>
6#include <opie2/odebug.h>
7using namespace Opie::Core;
6 8
7#include "devicehandler.h" 9#include "devicehandler.h"
8 10
9using namespace OpieTooth; 11using namespace OpieTooth;
10 12
11DeviceHandler::DeviceHandler() { 13DeviceHandler::DeviceHandler() {
12 14
13}; 15};
14DeviceHandler::~DeviceHandler() { 16DeviceHandler::~DeviceHandler() {
15 17
16} 18}
17 19
18RemoteDevice::ValueList DeviceHandler::load() { 20RemoteDevice::ValueList DeviceHandler::load() {
19 RemoteDevice::ValueList list; 21 RemoteDevice::ValueList list;
20QString path = QDir::homeDirPath() + "/Settings/bluetooth"; 22QString path = QDir::homeDirPath() + "/Settings/bluetooth";
21 QDir deviceListSave( path); 23 QDir deviceListSave( path);
22 24
23 // list of .conf files 25 // list of .conf files
24 QStringList devicesFileList = deviceListSave.entryList(); 26 QStringList devicesFileList = deviceListSave.entryList();
25 27
26 28
27 // cut .conf of to get the mac and also read the name entry in it. 29 // cut .conf of to get the mac and also read the name entry in it.
28 if (!devicesFileList.isEmpty() ) { 30 if (!devicesFileList.isEmpty() ) {
29 QString name; 31 QString name;
30 QString mac; 32 QString mac;
31 QStringList::Iterator it; 33 QStringList::Iterator it;
32 for (it = devicesFileList.begin(); it != devicesFileList.end(); ++it ) { 34 for (it = devicesFileList.begin(); it != devicesFileList.end(); ++it ) {
33 if ( (*it) == "." || (*it) == ".." ) 35 if ( (*it) == "." || (*it) == ".." )
34 continue; 36 continue;
35 37
36 odebug << (*it).latin1() << oendl; 38 odebug << (*it).latin1() << oendl;
37 Config conf(path + "/"+(*it), Config::File); 39 Config conf(path + "/"+(*it), Config::File);
38 conf.setGroup("Info"); 40 conf.setGroup("Info");
39 name = conf.readEntry("name", "Error"); 41 name = conf.readEntry("name", "Error");
40 mac = conf.readEntry("mac", QString::null); 42 mac = conf.readEntry("mac", QString::null);
41 odebug << "MAC: " + mac << oendl; 43 odebug << "MAC: " + mac << oendl;
42 odebug << "NAME: " + name << oendl; 44 odebug << "NAME: " + name << oendl;
43 if (mac.isEmpty() ) 45 if (mac.isEmpty() )
44 continue; 46 continue;
45 RemoteDevice currentDevice( mac , name ); 47 RemoteDevice currentDevice( mac , name );
46 list.append( currentDevice ); 48 list.append( currentDevice );
47 } 49 }
48 } 50 }
49 return list; 51 return list;
50}; 52};
51/* 53/*
52 * This is some how rude but make sure all old devices 54 * This is some how rude but make sure all old devices
53 * are getting deleted 55 * are getting deleted
54 */ 56 */
55void DeviceHandler::save( const RemoteDevice::ValueList& list) { 57void DeviceHandler::save( const RemoteDevice::ValueList& list) {
56 QCString rm; 58 QCString rm;
57 rm += "rm -rf "; 59 rm += "rm -rf ";
58 rm += QDir::homeDirPath() + "/Settings/bluetooth"; 60 rm += QDir::homeDirPath() + "/Settings/bluetooth";
59 system ( rm.data() ); 61 system ( rm.data() );
60 62
61 if (list.isEmpty() ) // no need to create the dir 63 if (list.isEmpty() ) // no need to create the dir
62 return; 64 return;
63 65
64 /** 66 /**
65 * Create a new dir 67 * Create a new dir
66 */ 68 */
67 rm = "mkdir "; 69 rm = "mkdir ";
68 rm += QDir::homeDirPath() + "/Settings/bluetooth"; 70 rm += QDir::homeDirPath() + "/Settings/bluetooth";
69 owarn << "out " << rm.data() << "" << oendl; 71 owarn << "out " << rm.data() << "" << oendl;
70 system( rm.data() ); 72 system( rm.data() );
71 73
72 RemoteDevice::ValueList::ConstIterator it; 74 RemoteDevice::ValueList::ConstIterator it;
73 // write the config 75 // write the config
74 76
75 for ( it = list.begin(); it != list.end(); ++it ) { 77 for ( it = list.begin(); it != list.end(); ++it ) {
76 odebug << "/Settings/bluetooth/" + (*it).mac() + ".conf" << oendl; 78 odebug << "/Settings/bluetooth/" + (*it).mac() + ".conf" << oendl;
77 79
78 Config conf( QDir::homeDirPath() + 80 Config conf( QDir::homeDirPath() +
79 "/Settings/bluetooth/" + 81 "/Settings/bluetooth/" +
80 (*it).mac() + ".conf", Config::File ); 82 (*it).mac() + ".conf", Config::File );
81 83
82 conf.setGroup( "Info" ); 84 conf.setGroup( "Info" );
83 conf.writeEntry( "name", (*it).name() ); 85 conf.writeEntry( "name", (*it).name() );
84 conf.writeEntry( "mac", (*it).mac() ); 86 conf.writeEntry( "mac", (*it).mac() );
85 } 87 }
86 88
87} 89}
diff --git a/noncore/net/opietooth/manager/dunpopup.cpp b/noncore/net/opietooth/manager/dunpopup.cpp
index 5b01d2f..10505a9 100644
--- a/noncore/net/opietooth/manager/dunpopup.cpp
+++ b/noncore/net/opietooth/manager/dunpopup.cpp
@@ -1,63 +1,65 @@
1#include <qpe/qcopenvelope_qws.h> 1#include <qpe/qcopenvelope_qws.h>
2 2
3#include <qtimer.h> 3#include <qtimer.h>
4#include <opie2/odebug.h>
5using namespace Opie::Core;
4 6
5#include "dunpopup.h" 7#include "dunpopup.h"
6 8
7using namespace OpieTooth; 9using namespace OpieTooth;
8 10
9/* 11/*
10 * c'tor init the QAction 12 * c'tor init the QAction
11 */ 13 */
12DunPopup::DunPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() { 14DunPopup::DunPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() {
13 15
14 owarn << "DunPopup c'tor" << oendl; 16 owarn << "DunPopup c'tor" << oendl;
15 17
16 m_item = item; 18 m_item = item;
17 QAction *a, *b, *c; 19 QAction *a, *b, *c;
18 20
19 m_dunconnection = 0l; 21 m_dunconnection = 0l;
20 /* connect action */ 22 /* connect action */
21 23
22 24
23 a = new QAction(); // so it's get deleted 25 a = new QAction(); // so it's get deleted
24 a->setText( tr("connect") ); 26 a->setText( tr("connect") );
25 a->addTo( this ); 27 a->addTo( this );
26 connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) ); 28 connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) );
27 29
28 30
29 b = new QAction(); 31 b = new QAction();
30 b->setText( tr( "connect+conf" ) ); 32 b->setText( tr( "connect+conf" ) );
31 b->addTo( this ); 33 b->addTo( this );
32 connect( b, SIGNAL( activated() ), this, SLOT( slotConnectAndConfig() ) ); 34 connect( b, SIGNAL( activated() ), this, SLOT( slotConnectAndConfig() ) );
33 35
34 c = new QAction(); 36 c = new QAction();
35 c->setText( tr( "disconnect" ) ); 37 c->setText( tr( "disconnect" ) );
36 c->addTo( this ); 38 c->addTo( this );
37 connect( c, SIGNAL( activated() ), this, SLOT( slotDisconnect() ) ); 39 connect( c, SIGNAL( activated() ), this, SLOT( slotDisconnect() ) );
38 40
39}; 41};
40 42
41DunPopup::~DunPopup() { 43DunPopup::~DunPopup() {
42 44
43} 45}
44 46
45void DunPopup::slotConnect() { 47void DunPopup::slotConnect() {
46 48
47 m_dunconnection = new StartDunConnection( m_item->mac() ); 49 m_dunconnection = new StartDunConnection( m_item->mac() );
48 m_dunconnection->start(); 50 m_dunconnection->start();
49} 51}
50 52
51void DunPopup::slotDisconnect() { 53void DunPopup::slotDisconnect() {
52 m_dunconnection->stop(); 54 m_dunconnection->stop();
53} 55}
54 56
55 57
56void DunPopup::slotConnectAndConfig() { 58void DunPopup::slotConnectAndConfig() {
57 slotConnect(); 59 slotConnect();
58 60
59 // more intelligence here later like passing the device ( bnepX ) 61 // more intelligence here later like passing the device ( bnepX )
60 QCopEnvelope e( "QPE/System", "execute(QString)" ); 62 QCopEnvelope e( "QPE/System", "execute(QString)" );
61 e << QString( "networksettings" ); 63 e << QString( "networksettings" );
62 64
63} 65}
diff --git a/noncore/net/opietooth/manager/hciconfwrapper.cpp b/noncore/net/opietooth/manager/hciconfwrapper.cpp
index 71c935c..ca2e7bd 100644
--- a/noncore/net/opietooth/manager/hciconfwrapper.cpp
+++ b/noncore/net/opietooth/manager/hciconfwrapper.cpp
@@ -1,139 +1,142 @@
1#include "hciconfwrapper.h" 1#include "hciconfwrapper.h"
2 2
3#include <qfile.h> 3#include <qfile.h>
4#include <qtextstream.h> 4#include <qtextstream.h>
5#include <qregexp.h> 5#include <qregexp.h>
6 6
7#include <opie2/odebug.h>
8using namespace Opie::Core;
9
7namespace OpieTooth { 10namespace OpieTooth {
8 11
9 12
10 HciConfWrapper::HciConfWrapper( const QString &fileName) { 13 HciConfWrapper::HciConfWrapper( const QString &fileName) {
11 m_fileName = fileName; 14 m_fileName = fileName;
12 } 15 }
13 16
14 HciConfWrapper::~HciConfWrapper() { 17 HciConfWrapper::~HciConfWrapper() {
15 } 18 }
16 19
17 20
18 void HciConfWrapper::setPinHelper( const QString& app ) { 21 void HciConfWrapper::setPinHelper( const QString& app ) {
19 setValue( "pin_helper" , app ); 22 setValue( "pin_helper" , app );
20 } 23 }
21 24
22 void HciConfWrapper::setName( const QString &name ) { 25 void HciConfWrapper::setName( const QString &name ) {
23 qDebug ("NAME : " + name); 26 qDebug ("NAME : " + name);
24 setValue( "name" , "\"" + name + "\"" ); 27 setValue( "name" , "\"" + name + "\"" );
25 } 28 }
26 29
27 void HciConfWrapper::setIscan( bool enable) { 30 void HciConfWrapper::setIscan( bool enable) {
28 31
29 if ( enable ) { 32 if ( enable ) {
30 setValue( "iscan" , "enable" ); 33 setValue( "iscan" , "enable" );
31 } else { 34 } else {
32 setValue( "iscan" , "disable" ); 35 setValue( "iscan" , "disable" );
33 } 36 }
34 } 37 }
35 38
36 void HciConfWrapper::setPscan( bool enable) { 39 void HciConfWrapper::setPscan( bool enable) {
37 40
38 if ( enable ) { 41 if ( enable ) {
39 setValue( "pscan" , "enable" ); 42 setValue( "pscan" , "enable" );
40 } else { 43 } else {
41 setValue( "pscan" , "disable" ); 44 setValue( "pscan" , "disable" );
42 } 45 }
43 } 46 }
44 47
45 48
46 void HciConfWrapper::setAuth( bool enable) { 49 void HciConfWrapper::setAuth( bool enable) {
47 50
48 if ( enable ) { 51 if ( enable ) {
49 setValue( "auth" , "enable" ); 52 setValue( "auth" , "enable" );
50 } else { 53 } else {
51 setValue( "auth" , "disable" ); 54 setValue( "auth" , "disable" );
52 } 55 }
53 } 56 }
54 57
55 58
56 void HciConfWrapper::setEncrypt( bool enable) { 59 void HciConfWrapper::setEncrypt( bool enable) {
57 60
58 if ( enable ) { 61 if ( enable ) {
59 setValue( "encrypt" , "enable" ); 62 setValue( "encrypt" , "enable" );
60 } else { 63 } else {
61 setValue( "encrypt" , "disable" ); 64 setValue( "encrypt" , "disable" );
62 } 65 }
63 } 66 }
64 67
65 68
66 void HciConfWrapper::setValue(const QString &key, const QString &value ) { 69 void HciConfWrapper::setValue(const QString &key, const QString &value ) {
67 70
68 if (m_file.isEmpty() ) // load first 71 if (m_file.isEmpty() ) // load first
69 return; 72 return;
70 73
71 QStringList::Iterator it; 74 QStringList::Iterator it;
72 75
73 QString str; 76 QString str;
74 for (it = m_file.begin(); it != m_file.end(); ++it ) { 77 for (it = m_file.begin(); it != m_file.end(); ++it ) {
75 str = (*it); 78 str = (*it);
76 if( (str.contains(key)) > 0 ) { 79 if( (str.contains(key)) > 0 ) {
77 odebug << "Found" << oendl; 80 odebug << "Found" << oendl;
78 // still need to look if its commented out!!! 81 // still need to look if its commented out!!!
79 str.simplifyWhiteSpace(); 82 str.simplifyWhiteSpace();
80 odebug << key << oendl; 83 odebug << key << oendl;
81 if (str.startsWith("#")) { 84 if (str.startsWith("#")) {
82 str = (key + " " + value + ";"); 85 str = (key + " " + value + ";");
83 } else { 86 } else {
84 str = str.replace( QRegExp( "\\s*"+key+"\\s+[^\\s][^;]*;" ), key + " " + value + ";"); 87 str = str.replace( QRegExp( "\\s*"+key+"\\s+[^\\s][^;]*;" ), key + " " + value + ";");
85 } 88 }
86 odebug << str << oendl; 89 odebug << str << oendl;
87 it = m_file.remove( it ); 90 it = m_file.remove( it );
88 it = m_file.insert( it, str ); 91 it = m_file.insert( it, str );
89 //return; the regexp is too wide -zecke // all set 92 //return; the regexp is too wide -zecke // all set
90 } 93 }
91 } 94 }
92 95
93 96
94 } 97 }
95 98
96 /** 99 /**
97 * This loads the config file and stores it inside 100 * This loads the config file and stores it inside
98 * the m_file 101 * the m_file
99 */ 102 */
100 void HciConfWrapper::load() { 103 void HciConfWrapper::load() {
101 owarn << "loaded" << oendl; 104 owarn << "loaded" << oendl;
102 m_file.clear(); 105 m_file.clear();
103 QFile file( m_fileName ); 106 QFile file( m_fileName );
104 if (!file.open( IO_ReadOnly ) ) { 107 if (!file.open( IO_ReadOnly ) ) {
105 odebug << "Could not open" << oendl; 108 odebug << "Could not open" << oendl;
106 return; 109 return;
107 } 110 }
108 111
109 /** 112 /**
110 * readAll() into a QByteArray 113 * readAll() into a QByteArray
111 * QStringList::split('\n', array ) 114 * QStringList::split('\n', array )
112 * would this be faster? -zecke 115 * would this be faster? -zecke
113 */ 116 */
114 QTextStream stream(&file ); 117 QTextStream stream(&file );
115 QString tmp; 118 QString tmp;
116 while ( !stream.atEnd() ) { 119 while ( !stream.atEnd() ) {
117 tmp = stream.readLine(); 120 tmp = stream.readLine();
118 m_file.append( tmp ); 121 m_file.append( tmp );
119 } 122 }
120 } 123 }
121 void HciConfWrapper::save() { 124 void HciConfWrapper::save() {
122 owarn << "save" << oendl; 125 owarn << "save" << oendl;
123 if (m_file.isEmpty() ) // load first 126 if (m_file.isEmpty() ) // load first
124 return; 127 return;
125 128
126 QFile file( m_fileName ); 129 QFile file( m_fileName );
127 if ( !file.open(IO_WriteOnly ) ) { 130 if ( !file.open(IO_WriteOnly ) ) {
128 owarn << "could not open " << m_fileName.latin1() << "" << oendl; 131 owarn << "could not open " << m_fileName.latin1() << "" << oendl;
129 return; 132 return;
130 } 133 }
131 134
132 QTextStream stream(&file ); 135 QTextStream stream(&file );
133 QStringList::Iterator it; 136 QStringList::Iterator it;
134 for ( it = m_file.begin(); it != m_file.end(); ++it ) { 137 for ( it = m_file.begin(); it != m_file.end(); ++it ) {
135 stream << (*it) << endl; 138 stream << (*it) << endl;
136 } 139 }
137 owarn << "saved" << oendl; 140 owarn << "saved" << oendl;
138 }; 141 };
139} 142}
diff --git a/noncore/net/opietooth/manager/manager.pro b/noncore/net/opietooth/manager/manager.pro
index 238acb3..5c05b4d 100644
--- a/noncore/net/opietooth/manager/manager.pro
+++ b/noncore/net/opietooth/manager/manager.pro
@@ -1,30 +1,30 @@
1CONFIG = qt warn_on quick-app 1CONFIG = qt warn_on quick-app
2HEADERS = btconnectionitem.h btdeviceitem.h \ 2HEADERS = btconnectionitem.h btdeviceitem.h \
3 btserviceitem.h stdpopups.h \ 3 btserviceitem.h stdpopups.h \
4 popuphelper.h bluebase.h \ 4 popuphelper.h bluebase.h \
5 scandialog.h btlistitem.h \ 5 scandialog.h btlistitem.h \
6 hciconfwrapper.h bticonloader.h \ 6 hciconfwrapper.h bticonloader.h \
7 pppdialog.h obexdialog.h \ 7 pppdialog.h obexdialog.h \
8 rfcommassigndialogimpl.h rfcommassigndialogitem.h \ 8 rfcommassigndialogimpl.h rfcommassigndialogitem.h \
9 devicehandler.h rfcpopup.h obexpopup.h \ 9 devicehandler.h rfcpopup.h obexpopup.h \
10 rfcommhelper.h panpopup.h dunpopup.h rfcommconfhandler.h 10 rfcommhelper.h panpopup.h dunpopup.h rfcommconfhandler.h
11 11
12SOURCES = btconnectionitem.cpp btdeviceitem.cpp \ 12SOURCES = btconnectionitem.cpp btdeviceitem.cpp \
13 btserviceitem.cpp stdpopups.cpp \ 13 btserviceitem.cpp stdpopups.cpp \
14 popuphelper.cpp main.cpp \ 14 popuphelper.cpp main.cpp \
15 bluebase.cpp scandialog.cpp \ 15 bluebase.cpp scandialog.cpp \
16 btlistitem.cpp hciconfwrapper.cpp \ 16 btlistitem.cpp hciconfwrapper.cpp \
17 bticonloader.cpp pppdialog.cpp \ 17 bticonloader.cpp pppdialog.cpp \
18 rfcommassigndialogimpl.cpp rfcommassigndialogitem.cpp \ 18 rfcommassigndialogimpl.cpp rfcommassigndialogitem.cpp \
19 obexdialog.cpp devicehandler.cpp \ 19 obexdialog.cpp devicehandler.cpp \
20 rfcpopup.cpp obexpopup.cpp \ 20 rfcpopup.cpp obexpopup.cpp \
21 rfcommhelper.cpp panpopup.cpp dunpopup.cpp rfcommconfhandler.cpp 21 rfcommhelper.cpp panpopup.cpp dunpopup.cpp rfcommconfhandler.cpp
22INCLUDEPATH += $(OPIEDIR)/include 22INCLUDEPATH += $(OPIEDIR)/include
23INCLUDEPATH += $(OPIEDIR)/noncore/net/opietooth/lib 23INCLUDEPATH += $(OPIEDIR)/noncore/net/opietooth/lib
24DEPENDPATH += $(OPIEDIR)/include 24DEPENDPATH += $(OPIEDIR)/include
25LIBS += -lqpe -lopietooth -lopiecore2 25LIBS += -lqpe -lopietooth -lopiecore2 -lopieui2
26INTERFACES = bluetoothbase.ui devicedialog.ui rfcommassigndialogbase.ui rfcommdialogitembase.ui 26INTERFACES = bluetoothbase.ui devicedialog.ui rfcommassigndialogbase.ui rfcommdialogitembase.ui
27 27
28 TARGET = bluetooth-manager 28 TARGET = bluetooth-manager
29 29
30include ( $(OPIEDIR)/include.pro ) 30include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/net/opietooth/manager/obexdialog.cpp b/noncore/net/opietooth/manager/obexdialog.cpp
index 3a3dbb0..951d87a 100644
--- a/noncore/net/opietooth/manager/obexdialog.cpp
+++ b/noncore/net/opietooth/manager/obexdialog.cpp
@@ -1,89 +1,91 @@
1 1
2#include "obexdialog.h" 2#include "obexdialog.h"
3#include <qpushbutton.h> 3#include <qpushbutton.h>
4#include <qmultilineedit.h> 4#include <qmultilineedit.h>
5#include <qlineedit.h> 5#include <qlineedit.h>
6#include <qlayout.h> 6#include <qlayout.h>
7#include <qlabel.h> 7#include <qlabel.h>
8#include <qfileinfo.h> 8#include <qfileinfo.h>
9 9
10#include <qpe/resource.h> 10#include <qpe/resource.h>
11 11
12#include <opie2/oprocess.h> 12#include <opie2/oprocess.h>
13#include <opie2/ofiledialog.h> 13#include <opie2/ofiledialog.h>
14#include <opie2/odebug.h>
15using namespace Opie::Core;
14 16
15using namespace OpieTooth; 17using namespace OpieTooth;
16 18
17using namespace Opie::Core; 19using namespace Opie::Core;
18using namespace Opie::Ui; 20using namespace Opie::Ui;
19using namespace Opie::Core; 21using namespace Opie::Core;
20ObexDialog::ObexDialog( QWidget* parent, const char* name, bool modal, WFlags fl, const QString& device ) 22ObexDialog::ObexDialog( QWidget* parent, const char* name, bool modal, WFlags fl, const QString& device )
21 : QDialog( parent, name, modal, fl ) { 23 : QDialog( parent, name, modal, fl ) {
22 24
23 if ( !name ) 25 if ( !name )
24 setName( "ObexDialog" ); 26 setName( "ObexDialog" );
25 setCaption( tr( "beam files " ) ) ; 27 setCaption( tr( "beam files " ) ) ;
26 28
27 m_device = device; 29 m_device = device;
28 30
29 layout = new QVBoxLayout( this ); 31 layout = new QVBoxLayout( this );
30 32
31 QLabel* info = new QLabel( this ); 33 QLabel* info = new QLabel( this );
32 info->setText( tr("Which file should be beamed?") ); 34 info->setText( tr("Which file should be beamed?") );
33 35
34 cmdLine = new QLineEdit( this ); 36 cmdLine = new QLineEdit( this );
35 37
36 QPushButton *browserButton; 38 QPushButton *browserButton;
37 browserButton = new QPushButton( Resource::loadIconSet("fileopen"),"",this,"BrowseButton"); 39 browserButton = new QPushButton( Resource::loadIconSet("fileopen"),"",this,"BrowseButton");
38 connect( browserButton, SIGNAL(released() ), this , SLOT(browse() ) ); 40 connect( browserButton, SIGNAL(released() ), this , SLOT(browse() ) );
39 41
40 chNameLine = new QLineEdit( this ); 42 chNameLine = new QLineEdit( this );
41 43
42 sendButton = new QPushButton( this ); 44 sendButton = new QPushButton( this );
43 sendButton->setText( tr( "Send" ) ); 45 sendButton->setText( tr( "Send" ) );
44 46
45 layout->addWidget(info); 47 layout->addWidget(info);
46 layout->addWidget(cmdLine); 48 layout->addWidget(cmdLine);
47 layout->addWidget(browserButton); 49 layout->addWidget(browserButton);
48 layout->addWidget(chNameLine); 50 layout->addWidget(chNameLine);
49 layout->addWidget(sendButton); 51 layout->addWidget(sendButton);
50 52
51 connect( sendButton, SIGNAL( clicked() ), this, SLOT( sendData() ) ); 53 connect( sendButton, SIGNAL( clicked() ), this, SLOT( sendData() ) );
52 54
53} 55}
54 56
55ObexDialog::~ObexDialog() { 57ObexDialog::~ObexDialog() {
56} 58}
57 59
58void ObexDialog::browse() { 60void ObexDialog::browse() {
59 61
60 MimeTypes types; 62 MimeTypes types;
61 QStringList all; 63 QStringList all;
62 all << "*/*"; 64 all << "*/*";
63 types.insert("All Files", all ); 65 types.insert("All Files", all );
64 66
65 QString str = OFileDialog::getOpenFileName( 1,"/","", types, 0 ); 67 QString str = OFileDialog::getOpenFileName( 1,"/","", types, 0 );
66 cmdLine->setText( str ); 68 cmdLine->setText( str );
67 69
68} 70}
69 71
70void ObexDialog::sendData() { 72void ObexDialog::sendData() {
71 QString fileURL = cmdLine->text(); 73 QString fileURL = cmdLine->text();
72 QString file = QFileInfo( fileURL ).fileName(); 74 QString file = QFileInfo( fileURL ).fileName();
73 QString modifiedName = chNameLine->text(); 75 QString modifiedName = chNameLine->text();
74 76
75 // vom popupmenu beziehen 77 // vom popupmenu beziehen
76 OProcess* obexSend = new OProcess(); 78 OProcess* obexSend = new OProcess();
77 if ( !modifiedName.isEmpty() ) { 79 if ( !modifiedName.isEmpty() ) {
78 *obexSend << "ussp-push" << m_device << fileURL << modifiedName; 80 *obexSend << "ussp-push" << m_device << fileURL << modifiedName;
79 } else { 81 } else {
80 *obexSend << "ussp-push" << m_device << fileURL << file; 82 *obexSend << "ussp-push" << m_device << fileURL << file;
81 } 83 }
82 if (!obexSend->start(OProcess::DontCare, OProcess::AllOutput) ) { 84 if (!obexSend->start(OProcess::DontCare, OProcess::AllOutput) ) {
83 owarn << "could not start" << oendl; 85 owarn << "could not start" << oendl;
84 delete obexSend; 86 delete obexSend;
85 } 87 }
86 88
87 89
88 90
89} 91}
diff --git a/noncore/net/opietooth/manager/obexpopup.cpp b/noncore/net/opietooth/manager/obexpopup.cpp
index 9a50199..010f7de 100644
--- a/noncore/net/opietooth/manager/obexpopup.cpp
+++ b/noncore/net/opietooth/manager/obexpopup.cpp
@@ -1,45 +1,47 @@
1 1
2#include "obexdialog.h" 2#include "obexdialog.h"
3#include "obexpopup.h" 3#include "obexpopup.h"
4 4
5/* OPIE */ 5/* OPIE */
6#include <qpe/qpeapplication.h> 6#include <qpe/qpeapplication.h>
7#include <opie2/odebug.h>
8using namespace Opie::Core;
7 9
8/* QT */ 10/* QT */
9#include <qtimer.h> 11#include <qtimer.h>
10 12
11using namespace OpieTooth; 13using namespace OpieTooth;
12 14
13/* 15/*
14 * c'tor init the QAction 16 * c'tor init the QAction
15 */ 17 */
16ObexPopup::ObexPopup() 18ObexPopup::ObexPopup()
17 : QPopupMenu() 19 : QPopupMenu()
18{ 20{
19 owarn << "RfcCommPopup c'tor" << oendl; 21 owarn << "RfcCommPopup c'tor" << oendl;
20 22
21 QAction* a; 23 QAction* a;
22 24
23 /* connect action */ 25 /* connect action */
24 a = new QAction( ); // so it's get deleted 26 a = new QAction( ); // so it's get deleted
25 a->setText("Push file"); 27 a->setText("Push file");
26 a->addTo( this ); 28 a->addTo( this );
27 connect( a, SIGNAL( activated() ), 29 connect( a, SIGNAL( activated() ),
28 this, SLOT( slotPush() ) ); 30 this, SLOT( slotPush() ) );
29}; 31};
30 32
31 33
32ObexPopup::~ObexPopup() 34ObexPopup::~ObexPopup()
33{} 35{}
34 36
35 37
36void ObexPopup::slotPush() 38void ObexPopup::slotPush()
37{ 39{
38 40
39 owarn << "push something" << oendl; 41 owarn << "push something" << oendl;
40 42
41 ObexDialog obexDialog; 43 ObexDialog obexDialog;
42 QPEApplication::execDialog( &obexDialog ); 44 QPEApplication::execDialog( &obexDialog );
43} 45}
44 46
45 47
diff --git a/noncore/net/opietooth/manager/panpopup.cpp b/noncore/net/opietooth/manager/panpopup.cpp
index 43c2777..f02a58c 100644
--- a/noncore/net/opietooth/manager/panpopup.cpp
+++ b/noncore/net/opietooth/manager/panpopup.cpp
@@ -1,64 +1,66 @@
1#include <qpe/qcopenvelope_qws.h> 1#include <qpe/qcopenvelope_qws.h>
2#include <opie2/odebug.h>
3using namespace Opie::Core;
2 4
3#include <qtimer.h> 5#include <qtimer.h>
4 6
5#include "panpopup.h" 7#include "panpopup.h"
6 8
7using namespace OpieTooth; 9using namespace OpieTooth;
8 10
9/* 11/*
10 * c'tor init the QAction 12 * c'tor init the QAction
11 */ 13 */
12PanPopup::PanPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() { 14PanPopup::PanPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() {
13 15
14 owarn << "PanPopup c'tor" << oendl; 16 owarn << "PanPopup c'tor" << oendl;
15 17
16 m_item = item; 18 m_item = item;
17 QAction *a, *b, *c; 19 QAction *a, *b, *c;
18 20
19 m_panconnection = 0l; 21 m_panconnection = 0l;
20 /* connect action */ 22 /* connect action */
21 23
22 24
23 a = new QAction(); // so it's get deleted 25 a = new QAction(); // so it's get deleted
24 a->setText( tr("connect") ); 26 a->setText( tr("connect") );
25 a->addTo( this ); 27 a->addTo( this );
26 connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) ); 28 connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) );
27 29
28 30
29 b = new QAction(); 31 b = new QAction();
30 b->setText( tr( "connect+conf" ) ); 32 b->setText( tr( "connect+conf" ) );
31 b->addTo( this ); 33 b->addTo( this );
32 connect( b, SIGNAL( activated() ), this, SLOT( slotConnectAndConfig() ) ); 34 connect( b, SIGNAL( activated() ), this, SLOT( slotConnectAndConfig() ) );
33 35
34 c = new QAction(); 36 c = new QAction();
35 c->setText( tr( "disconnect" ) ); 37 c->setText( tr( "disconnect" ) );
36 c->addTo( this ); 38 c->addTo( this );
37 connect( c, SIGNAL( activated() ), this, SLOT( slotDisconnect() ) ); 39 connect( c, SIGNAL( activated() ), this, SLOT( slotDisconnect() ) );
38 40
39}; 41};
40 42
41PanPopup::~PanPopup() { 43PanPopup::~PanPopup() {
42 44
43} 45}
44 46
45void PanPopup::slotConnect() { 47void PanPopup::slotConnect() {
46 48
47 m_panconnection = new StartPanConnection( m_item->mac() ); 49 m_panconnection = new StartPanConnection( m_item->mac() );
48 m_panconnection->start(); 50 m_panconnection->start();
49} 51}
50 52
51void PanPopup::slotDisconnect() { 53void PanPopup::slotDisconnect() {
52 if (!m_panconnection) m_panconnection = new StartPanConnection( m_item->mac() ); 54 if (!m_panconnection) m_panconnection = new StartPanConnection( m_item->mac() );
53 m_panconnection->stop(); 55 m_panconnection->stop();
54} 56}
55 57
56 58
57void PanPopup::slotConnectAndConfig() { 59void PanPopup::slotConnectAndConfig() {
58 slotConnect(); 60 slotConnect();
59 61
60 // more intelligence here later like passing the device ( bnepX ) 62 // more intelligence here later like passing the device ( bnepX )
61 QCopEnvelope e( "QPE/System", "execute(QString)" ); 63 QCopEnvelope e( "QPE/System", "execute(QString)" );
62 e << QString( "networksettings" ); 64 e << QString( "networksettings" );
63 65
64} 66}
diff --git a/noncore/net/opietooth/manager/pppdialog.cpp b/noncore/net/opietooth/manager/pppdialog.cpp
index 989bf45..ef007f5 100644
--- a/noncore/net/opietooth/manager/pppdialog.cpp
+++ b/noncore/net/opietooth/manager/pppdialog.cpp
@@ -1,69 +1,71 @@
1 1
2#include "pppdialog.h" 2#include "pppdialog.h"
3#include <qpushbutton.h> 3#include <qpushbutton.h>
4#include <qmultilineedit.h> 4#include <qmultilineedit.h>
5#include <qlineedit.h> 5#include <qlineedit.h>
6#include <qlayout.h> 6#include <qlayout.h>
7#include <qlabel.h> 7#include <qlabel.h>
8#include <opie2/oprocess.h> 8#include <opie2/oprocess.h>
9#include <opie2/odebug.h>
10using namespace Opie::Core;
9 11
10using namespace OpieTooth; 12using namespace OpieTooth;
11 13
12using namespace Opie::Core; 14using namespace Opie::Core;
13PPPDialog::PPPDialog( QWidget* parent, const char* name, bool modal, WFlags fl, const QString& device ) 15PPPDialog::PPPDialog( QWidget* parent, const char* name, bool modal, WFlags fl, const QString& device )
14 : QDialog( parent, name, modal, fl ) { 16 : QDialog( parent, name, modal, fl ) {
15 17
16 if ( !name ) 18 if ( !name )
17 setName( "PPPDialog" ); 19 setName( "PPPDialog" );
18 setCaption( tr( "ppp connection " ) ) ; 20 setCaption( tr( "ppp connection " ) ) ;
19 21
20 m_device = device; 22 m_device = device;
21 23
22 layout = new QVBoxLayout( this ); 24 layout = new QVBoxLayout( this );
23 25
24 QLabel* info = new QLabel( this ); 26 QLabel* info = new QLabel( this );
25 info->setText( tr("Enter an ppp script name:") ); 27 info->setText( tr("Enter an ppp script name:") );
26 28
27 cmdLine = new QLineEdit( this ); 29 cmdLine = new QLineEdit( this );
28 30
29 outPut = new QMultiLineEdit( this ); 31 outPut = new QMultiLineEdit( this );
30 QFont outPut_font( outPut->font() ); 32 QFont outPut_font( outPut->font() );
31 outPut_font.setPointSize( 8 ); 33 outPut_font.setPointSize( 8 );
32 outPut->setFont( outPut_font ); 34 outPut->setFont( outPut_font );
33 outPut->setWordWrap( QMultiLineEdit::WidgetWidth ); 35 outPut->setWordWrap( QMultiLineEdit::WidgetWidth );
34 36
35 connectButton = new QPushButton( this ); 37 connectButton = new QPushButton( this );
36 connectButton->setText( tr( "Connect" ) ); 38 connectButton->setText( tr( "Connect" ) );
37 39
38 layout->addWidget(info); 40 layout->addWidget(info);
39 layout->addWidget(cmdLine); 41 layout->addWidget(cmdLine);
40 layout->addWidget(outPut); 42 layout->addWidget(outPut);
41 layout->addWidget(connectButton); 43 layout->addWidget(connectButton);
42 44
43 connect( connectButton, SIGNAL( clicked() ), this, SLOT( connectToDevice() ) ); 45 connect( connectButton, SIGNAL( clicked() ), this, SLOT( connectToDevice() ) );
44 46
45} 47}
46 48
47PPPDialog::~PPPDialog() { 49PPPDialog::~PPPDialog() {
48} 50}
49 51
50void PPPDialog::connectToDevice() { 52void PPPDialog::connectToDevice() {
51 outPut->clear(); 53 outPut->clear();
52 // vom popupmenu beziehen 54 // vom popupmenu beziehen
53 QString connectScript = "/etc/ppp/peers/" + cmdLine->text(); 55 QString connectScript = "/etc/ppp/peers/" + cmdLine->text();
54 OProcess* pppDial = new OProcess(); 56 OProcess* pppDial = new OProcess();
55 *pppDial << "pppd" << m_device << "call" << connectScript; 57 *pppDial << "pppd" << m_device << "call" << connectScript;
56 connect( pppDial, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int) ), 58 connect( pppDial, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int) ),
57 this, SLOT(fillOutPut(Opie::Core::OProcess*,char*,int) ) ); 59 this, SLOT(fillOutPut(Opie::Core::OProcess*,char*,int) ) );
58 if (!pppDial->start(OProcess::DontCare, OProcess::AllOutput) ) { 60 if (!pppDial->start(OProcess::DontCare, OProcess::AllOutput) ) {
59 owarn << "could not start" << oendl; 61 owarn << "could not start" << oendl;
60 delete pppDial; 62 delete pppDial;
61 } 63 }
62} 64}
63 65
64void PPPDialog::fillOutPut( OProcess* pppDial, char* cha, int len ) { 66void PPPDialog::fillOutPut( OProcess* pppDial, char* cha, int len ) {
65 QCString str(cha, len ); 67 QCString str(cha, len );
66 outPut->insertLine( str ); 68 outPut->insertLine( str );
67 delete pppDial; 69 delete pppDial;
68} 70}
69 71
diff --git a/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp b/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp
index 4469129..3fe2ea6 100644
--- a/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp
+++ b/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp
@@ -1,135 +1,137 @@
1 1
2#include "rfcommassigndialogimpl.h" 2#include "rfcommassigndialogimpl.h"
3#include "rfcommassigndialogitem.h" 3#include "rfcommassigndialogitem.h"
4#include "rfcommconfhandler.h" 4#include "rfcommconfhandler.h"
5 5
6/* OPIE */ 6/* OPIE */
7#include <qpe/config.h> 7#include <qpe/config.h>
8#include <qpe/qpeapplication.h> 8#include <qpe/qpeapplication.h>
9#include <opie2/odebug.h>
10using namespace Opie::Core;
9 11
10/* QT */ 12/* QT */
11#include <qlayout.h> 13#include <qlayout.h>
12 14
13using namespace OpieTooth; 15using namespace OpieTooth;
14 16
15// TODO: write only the file in bluebase? 17// TODO: write only the file in bluebase?
16// muss rfcommd dann neu gestartet werden 18// muss rfcommd dann neu gestartet werden
17// sollte rfcomm bind all nicht eh default config sein ( polled das? - d.h. sobald nen gerät in der nähe ist bindet es? 19// sollte rfcomm bind all nicht eh default config sein ( polled das? - d.h. sobald nen gerät in der nähe ist bindet es?
18 20
19 21
20RfcommAssignDialog::RfcommAssignDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) 22RfcommAssignDialog::RfcommAssignDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
21 : RfcommAssignDialogBase( parent, name, modal, fl ) 23 : RfcommAssignDialogBase( parent, name, modal, fl )
22{ 24{
23 25
24 m_range = 5; 26 m_range = 5;
25 27
26 m_scrollView = new QScrollView( this ); 28 m_scrollView = new QScrollView( this );
27 m_scrollView->setResizePolicy( QScrollView::AutoOneFit ); 29 m_scrollView->setResizePolicy( QScrollView::AutoOneFit );
28 m_scrollView->setHScrollBarMode( QScrollView::AlwaysOff ); 30 m_scrollView->setHScrollBarMode( QScrollView::AlwaysOff );
29 31
30 RfcommAssignDialogBaseLayout->addWidget( m_scrollView ); 32 RfcommAssignDialogBaseLayout->addWidget( m_scrollView );
31 33
32 m_box = new QVBox( m_scrollView->viewport() ); 34 m_box = new QVBox( m_scrollView->viewport() );
33 m_scrollView->addChild( m_box ); 35 m_scrollView->addChild( m_box );
34 36
35 confHandler = new RfCommConfHandler( "/etc/bluetooth/rfcomm.conf" ); 37 confHandler = new RfCommConfHandler( "/etc/bluetooth/rfcomm.conf" );
36 38
37 loadConfig(); 39 loadConfig();
38} 40}
39 41
40RfcommAssignDialog::~RfcommAssignDialog() 42RfcommAssignDialog::~RfcommAssignDialog()
41{ 43{
42 if ( confHandler ) 44 if ( confHandler )
43 { 45 {
44 delete confHandler; 46 delete confHandler;
45 } 47 }
46} 48}
47 49
48 50
49void RfcommAssignDialog::newDevice( const QString & mac ) 51void RfcommAssignDialog::newDevice( const QString & mac )
50{ 52{
51 53
52 for ( int i = 0 ; i < m_range; i++ ) 54 for ( int i = 0 ; i < m_range; i++ )
53 { 55 {
54 56
55 QMap<QString, RfCommConfObject*>::Iterator it; 57 QMap<QString, RfCommConfObject*>::Iterator it;
56 it = confHandler->foundEntries().find( QString("%1").arg( i ) ); 58 it = confHandler->foundEntries().find( QString("%1").arg( i ) );
57 // make sure that rfcommX is not assigned yet 59 // make sure that rfcommX is not assigned yet
58 if ( it == confHandler->foundEntries().end() ) 60 if ( it == confHandler->foundEntries().end() )
59 { 61 {
60 QDialog dialog( this, "newdevice", true, WStyle_ContextHelp ); 62 QDialog dialog( this, "newdevice", true, WStyle_ContextHelp );
61 63
62 RfcommDialogItem *newDev = new RfcommDialogItem( &dialog ); 64 RfcommDialogItem *newDev = new RfcommDialogItem( &dialog );
63 newDev->setIdent( i ); 65 newDev->setIdent( i );
64 newDev->setMac( mac ); 66 newDev->setMac( mac );
65 67
66 if ( QPEApplication::execDialog( &dialog ) == QDialog::Accepted ) 68 if ( QPEApplication::execDialog( &dialog ) == QDialog::Accepted )
67 { 69 {
68 RfcommDialogItem *rfcomm = new RfcommDialogItem( m_box ); 70 RfcommDialogItem *rfcomm = new RfcommDialogItem( m_box );
69 m_itemList.insert( i , rfcomm ); 71 m_itemList.insert( i , rfcomm );
70 rfcomm->setIdent( i ); 72 rfcomm->setIdent( i );
71 rfcomm->setMac( mac ); 73 rfcomm->setMac( mac );
72 rfcomm->setChannel( newDev->channel() ); 74 rfcomm->setChannel( newDev->channel() );
73 rfcomm->setComment( newDev->comment() ); 75 rfcomm->setComment( newDev->comment() );
74 odebug << "New device set up" << oendl; 76 odebug << "New device set up" << oendl;
75 } 77 }
76 } 78 }
77 } 79 }
78} 80}
79 81
80void RfcommAssignDialog::loadConfig() 82void RfcommAssignDialog::loadConfig()
81{ 83{
82 84
83 //Config cfg( "bluetoothmanager-rfcommbind" ); 85 //Config cfg( "bluetoothmanager-rfcommbind" );
84 86
85 for ( int i = 0 ; i < m_range; i++ ) 87 for ( int i = 0 ; i < m_range; i++ )
86 { 88 {
87 // cfg.setGroup( QString("%1").arg( i ) ); 89 // cfg.setGroup( QString("%1").arg( i ) );
88 RfcommDialogItem *rfcomm = new RfcommDialogItem( m_box ); 90 RfcommDialogItem *rfcomm = new RfcommDialogItem( m_box );
89 m_itemList.insert( i , rfcomm ); 91 m_itemList.insert( i , rfcomm );
90 rfcomm->setIdent( i ); 92 rfcomm->setIdent( i );
91 QMap<QString, RfCommConfObject*>::Iterator it; 93 QMap<QString, RfCommConfObject*>::Iterator it;
92 it = confHandler->foundEntries().find( QString("%1").arg( i ) ); 94 it = confHandler->foundEntries().find( QString("%1").arg( i ) );
93 if ( it != confHandler->foundEntries().end() ) 95 if ( it != confHandler->foundEntries().end() )
94 { 96 {
95 odebug << "Found key in foundEntries() " << oendl; 97 odebug << "Found key in foundEntries() " << oendl;
96 rfcomm->setMac( it.data()->mac() ); 98 rfcomm->setMac( it.data()->mac() );
97 rfcomm->setChannel( it.data()->channel() ); 99 rfcomm->setChannel( it.data()->channel() );
98 rfcomm->setComment( it.data()->comment() ); 100 rfcomm->setComment( it.data()->comment() );
99 } 101 }
100 /* Use rfcomm.conf directly for now 102 /* Use rfcomm.conf directly for now
101 * rfcomm->setMac( cfg.readEntry( "mac", "" ) ); 103 * rfcomm->setMac( cfg.readEntry( "mac", "" ) );
102 * rfcomm->setChannel( cfg.readNumEntry( "channel", 1 ) ); 104 * rfcomm->setChannel( cfg.readNumEntry( "channel", 1 ) );
103 * rfcomm->setComment( cfg.readEntry( "comment", "" ) ); 105 * rfcomm->setComment( cfg.readEntry( "comment", "" ) );
104 */ 106 */
105 } 107 }
106} 108}
107 109
108 110
109void RfcommAssignDialog::saveConfig() 111void RfcommAssignDialog::saveConfig()
110{ 112{
111 113
112 //Config cfg( "bluetoothmanager-rfcommbind" ); 114 //Config cfg( "bluetoothmanager-rfcommbind" );
113 115
114 QMap< int, RfcommDialogItem*>::Iterator it; 116 QMap< int, RfcommDialogItem*>::Iterator it;
115 117
116 QMap< QString, RfCommConfObject*> outMap; 118 QMap< QString, RfCommConfObject*> outMap;
117 119
118 for( it = m_itemList.begin(); it != m_itemList.end(); ++it ) 120 for( it = m_itemList.begin(); it != m_itemList.end(); ++it )
119 { 121 {
120 122
121 //cfg.setGroup( QString("%1").arg( it.key() ) ); 123 //cfg.setGroup( QString("%1").arg( it.key() ) );
122 RfcommDialogItem *rfcomm = it.data(); 124 RfcommDialogItem *rfcomm = it.data();
123 125
124 126
125 outMap.insert( QString( "%1").arg( it.key() ), new RfCommConfObject( it.key(), rfcomm->mac(), rfcomm->channel(), rfcomm->comment() ) ); 127 outMap.insert( QString( "%1").arg( it.key() ), new RfCommConfObject( it.key(), rfcomm->mac(), rfcomm->channel(), rfcomm->comment() ) );
126 128
127 129
128 //cfg.writeEntry( "mac", rfcomm->mac() ); 130 //cfg.writeEntry( "mac", rfcomm->mac() );
129 //cfg.writeEntry( "channel", rfcomm->channel() ); 131 //cfg.writeEntry( "channel", rfcomm->channel() );
130 //cfg.writeEntry( "comment", rfcomm->comment() ); 132 //cfg.writeEntry( "comment", rfcomm->comment() );
131 } 133 }
132 134
133 confHandler->save( outMap ); 135 confHandler->save( outMap );
134 136
135} 137}
diff --git a/noncore/net/opietooth/manager/rfcommconfhandler.cpp b/noncore/net/opietooth/manager/rfcommconfhandler.cpp
index 2ef95ff..1f7ba65 100644
--- a/noncore/net/opietooth/manager/rfcommconfhandler.cpp
+++ b/noncore/net/opietooth/manager/rfcommconfhandler.cpp
@@ -1,114 +1,116 @@
1 1
2#include <qtextstream.h> 2#include <qtextstream.h>
3#include <opie2/odebug.h>
4using namespace Opie::Core;
3 5
4#include "rfcommconfhandler.h" 6#include "rfcommconfhandler.h"
5 7
6 8
7using namespace OpieTooth; 9using namespace OpieTooth;
8 10
9// move to lib 11// move to lib
10 12
11 13
12RfCommConfObject::RfCommConfObject( int number, QString mac, int channel, QString comment ) { 14RfCommConfObject::RfCommConfObject( int number, QString mac, int channel, QString comment ) {
13 m_number = number; 15 m_number = number;
14 m_mac = mac; 16 m_mac = mac;
15 m_channel = channel; 17 m_channel = channel;
16 m_comment = comment; 18 m_comment = comment;
17 // m_foundEntries = 0; 19 // m_foundEntries = 0;
18} 20}
19 21
20void RfCommConfObject::setNumber( int number ) { 22void RfCommConfObject::setNumber( int number ) {
21 m_number = number; 23 m_number = number;
22} 24}
23 25
24void RfCommConfObject::setMac( QString mac ) { 26void RfCommConfObject::setMac( QString mac ) {
25 m_mac = mac; 27 m_mac = mac;
26} 28}
27 29
28void RfCommConfObject::setChannel( int channel ) { 30void RfCommConfObject::setChannel( int channel ) {
29 m_channel = channel; 31 m_channel = channel;
30} 32}
31 33
32void RfCommConfObject::setComment( QString comment ) { 34void RfCommConfObject::setComment( QString comment ) {
33 m_comment = comment; 35 m_comment = comment;
34} 36}
35 37
36 38
37RfCommConfObject::~RfCommConfObject() { 39RfCommConfObject::~RfCommConfObject() {
38} 40}
39 41
40 42
41RfCommConfHandler::RfCommConfHandler( const QString & filename ) { 43RfCommConfHandler::RfCommConfHandler( const QString & filename ) {
42 44
43 m_filename = filename; 45 m_filename = filename;
44 load(); 46 load();
45} 47}
46 48
47RfCommConfHandler::~RfCommConfHandler() { 49RfCommConfHandler::~RfCommConfHandler() {
48 50
49} 51}
50 52
51void RfCommConfHandler::save( QMap<QString, RfCommConfObject*> devices ) { 53void RfCommConfHandler::save( QMap<QString, RfCommConfObject*> devices ) {
52 54
53 QFile rfCommConf( "/tmp/test" ); 55 QFile rfCommConf( "/tmp/test" );
54 QTextStream outStream( &rfCommConf ); 56 QTextStream outStream( &rfCommConf );
55 if ( rfCommConf.open( IO_WriteOnly ) ) { 57 if ( rfCommConf.open( IO_WriteOnly ) ) {
56 58
57 QMap<QString, RfCommConfObject*>::Iterator it; 59 QMap<QString, RfCommConfObject*>::Iterator it;
58 for( it = devices.begin(); it != devices.end(); ++it ) { 60 for( it = devices.begin(); it != devices.end(); ++it ) {
59 outStream << "rfcomm" + QString("%1").arg( it.data()->number() ) + " {\n"; 61 outStream << "rfcomm" + QString("%1").arg( it.data()->number() ) + " {\n";
60 outStream << " device " + it.data()->mac() + ";\n"; 62 outStream << " device " + it.data()->mac() + ";\n";
61 outStream << " channel " + QString( "%1" ).arg( it.data()->channel() ) + ";\n"; 63 outStream << " channel " + QString( "%1" ).arg( it.data()->channel() ) + ";\n";
62 outStream << " comment \"" + it.data()->comment() + "\";\n"; 64 outStream << " comment \"" + it.data()->comment() + "\";\n";
63 outStream << "}\n\n"; 65 outStream << "}\n\n";
64 } 66 }
65 67
66 rfCommConf.close(); 68 rfCommConf.close();
67 } 69 }
68} 70}
69 71
70 72
71QMap<QString, RfCommConfObject*> RfCommConfHandler::foundEntries() { 73QMap<QString, RfCommConfObject*> RfCommConfHandler::foundEntries() {
72 return m_foundEntries; 74 return m_foundEntries;
73} 75}
74 76
75void RfCommConfHandler::load() { 77void RfCommConfHandler::load() {
76 78
77 QFile rfCommConf( m_filename ); 79 QFile rfCommConf( m_filename );
78 if ( rfCommConf.open( IO_ReadOnly ) ) { 80 if ( rfCommConf.open( IO_ReadOnly ) ) {
79 81
80 QStringList list; 82 QStringList list;
81 QTextStream inStream( &rfCommConf ); 83 QTextStream inStream( &rfCommConf );
82 list = QStringList::split( "\n", inStream.read() ); 84 list = QStringList::split( "\n", inStream.read() );
83 85
84 QString number; 86 QString number;
85 QString mac; 87 QString mac;
86 QString channel; 88 QString channel;
87 QString comment; 89 QString comment;
88 90
89 for ( QStringList::Iterator line=list.begin(); line != list.end(); line++ ) { 91 for ( QStringList::Iterator line=list.begin(); line != list.end(); line++ ) {
90 92
91 QString tmpLine = ( *line ).stripWhiteSpace(); 93 QString tmpLine = ( *line ).stripWhiteSpace();
92 94
93 if ( tmpLine.startsWith("rfcomm") ) { 95 if ( tmpLine.startsWith("rfcomm") ) {
94 QString number = tmpLine.mid( 6,1 ); 96 QString number = tmpLine.mid( 6,1 );
95 odebug << tmpLine << oendl; 97 odebug << tmpLine << oendl;
96 odebug << "TEST " + number << oendl; 98 odebug << "TEST " + number << oendl;
97 } else if ( tmpLine.startsWith( "}" ) ) { 99 } else if ( tmpLine.startsWith( "}" ) ) {
98 m_foundEntries.insert( number, new RfCommConfObject( number.toInt(), mac, channel.toInt(), comment ) ); 100 m_foundEntries.insert( number, new RfCommConfObject( number.toInt(), mac, channel.toInt(), comment ) );
99 } else if ( tmpLine.startsWith( "device" ) ) { 101 } else if ( tmpLine.startsWith( "device" ) ) {
100 mac = tmpLine.mid( 7, 17 ); 102 mac = tmpLine.mid( 7, 17 );
101 odebug << "mac" + mac << oendl; 103 odebug << "mac" + mac << oendl;
102 } else if ( tmpLine.startsWith( "channel" ) ) { 104 } else if ( tmpLine.startsWith( "channel" ) ) {
103 channel = tmpLine.mid( 8, 1 ); 105 channel = tmpLine.mid( 8, 1 );
104 qDebug ( "Channel :" + channel ); 106 qDebug ( "Channel :" + channel );
105 } else if ( tmpLine.startsWith( "comment" ) ) { 107 } else if ( tmpLine.startsWith( "comment" ) ) {
106 comment = tmpLine.mid( 9, tmpLine.find( ';' ) - 9 - 1 ); 108 comment = tmpLine.mid( 9, tmpLine.find( ';' ) - 9 - 1 );
107 odebug << "Comment: " + comment << oendl; 109 odebug << "Comment: " + comment << oendl;
108 } 110 }
109 } 111 }
110 rfCommConf.close(); 112 rfCommConf.close();
111 } 113 }
112 save( m_foundEntries ); 114 save( m_foundEntries );
113 odebug << QString( "ENTries: %1").arg( m_foundEntries.count() ) << oendl; 115 odebug << QString( "ENTries: %1").arg( m_foundEntries.count() ) << oendl;
114} 116}
diff --git a/noncore/net/opietooth/manager/rfcpopup.cpp b/noncore/net/opietooth/manager/rfcpopup.cpp
index 01ad616..54f1eb7 100644
--- a/noncore/net/opietooth/manager/rfcpopup.cpp
+++ b/noncore/net/opietooth/manager/rfcpopup.cpp
@@ -1,103 +1,105 @@
1 1
2#include "pppdialog.h" 2#include "pppdialog.h"
3#include "rfcpopup.h" 3#include "rfcpopup.h"
4#include "rfcommassigndialogimpl.h" 4#include "rfcommassigndialogimpl.h"
5 5
6/* OPIE */ 6/* OPIE */
7#include <qpe/qpeapplication.h> 7#include <qpe/qpeapplication.h>
8#include <opie2/odebug.h>
9using namespace Opie::Core;
8 10
9/* QT */ 11/* QT */
10#include <qtimer.h> 12#include <qtimer.h>
11 13
12using namespace OpieTooth; 14using namespace OpieTooth;
13 15
14/* 16/*
15 * c'tor init the QAction 17 * c'tor init the QAction
16 */ 18 */
17RfcCommPopup::RfcCommPopup( OpieTooth::BTDeviceItem* item ) 19RfcCommPopup::RfcCommPopup( OpieTooth::BTDeviceItem* item )
18 : QPopupMenu() 20 : QPopupMenu()
19{ 21{
20 owarn << "RfcCommPopup c'tor" << oendl; 22 owarn << "RfcCommPopup c'tor" << oendl;
21 23
22 QAction* a; 24 QAction* a;
23 25
24 26
25 m_item = item; 27 m_item = item;
26 28
27 /* connect action */ 29 /* connect action */
28 a = new QAction( ); // so it's get deleted 30 a = new QAction( ); // so it's get deleted
29 a->setText("Connect"); 31 a->setText("Connect");
30 a->addTo( this ); 32 a->addTo( this );
31 connect( a, SIGNAL( activated() ), 33 connect( a, SIGNAL( activated() ),
32 this, SLOT( slotConnect() ) ); 34 this, SLOT( slotConnect() ) );
33 35
34 36
35 /* disconnect action */ 37 /* disconnect action */
36 a = new QAction( ); 38 a = new QAction( );
37 a->setText("Disconnect"); 39 a->setText("Disconnect");
38 a->addTo( this ); 40 a->addTo( this );
39 connect( a, SIGNAL( activated() ) , 41 connect( a, SIGNAL( activated() ) ,
40 this, SLOT( slotDisconnect() ) ); 42 this, SLOT( slotDisconnect() ) );
41 43
42 44
43 /* foo action */ 45 /* foo action */
44 a = new QAction( ); 46 a = new QAction( );
45 a->setText("Bind table"); 47 a->setText("Bind table");
46 a->addTo( this ); 48 a->addTo( this );
47 connect( a, SIGNAL( activated() ), 49 connect( a, SIGNAL( activated() ),
48 this, SLOT( slotBind() ) ); 50 this, SLOT( slotBind() ) );
49 51
50 52
51 /* bar action */ 53 /* bar action */
52 a = new QAction( ); 54 a = new QAction( );
53 a->setText( "Bar" ); 55 a->setText( "Bar" );
54 a->addTo( this ); 56 a->addTo( this );
55 connect( a, SIGNAL( activated() ), 57 connect( a, SIGNAL( activated() ),
56 this, SLOT( slotBar() ) ); 58 this, SLOT( slotBar() ) );
57 59
58}; 60};
59 61
60 62
61RfcCommPopup::~RfcCommPopup() 63RfcCommPopup::~RfcCommPopup()
62{ 64{
63 /* delete m_con; 65 /* delete m_con;
64 delete m_dis; 66 delete m_dis;
65 delete m_foo; 67 delete m_foo;
66 delete m_bar; */ 68 delete m_bar; */
67} 69}
68 70
69 71
70void RfcCommPopup::slotConnect() 72void RfcCommPopup::slotConnect()
71{ 73{
72 74
73 owarn << "connect" << oendl; 75 owarn << "connect" << oendl;
74 76
75 PPPDialog pppDialog; 77 PPPDialog pppDialog;
76 QPEApplication::execDialog( &pppDialog ); 78 QPEApplication::execDialog( &pppDialog );
77} 79}
78 80
79 81
80void RfcCommPopup::slotDisconnect() 82void RfcCommPopup::slotDisconnect()
81{ 83{
82 owarn << "slot disconnected" << oendl; 84 owarn << "slot disconnected" << oendl;
83} 85}
84 86
85 87
86void RfcCommPopup::slotBind() 88void RfcCommPopup::slotBind()
87{ 89{
88 RfcommAssignDialog rfcommAssign ( this, "RfcommAssignDialog", true, WStyle_ContextHelp ); 90 RfcommAssignDialog rfcommAssign ( this, "RfcommAssignDialog", true, WStyle_ContextHelp );
89 91
90 rfcommAssign.newDevice( m_item->mac() ); 92 rfcommAssign.newDevice( m_item->mac() );
91 93
92 if ( QPEApplication::execDialog( &rfcommAssign ) == QDialog::Accepted ) 94 if ( QPEApplication::execDialog( &rfcommAssign ) == QDialog::Accepted )
93 { 95 {
94 rfcommAssign.saveConfig(); 96 rfcommAssign.saveConfig();
95 } 97 }
96} 98}
97 99
98 100
99void RfcCommPopup::slotBar() 101void RfcCommPopup::slotBar()
100{ 102{
101 owarn << "slotBar" << oendl; 103 owarn << "slotBar" << oendl;
102}; 104};
103 105
diff --git a/noncore/net/opietooth/manager/scandialog.cpp b/noncore/net/opietooth/manager/scandialog.cpp
index 3b005c4..bccc6c2 100644
--- a/noncore/net/opietooth/manager/scandialog.cpp
+++ b/noncore/net/opietooth/manager/scandialog.cpp
@@ -1,161 +1,164 @@
1/* main.cpp 1/* main.cpp
2 * 2 *
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 18
19#include "scandialog.h" 19#include "scandialog.h"
20 20
21#include <qheader.h> 21#include <qheader.h>
22#include <qlistview.h> 22#include <qlistview.h>
23#include <qpushbutton.h> 23#include <qpushbutton.h>
24#include <qlayout.h> 24#include <qlayout.h>
25#include <qvariant.h> 25#include <qvariant.h>
26#include <qtooltip.h> 26#include <qtooltip.h>
27#include <qwhatsthis.h> 27#include <qwhatsthis.h>
28#include <qprogressbar.h> 28#include <qprogressbar.h>
29#include <qlist.h> 29#include <qlist.h>
30 30
31#include <manager.h> 31#include <manager.h>
32#include <device.h> 32#include <device.h>
33 33
34#include <opie2/odebug.h>
35using namespace Opie::Core;
36
34 37
35namespace OpieTooth { 38namespace OpieTooth {
36 39
37#include <remotedevice.h> 40#include <remotedevice.h>
38 41
39/** 42/**
40 */ 43 */
41 ScanDialog::ScanDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) 44 ScanDialog::ScanDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
42 : QDialog( parent, name, modal, fl ) { 45 : QDialog( parent, name, modal, fl ) {
43 46
44 setCaption( tr( "Scan for devices" ) ); 47 setCaption( tr( "Scan for devices" ) );
45 48
46 Layout11 = new QVBoxLayout( this ); 49 Layout11 = new QVBoxLayout( this );
47 Layout11->setSpacing( 6 ); 50 Layout11->setSpacing( 6 );
48 Layout11->setMargin( 0 ); 51 Layout11->setMargin( 0 );
49 52
50 progress = new QProgressBar( this, "progbar"); 53 progress = new QProgressBar( this, "progbar");
51 progress->setTotalSteps(20); 54 progress->setTotalSteps(20);
52 55
53 StartStopButton = new QPushButton( this, "StartButton" ); 56 StartStopButton = new QPushButton( this, "StartButton" );
54 StartStopButton->setText( tr( "Start scan" ) ); 57 StartStopButton->setText( tr( "Start scan" ) );
55 58
56 ListView1 = new QListView( this, "ListView1" ); 59 ListView1 = new QListView( this, "ListView1" );
57 60
58 //ListView1->addColumn( tr( "Add" ) ); 61 //ListView1->addColumn( tr( "Add" ) );
59 ListView1->addColumn( tr( "Add Device" ) ); 62 ListView1->addColumn( tr( "Add Device" ) );
60 //ListView1->addColumn( tr( "Type" ) ); 63 //ListView1->addColumn( tr( "Type" ) );
61 64
62 Layout11->addWidget( ListView1 ); 65 Layout11->addWidget( ListView1 );
63 Layout11->addWidget( progress ); 66 Layout11->addWidget( progress );
64 Layout11->addWidget( StartStopButton ); 67 Layout11->addWidget( StartStopButton );
65 68
66 localDevice = new Manager( "hci0" ); 69 localDevice = new Manager( "hci0" );
67 70
68 connect( StartStopButton, SIGNAL( clicked() ), this, SLOT( startSearch() ) ); 71 connect( StartStopButton, SIGNAL( clicked() ), this, SLOT( startSearch() ) );
69 connect( localDevice, SIGNAL( foundDevices(const QString&,RemoteDevice::ValueList) ), 72 connect( localDevice, SIGNAL( foundDevices(const QString&,RemoteDevice::ValueList) ),
70 this, SLOT( fillList(const QString&,RemoteDevice::ValueList) ) ) ; 73 this, SLOT( fillList(const QString&,RemoteDevice::ValueList) ) ) ;
71 74
72 progressStat = 0; 75 progressStat = 0;
73 m_search = false; 76 m_search = false;
74 } 77 }
75 78
76// hack, make cleaner later 79// hack, make cleaner later
77 void ScanDialog::progressTimer() { 80 void ScanDialog::progressTimer() {
78 81
79 progressStat++; 82 progressStat++;
80 if ( progressStat++ < 20 && m_search ) { 83 if ( progressStat++ < 20 && m_search ) {
81 QTimer::singleShot( 2000, this, SLOT( progressTimer() ) ); 84 QTimer::singleShot( 2000, this, SLOT( progressTimer() ) );
82 progress->setProgress( progressStat++ ); 85 progress->setProgress( progressStat++ );
83 } 86 }
84 } 87 }
85 88
86 void ScanDialog::accept() { 89 void ScanDialog::accept() {
87 emitToManager(); 90 emitToManager();
88 QDialog::accept(); 91 QDialog::accept();
89 } 92 }
90 93
91 94
92 void ScanDialog::startSearch() { 95 void ScanDialog::startSearch() {
93 if ( m_search ) { 96 if ( m_search ) {
94 stopSearch(); 97 stopSearch();
95 return; 98 return;
96 } 99 }
97 m_search = true; 100 m_search = true;
98 progress->setProgress(0); 101 progress->setProgress(0);
99 progressStat = 0; 102 progressStat = 0;
100 103
101 // empty list before a new scan 104 // empty list before a new scan
102 ListView1->clear(); 105 ListView1->clear();
103 106
104 progressTimer(); 107 progressTimer();
105 // when finished, it emmite foundDevices() 108 // when finished, it emmite foundDevices()
106 // checken ob initialisiert , qcop ans applet. 109 // checken ob initialisiert , qcop ans applet.
107 StartStopButton->setText( tr( "Stop scan" ) ); 110 StartStopButton->setText( tr( "Stop scan" ) );
108 111
109 localDevice->searchDevices(); 112 localDevice->searchDevices();
110 113
111 } 114 }
112 115
113 void ScanDialog::stopSearch() { 116 void ScanDialog::stopSearch() {
114 m_search = true; 117 m_search = true;
115 } 118 }
116 119
117 void ScanDialog::fillList(const QString&, RemoteDevice::ValueList deviceList) { 120 void ScanDialog::fillList(const QString&, RemoteDevice::ValueList deviceList) {
118 progress->setProgress(0); 121 progress->setProgress(0);
119 progressStat = 0; 122 progressStat = 0;
120 QCheckListItem * deviceItem; 123 QCheckListItem * deviceItem;
121 124
122 RemoteDevice::ValueList::Iterator it; 125 RemoteDevice::ValueList::Iterator it;
123 for( it = deviceList.begin(); it != deviceList.end(); ++it ) { 126 for( it = deviceList.begin(); it != deviceList.end(); ++it ) {
124 127
125 deviceItem = new QCheckListItem( ListView1, (*it).name(), QCheckListItem::CheckBox ); 128 deviceItem = new QCheckListItem( ListView1, (*it).name(), QCheckListItem::CheckBox );
126 deviceItem->setText( 1, (*it).mac() ); 129 deviceItem->setText( 1, (*it).mac() );
127 } 130 }
128 m_search = false; 131 m_search = false;
129 StartStopButton->setText( tr( "Start scan" ) ); 132 StartStopButton->setText( tr( "Start scan" ) );
130 } 133 }
131 134
132/** 135/**
133 * Iterates trough the items, and collects the checked items. 136 * Iterates trough the items, and collects the checked items.
134 * Then it emits it, so the manager can connect to the signal to fill the listing. 137 * Then it emits it, so the manager can connect to the signal to fill the listing.
135 */ 138 */
136 void ScanDialog::emitToManager() { 139 void ScanDialog::emitToManager() {
137 140
138 if (!ListView1) { 141 if (!ListView1) {
139 return; 142 return;
140 } 143 }
141 144
142 QValueList<RemoteDevice> deviceList; 145 QValueList<RemoteDevice> deviceList;
143 146
144 QListViewItemIterator it( ListView1 ); 147 QListViewItemIterator it( ListView1 );
145 for ( ; it.current(); ++it ) { 148 for ( ; it.current(); ++it ) {
146 if ( ( (QCheckListItem*)it.current() )->isOn() ) { 149 if ( ( (QCheckListItem*)it.current() )->isOn() ) {
147 RemoteDevice device( it.current()->text(1), it.current()->text(0) ); 150 RemoteDevice device( it.current()->text(1), it.current()->text(0) );
148 deviceList.append( device ); 151 deviceList.append( device );
149 } 152 }
150 } 153 }
151 emit selectedDevices( deviceList ); 154 emit selectedDevices( deviceList );
152 } 155 }
153 156
154/** 157/**
155 * Cleanup 158 * Cleanup
156 */ 159 */
157 ScanDialog::~ScanDialog() { 160 ScanDialog::~ScanDialog() {
158 owarn << "delete scan dialog" << oendl; 161 owarn << "delete scan dialog" << oendl;
159 delete localDevice; 162 delete localDevice;
160 } 163 }
161} 164}