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"
|
2015-06-26 16:40:34 +03:00
|
|
|
#include "quotainfo.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
|
|
|
|
|
|
|
|
public:
|
2018-11-11 12:56:22 +03:00
|
|
|
explicit AccountSettings(AccountState *accountState, QWidget *parent = nullptr);
|
2013-07-04 21:59:40 +04:00
|
|
|
~AccountSettings();
|
2018-11-11 13:09:29 +03:00
|
|
|
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 &);
|
2018-11-09 14:12:25 +03:00
|
|
|
void showIssuesList(AccountState *account);
|
2018-06-21 18:20:09 +03:00
|
|
|
void requesetMnemonic();
|
2019-07-24 14:56:21 +03:00
|
|
|
void removeAccountFolders(AccountState *account);
|
2019-12-19 21:50:21 +03:00
|
|
|
void styleChanged();
|
2013-07-04 21:59:40 +04:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
void slotOpenOC();
|
|
|
|
void slotUpdateQuota(qint64, qint64);
|
2017-07-13 12:27:02 +03:00
|
|
|
void slotAccountStateChanged();
|
2019-12-09 22:47:42 +03:00
|
|
|
void slotStyleChanged();
|
2013-07-04 21:59:40 +04:00
|
|
|
|
2015-07-15 12:37:38 +03:00
|
|
|
AccountState *accountsState() { return _accountState; }
|
2013-09-11 12:24:31 +04:00
|
|
|
|
2013-07-04 21:59:40 +04:00
|
|
|
protected slots:
|
|
|
|
void slotAddFolder();
|
|
|
|
void slotEnableCurrentFolder();
|
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();
|
|
|
|
void slotEditCurrentLocalIgnoredFiles();
|
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();
|
|
|
|
void slotOpenAccountWizard();
|
|
|
|
void slotAccountAdded(AccountState *);
|
2015-03-27 13:46:03 +03:00
|
|
|
void refreshSelectiveSyncStatus();
|
2019-08-15 01:08:21 +03:00
|
|
|
void slotMarkSubfolderEncrypted(const FolderStatusModel::SubFolderInfo* folderInfo);
|
2018-05-12 00:22:33 +03:00
|
|
|
void slotMarkSubfolderDecrypted(const 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
|
|
|
|
2018-06-21 18:20:09 +03:00
|
|
|
void slotMenuBeforeShow();
|
|
|
|
|
2017-12-16 01:32:41 +03:00
|
|
|
// Encryption Related Stuff.
|
2018-06-21 18:20:09 +03:00
|
|
|
void slotShowMnemonic(const QString &mnemonic);
|
2019-05-08 20:56:00 +03:00
|
|
|
void slotNewMnemonicGenerated();
|
2018-06-21 18:20:09 +03:00
|
|
|
|
2017-11-03 14:00:25 +03:00
|
|
|
void slotEncryptionFlagSuccess(const QByteArray &folderId);
|
|
|
|
void slotEncryptionFlagError(const QByteArray &folderId, int httpReturnCode);
|
2017-12-16 01:32:41 +03:00
|
|
|
void slotLockForEncryptionSuccess(const QByteArray& folderId, const QByteArray& token);
|
|
|
|
void slotLockForEncryptionError(const QByteArray &folderId, int httpReturnCode);
|
2017-11-03 14:34:30 +03:00
|
|
|
void slotUnlockFolderSuccess(const QByteArray& folderId);
|
|
|
|
void slotUnlockFolderError(const QByteArray& folderId, int httpReturnCode);
|
2018-06-21 18:20:09 +03:00
|
|
|
void slotUploadMetadataSuccess(const QByteArray& folderId);
|
|
|
|
void slotUpdateMetadataError(const QByteArray& folderId, int httpReturnCode);
|
2013-07-04 21:59:40 +04:00
|
|
|
|
2019-08-15 01:08:21 +03:00
|
|
|
// Remove Encryption Bit.
|
2017-12-16 01:32:41 +03:00
|
|
|
void slotLockForDecryptionSuccess(const QByteArray& folderId, const QByteArray& token);
|
|
|
|
void slotLockForDecryptionError(const QByteArray& folderId, int httpReturnCode);
|
|
|
|
void slotDeleteMetadataSuccess(const QByteArray& folderId);
|
|
|
|
void slotDeleteMetadataError(const QByteArray& folderId, int httpReturnCode);
|
|
|
|
void slotUnlockForDecryptionSuccess(const QByteArray& folderId);
|
|
|
|
void slotUnlockForDecryptionError(const QByteArray& folderId, int httpReturnCode);
|
|
|
|
void slotDecryptionFlagSuccess(const QByteArray& folderId);
|
|
|
|
void slotDecryptionFlagError(const QByteArray& folderId, int httpReturnCode);
|
|
|
|
|
2013-07-04 21:59:40 +04:00
|
|
|
private:
|
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
|
|
|
|
2017-04-12 16:24:54 +03:00
|
|
|
/// Returns the alias of the selected folder, empty string if none
|
|
|
|
QString selectedFolderAlias() const;
|
|
|
|
|
2013-07-04 21:59:40 +04: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;
|
2015-06-26 16:40:34 +03:00
|
|
|
QuotaInfo _quotaInfo;
|
2015-11-13 16:50:07 +03:00
|
|
|
QAction *_toggleSignInOutAction;
|
|
|
|
QAction *_addAccountAction;
|
2018-06-21 18:20:09 +03:00
|
|
|
|
|
|
|
bool _menuShown;
|
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
|