Compare commits
1 Commits
release/23
...
work/tobia
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d9d5e17be2 |
@@ -125,18 +125,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(connection, &Connection::syncDone, this, [=]() {
|
||||
connect(&Accounts, &AccountRegistry::accountCountChanged, this, [this]() {
|
||||
if (Accounts.size() > oldAccountCount) {
|
||||
auto connection = Accounts.accounts()[Accounts.size() - 1];
|
||||
connect(connection, &Connection::syncDone, this, [this, connection]() {
|
||||
handleNotifications(connection);
|
||||
});
|
||||
}
|
||||
oldAccountCount = AccountRegistry::instance().size();
|
||||
oldAccountCount = Accounts.size();
|
||||
});
|
||||
#endif
|
||||
}
|
||||
@@ -277,10 +281,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);
|
||||
@@ -295,8 +307,8 @@ void Controller::addConnection(Connection *c)
|
||||
{
|
||||
Q_ASSERT_X(c, __FUNCTION__, "Attempt to add a null connection");
|
||||
|
||||
#ifndef QUOTIENT_07
|
||||
AccountRegistry::instance().add(c);
|
||||
#ifdef QUOTIENT_07
|
||||
Accounts.add(c);
|
||||
#endif
|
||||
|
||||
c->setLazyLoading(true);
|
||||
@@ -548,7 +560,11 @@ NeochatChangePasswordJob::NeochatChangePasswordJob(const QString &newPassword, b
|
||||
|
||||
int Controller::accountCount() const
|
||||
{
|
||||
#ifdef QUOTIENT_07
|
||||
return Accounts.count();
|
||||
#else
|
||||
return AccountRegistry::instance().count();
|
||||
#endif
|
||||
}
|
||||
|
||||
bool Controller::quitOnLastWindowClosed()
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -63,8 +63,6 @@ NeoChatRoom::NeoChatRoom(Connection *connection, QString roomId, JoinState joinS
|
||||
: Room(connection, std::move(roomId), joinState)
|
||||
{
|
||||
connect(connection, &Connection::accountDataChanged, this, &NeoChatRoom::updatePushNotificationState);
|
||||
connect(this, &NeoChatRoom::notificationCountChanged, this, &NeoChatRoom::countChanged);
|
||||
connect(this, &NeoChatRoom::highlightCountChanged, this, &NeoChatRoom::countChanged);
|
||||
connect(this, &Room::fileTransferCompleted, this, [this] {
|
||||
setFileUploadingProgress(0);
|
||||
setHasFileUploading(false);
|
||||
@@ -339,14 +337,6 @@ void NeoChatRoom::onRedaction(const RoomEvent &prevEvent, const RoomEvent & /*af
|
||||
}
|
||||
}
|
||||
|
||||
void NeoChatRoom::countChanged()
|
||||
{
|
||||
if (displayed() && !hasUnreadMessages()) {
|
||||
resetNotificationCount();
|
||||
resetHighlightCount();
|
||||
}
|
||||
}
|
||||
|
||||
QDateTime NeoChatRoom::lastActiveTime()
|
||||
{
|
||||
if (timelineSize() == 0) {
|
||||
|
||||
@@ -385,7 +385,6 @@ private:
|
||||
#endif
|
||||
|
||||
private Q_SLOTS:
|
||||
void countChanged();
|
||||
void updatePushNotificationState(QString type);
|
||||
|
||||
Q_SIGNALS:
|
||||
|
||||
@@ -249,6 +249,8 @@ Kirigami.ApplicationWindow {
|
||||
target: Controller
|
||||
|
||||
function onInitiated() {
|
||||
console.warn("INITIATED")
|
||||
console.warn(Controller.accountCount)
|
||||
if (Controller.accountCount === 0) {
|
||||
pageStack.replace("qrc:/WelcomePage.qml", {});
|
||||
} else if (!roomListLoaded) {
|
||||
|
||||
Reference in New Issue
Block a user