Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d2c644d
Showing
56 changed files
with
3,512 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#include "agent.h" | ||
#include "hiddennetworkdialog.h" | ||
#include "authdialog.h" | ||
#include "service.h" | ||
|
||
#include <connman/connmanagent.h> | ||
|
||
#include <QDebug> | ||
|
||
Agent::Agent(QObject *parent): | ||
QObject(parent) | ||
{ | ||
new ConnmanAgent(this); | ||
|
||
QDBusConnection connection = QDBusConnection::systemBus(); | ||
connection.registerObject("/", this); | ||
connection.registerService("net.connman.Agent"); | ||
} | ||
|
||
void Agent::Release() | ||
{ | ||
} | ||
|
||
QVariantMap Agent::RequestInput(const QDBusObjectPath &servicePath, const QVariantMap &fields) | ||
{ | ||
QVariantMap map; | ||
|
||
qDebug() << "RequestInput fields" << fields.keys(); | ||
|
||
if (fields.contains("SSID")) | ||
{ | ||
HiddenNetworkDialog dialog(Service(servicePath.path(), this).security().join(" ").toUpper(), qobject_cast<QWidget *>(parent())); | ||
if (dialog.exec() != QDialog::Accepted) | ||
return map; | ||
|
||
map.unite(dialog.toMap()); | ||
} | ||
else if (fields.contains("Passphrase")) | ||
{ | ||
Service service(servicePath.path(), this); | ||
AuthDialog dialog(service.security().join(" ").toUpper(), service.passphrase(), qobject_cast<QWidget *>(parent())); | ||
if (dialog.exec() != QDialog::Accepted) | ||
return map; | ||
|
||
map["Passphrase"] = dialog.password(); | ||
} | ||
|
||
qDebug() << "RequestInput reply" << map; | ||
|
||
return map; | ||
} | ||
|
||
void Agent::ReportError(const QDBusObjectPath &servicePath, const QString &error) | ||
{ | ||
qDebug() << "ReportError" << servicePath.path() << error; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#ifndef _AGENT_H | ||
#define _AGENT_H | ||
|
||
#include <QObject> | ||
#include <QDBusObjectPath> | ||
#include <QVariantMap> | ||
|
||
class Agent: public QObject | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
Agent(QObject *parent); | ||
|
||
public slots: | ||
void Release(); | ||
QVariantMap RequestInput(const QDBusObjectPath &servicePath, const QVariantMap &fields); | ||
void ReportError(const QDBusObjectPath &servicePath, const QString &error); | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" | ||
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> | ||
<node> | ||
<interface name="net.connman.Agent"> | ||
<method name="Release"/> | ||
<method name="ReportError"> | ||
<arg type="o" direction="in"/> | ||
<arg type="s" direction="in"/> | ||
</method> | ||
<method name="RequestInput"> | ||
<arg type="o" direction="in"/> | ||
<arg type="a{sv}" direction="in"/> | ||
<arg type="a{sv}" direction="out"/> | ||
<annotation name="com.trolltech.QtDBus.QtTypeName.In1" value="QVariantMap"/> | ||
<annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="QVariantMap"/> | ||
</method> | ||
<method name="Cancel"/> | ||
</interface> | ||
</node> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include "authdialog.h" | ||
|
||
#include <QDebug> | ||
|
||
AuthDialog::AuthDialog(const QString &security, const QString &password, QWidget *parent): | ||
QDialog(parent) | ||
{ | ||
ui.setupUi(this); | ||
ui.label->setText(ui.label->text().arg(security)); | ||
ui.password->setText(password); | ||
|
||
connect(ui.showPassword, SIGNAL(toggled(bool)), SLOT(showPassword(bool))); | ||
} | ||
|
||
QString AuthDialog::password() | ||
{ | ||
return ui.password->text(); | ||
} | ||
|
||
void AuthDialog::showPassword(bool checked) | ||
{ | ||
if (!checked) | ||
ui.password->setEchoMode(QLineEdit::Password); | ||
else | ||
ui.password->setEchoMode(QLineEdit::Normal); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#ifndef _AUTHDIALOG_H | ||
#define _AUTHDIALOG_H | ||
|
||
#include "ui_authdialog.h" | ||
|
||
class AuthDialog: public QDialog | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
AuthDialog(const QString &security, const QString &password, QWidget *parent); | ||
|
||
QString password(); | ||
|
||
private slots: | ||
void showPassword(bool checked); | ||
|
||
private: | ||
Ui::AuthDialog ui; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>AuthDialog</class> | ||
<widget class="QDialog" name="AuthDialog"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>380</width> | ||
<height>189</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>Authentication</string> | ||
</property> | ||
<layout class="QVBoxLayout" name="verticalLayout"> | ||
<property name="sizeConstraint"> | ||
<enum>QLayout::SetFixedSize</enum> | ||
</property> | ||
<item> | ||
<layout class="QHBoxLayout" name="horizontalLayout_2"> | ||
<item> | ||
<widget class="QLabel" name="icon"> | ||
<property name="sizePolicy"> | ||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred"> | ||
<horstretch>0</horstretch> | ||
<verstretch>0</verstretch> | ||
</sizepolicy> | ||
</property> | ||
<property name="text"> | ||
<string/> | ||
</property> | ||
<property name="pixmap"> | ||
<pixmap resource="qconnman.qrc">:/images/protected.png</pixmap> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="QLabel" name="label"> | ||
<property name="text"> | ||
<string>This network requires a %1 password to connect. Please enter the password bellow.</string> | ||
</property> | ||
<property name="wordWrap"> | ||
<bool>true</bool> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</item> | ||
<item> | ||
<spacer name="verticalSpacer"> | ||
<property name="orientation"> | ||
<enum>Qt::Vertical</enum> | ||
</property> | ||
<property name="sizeType"> | ||
<enum>QSizePolicy::Fixed</enum> | ||
</property> | ||
<property name="sizeHint" stdset="0"> | ||
<size> | ||
<width>20</width> | ||
<height>10</height> | ||
</size> | ||
</property> | ||
</spacer> | ||
</item> | ||
<item> | ||
<layout class="QHBoxLayout" name="horizontalLayout"> | ||
<item> | ||
<spacer name="horizontalSpacer"> | ||
<property name="orientation"> | ||
<enum>Qt::Horizontal</enum> | ||
</property> | ||
<property name="sizeHint" stdset="0"> | ||
<size> | ||
<width>40</width> | ||
<height>20</height> | ||
</size> | ||
</property> | ||
</spacer> | ||
</item> | ||
<item> | ||
<layout class="QGridLayout" name="gridLayout"> | ||
<item row="0" column="0"> | ||
<widget class="QLabel" name="label_3"> | ||
<property name="text"> | ||
<string>Password:</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="0" column="1"> | ||
<widget class="QLineEdit" name="password"> | ||
<property name="echoMode"> | ||
<enum>QLineEdit::Password</enum> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="1" column="1"> | ||
<widget class="QCheckBox" name="showPassword"> | ||
<property name="text"> | ||
<string>Show password</string> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</item> | ||
<item> | ||
<spacer name="horizontalSpacer_2"> | ||
<property name="orientation"> | ||
<enum>Qt::Horizontal</enum> | ||
</property> | ||
<property name="sizeHint" stdset="0"> | ||
<size> | ||
<width>40</width> | ||
<height>20</height> | ||
</size> | ||
</property> | ||
</spacer> | ||
</item> | ||
</layout> | ||
</item> | ||
<item> | ||
<widget class="QDialogButtonBox" name="buttonBox"> | ||
<property name="orientation"> | ||
<enum>Qt::Horizontal</enum> | ||
</property> | ||
<property name="standardButtons"> | ||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</widget> | ||
<resources> | ||
<include location="qconnman.qrc"/> | ||
</resources> | ||
<connections> | ||
<connection> | ||
<sender>buttonBox</sender> | ||
<signal>accepted()</signal> | ||
<receiver>AuthDialog</receiver> | ||
<slot>accept()</slot> | ||
<hints> | ||
<hint type="sourcelabel"> | ||
<x>248</x> | ||
<y>254</y> | ||
</hint> | ||
<hint type="destinationlabel"> | ||
<x>157</x> | ||
<y>274</y> | ||
</hint> | ||
</hints> | ||
</connection> | ||
<connection> | ||
<sender>buttonBox</sender> | ||
<signal>rejected()</signal> | ||
<receiver>AuthDialog</receiver> | ||
<slot>reject()</slot> | ||
<hints> | ||
<hint type="sourcelabel"> | ||
<x>316</x> | ||
<y>260</y> | ||
</hint> | ||
<hint type="destinationlabel"> | ||
<x>286</x> | ||
<y>274</y> | ||
</hint> | ||
</hints> | ||
</connection> | ||
</connections> | ||
</ui> |
Oops, something went wrong.