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 | |||
@@ -13,39 +13,40 @@ | |||
13 | 13 | ||
14 | using namespace Opie::Core; | 14 | using namespace Opie::Core; |
15 | using Opie::Security::MultiauthPluginObject; | 15 | using Opie::Security::MultiauthPluginObject; |
16 | using Opie::Security::MultiauthConfigWidget; | 16 | using Opie::Security::MultiauthConfigWidget; |
17 | 17 | ||
18 | 18 | ||
19 | /// creates and initializes the m_config Config object | 19 | /// standard c'tor |
20 | BluepingPlugin::BluepingPlugin() : MultiauthPluginObject(), m_ping(0) { | 20 | BluepingPlugin::BluepingPlugin() : MultiauthPluginObject(), m_ping(0), m_bluepingW(0) { |
21 | m_config = new Config("Security"); | ||
22 | m_config->setGroup("BluepingPlugin"); | ||
23 | bluetoothAlreadyRestarted = false; | 21 | bluetoothAlreadyRestarted = false; |
24 | } | 22 | } |
25 | 23 | ||
26 | /// deletes the m_config Config object and noticeW if necessary | 24 | /// cleans m_ping if we need to |
27 | BluepingPlugin::~BluepingPlugin() { | 25 | BluepingPlugin::~BluepingPlugin() { |
28 | delete m_config; | ||
29 | delete m_ping; | 26 | delete m_ping; |
27 | if (m_bluepingW != 0) | ||
28 | delete m_bluepingW; | ||
30 | } | 29 | } |
31 | 30 | ||
32 | /// Simply return its name (Blueping plugin) | 31 | /// Simply return its name (Blueping plugin) |
33 | QString BluepingPlugin::pluginName() const { | 32 | QString BluepingPlugin::pluginName() const { |
34 | return "Blueping plugin"; | 33 | return "Blueping plugin"; |
35 | } | 34 | } |
36 | 35 | ||
37 | /// no configuration widget for the moment | 36 | /// returns a BluepingConfigWidget |
38 | MultiauthConfigWidget * BluepingPlugin::configWidget(QWidget * parent) { | 37 | MultiauthConfigWidget * BluepingPlugin::configWidget(QWidget * parent) { |
39 | return 0l; | 38 | if (m_bluepingW == 0) |
39 | m_bluepingW = new BluepingConfigWidget(parent, "Blueping configuration widget"); | ||
40 | return m_bluepingW; | ||
40 | } | 41 | } |
41 | QString BluepingPlugin::pixmapNameWidget() const { | 42 | QString BluepingPlugin::pixmapNameWidget() const { |
42 | return "security/bluepingplugin"; | 43 | return "security/bluepingplugin"; |
43 | } | 44 | } |
44 | QString BluepingPlugin::pixmapNameConfig() const { | 45 | QString BluepingPlugin::pixmapNameConfig() const { |
45 | return 0l; | 46 | return "security/bluepingplugin"; |
46 | } | 47 | } |
47 | 48 | ||
48 | /// Emit the MultiauthPluginObject::Success emitCode | 49 | /// Emit the MultiauthPluginObject::Success emitCode |
49 | void BluepingPlugin::success() { | 50 | void BluepingPlugin::success() { |
50 | emit emitCode(MultiauthPluginObject::Success); | 51 | emit emitCode(MultiauthPluginObject::Success); |
51 | } | 52 | } |
@@ -103,13 +104,13 @@ int BluepingPlugin::authenticate() { | |||
103 | Config cfg("Security"); | 104 | Config cfg("Security"); |
104 | cfg.setGroup("BluepingPlugin"); | 105 | cfg.setGroup("BluepingPlugin"); |
105 | macToPing = cfg.readEntry("mac"); | 106 | macToPing = cfg.readEntry("mac"); |
106 | if (!macToPing.isEmpty()) | 107 | if (!macToPing.isEmpty()) |
107 | { | 108 | { |
108 | /* Standard, inescapable authentication dialog | 109 | /* Standard, inescapable authentication dialog |
109 | */ | 110 | */ |
110 | QDialog bluepingDialog(0, | 111 | QDialog bluepingDialog(0, |
111 | "Blueping dialog", | 112 | "Blueping dialog", |
112 | TRUE, | 113 | TRUE, |
113 | Qt::WStyle_NoBorder | Qt::WStyle_Customize | Qt::WStyle_StaysOnTop); | 114 | Qt::WStyle_NoBorder | Qt::WStyle_Customize | Qt::WStyle_StaysOnTop); |
114 | 115 | ||
115 | QRect desk = oApp->desktop()->geometry(); | 116 | QRect desk = oApp->desktop()->geometry(); |
@@ -132,12 +133,14 @@ int BluepingPlugin::authenticate() { | |||
132 | 133 | ||
133 | // connect the skip button to the skip signal emitting function | 134 | // connect the skip button to the skip signal emitting function |
134 | QObject::connect(&pbSkip, SIGNAL(clicked()), this, SLOT(skip())); | 135 | QObject::connect(&pbSkip, SIGNAL(clicked()), this, SLOT(skip())); |
135 | // connect the signal emitting functions to the bluepingDialog done(int) finishing function | 136 | // connect the signal emitting functions to the bluepingDialog done(int) finishing function |
136 | QObject::connect(this, SIGNAL(emitCode(int)), &bluepingDialog, SLOT(done(int))); | 137 | QObject::connect(this, SIGNAL(emitCode(int)), &bluepingDialog, SLOT(done(int))); |
137 | 138 | ||
139 | // we can uncomment the following when testing | ||
140 | //bluetoothAlreadyRestarted = true; | ||
138 | if (!bluetoothAlreadyRestarted) | 141 | if (!bluetoothAlreadyRestarted) |
139 | { | 142 | { |
140 | // we have just started or resumed the device, so Bluetooth has to be (re)started | 143 | // we have just started or resumed the device, so Bluetooth has to be (re)started |
141 | OProcess killB; | 144 | OProcess killB; |
142 | killB << "killall" << "hciattach"; | 145 | killB << "killall" << "hciattach"; |
143 | odebug << "killing Bluetooth..." << oendl; | 146 | odebug << "killing Bluetooth..." << oendl; |