1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
From a94f46f90462dce1f817e9f28d24dad454e0dfb4 Mon Sep 17 00:00:00 2001
From: Tobias Fella <fella@posteo.de>
Date: Fri, 26 May 2023 17:47:26 +0200
Subject: [PATCH] Fix build against libQuotient 0.8
---
src/controller.cpp | 24 ++++++++++++++++++++----
src/login.cpp | 4 ++++
2 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/src/controller.cpp b/src/controller.cpp
index dd38ede9b..3835e312b 100644
--- a/src/controller.cpp
+++ b/src/controller.cpp
@@ -109,18 +109,22 @@ Controller::Controller(QObject *parent)
}
#endif
+#ifdef QUOTIENT_07
+ connect(&Accounts, &AccountRegistry::accountCountChanged, this, &Controller::activeConnectionIndexChanged);
+#else
connect(&AccountRegistry::instance(), &AccountRegistry::accountCountChanged, this, &Controller::activeConnectionIndexChanged);
+#endif
#ifdef QUOTIENT_07
static int oldAccountCount = 0;
- connect(&AccountRegistry::instance(), &AccountRegistry::accountCountChanged, this, [=]() {
- if (AccountRegistry::instance().size() > oldAccountCount) {
- auto connection = AccountRegistry::instance().accounts()[AccountRegistry::instance().size() - 1];
+ connect(&Accounts, &AccountRegistry::accountCountChanged, this, [=]() {
+ if (Accounts.size() > oldAccountCount) {
+ auto connection = Accounts.accounts()[Accounts.size() - 1];
connect(connection, &Connection::syncDone, this, [=]() {
handleNotifications(connection);
});
}
- oldAccountCount = AccountRegistry::instance().size();
+ oldAccountCount = Accounts.size();
});
#endif
}
@@ -228,10 +232,18 @@ void Controller::logout(Connection *conn, bool serverSideLogout)
job.start();
loop.exec();
+#ifdef QUOTIENT_07
+ if (Accounts.count() > 1) {
+#else
if (AccountRegistry::instance().count() > 1) {
+#endif
// Only set the connection if the the account being logged out is currently active
if (conn == activeConnection()) {
+#ifdef QUOTIENT_07
+ setActiveConnection(Accounts.accounts()[0]);
+#else
setActiveConnection(AccountRegistry::instance().accounts()[0]);
+#endif
}
} else {
setActiveConnection(nullptr);
@@ -495,7 +507,11 @@ NeochatChangePasswordJob::NeochatChangePasswordJob(const QString &newPassword, b
int Controller::accountCount() const
{
+#ifdef QUOTIENT_07
+ return Accounts.count();
+#else
return AccountRegistry::instance().count();
+#endif
}
void Controller::setQuitOnLastWindowClosed()
diff --git a/src/login.cpp b/src/login.cpp
index 1121875f9..8b937abaa 100644
--- a/src/login.cpp
+++ b/src/login.cpp
@@ -43,7 +43,11 @@ void Login::init()
return;
}
+#ifdef QUOTIENT_07
+ m_isLoggedIn = Accounts.isLoggedIn(m_matrixId);
+#else
m_isLoggedIn = AccountRegistry::instance().isLoggedIn(m_matrixId);
+#endif
Q_EMIT isLoggedInChanged();
if (m_isLoggedIn) {
return;
--
GitLab
|