File indexing completed on 2024-05-12 16:27:07

0001 /*
0002    SPDX-FileCopyrightText: 2020-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "accountmanager.h"
0010 #include "libruqolawidgets_private_export.h"
0011 #include <QListWidget>
0012 class AccountServerListWidgetItem : public QListWidgetItem
0013 {
0014 public:
0015     explicit AccountServerListWidgetItem(QListWidget *parent = nullptr);
0016     ~AccountServerListWidgetItem() override;
0017     [[nodiscard]] AccountManager::AccountManagerInfo accountInfo() const;
0018     void setAccountInfo(const AccountManager::AccountManagerInfo &accountInfo);
0019 
0020     [[nodiscard]] bool newAccount() const;
0021     void setNewAccount(bool newAccount);
0022 
0023 private:
0024     AccountManager::AccountManagerInfo mInfo;
0025     bool mNewAccount = false;
0026 };
0027 
0028 class LIBRUQOLAWIDGETS_TESTS_EXPORT AccountServerListWidget : public QListWidget
0029 {
0030     Q_OBJECT
0031 public:
0032     explicit AccountServerListWidget(QWidget *parent = nullptr);
0033     ~AccountServerListWidget() override;
0034 
0035     void load();
0036     void save();
0037     void addAccountConfig();
0038     void deleteAccountConfig(QListWidgetItem *item, bool removeLogs);
0039 
0040     void modifyAccountConfig();
0041 
0042     void slotMoveAccountUp();
0043     void slotMoveAccountDown();
0044 
0045 private:
0046     // AccountName, remove logs
0047     QMap<QString, bool> mListRemovedAccount;
0048 };