Diffstat (limited to 'noncore/net/opietooth/manager/bluebase.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index 9ec5bf8..924d191 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp | |||
@@ -50,12 +50,13 @@ using namespace Opie::Core; | |||
50 | #include <qlineedit.h> | 50 | #include <qlineedit.h> |
51 | #include <qlistview.h> | 51 | #include <qlistview.h> |
52 | #include <qdir.h> | 52 | #include <qdir.h> |
53 | #include <qpopupmenu.h> | 53 | #include <qpopupmenu.h> |
54 | #include <qtimer.h> | 54 | #include <qtimer.h> |
55 | #include <qlist.h> | 55 | #include <qlist.h> |
56 | #include <qfile.h> | ||
56 | 57 | ||
57 | /* STD */ | 58 | /* STD */ |
58 | #include <remotedevice.h> | 59 | #include <remotedevice.h> |
59 | #include <services.h> | 60 | #include <services.h> |
60 | #include <stdlib.h> | 61 | #include <stdlib.h> |
61 | 62 | ||
@@ -91,12 +92,13 @@ BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) | |||
91 | this, SLOT( deviceActive(const QString&,bool) ) ); | 92 | this, SLOT( deviceActive(const QString&,bool) ) ); |
92 | connect( m_localDevice, SIGNAL( connections(ConnectionState::ValueList) ), | 93 | connect( m_localDevice, SIGNAL( connections(ConnectionState::ValueList) ), |
93 | this, SLOT( addConnectedDevices(ConnectionState::ValueList) ) ); | 94 | this, SLOT( addConnectedDevices(ConnectionState::ValueList) ) ); |
94 | connect( m_localDevice, SIGNAL( signalStrength(const QString&,const QString&) ), | 95 | connect( m_localDevice, SIGNAL( signalStrength(const QString&,const QString&) ), |
95 | this, SLOT( addSignalStrength(const QString&,const QString&) ) ); | 96 | this, SLOT( addSignalStrength(const QString&,const QString&) ) ); |
96 | connect(runButton, SIGNAL(clicked()), this, SLOT(doForward())); | 97 | connect(runButton, SIGNAL(clicked()), this, SLOT(doForward())); |
98 | connect(encCheckBox, SIGNAL(toggled(bool)), this, SLOT(doEncrypt(bool))); | ||
97 | 99 | ||
98 | // let hold be rightButtonClicked() | 100 | // let hold be rightButtonClicked() |
99 | QPEApplication::setStylusOperation( devicesView->viewport(), QPEApplication::RightOnHold); | 101 | QPEApplication::setStylusOperation( devicesView->viewport(), QPEApplication::RightOnHold); |
100 | QPEApplication::setStylusOperation( connectionsView->viewport(), QPEApplication::RightOnHold); | 102 | QPEApplication::setStylusOperation( connectionsView->viewport(), QPEApplication::RightOnHold); |
101 | 103 | ||
102 | //Load all icons needed | 104 | //Load all icons needed |
@@ -127,12 +129,13 @@ BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) | |||
127 | forwarder = NULL; | 129 | forwarder = NULL; |
128 | serDevName->setText(tr("/dev/ircomm0")); | 130 | serDevName->setText(tr("/dev/ircomm0")); |
129 | for (unsigned int i = 0; i < (sizeof(speeds) / sizeof(speeds[0])); i++) { | 131 | for (unsigned int i = 0; i < (sizeof(speeds) / sizeof(speeds[0])); i++) { |
130 | serSpeed->insertItem(speeds[i].str); | 132 | serSpeed->insertItem(speeds[i].str); |
131 | } | 133 | } |
132 | serSpeed->setCurrentItem((sizeof(speeds) / sizeof(speeds[0])) - 1); | 134 | serSpeed->setCurrentItem((sizeof(speeds) / sizeof(speeds[0])) - 1); |
135 | encCheckBox->setChecked(true); | ||
133 | } | 136 | } |
134 | 137 | ||
135 | /** | 138 | /** |
136 | * Reads all options from the config file | 139 | * Reads all options from the config file |
137 | */ | 140 | */ |
138 | void BlueBase::readConfig() | 141 | void BlueBase::readConfig() |
@@ -170,22 +173,30 @@ void BlueBase::writeConfig() | |||
170 | 173 | ||
171 | /** | 174 | /** |
172 | * Modify the hcid.conf file to our needs | 175 | * Modify the hcid.conf file to our needs |
173 | */ | 176 | */ |
174 | void BlueBase::writeToHciConfig() | 177 | void BlueBase::writeToHciConfig() |
175 | { | 178 | { |
179 | QFile pinFile("/etc/bluetooth/pin"); // /etc/bluetooth/pin file | ||
176 | owarn << "writeToHciConfig" << oendl; | 180 | owarn << "writeToHciConfig" << oendl; |
181 | //Write /etc/bluetooth/hcid.conf file | ||
177 | HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" ); | 182 | HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" ); |
178 | hciconf.load(); | 183 | hciconf.load(); |
179 | hciconf.setPinHelper( QPEApplication::qpeDir() + "bin/bluepin" ); | 184 | hciconf.setPinHelper( QPEApplication::qpeDir() + "bin/bluepin" ); |
180 | hciconf.setName( m_deviceName ); | 185 | hciconf.setName( m_deviceName ); |
181 | hciconf.setEncrypt( m_useEncryption ); | 186 | hciconf.setEncrypt( m_useEncryption ); |
182 | hciconf.setAuth( m_enableAuthentification ); | 187 | hciconf.setAuth( m_enableAuthentification ); |
183 | hciconf.setPscan( m_enablePagescan ); | 188 | hciconf.setPscan( m_enablePagescan ); |
184 | hciconf.setIscan( m_enableInquiryscan ); | 189 | hciconf.setIscan( m_enableInquiryscan ); |
185 | hciconf.save(); | 190 | hciconf.save(); |
191 | // Write /etc/bluetooth/pin (default PIN file) | ||
192 | pinFile.open(IO_WriteOnly | IO_Truncate); | ||
193 | pinFile.writeBlock(m_defaultPasskey, m_defaultPasskey.length()); | ||
194 | pinFile.writeBlock("\n", sizeof("\n")); | ||
195 | pinFile.flush(); | ||
196 | pinFile.close(); | ||
186 | } | 197 | } |
187 | 198 | ||
188 | 199 | ||
189 | /** | 200 | /** |
190 | * Read the list of already known devices | 201 | * Read the list of already known devices |
191 | */ | 202 | */ |
@@ -737,7 +748,16 @@ void BlueBase::forwardExit(Opie::Core::OProcess* proc) | |||
737 | tr("Forwarder start error")); | 748 | tr("Forwarder start error")); |
738 | delete proc; | 749 | delete proc; |
739 | forwarder = NULL; | 750 | forwarder = NULL; |
740 | runButton->setText("start gateway"); | 751 | runButton->setText("start gateway"); |
741 | } | 752 | } |
742 | 753 | ||
754 | /** | ||
755 | * Encrypt entered passkey | ||
756 | * doit - do encryption of the key | ||
757 | */ | ||
758 | void BlueBase::doEncrypt(bool doit) | ||
759 | { | ||
760 | passkeyLine->setEchoMode((doit)? QLineEdit::Password: QLineEdit::Normal); | ||
761 | } | ||
762 | |||
743 | //eof | 763 | //eof |