-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfiguration.h
159 lines (133 loc) · 4.36 KB
/
configuration.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#ifndef CONFIGURATION_H
#define CONFIGURATION_H
#include <QDialog>
#include <QSettings>
#include "contactdatabase.h"
#include "googleaccess.h"
#include "../Lib/iniconfig.h"
#include "../Lib/encryption.h"
namespace Ui {
class Configuration;
}
enum DatabaseMaster {
ContactManagerMaster = 0,
GoogleMaster = 1
};
#define MSG_EMAIL_CONFIRMATION 1
#define MSG_EMAIL_DELETION 2
#define MSG_EMAIL_UPDATE 3
#define MSG_EMAIL_REMINDER 4
#define MSG_SMS_CONFIRMATION 5
#define MSG_SMS_DELETION 6
#define MSG_SMS_UPDATE 7
#define MSG_SMS_REMINDER 8
// Max Number of SMS/Emails to send for a single appointment
// (used to trap send bugs to prevent client being bombarded)
#define MAXMESSAGERETRIES 10
class Configuration : public QDialog
{
Q_OBJECT
private:
QString settingCodec ;
QString settingIdMe ;
QString settingDatabaseDir ;
QString settingBackupDir ;
QString settingJournalDir ;
QString settingEasyNotepadExe ;
QString settingBackupDate ;
QString settingGoogleUsername ;
QString settingGoogleRefreshToken ;
QString settingLocalDiallingCode ;
QString settingCountryDiallingCode ;
QString settingWorkingDirectory ;
QString settingLastGoogleContactSyncDate ;
QString settingLastGoogleCalendarSyncDate ;
QString settingLastGoogleContactSyncToken ;
QString settingLastGoogleCalendarSyncToken ;
QString settingSMSAgent ;
QString settingSMSUsername ;
QString settingSMSPassword ;
QString settingSMTPServer ;
QString settingSMTPUsername ;
QString settingSMTPPort ;
QString settingSMTPPassword ;
QString settingEmailCommand ;
DatabaseMaster settingDatabaseMaster ;
Encryption *enc ;
public:
explicit Configuration(QWidget *parent = 0);
~Configuration();
bool save(QString filename) ;
bool SetupForm(ContactDatabase *db, GoogleAccess *ga) ;
bool SaveForm() ;
// INI File Access Functions
QString &getDatabasePath() ;
QString &getBackupPath() ;
QString &getJournalPath(QString userName) ;
QString &getEasyNotepadPath() ;
QString getEmailCommand(QString name, QString to) ;
QString &getLocalDiallingCode() ;
QString &getCountryDiallingCode() ;
QString &getCodec() ;
QString &getSMSAgent() ;
QString &getSMSUsername() ;
QString &getSMTPServer() ;
QString &getSMTPUsername() ;
QString &getSMTPPort() ;
QString getMessageFile(int index) ;
bool contactManagerMaster() ;
bool googleMaster() ;
bool debugGoogleEnabled() ;
bool encryptedEnabled() ;
bool contactSyncEnabled() ;
bool calendarSyncEnabled() ;
bool calendarShowBirthdays() ;
// QSettings Access Functions
QString &getMe() ;
QString &getGoogleOauth2RefreshToken() ;
QString &getGoogleUsername() ;
QString &getLastGoogleContactSyncDate() ;
QString &getLastGoogleCalendarSyncDate() ;
QString &getLastGoogleContactSyncToken() ;
QString &getLastGoogleCalendarSyncToken() ;
QString& getSMTPPassword() ;
QString& getSMSPassword() ;
DatabaseMaster getDatabaseMaster() ;
bool getEnableReminders() ;
void setLastGoogleContactSyncDate(QString syncDate) ;
void setLastGoogleCalendarSyncDate(QString syncDate) ;
void setLastGoogleContactSyncToken(QString syncToken) ;
void setLastGoogleCalendarSyncToken(QString syncToken) ;
QString &getBackupDate() ;
void setBackupDate(QString dt) ;
int getBackupSequence() ;
void setBackupSequence(int seq) ;
QString getDebug(QString key) ;
// Encryption Info
void setEncryption(Encryption *enc) ;
Encryption *encryption() ;
// void setWorkingDirectory(QString dir) ;
// void setCodec(QString val) ;
// void setBackupPath() ;
private slots:
void on_Authenticate_clicked();
void on_ResetLastSync_clicked();
void on_conflictGoogle_clicked();
void on_conflictContactManager_clicked();
private:
QString expandVars(QString str, QString name=QString(""), QString to=QString("")) ;
QString tidyPath(QString path, bool appendslash=true) ;
IniConfig ini ;
QSettings *settings ;
ContactDatabase emptydatabase ;
GoogleAccess emptygoogleaccess ;
QString googleRefreshToken ;
GoogleAccess *googleaccess ;
ContactDatabase *db ;
Ui::Configuration *ui;
};
extern QString gSavePath ;
extern QString gContactSavePath ;
extern QString gCalendarSavePath ;
extern Configuration *gConf ;
#endif // CONFIGURATION_H