Port away from Controller::activeConnectionIndex
This commit is contained in:
committed by
Joshua Goins
parent
e9e1e223f7
commit
6ba2b715c3
@@ -346,7 +346,6 @@ void Controller::setActiveConnection(NeoChatConnection *connection)
|
||||
}
|
||||
NeoChatConfig::self()->save();
|
||||
Q_EMIT activeConnectionChanged();
|
||||
Q_EMIT activeConnectionIndexChanged();
|
||||
}
|
||||
|
||||
void Controller::saveWindowGeometry()
|
||||
@@ -407,14 +406,6 @@ void Controller::setApplicationProxy()
|
||||
QNetworkProxy::setApplicationProxy(proxy);
|
||||
}
|
||||
|
||||
int Controller::activeConnectionIndex() const
|
||||
{
|
||||
auto result = std::find_if(m_accountRegistry.accounts().begin(), m_accountRegistry.accounts().end(), [this](const auto &it) {
|
||||
return it == m_connection;
|
||||
});
|
||||
return result - m_accountRegistry.accounts().begin();
|
||||
}
|
||||
|
||||
bool Controller::isFlatpak() const
|
||||
{
|
||||
#ifdef NEOCHAT_FLATPAK
|
||||
|
||||
@@ -46,11 +46,6 @@ class Controller : public QObject
|
||||
*/
|
||||
Q_PROPERTY(NeoChatConnection *activeConnection READ activeConnection WRITE setActiveConnection NOTIFY activeConnectionChanged)
|
||||
|
||||
/**
|
||||
* @brief The row number in the accounts directory of the active connection.
|
||||
*/
|
||||
Q_PROPERTY(int activeConnectionIndex READ activeConnectionIndex NOTIFY activeConnectionIndexChanged)
|
||||
|
||||
/**
|
||||
* @brief Whether the OS NeoChat is running on supports sytem tray icons.
|
||||
*/
|
||||
@@ -99,8 +94,6 @@ public:
|
||||
*/
|
||||
void dropConnection(NeoChatConnection *c);
|
||||
|
||||
int activeConnectionIndex() const;
|
||||
|
||||
/**
|
||||
* @brief Save an access token to the keychain for the given account.
|
||||
*/
|
||||
@@ -169,7 +162,6 @@ Q_SIGNALS:
|
||||
void passwordStatus(Controller::PasswordStatus status);
|
||||
void userConsentRequired(QUrl url);
|
||||
void isOnlineChanged(bool isOnline);
|
||||
void activeConnectionIndexChanged();
|
||||
|
||||
public Q_SLOTS:
|
||||
void saveWindowGeometry();
|
||||
|
||||
@@ -160,8 +160,6 @@ RowLayout {
|
||||
id: accounts
|
||||
implicitHeight: contentHeight
|
||||
|
||||
currentIndex: Controller.activeConnectionIndex
|
||||
|
||||
header: Kirigami.Separator {}
|
||||
|
||||
footer: Delegates.RoundedItemDelegate {
|
||||
@@ -227,6 +225,15 @@ RowLayout {
|
||||
}
|
||||
}
|
||||
|
||||
onVisibleChanged: {
|
||||
for (let i = 0; i < accounts.count; i++) {
|
||||
if (model.data(model.index(i, 0), Qt.DisplayRole) === root.connection.localUser.id) {
|
||||
accounts.currentIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
delegate: Delegates.RoundedItemDelegate {
|
||||
id: userDelegate
|
||||
|
||||
|
||||
Reference in New Issue
Block a user