add dbus interface proto

This commit is contained in:
arcan1s
2014-08-06 19:01:03 +04:00
parent e8a7865e99
commit 447bcf8a0e
10 changed files with 147 additions and 5 deletions

View File

@ -18,6 +18,7 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDBusConnection>
#include <QDebug>
#include <QDesktopServices>
#include <QFileDialog>
@ -36,6 +37,7 @@
#include "macvlanwidget.h"
#include "mobilewidget.h"
#include "netctlautowindow.h"
#include "netctlguiadaptor.h"
#include "passwdwidget.h"
#include "pppoewidget.h"
#include "settingswindow.h"
@ -87,6 +89,7 @@ MainWindow::MainWindow(QWidget *parent,
configuration[optionsDict.keys()[i]] = optionsDict[optionsDict.keys()[i]];
// backend
createDBusSession();
netctlCommand = new Netctl(debug, configuration);
netctlProfile = new NetctlProfile(debug, configuration);
wpaCommand = new WpaSup(debug, configuration);
@ -346,6 +349,19 @@ void MainWindow::createActions()
}
void MainWindow::createDBusSession()
{
if (debug) qDebug() << "[MainWindow]" << "[createDBusSession]";
new NetctlGuiAdaptor(this, debug);
QDBusConnection bus = QDBusConnection::sessionBus();
if (!bus.registerService(QString(DBUS_SERVICE)))
if (debug) qDebug() << "[MainWindow]" << "[createDBusSession]" << ":" << "Could not register service";
if (!bus.registerObject(QString(DBUS_OBJECT_PATH), this))
if (debug) qDebug() << "[MainWindow]" << "[createDBusSession]" << ":" << "Could not register object";
}
void MainWindow::keyPressEvent(QKeyEvent *pressedKey)
{
if (debug) qDebug() << "[MainWindow]" << "[keyPressEvent]";