Changeset View
Changeset View
Standalone View
Standalone View
resources/google-groupware/googlesettingsdialog.h
- This file was moved from resources/google/common/googlesettingsdialog.h.
1 | /* | 1 | /* | ||
---|---|---|---|---|---|
2 | Copyright (C) 2013 Daniel Vrátil <dvratil@redhat.com> | 2 | Copyright (C) 2013 Daniel Vrátil <dvratil@redhat.com> | ||
3 | 2020 Igor Poboiko <igor.poboiko@gmail.com> | ||||
3 | 4 | | |||
4 | This program is free software: you can redistribute it and/or modify | 5 | 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 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation, either version 3 of the License, or | 7 | the Free Software Foundation, either version 3 of the License, or | ||
7 | (at your option) any later version. | 8 | (at your option) any later version. | ||
8 | 9 | | |||
9 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | 13 | GNU General Public License for more details. | ||
13 | 14 | | |||
14 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License | ||
15 | along with this program. If not, see <https://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
16 | */ | 17 | */ | ||
17 | 18 | | |||
18 | #ifndef GOOGLESETTINGSDIALOG_H | 19 | #ifndef GOOGLESETTINGSDIALOG_H | ||
19 | #define GOOGLESETTINGSDIALOG_H | 20 | #define GOOGLESETTINGSDIALOG_H | ||
20 | 21 | | |||
21 | #include <QDialog> | 22 | #include <QDialog> | ||
22 | | ||||
23 | #include <KGAPI/Types> | 23 | #include <KGAPI/Types> | ||
24 | 24 | | |||
25 | namespace Ui { | ||||
26 | class GoogleSettingsDialog; | ||||
27 | } | ||||
25 | namespace KGAPI2 { | 28 | namespace KGAPI2 { | ||
26 | class Job; | 29 | class Job; | ||
27 | } | 30 | } | ||
28 | | ||||
29 | class GoogleResource; | 31 | class GoogleResource; | ||
30 | class GoogleSettings; | 32 | class GoogleSettings; | ||
31 | class GoogleAccountManager; | | |||
32 | | ||||
33 | class QGroupBox; | | |||
34 | class QComboBox; | | |||
35 | class QCheckBox; | | |||
36 | class KPluralHandlingSpinBox; | | |||
37 | class QPushButton; | | |||
38 | class QVBoxLayout; | | |||
39 | 33 | | |||
40 | class GoogleSettingsDialog : public QDialog | 34 | class GoogleSettingsDialog : public QDialog | ||
41 | { | 35 | { | ||
42 | Q_OBJECT | 36 | Q_OBJECT | ||
43 | | ||||
44 | public: | 37 | public: | ||
45 | explicit GoogleSettingsDialog(GoogleAccountManager *accountManager, WId wId, GoogleResource *parent); | 38 | explicit GoogleSettingsDialog(GoogleResource *resource, GoogleSettings *settings, WId wId); | ||
46 | ~GoogleSettingsDialog() override; | 39 | ~GoogleSettingsDialog(); | ||
47 | | ||||
48 | GoogleAccountManager *accountManager() const; | | |||
49 | KGAPI2::AccountPtr currentAccount() const; | | |||
50 | | ||||
51 | public Q_SLOTS: | | |||
52 | void reloadAccounts(); | | |||
53 | | ||||
54 | Q_SIGNALS: | | |||
55 | void currentAccountChanged(const QString &accountName); | | |||
56 | | ||||
57 | protected: | 40 | protected: | ||
58 | bool handleError(KGAPI2::Job *job); | 41 | bool handleError(KGAPI2::Job *job); | ||
59 | virtual void saveSettings() = 0; | 42 | void accountChanged(); | ||
60 | QVBoxLayout *mainLayout() const; | 43 | private: | ||
61 | 44 | GoogleResource *m_resource; | |||
45 | GoogleSettings *m_settings; | ||||
46 | Ui::GoogleSettingsDialog *m_ui = nullptr; | ||||
47 | KGAPI2::AccountPtr m_account; | ||||
62 | private Q_SLOTS: | 48 | private Q_SLOTS: | ||
63 | void slotSaveSettings(); | 49 | void slotConfigure(); | ||
64 | void slotAddAccountClicked(); | | |||
65 | void slotRemoveAccountClicked(); | | |||
66 | void slotAuthJobFinished(KGAPI2::Job *job); | 50 | void slotAuthJobFinished(KGAPI2::Job *job); | ||
67 | void slotAccountAuthenticated(KGAPI2::Job *job); | 51 | void slotSaveSettings(); | ||
68 | 52 | void slotReloadCalendars(); | |||
69 | private: | 53 | void slotReloadTaskLists(); | ||
70 | GoogleResource *m_parentResource = nullptr; | | |||
71 | GoogleAccountManager *m_accountManager = nullptr; | | |||
72 | | ||||
73 | QGroupBox *m_accGroupBox = nullptr; | | |||
74 | QPushButton *m_addAccButton = nullptr; | | |||
75 | QPushButton *m_removeAccButton = nullptr; | | |||
76 | QComboBox *m_accComboBox = nullptr; | | |||
77 | QCheckBox *m_enableRefresh = nullptr; | | |||
78 | KPluralHandlingSpinBox *m_refreshSpinBox = nullptr; | | |||
79 | QVBoxLayout *m_mainLayout = nullptr; | | |||
80 | }; | 54 | }; | ||
81 | 55 | | |||
82 | #endif // GOOGLESETTINGSDIALOG_H | 56 | #endif // GOOGLESETTINGSDIALOG_H |