summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Clipboard.h2
-rw-r--r--src/encryption/DeviceVerificationFlow.h3
-rw-r--r--src/encryption/SelfVerificationStatus.cpp2
-rw-r--r--src/encryption/SelfVerificationStatus.h2
-rw-r--r--src/main.cpp17
-rw-r--r--src/timeline/TimelineModel.cpp17
-rw-r--r--src/timeline/TimelineModel.h2
-rw-r--r--src/ui/NhekoGlobalObject.cpp1
-rw-r--r--src/ui/NhekoGlobalObject.h2
-rw-r--r--src/voip/ScreenCastPortal.cpp19
10 files changed, 49 insertions, 18 deletions
diff --git a/src/Clipboard.h b/src/Clipboard.h
index 8bf89c22..e3321c02 100644
--- a/src/Clipboard.h
+++ b/src/Clipboard.h
@@ -8,7 +8,7 @@
 #include <QQmlEngine>
 #include <QString>
 
-class Clipboard final : public QObject
+class Clipboard : public QObject
 {
     Q_OBJECT
     QML_ELEMENT
diff --git a/src/encryption/DeviceVerificationFlow.h b/src/encryption/DeviceVerificationFlow.h
index 48de14e5..50818883 100644
--- a/src/encryption/DeviceVerificationFlow.h
+++ b/src/encryption/DeviceVerificationFlow.h
@@ -63,6 +63,9 @@ using sas_ptr = std::unique_ptr<mtx::crypto::SAS>;
 class DeviceVerificationFlow final : public QObject
 {
     Q_OBJECT
+    QML_ELEMENT
+    QML_UNCREATABLE("")
+
     Q_PROPERTY(QString state READ state NOTIFY stateChanged)
     Q_PROPERTY(Error error READ error NOTIFY errorChanged)
     Q_PROPERTY(QString userId READ getUserId CONSTANT)
diff --git a/src/encryption/SelfVerificationStatus.cpp b/src/encryption/SelfVerificationStatus.cpp
index d9d3d787..e54cbc2d 100644
--- a/src/encryption/SelfVerificationStatus.cpp
+++ b/src/encryption/SelfVerificationStatus.cpp
@@ -246,6 +246,8 @@ SelfVerificationStatus::verifyMasterKey()
     if (!devices.empty())
         ChatPage::instance()->timelineManager()->verificationManager()->verifyOneOfDevices(
           QString::fromStdString(this_user), std::move(devices));
+    else
+        nhlog::db()->info("No devices to verify");
 }
 
 void
diff --git a/src/encryption/SelfVerificationStatus.h b/src/encryption/SelfVerificationStatus.h
index c65fffd0..8d28f46a 100644
--- a/src/encryption/SelfVerificationStatus.h
+++ b/src/encryption/SelfVerificationStatus.h
@@ -7,7 +7,7 @@
 #include <QObject>
 #include <QQmlEngine>
 
-class SelfVerificationStatus final : public QObject
+class SelfVerificationStatus : public QObject
 {
     Q_OBJECT
 
diff --git a/src/main.cpp b/src/main.cpp
index 07397d62..3984f4ba 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -334,10 +334,21 @@ main(int argc, char *argv[])
 
     QTranslator qtTranslator;
     if (qtTranslator.load(QLocale(),
-                          QStringLiteral("qt"),
+                          QStringLiteral("qtbase"),
                           QStringLiteral("_"),
-                          QLibraryInfo::path(QLibraryInfo::TranslationsPath)))
+                          QLibraryInfo::path(QLibraryInfo::TranslationsPath))) {
         app.installTranslator(&qtTranslator);
+    } else
+        qDebug() << "Failed to load qtbase translations: "
+                 << QLibraryInfo::path(QLibraryInfo::TranslationsPath);
+    QTranslator qmlTranslator;
+    if (qmlTranslator.load(QLocale(),
+                           QStringLiteral("qtdeclarative"),
+                           QStringLiteral("_"),
+                           QLibraryInfo::path(QLibraryInfo::TranslationsPath))) {
+        app.installTranslator(&qmlTranslator);
+    } else
+        qDebug() << "Failed to load qtdeclarative translations";
 
     QTranslator appTranslator;
     if (appTranslator.load(QLocale(),
@@ -345,6 +356,8 @@ main(int argc, char *argv[])
                            QStringLiteral("_"),
                            QStringLiteral(":/translations")))
         app.installTranslator(&appTranslator);
+    else
+        qDebug() << "Failed to load nheko translations";
 
     MainWindow w(nullptr);
     // QQuickView w;
diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp
index 752aedb0..fddd5700 100644
--- a/src/timeline/TimelineModel.cpp
+++ b/src/timeline/TimelineModel.cpp
@@ -1284,13 +1284,20 @@ TimelineModel::updateLastMessage()
 void
 TimelineModel::setCurrentIndex(int index)
 {
+    setCurrentIndex(index, false);
+}
+
+void
+TimelineModel::setCurrentIndex(int index, bool ignoreInactiveState)
+{
     auto oldIndex = idToIndex(currentId);
     currentId     = indexToId(index);
     if (index != oldIndex)
         emit currentIndexChanged(index);
 
-    if (!QGuiApplication::focusWindow() || !QGuiApplication::focusWindow()->isActive() ||
-        MainWindow::instance()->windowForRoom(roomId()) != QGuiApplication::focusWindow())
+    if (!ignoreInactiveState &&
+        (!QGuiApplication::focusWindow() || !QGuiApplication::focusWindow()->isActive() ||
+         MainWindow::instance()->windowForRoom(roomId()) != QGuiApplication::focusWindow()))
         return;
 
     if (!currentId.startsWith('m')) {
@@ -1562,6 +1569,12 @@ TimelineModel::markEventsAsRead(const std::vector<QString> &event_ids)
 }
 
 void
+TimelineModel::markRoomAsRead()
+{
+    setCurrentIndex(0, true);
+}
+
+void
 TimelineModel::updateLastReadId(const QString &currentRoomId)
 {
     if (currentRoomId == room_id_) {
diff --git a/src/timeline/TimelineModel.h b/src/timeline/TimelineModel.h
index fd1a4396..64941920 100644
--- a/src/timeline/TimelineModel.h
+++ b/src/timeline/TimelineModel.h
@@ -386,9 +386,11 @@ public:
 
 public slots:
     void setCurrentIndex(int index);
+    void setCurrentIndex(int index, bool ignoreInactiveState);
     int currentIndex() const { return idToIndex(currentId); }
     void eventShown();
     void markEventsAsRead(const std::vector<QString> &event_ids);
+    void markRoomAsRead();
     void updateLastReadId(const QString &currentRoomId);
     void lastReadIdOnWindowFocus();
     void checkAfterFetch();
diff --git a/src/ui/NhekoGlobalObject.cpp b/src/ui/NhekoGlobalObject.cpp
index 1bab73b5..54c4c1c9 100644
--- a/src/ui/NhekoGlobalObject.cpp
+++ b/src/ui/NhekoGlobalObject.cpp
@@ -153,7 +153,6 @@ Nheko::createRoom(bool space,
     if (space) {
         req.creation_content       = mtx::events::state::Create{};
         req.creation_content->type = mtx::events::state::room_type::space;
-        req.creation_content->creator.clear();
         req.creation_content->room_version.clear();
     }
 
diff --git a/src/ui/NhekoGlobalObject.h b/src/ui/NhekoGlobalObject.h
index 91210c54..c1f3579c 100644
--- a/src/ui/NhekoGlobalObject.h
+++ b/src/ui/NhekoGlobalObject.h
@@ -16,7 +16,7 @@
 #include "Theme.h"
 #include "UserProfile.h"
 
-class Nheko final : public QObject
+class Nheko : public QObject
 {
     Q_OBJECT
 
diff --git a/src/voip/ScreenCastPortal.cpp b/src/voip/ScreenCastPortal.cpp
index 6cd91e51..83f7595b 100644
--- a/src/voip/ScreenCastPortal.cpp
+++ b/src/voip/ScreenCastPortal.cpp
@@ -420,16 +420,15 @@ ScreenCastPortal::start()
 
     QDBusPendingCall pendingCall     = QDBusConnection::sessionBus().asyncCall(msg);
     QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingCall, this);
-    connect(
-      watcher, &QDBusPendingCallWatcher::finished, this, [this](QDBusPendingCallWatcher *self) {
-          self->deleteLater();
-          QDBusPendingReply<QDBusObjectPath> reply = *self;
+    connect(watcher, &QDBusPendingCallWatcher::finished, this, [](QDBusPendingCallWatcher *self) {
+        self->deleteLater();
+        QDBusPendingReply<QDBusObjectPath> reply = *self;
 
-          if (!reply.isValid()) {
-              nhlog::ui()->error("org.freedesktop.portal.ScreenCast (Start): {}",
-                                 reply.error().message().toStdString());
-          }
-      });
+        if (!reply.isValid()) {
+            nhlog::ui()->error("org.freedesktop.portal.ScreenCast (Start): {}",
+                               reply.error().message().toStdString());
+        }
+    });
 }
 
 struct PipeWireStream
@@ -502,7 +501,7 @@ ScreenCastPortal::openPipeWireRemote()
                                  reply.error().message().toStdString());
               close();
           } else {
-              stream.fd = std::move(reply.value());
+              stream.fd = reply.value();
               nhlog::ui()->error("org.freedesktop.portal.ScreenCast: fd = {}",
                                  stream.fd.fileDescriptor());
               state = State::Started;