1/*
2 * Copyright (C) by Daniel Molkentin <danimo@owncloud.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 */
14
15#ifndef ACCOUNTSETTINGS_H
16#define ACCOUNTSETTINGS_H
17
18#include <QWidget>
19#include <QUrl>
20#include <QPointer>
21#include <QHash>
22#include <QTimer>
23
24#include "folder.h"
25#include "quotainfo.h"
26#include "progressdispatcher.h"
27#include "owncloudgui.h"
28
29class QModelIndex;
30class QNetworkReply;
31class QListWidgetItem;
32class QLabel;
33
34namespace OCC {
35
36namespace Ui {
37 class AccountSettings;
38}
39
40class FolderMan;
41
42class Account;
43class AccountState;
44class FolderStatusModel;
45
46/**
47 * @brief The AccountSettings class
48 * @ingroup gui
49 */
50class AccountSettings : public QWidget
51{
52 Q_OBJECT
53
54public:
55 explicit AccountSettings(AccountState *accountState, QWidget *parent = 0);
56 ~AccountSettings();
57 QSize sizeHint() const Q_DECL_OVERRIDE { return ownCloudGui::settingsDialogSize(); }
58
59
60signals:
61 void folderChanged();
62 void openFolderAlias(const QString &);
63 void showIssuesList(const QString &folderAlias);
64
65public slots:
66 void slotOpenOC();
67 void slotUpdateQuota(qint64, qint64);
68 void slotAccountStateChanged();
69
70 AccountState *accountsState() { return _accountState; }
71
72protected slots:
73 void slotAddFolder();
74 void slotEnableCurrentFolder();
75 void slotScheduleCurrentFolder();
76 void slotScheduleCurrentFolderForceRemoteDiscovery();
77 void slotForceSyncCurrentFolder();
78 void slotRemoveCurrentFolder();
79 void slotOpenCurrentFolder(); // sync folder
80 void slotOpenCurrentLocalSubFolder(); // selected subfolder in sync folder
81 void slotFolderWizardAccepted();
82 void slotFolderWizardRejected();
83 void slotDeleteAccount();
84 void slotToggleSignInState();
85 void slotOpenAccountWizard();
86 void slotAccountAdded(AccountState *);
87 void refreshSelectiveSyncStatus();
88 void slotCustomContextMenuRequested(const QPoint &);
89 void slotFolderListClicked(const QModelIndex &indx);
90 void doExpand();
91 void slotLinkActivated(const QString &link);
92
93private:
94 void showConnectionLabel(const QString &message,
95 QStringList errors = QStringList());
96 bool event(QEvent *) Q_DECL_OVERRIDE;
97 void createAccountToolbox();
98
99 /// Returns the alias of the selected folder, empty string if none
100 QString selectedFolderAlias() const;
101
102 Ui::AccountSettings *ui;
103
104 FolderStatusModel *_model;
105 QUrl _OCUrl;
106 bool _wasDisabledBefore;
107 AccountState *_accountState;
108 QuotaInfo _quotaInfo;
109 QAction *_toggleSignInOutAction;
110 QAction *_addAccountAction;
111};
112
113} // namespace OCC
114
115#endif // ACCOUNTSETTINGS_H
116