summary refs log tree commit diff
path: root/src/timeline/RoomlistModel.cpp
diff options
context:
space:
mode:
authorLoren Burkholder <55629213+LorenDB@users.noreply.github.com>2022-04-14 11:02:55 -0400
committerGitHub <noreply@github.com>2022-04-14 15:02:55 +0000
commit686ebfdbecbcacdbdba6c6289f22479c2fe5133e (patch)
treeef4124f0ad74d78612555160bfd556a8e98d068b /src/timeline/RoomlistModel.cpp
parentTranslated using Weblate (Finnish) (diff)
downloadnheko-686ebfdbecbcacdbdba6c6289f22479c2fe5133e.tar.xz
Add D-Bus API (#916)
This adds functionality for viewing joined rooms and activating rooms.
Diffstat (limited to 'src/timeline/RoomlistModel.cpp')
-rw-r--r--src/timeline/RoomlistModel.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/timeline/RoomlistModel.cpp b/src/timeline/RoomlistModel.cpp

index 31e5a33d..ea4f6fa8 100644 --- a/src/timeline/RoomlistModel.cpp +++ b/src/timeline/RoomlistModel.cpp
@@ -15,6 +15,10 @@ #include "TimelineViewManager.h" #include "UserSettingsPage.h" +#ifdef NHEKO_DBUS_SYS +#include <QDBusConnection> +#endif + RoomlistModel::RoomlistModel(TimelineViewManager *parent) : QAbstractListModel(parent) , manager(parent) @@ -604,6 +608,15 @@ RoomlistModel::initializeRooms() nhlog::db()->info("Restored {} rooms from cache", rowCount()); endResetModel(); + +#ifdef NHEKO_DBUS_SYS + if (MainWindow::instance()->dbusAvailable()) { + dbusInterface_ = new NhekoDBusBackend{this}; + if (!QDBusConnection::sessionBus().registerObject( + "/", dbusInterface_, QDBusConnection::ExportScriptableSlots)) + nhlog::ui()->warn("Failed to register rooms with D-Bus"); + } +#endif } void