Diffstat (limited to 'noncore/securityplugins/blueping/bluepingplugin.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/securityplugins/blueping/bluepingplugin.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/noncore/securityplugins/blueping/bluepingplugin.cpp b/noncore/securityplugins/blueping/bluepingplugin.cpp index 05fd3c2..f5d9ad6 100644 --- a/noncore/securityplugins/blueping/bluepingplugin.cpp +++ b/noncore/securityplugins/blueping/bluepingplugin.cpp @@ -7,51 +7,52 @@ #include <qdialog.h> #include <qlayout.h> #include <qhbox.h> #include <qlabel.h> #include <qpushbutton.h> #include <qtimer.h> using namespace Opie::Core; using Opie::Security::MultiauthPluginObject; using Opie::Security::MultiauthConfigWidget; -/// creates and initializes the m_config Config object -BluepingPlugin::BluepingPlugin() : MultiauthPluginObject(), m_ping(0) { - m_config = new Config("Security"); - m_config->setGroup("BluepingPlugin"); +/// standard c'tor +BluepingPlugin::BluepingPlugin() : MultiauthPluginObject(), m_ping(0), m_bluepingW(0) { bluetoothAlreadyRestarted = false; } -/// deletes the m_config Config object and noticeW if necessary +/// cleans m_ping if we need to BluepingPlugin::~BluepingPlugin() { - delete m_config; delete m_ping; + if (m_bluepingW != 0) + delete m_bluepingW; } /// Simply return its name (Blueping plugin) QString BluepingPlugin::pluginName() const { return "Blueping plugin"; } -/// no configuration widget for the moment +/// returns a BluepingConfigWidget MultiauthConfigWidget * BluepingPlugin::configWidget(QWidget * parent) { - return 0l; + if (m_bluepingW == 0) + m_bluepingW = new BluepingConfigWidget(parent, "Blueping configuration widget"); + return m_bluepingW; } QString BluepingPlugin::pixmapNameWidget() const { return "security/bluepingplugin"; } QString BluepingPlugin::pixmapNameConfig() const { - return 0l; + return "security/bluepingplugin"; } /// Emit the MultiauthPluginObject::Success emitCode void BluepingPlugin::success() { emit emitCode(MultiauthPluginObject::Success); } /// Emit the MultiauthPluginObject::Failure emitCode void BluepingPlugin::failure() { emit emitCode(MultiauthPluginObject::Failure); } @@ -97,25 +98,25 @@ void BluepingPlugin::ping() { /** * (very simple "success" / "failure" buttons in a dialog) * \return The outcome code of this authentication */ int BluepingPlugin::authenticate() { Config cfg("Security"); cfg.setGroup("BluepingPlugin"); macToPing = cfg.readEntry("mac"); if (!macToPing.isEmpty()) { /* Standard, inescapable authentication dialog - */ + */ QDialog bluepingDialog(0, "Blueping dialog", TRUE, Qt::WStyle_NoBorder | Qt::WStyle_Customize | Qt::WStyle_StaysOnTop); QRect desk = oApp->desktop()->geometry(); bluepingDialog.setGeometry( 0, 0, desk.width(), desk.height() ); // Creation of the particular widgets of our Blueping user interface QVBoxLayout *layout = new QVBoxLayout(&bluepingDialog); layout->setSpacing(11); layout->setMargin(11); @@ -126,24 +127,26 @@ int BluepingPlugin::authenticate() { QLabel subTitle2("<center>You can skip this step and use another authentication way with the following button</center>", &bluepingDialog); QPushButton pbSkip("Skip", &bluepingDialog); layout->addWidget(&title); layout->addWidget(&subTitle); layout->addWidget(&subTitle2); layout->addWidget(&pbSkip, 0, Qt::AlignHCenter); // connect the skip button to the skip signal emitting function QObject::connect(&pbSkip, SIGNAL(clicked()), this, SLOT(skip())); // connect the signal emitting functions to the bluepingDialog done(int) finishing function QObject::connect(this, SIGNAL(emitCode(int)), &bluepingDialog, SLOT(done(int))); + // we can uncomment the following when testing + //bluetoothAlreadyRestarted = true; if (!bluetoothAlreadyRestarted) { // we have just started or resumed the device, so Bluetooth has to be (re)started OProcess killB; killB << "killall" << "hciattach"; odebug << "killing Bluetooth..." << oendl; if ( !killB.start(OProcess::Block) ) { oerr << "could not kill bluetooth" << oendl; } OProcess startB; switch ( ODevice::inst()->model() ) { |