summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth/manager/bluebase.cpp
authorkorovkin <korovkin>2006-04-15 16:03:19 (UTC)
committer korovkin <korovkin>2006-04-15 16:03:19 (UTC)
commit6d3a8eaf3b92f8eec9908eed91568342fac5de1d (patch) (side-by-side diff)
treedeb2f977342b99f72ddcbbaec4066c81278cd65f /noncore/net/opietooth/manager/bluebase.cpp
parenta1bcbe41d45924713c4ead9b25ac5518473c9ca9 (diff)
downloadopie-6d3a8eaf3b92f8eec9908eed91568342fac5de1d.zip
opie-6d3a8eaf3b92f8eec9908eed91568342fac5de1d.tar.gz
opie-6d3a8eaf3b92f8eec9908eed91568342fac5de1d.tar.bz2
Added default passkey writing to /etc/bluetooth/pin file.
Added encrypt default passkey in edit line button.
Diffstat (limited to 'noncore/net/opietooth/manager/bluebase.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp20
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
@@ -53,6 +53,7 @@ using namespace Opie::Core;
#include <qpopupmenu.h>
#include <qtimer.h>
#include <qlist.h>
+#include <qfile.h>
/* STD */
#include <remotedevice.h>
@@ -94,6 +95,7 @@ BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl )
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);
@@ -130,6 +132,7 @@ BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl )
serSpeed->insertItem(speeds[i].str);
}
serSpeed->setCurrentItem((sizeof(speeds) / sizeof(speeds[0])) - 1);
+ encCheckBox->setChecked(true);
}
/**
@@ -173,7 +176,9 @@ void BlueBase::writeConfig()
*/
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" );
@@ -183,6 +188,12 @@ void BlueBase::writeToHciConfig()
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();
}
@@ -740,4 +751,13 @@ void BlueBase::forwardExit(Opie::Core::OProcess* proc)
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