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; #include <qlineedit.h> #include <qlistview.h> #include <qdir.h> #include <qpopupmenu.h> #include <qtimer.h> #include <qlist.h> +#include <qfile.h> /* STD */ #include <remotedevice.h> #include <services.h> #include <stdlib.h> @@ -91,12 +92,13 @@ BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) this, SLOT( deviceActive(const QString&,bool) ) ); connect( m_localDevice, SIGNAL( connections(ConnectionState::ValueList) ), this, SLOT( addConnectedDevices(ConnectionState::ValueList) ) ); connect( m_localDevice, SIGNAL( signalStrength(const QString&,const QString&) ), this, SLOT( addSignalStrength(const QString&,const QString&) ) ); connect(runButton, SIGNAL(clicked()), this, SLOT(doForward())); + connect(encCheckBox, SIGNAL(toggled(bool)), this, SLOT(doEncrypt(bool))); // let hold be rightButtonClicked() QPEApplication::setStylusOperation( devicesView->viewport(), QPEApplication::RightOnHold); QPEApplication::setStylusOperation( connectionsView->viewport(), QPEApplication::RightOnHold); //Load all icons needed @@ -127,12 +129,13 @@ BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) forwarder = NULL; serDevName->setText(tr("/dev/ircomm0")); for (unsigned int i = 0; i < (sizeof(speeds) / sizeof(speeds[0])); i++) { serSpeed->insertItem(speeds[i].str); } serSpeed->setCurrentItem((sizeof(speeds) / sizeof(speeds[0])) - 1); + encCheckBox->setChecked(true); } /** * Reads all options from the config file */ void BlueBase::readConfig() @@ -170,22 +173,30 @@ void BlueBase::writeConfig() /** * Modify the hcid.conf file to our needs */ void BlueBase::writeToHciConfig() { + QFile pinFile("/etc/bluetooth/pin"); // /etc/bluetooth/pin file owarn << "writeToHciConfig" << oendl; + //Write /etc/bluetooth/hcid.conf file HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" ); hciconf.load(); hciconf.setPinHelper( QPEApplication::qpeDir() + "bin/bluepin" ); hciconf.setName( m_deviceName ); hciconf.setEncrypt( m_useEncryption ); hciconf.setAuth( m_enableAuthentification ); hciconf.setPscan( m_enablePagescan ); hciconf.setIscan( m_enableInquiryscan ); hciconf.save(); + // Write /etc/bluetooth/pin (default PIN file) + pinFile.open(IO_WriteOnly | IO_Truncate); + pinFile.writeBlock(m_defaultPasskey, m_defaultPasskey.length()); + pinFile.writeBlock("\n", sizeof("\n")); + pinFile.flush(); + pinFile.close(); } /** * Read the list of already known devices */ @@ -737,7 +748,16 @@ void BlueBase::forwardExit(Opie::Core::OProcess* proc) tr("Forwarder start error")); delete proc; forwarder = NULL; runButton->setText("start gateway"); } +/** + * Encrypt entered passkey + * doit - do encryption of the key + */ +void BlueBase::doEncrypt(bool doit) +{ + passkeyLine->setEchoMode((doit)? QLineEdit::Password: QLineEdit::Normal); +} + //eof |