16 */ |
16 */ |
17 |
17 |
18 #ifndef NMAPISETTINGSMANAGER_P_H_ |
18 #ifndef NMAPISETTINGSMANAGER_P_H_ |
19 #define NMAPISETTINGSMANAGER_P_H_ |
19 #define NMAPISETTINGSMANAGER_P_H_ |
20 |
20 |
21 #include <QVariant> |
|
22 |
|
23 #include <nmapimailboxsettingsdata.h> |
|
24 #include <cemailaccounts.h> |
|
25 |
|
26 class CImImap4Settings; |
|
27 class CImSmtpSettings; |
|
28 class XQSettingsManager; |
|
29 class XQCentralRepositoryUtils; |
|
30 |
21 |
31 namespace EmailClientApi |
22 namespace EmailClientApi |
32 { |
23 { |
33 |
24 |
34 class NmApiSettingsManagerPrivate |
25 class NmApiSettingsManagerPrivate |
35 { |
26 { |
|
27 private: |
|
28 class AccountDataCleanUpItem |
|
29 { |
|
30 public: |
|
31 /* CleanupItem class for making sure that all allocated members |
|
32 will be deleted and set to null when load or save function execution |
|
33 stops. |
|
34 */ |
|
35 AccountDataCleanUpItem(CEmailAccounts *&account, |
|
36 CImPop3Settings *&pop3Settings, |
|
37 CImImap4Settings *&imap4Settings, |
|
38 CImSmtpSettings *&smtpSettings, |
|
39 XQSettingsManager *&qSettingsManager |
|
40 ) |
|
41 : |
|
42 mAccount(account), |
|
43 mPop3Settings(pop3Settings), |
|
44 mImap4Settings(imap4Settings), |
|
45 mSmtpSettings(smtpSettings), |
|
46 mQSettingsManager(qSettingsManager) |
|
47 { |
|
48 } |
|
49 |
|
50 ~AccountDataCleanUpItem() |
|
51 { |
|
52 delete mAccount; |
|
53 mAccount = NULL; |
|
54 delete mPop3Settings; |
|
55 mPop3Settings = NULL; |
|
56 delete mImap4Settings; |
|
57 mImap4Settings = NULL; |
|
58 delete mSmtpSettings; |
|
59 mSmtpSettings = NULL; |
|
60 delete mQSettingsManager; |
|
61 mQSettingsManager = NULL; |
|
62 } |
|
63 |
|
64 public: |
|
65 CEmailAccounts *&mAccount; |
|
66 CImPop3Settings *&mPop3Settings; |
|
67 CImImap4Settings *&mImap4Settings; |
|
68 CImSmtpSettings *&mSmtpSettings; |
|
69 XQSettingsManager *&mQSettingsManager; |
|
70 }; |
|
71 |
36 public: |
72 public: |
37 NmApiSettingsManagerPrivate(const quint64 mailboxId); |
73 NmApiSettingsManagerPrivate(); |
38 ~NmApiSettingsManagerPrivate(); |
74 ~NmApiSettingsManagerPrivate(); |
39 |
75 |
40 bool load(quint64 mailboxId, NmApiMailboxSettingsData &data); |
76 bool load(quint64 mailboxId, NmApiMailboxSettingsData &data); |
41 bool save(const NmApiMailboxSettingsData &data); |
77 bool save(quint64 mailboxId, const NmApiMailboxSettingsData &data); |
42 |
78 |
43 private: |
79 private: |
44 bool writeSettingL(const NmApiMailboxSettingsData &data); |
80 |
45 bool saveSettings(); |
81 void fillImapSettingDataL(const NmApiMailboxSettingsData &data); |
46 bool readSetting(NmApiMailboxSettingsData &data); |
82 void fillPopSettingDataL(const NmApiMailboxSettingsData &data); |
47 bool readCenRepSetting(NmApiMailboxSettingsData &data); |
83 void fillSmtpSettingDataL(const NmApiMailboxSettingsData &data, |
|
84 const QVariant settingValue, const int key); |
|
85 |
|
86 void writeSettingL(const NmApiMailboxSettingsData &data); |
|
87 void readSettings(NmApiMailboxSettingsData &data); |
|
88 bool readCenRepSettings(NmApiMailboxSettingsData &data); |
48 QVariant readFromCenRep(quint32 key) const; |
89 QVariant readFromCenRep(quint32 key) const; |
|
90 QVariant readFromCenRep(quint32 key, bool &success) const; |
49 bool writeSettingToCenRep(const NmApiMailboxSettingsData &data); |
91 bool writeSettingToCenRep(const NmApiMailboxSettingsData &data); |
50 bool writeToCenRep(quint32 key, const QVariant &value) const; |
92 bool writeToCenRep(quint32 key, const QVariant &value) const; |
51 void setSecurity(QString securityType); |
93 void setSecurity(CImBaseEmailSettings &settings, QString securityType); |
52 QString security() const; |
94 |
53 QString alwaysOnlineState() const; |
95 QString security(CImBaseEmailSettings &settings) const; |
54 void setAlwaysOnlineState(const QVariant state); |
96 QString alwaysOnlineState(bool &success) const; |
55 void calculateMailboxOffset(); |
97 bool setAlwaysOnlineState(const QVariant &state); |
56 void calculateActiveProfileOffset(); |
98 bool calculateMailboxOffset(); |
57 qint32 convertToProfileOffset(int profile) const; |
99 bool calculateActiveProfileOffset(); |
58 bool checkAccountType(); |
100 bool checkAccountTypeL(); |
59 void initAccountL(); |
101 void initAccountL(); |
60 |
102 |
61 private: |
103 private: |
62 NmApiMailboxSettingsData *mSettingsData; |
|
63 |
104 |
64 CEmailAccounts *mAccount; |
105 CEmailAccounts *mAccount; |
65 CImPop3Settings *mPop3Settings; |
106 CImPop3Settings *mPop3Settings; |
66 CImImap4Settings *mImap4Settings; |
107 CImImap4Settings *mImap4Settings; |
67 CImSmtpSettings *mSmtpSettings; |
108 CImSmtpSettings *mSmtpSettings; |
|
109 XQSettingsManager *mQSettingsManager; |
68 |
110 |
69 TSmtpAccount mSmtpAccount; |
111 TSmtpAccount mSmtpAccount; |
70 TImapAccount mImap4Account; |
112 TImapAccount mImap4Account; |
71 TPopAccount mPop3Account; |
113 TPopAccount mPop3Account; |
72 |
114 |
73 QString mMailboxType; |
115 QString mMailboxType; |
74 qint32 mMailboxOffset; |
116 qint32 mMailboxOffset; |
75 qint32 mActiveProfileOffset; |
117 qint32 mActiveProfileOffset; |
76 XQSettingsManager *mQSettingsManager; |
118 |
77 |
119 |
78 quint32 mMailboxId; |
120 quint32 mMailboxId; |
79 }; |
121 }; |
80 |
122 |
81 } //namespace EmailClientApi |
123 } //namespace EmailClientApi |