summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp
index 910bb8c..af65f14 100644
--- a/noncore/net/opietooth/manager/bluebase.cpp
+++ b/noncore/net/opietooth/manager/bluebase.cpp
@@ -1,162 +1,162 @@
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 20
21#include <qframe.h> 21#include <qframe.h>
22#include <qlabel.h> 22#include <qlabel.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 <qwhatsthis.h> 26#include <qwhatsthis.h>
27#include <qimage.h> 27#include <qimage.h>
28#include <qpixmap.h> 28#include <qpixmap.h>
29#include <qtabwidget.h> 29#include <qtabwidget.h>
30#include <qscrollview.h> 30#include <qscrollview.h>
31#include <qvbox.h> 31#include <qvbox.h>
32#include <qmessagebox.h> 32#include <qmessagebox.h>
33#include <qapplication.h> 33#include <qapplication.h>
34#include <qcheckbox.h> 34#include <qcheckbox.h>
35#include <qlineedit.h> 35#include <qlineedit.h>
36#include <qlistview.h> 36#include <qlistview.h>
37#include <qdir.h> 37#include <qdir.h>
38#include <qpopupmenu.h> 38#include <qpopupmenu.h>
39 39
40#include <qpe/resource.h> 40#include <qpe/resource.h>
41#include <qpe/config.h> 41#include <qpe/config.h>
42 42
43#include <remotedevice.h> 43#include <remotedevice.h>
44 44
45 45
46namespace OpieTooth { 46namespace OpieTooth {
47 47
48 48
49 BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) 49 BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl )
50 : BluetoothBase( parent, name, fl ) { 50 : BluetoothBase( parent, name, fl ) {
51 51
52 localDevice = new Manager( "hci0" ); 52 localDevice = new Manager( "hci0" );
53 53
54 connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) ); 54 connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) );
55 connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) ); 55 connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) );
56 // not good since lib is async 56 // not good since lib is async
57 // connect( ListView2, SIGNAL( expanded ( QListViewItem* ) ), 57 // connect( ListView2, SIGNAL( expanded ( QListViewItem* ) ),
58 // this, SLOT( addServicesToDevice( QListViewItem * ) ) ); 58 // this, SLOT( addServicesToDevice( QListViewItem * ) ) );
59 connect( ListView2, SIGNAL( clicked( QListViewItem* )), 59 connect( ListView2, SIGNAL( clicked( QListViewItem* )),
60 this, SLOT( startServiceActionClicked( QListViewItem* ) ) ); 60 this, SLOT( startServiceActionClicked( QListViewItem* ) ) );
61 connect( ListView2, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int ) ), 61 connect( ListView2, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int ) ),
62 this, SLOT(startServiceActionHold( BTListItem *, const QPoint &, int) ) ); 62 this, SLOT(startServiceActionHold( BTListItem *, const QPoint &, int) ) );
63 connect( localDevice , SIGNAL( foundServices( const QString& , Services::ValueList ) ), 63 connect( localDevice , SIGNAL( foundServices( const QString& , Services::ValueList ) ),
64 this, SLOT( addServicesToDevice( const QString& , Services::ValueList ) ) ); 64 this, SLOT( addServicesToDevice( const QString& , Services::ValueList ) ) );
65 connect( localDevice, SIGNAL( available( const QString& device, bool connected ) ), 65 connect( localDevice, SIGNAL( available( const QString&, bool ) ),
66 this, SLOT( deviceActive( const QString& mac, bool connected ) ) ); 66 this, SLOT( deviceActive( const QString& , bool ) ) );
67 67
68 //Load all icons needed 68 //Load all icons needed
69 69
70 offPix = Resource::loadPixmap( "editdelete" ); 70 offPix = Resource::loadPixmap( "editdelete" );
71 onPix = Resource::loadPixmap( "installed" ); 71 onPix = Resource::loadPixmap( "installed" );
72 72
73 QPalette pal = this->palette(); 73 QPalette pal = this->palette();
74 QColor col = pal.color( QPalette::Active, QColorGroup::Background ); 74 QColor col = pal.color( QPalette::Active, QColorGroup::Background );
75 pal.setColor( QPalette::Active, QColorGroup::Button, col ); 75 pal.setColor( QPalette::Active, QColorGroup::Button, col );
76 pal.setColor( QPalette::Inactive, QColorGroup::Button, col ); 76 pal.setColor( QPalette::Inactive, QColorGroup::Button, col );
77 pal.setColor( QPalette::Normal, QColorGroup::Button, col ); 77 pal.setColor( QPalette::Normal, QColorGroup::Button, col );
78 pal.setColor( QPalette::Disabled, QColorGroup::Button, col ); 78 pal.setColor( QPalette::Disabled, QColorGroup::Button, col );
79 this->setPalette( pal ); 79 this->setPalette( pal );
80 80
81 setCaption( tr( "Bluetooth Manager" ) ); 81 setCaption( tr( "Bluetooth Manager" ) );
82 82
83 readConfig(); 83 readConfig();
84 initGui(); 84 initGui();
85 85
86 //TESTING 86 //TESTING
87 ListView2->setRootIsDecorated(true); 87 ListView2->setRootIsDecorated(true);
88 88
89 BTListItem *topLV2 = new BTListItem( ListView2, "Siemens S45", "", "device" ); 89 BTListItem *topLV2 = new BTListItem( ListView2, "Siemens S45", "", "device" );
90 topLV2->setPixmap( 1, onPix ); 90 topLV2->setPixmap( 1, onPix );
91 (void) new BTListItem( topLV2, "Serial" ,"", "service" ); 91 (void) new BTListItem( topLV2, "Serial" ,"", "service" );
92 (void) new BTListItem( topLV2, "BlueNiC" , "", "service" ); 92 (void) new BTListItem( topLV2, "BlueNiC" , "", "service" );
93 } 93 }
94 94
95 95
96 /** 96 /**
97 * Reads all options from the config file 97 * Reads all options from the config file
98 */ 98 */
99 void BlueBase::readConfig() { 99 void BlueBase::readConfig() {
100 100
101 Config cfg( "bluetoothmanager" ); 101 Config cfg( "bluetoothmanager" );
102 cfg.setGroup( "bluezsettings" ); 102 cfg.setGroup( "bluezsettings" );
103 103
104 104
105 deviceName = cfg.readEntry( "name" , "No name" ); // name the device should identify with 105 deviceName = cfg.readEntry( "name" , "No name" ); // name the device should identify with
106 defaultPasskey = cfg.readEntryCrypt( "passkey" , "" ); // <- hmm, look up how good the trolls did that, maybe too weak 106 defaultPasskey = cfg.readEntryCrypt( "passkey" , "" ); // <- hmm, look up how good the trolls did that, maybe too weak
107 useEncryption = cfg.readNumEntry( "useEncryption" , 1 ); 107 useEncryption = cfg.readNumEntry( "useEncryption" , 1 );
108 enableAuthentification = cfg.readNumEntry( "enableAuthentification" , 1 ); 108 enableAuthentification = cfg.readNumEntry( "enableAuthentification" , 1 );
109 enablePagescan = cfg.readNumEntry( "enablePagescan" , 1 ); 109 enablePagescan = cfg.readNumEntry( "enablePagescan" , 1 );
110 enableInquiryscan = cfg.readNumEntry( "enableInquiryscan" , 1 ); 110 enableInquiryscan = cfg.readNumEntry( "enableInquiryscan" , 1 );
111 111
112 } 112 }
113 113
114 /** 114 /**
115 * Writes all options to the config file 115 * Writes all options to the config file
116 */ 116 */
117 void BlueBase::writeConfig() { 117 void BlueBase::writeConfig() {
118 118
119 119
120 Config cfg( "bluetoothmanager" ); 120 Config cfg( "bluetoothmanager" );
121 cfg.setGroup( "bluezsettings" ); 121 cfg.setGroup( "bluezsettings" );
122 122
123 cfg.writeEntry( "name" , deviceName ); 123 cfg.writeEntry( "name" , deviceName );
124 cfg.writeEntryCrypt( "passkey" , defaultPasskey ); 124 cfg.writeEntryCrypt( "passkey" , defaultPasskey );
125 cfg.writeEntry( "useEncryption" , useEncryption ); 125 cfg.writeEntry( "useEncryption" , useEncryption );
126 cfg.writeEntry( "enableAuthentification" , enableAuthentification ); 126 cfg.writeEntry( "enableAuthentification" , enableAuthentification );
127 cfg.writeEntry( "enablePagescan" , enablePagescan ); 127 cfg.writeEntry( "enablePagescan" , enablePagescan );
128 cfg.writeEntry( "enableInquiryscan" , enableInquiryscan ); 128 cfg.writeEntry( "enableInquiryscan" , enableInquiryscan );
129} 129}
130 130
131 131
132 /** 132 /**
133 * Read the list of allready known devices 133 * Read the list of allready known devices
134 * 134 *
135 */ 135 */
136 void BlueBase::readSavedDevices() { 136 void BlueBase::readSavedDevices() {
137 137
138 QList<RemoteDevice> *loadedDevices = new QList<RemoteDevice>; 138 QList<RemoteDevice> *loadedDevices = new QList<RemoteDevice>;
139 139
140 QDir deviceListSave( QDir::homeDirPath() + "/Settings/bluetooth/"); 140 QDir deviceListSave( QDir::homeDirPath() + "/Settings/bluetooth/");
141 // list of .conf files 141 // list of .conf files
142 QStringList devicesFileList = deviceListSave.entryList(); 142 QStringList devicesFileList = deviceListSave.entryList();
143 143
144 // cut .conf of to get the mac and also read the name entry in it. 144 // cut .conf of to get the mac and also read the name entry in it.
145 145
146 for ( QStringList::Iterator it = devicesFileList.begin(); it != devicesFileList.end(); ++it ) { 146 for ( QStringList::Iterator it = devicesFileList.begin(); it != devicesFileList.end(); ++it ) {
147 147
148 QString name; 148 QString name;
149 QString mac; 149 QString mac;
150 qDebug((*it).latin1() ); 150 qDebug((*it).latin1() );
151 Config conf((*it)); 151 Config conf((*it));
152 conf.setGroup("Info"); 152 conf.setGroup("Info");
153 name = conf.readEntry("name", "Error"); 153 name = conf.readEntry("name", "Error");
154 qDebug("MAC: " + mac); 154 qDebug("MAC: " + mac);
155 qDebug("NAME: " + name); 155 qDebug("NAME: " + name);
156 RemoteDevice currentDevice = RemoteDevice( mac , name ); 156 RemoteDevice currentDevice = RemoteDevice( mac , name );
157 loadedDevices->append( &currentDevice ); 157 loadedDevices->append( &currentDevice );
158 } 158 }
159 addSearchedDevices( *loadedDevices ); 159 addSearchedDevices( *loadedDevices );
160 } 160 }
161 161
162 /** 162 /**