2013-07-04 21:59:40 +04:00
|
|
|
/*
|
|
|
|
* Copyright (C) by Daniel Molkentin <danimo@owncloud.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
2016-10-25 12:00:07 +03:00
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
2013-07-04 21:59:40 +04:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef ACCOUNTSETTINGS_H
|
|
|
|
#define ACCOUNTSETTINGS_H
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
#include <QUrl>
|
|
|
|
#include <QPointer>
|
2013-07-18 00:32:47 +04:00
|
|
|
#include <QHash>
|
|
|
|
#include <QTimer>
|
2013-07-04 21:59:40 +04:00
|
|
|
|
2014-07-11 02:31:24 +04:00
|
|
|
#include "folder.h"
|
2020-02-14 04:10:01 +03:00
|
|
|
#include "userinfo.h"
|
2014-07-11 02:31:24 +04:00
|
|
|
#include "progressdispatcher.h"
|
2015-07-20 19:15:45 +03:00
|
|
|
#include "owncloudgui.h"
|
2018-05-12 00:22:33 +03:00
|
|
|
#include "folderstatusmodel.h"
|
2013-07-04 21:59:40 +04:00
|
|
|
|
|
|
|
class QModelIndex;
|
|
|
|
class QNetworkReply;
|
|
|
|
class QListWidgetItem;
|
2015-03-27 13:46:03 +03:00
|
|
|
class QLabel;
|
2013-07-04 21:59:40 +04:00
|
|
|
|
2014-11-10 00:34:07 +03:00
|
|
|
namespace OCC {
|
2013-07-04 21:59:40 +04:00
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class AccountSettings;
|
|
|
|
}
|
|
|
|
|
|
|
|
class FolderMan;
|
2015-03-27 13:46:03 +03:00
|
|
|
|
2013-11-04 19:36:23 +04:00
|
|
|
class Account;
|
2014-12-17 16:09:57 +03:00
|
|
|
class AccountState;
|
2015-03-27 13:46:03 +03:00
|
|
|
class FolderStatusModel;
|
2013-07-04 21:59:40 +04:00
|
|
|
|
2015-06-29 19:56:09 +03:00
|
|
|
/**
|
|
|
|
* @brief The AccountSettings class
|
|
|
|
* @ingroup gui
|
2015-06-26 18:07:47 +03:00
|
|
|
*/
|
2013-07-04 21:59:40 +04:00
|
|
|
class AccountSettings : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2019-06-05 21:57:15 +03:00
|
|
|
Q_PROPERTY(AccountState* accountState MEMBER _accountState)
|
2013-07-04 21:59:40 +04:00
|
|
|
|
|
|
|
public:
|
2018-11-11 12:56:22 +03:00
|
|
|
explicit AccountSettings(AccountState *accountState, QWidget *parent = nullptr);
|
2021-08-17 13:39:31 +03:00
|
|
|
~AccountSettings() override;
|
2022-09-30 20:12:08 +03:00
|
|
|
[[nodiscard]] QSize sizeHint() const override { return ownCloudGui::settingsDialogSize(); }
|
2018-05-12 00:22:33 +03:00
|
|
|
bool canEncryptOrDecrypt(const FolderStatusModel::SubFolderInfo* folderInfo);
|
2013-07-04 21:59:40 +04:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void folderChanged();
|
|
|
|
void openFolderAlias(const QString &);
|
2022-10-24 17:00:50 +03:00
|
|
|
void showIssuesList(OCC::AccountState *account);
|
2020-12-08 18:59:06 +03:00
|
|
|
void requestMnemonic();
|
2022-10-24 17:00:50 +03:00
|
|
|
void removeAccountFolders(OCC::AccountState *account);
|
2019-12-19 21:50:21 +03:00
|
|
|
void styleChanged();
|
2013-07-04 21:59:40 +04:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
void slotOpenOC();
|
2020-07-01 22:30:17 +03:00
|
|
|
void slotUpdateQuota(qint64 total, qint64 used);
|
2017-07-13 12:27:02 +03:00
|
|
|
void slotAccountStateChanged();
|
2019-12-09 22:47:42 +03:00
|
|
|
void slotStyleChanged();
|
2022-10-24 17:00:50 +03:00
|
|
|
OCC::AccountState *accountsState() { return _accountState; }
|
2020-12-02 18:09:43 +03:00
|
|
|
void slotHideSelectiveSyncWidget();
|
2013-09-11 12:24:31 +04:00
|
|
|
|
2013-07-04 21:59:40 +04:00
|
|
|
protected slots:
|
|
|
|
void slotAddFolder();
|
2020-10-15 16:12:16 +03:00
|
|
|
void slotEnableCurrentFolder(bool terminate = false);
|
2016-11-25 16:23:56 +03:00
|
|
|
void slotScheduleCurrentFolder();
|
2017-04-12 16:25:26 +03:00
|
|
|
void slotScheduleCurrentFolderForceRemoteDiscovery();
|
2016-11-25 16:23:56 +03:00
|
|
|
void slotForceSyncCurrentFolder();
|
2013-07-04 21:59:40 +04:00
|
|
|
void slotRemoveCurrentFolder();
|
2017-04-26 21:03:55 +03:00
|
|
|
void slotOpenCurrentFolder(); // sync folder
|
|
|
|
void slotOpenCurrentLocalSubFolder(); // selected subfolder in sync folder
|
2019-08-15 01:04:16 +03:00
|
|
|
void slotEditCurrentIgnoredFiles();
|
2021-01-29 21:00:21 +03:00
|
|
|
void slotOpenMakeFolderDialog();
|
2019-08-15 01:04:16 +03:00
|
|
|
void slotEditCurrentLocalIgnoredFiles();
|
2020-11-27 02:57:49 +03:00
|
|
|
void slotEnableVfsCurrentFolder();
|
|
|
|
void slotDisableVfsCurrentFolder();
|
2022-10-24 17:00:50 +03:00
|
|
|
void slotSetCurrentFolderAvailability(OCC::PinState state);
|
|
|
|
void slotSetSubFolderAvailability(OCC::Folder *folder, const QString &path, OCC::PinState state);
|
2013-07-04 21:59:40 +04:00
|
|
|
void slotFolderWizardAccepted();
|
|
|
|
void slotFolderWizardRejected();
|
2015-05-12 16:16:32 +03:00
|
|
|
void slotDeleteAccount();
|
2015-11-13 16:50:07 +03:00
|
|
|
void slotToggleSignInState();
|
2015-03-27 13:46:03 +03:00
|
|
|
void refreshSelectiveSyncStatus();
|
2022-10-24 17:00:50 +03:00
|
|
|
void slotMarkSubfolderEncrypted(OCC::FolderStatusModel::SubFolderInfo *folderInfo);
|
2017-10-31 13:03:24 +03:00
|
|
|
void slotSubfolderContextMenuRequested(const QModelIndex& idx, const QPoint& point);
|
2015-06-26 16:40:34 +03:00
|
|
|
void slotCustomContextMenuRequested(const QPoint &);
|
2015-09-25 13:22:51 +03:00
|
|
|
void slotFolderListClicked(const QModelIndex &indx);
|
2015-09-16 04:07:04 +03:00
|
|
|
void doExpand();
|
2015-09-01 16:37:01 +03:00
|
|
|
void slotLinkActivated(const QString &link);
|
2017-12-16 01:32:41 +03:00
|
|
|
|
|
|
|
// Encryption Related Stuff.
|
2022-10-14 18:47:46 +03:00
|
|
|
void slotE2eEncryptionMnemonicReady();
|
|
|
|
void slotE2eEncryptionGenerateKeys();
|
|
|
|
void slotE2eEncryptionInitializationFinished(bool isNewMnemonicGenerated);
|
2020-06-17 20:08:59 +03:00
|
|
|
void slotEncryptFolderFinished(int status);
|
2017-12-16 01:32:41 +03:00
|
|
|
|
2020-12-02 18:09:43 +03:00
|
|
|
void slotSelectiveSyncChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight,
|
|
|
|
const QVector<int> &roles);
|
2022-12-07 21:43:27 +03:00
|
|
|
void slotPossiblyUnblacklistE2EeFoldersAndRestartSync();
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void updateBlackListAndScheduleFolderSync(const QStringList &blackList, OCC::Folder *folder, const QStringList &foldersToRemoveFromBlacklist) const;
|
|
|
|
void folderTerminateSyncAndUpdateBlackList(const QStringList &blackList, OCC::Folder *folder, const QStringList &foldersToRemoveFromBlacklist);
|
2020-12-02 18:09:43 +03:00
|
|
|
|
2013-07-04 21:59:40 +04:00
|
|
|
private:
|
2022-10-14 18:47:46 +03:00
|
|
|
void displayMnemonic(const QString &mnemonic);
|
2015-07-15 12:37:38 +03:00
|
|
|
void showConnectionLabel(const QString &message,
|
|
|
|
QStringList errors = QStringList());
|
2018-11-11 13:09:29 +03:00
|
|
|
bool event(QEvent *) override;
|
2015-11-13 16:50:07 +03:00
|
|
|
void createAccountToolbox();
|
2019-08-15 01:04:16 +03:00
|
|
|
void openIgnoredFilesDialog(const QString & absFolderPath);
|
2019-12-09 22:47:42 +03:00
|
|
|
void customizeStyle();
|
2013-07-19 19:05:35 +04:00
|
|
|
|
2022-10-14 18:47:46 +03:00
|
|
|
void initializeE2eEncryption();
|
|
|
|
void removeActionFromEncryptionMessage(const QString &actionId);
|
|
|
|
QAction *addActionToEncryptionMessage(const QString &actionTitle, const QString &actionId);
|
|
|
|
|
2017-04-12 16:24:54 +03:00
|
|
|
/// Returns the alias of the selected folder, empty string if none
|
2022-09-30 20:12:08 +03:00
|
|
|
[[nodiscard]] QString selectedFolderAlias() const;
|
2017-04-12 16:24:54 +03:00
|
|
|
|
2019-12-19 21:53:48 +03:00
|
|
|
Ui::AccountSettings *_ui;
|
2015-03-27 13:46:03 +03:00
|
|
|
|
|
|
|
FolderStatusModel *_model;
|
2013-07-04 21:59:40 +04:00
|
|
|
QUrl _OCUrl;
|
2013-10-11 19:51:55 +04:00
|
|
|
bool _wasDisabledBefore;
|
2014-12-17 16:09:57 +03:00
|
|
|
AccountState *_accountState;
|
2020-02-14 04:10:01 +03:00
|
|
|
UserInfo _userInfo;
|
2015-11-13 16:50:07 +03:00
|
|
|
QAction *_toggleSignInOutAction;
|
|
|
|
QAction *_addAccountAction;
|
2018-06-21 18:20:09 +03:00
|
|
|
|
|
|
|
bool _menuShown;
|
2022-12-07 21:43:27 +03:00
|
|
|
|
|
|
|
QHash<QString, QMetaObject::Connection> _folderConnections;
|
2013-07-04 21:59:40 +04:00
|
|
|
};
|
|
|
|
|
2014-11-10 00:34:07 +03:00
|
|
|
} // namespace OCC
|
2013-07-04 21:59:40 +04:00
|
|
|
|
|
|
|
#endif // ACCOUNTSETTINGS_H
|