[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/network/kbluetooth4/src/agent
From: Luiz Augusto von Dentz <luiz.dentz () gmail ! com>
Date: 2009-03-28 22:29:52
Message-ID: 1238279392.937793.5819.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 946231 by vudentz:
- Cancel current dialog if agent.Cancel is called.
M +27 -5 agent.cpp
M +2 -0 agent.h
--- trunk/playground/network/kbluetooth4/src/agent/agent.cpp #946230:946231
@@ -70,6 +70,17 @@
app->quit();
}
+int Agent::execDialog(QDialog* dialog)
+{
+ int ret;
+
+ currentDialog = dialog;
+ ret = currentDialog->exec();
+
+ currentDialog = 0;
+ return ret;
+}
+
void Agent::Authorize(QDBusObjectPath device, const QString& uuid, const QDBusMessage &msg)
{
qDebug() << "AGENT-Authorize " << device.path() << " Service: " << uuid;
@@ -77,7 +88,8 @@
authDialog->setName(remoteDevice->name());
authDialog->setAddr(remoteDevice->address());
authDialog->setService(uuid);
- int trust = authDialog->exec();
+
+ int trust = execDialog(authDialog);
qDebug() << "trust value = " << trust;
switch(trust) {
@@ -109,7 +121,7 @@
passkeyDialog->setAddr(remoteDevice->address());
passkeyDialog->clearPinCode();
- bool done = passkeyDialog->exec();
+ bool done = execDialog(passkeyDialog);
qDebug() << "pinCode " << pincode;
@@ -130,7 +142,7 @@
passkeyDialog->setName(remoteDevice->name());
passkeyDialog->setAddr(remoteDevice->address());
- bool done = passkeyDialog->exec();
+ bool done = execDialog(passkeyDialog);
qDebug() << "passkey " << QString::number(passkey);
@@ -154,7 +166,9 @@
confirmDialog->setName(remoteDevice->name());
confirmDialog->setAddr(remoteDevice->address());
confirmDialog->setPassKey(QString::number(passkey));
- bool confirm = confirmDialog->exec();
+
+ bool confirm = execDialog(confirmDialog);
+
if (confirm)
return;
@@ -168,7 +182,9 @@
confirmDialog->setName(adapter->name());
confirmDialog->setAddr(adapter->address());
confirmDialog->setMode(mode);
- bool confirm = confirmDialog->exec();
+
+ bool confirm = execDialog(confirmDialog);
+
if (confirm)
return;
@@ -179,6 +195,12 @@
void Agent::Cancel()
{
qDebug() << "AGENT-Cancel";
+
+ if (!currentDialog)
+ return;
+
+ currentDialog->reject();
+ currentDialog = 0;
}
void Agent::slotOkClicked()
--- trunk/playground/network/kbluetooth4/src/agent/agent.h #946230:946231
@@ -53,6 +53,7 @@
bool exitOnRelease();
void setExitOnRelease(bool val);
void setBluetoothInterface(Solid::Control::BluetoothInterface* iface);
+ int execDialog(QDialog*);
public slots:
@@ -79,6 +80,7 @@
PasskeyDialog* passkeyDialog;
AuthDialog* authDialog;
ConfirmDialog* confirmDialog;
+ QDialog* currentDialog;
private slots:
void slotOkClicked();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic