+ QDBusConnection dbus = QDBusConnection::sessionBus();
+ dbus.registerObject("/qtrapids_gui", this);
+ dbus.registerService("com.ixonos.qtrapids_gui");
+
+ connectToServer();
+ restoreSettings();
+ // Add to QML context. This can then be used in QML context.
+ QDeclarativeContext *context = engine->rootContext();
+ context->setContextProperty("downloadModel", &downloadModel_);
+ context->setContextProperty("mainPageHandler", this);
+
+ connect(&server_, SIGNAL(alert(qtrapids::TorrentState, qtrapids::ParamsMap_t)),
+ this, SLOT(on_alert(qtrapids::TorrentState, qtrapids::ParamsMap_t)));
+ // TODO: Check if this is a problem, as connection is done also in connectToServer()
+// connect(&server_, SIGNAL(alert(qtrapids::TorrentState, qtrapids::ParamsMap_t)),
+// this, SLOT(on_alert(qtrapids::TorrentState, qtrapids::ParamsMap_t)));
+ connect(&server_, SIGNAL(sessionTerminated()), this, SLOT(on_serverTerminated()));