-rw-r--r-- | kmicromail/libmailwrapper/settings.cpp | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/kmicromail/libmailwrapper/settings.cpp b/kmicromail/libmailwrapper/settings.cpp index 8f909f9..9436d43 100644 --- a/kmicromail/libmailwrapper/settings.cpp +++ b/kmicromail/libmailwrapper/settings.cpp | |||
@@ -1,378 +1,377 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | #include <qdir.h> | 2 | #include <qdir.h> |
3 | 3 | ||
4 | #include <qtextcodec.h> | 4 | #include <qtextcodec.h> |
5 | #include <qtextstream.h> | 5 | #include <qtextstream.h> |
6 | #include <qfile.h> | 6 | #include <qfile.h> |
7 | 7 | ||
8 | //#include <opie2/odebug.h> | 8 | //#include <opie2/odebug.h> |
9 | #include <kconfig.h> | 9 | #include <kconfig.h> |
10 | 10 | ||
11 | #include <kstandarddirs.h> | 11 | #include <kstandarddirs.h> |
12 | #include "settings.h" | 12 | #include "settings.h" |
13 | //#include "defines.h" | 13 | //#include "defines.h" |
14 | 14 | ||
15 | #define IMAP_PORT "143" | 15 | #define IMAP_PORT "143" |
16 | #define IMAP_SSL_PORT "993" | 16 | #define IMAP_SSL_PORT "993" |
17 | #define SMTP_PORT "25" | 17 | #define SMTP_PORT "25" |
18 | #define SMTP_SSL_PORT "465" | 18 | #define SMTP_SSL_PORT "465" |
19 | #define POP3_PORT "110" | 19 | #define POP3_PORT "110" |
20 | #define POP3_SSL_PORT "995" | 20 | #define POP3_SSL_PORT "995" |
21 | #define NNTP_PORT "119" | 21 | #define NNTP_PORT "119" |
22 | #define NNTP_SSL_PORT "563" | 22 | #define NNTP_SSL_PORT "563" |
23 | 23 | ||
24 | 24 | ||
25 | Settings::Settings() | 25 | Settings::Settings() |
26 | : QObject() | 26 | : QObject() |
27 | { | 27 | { |
28 | accounts.setAutoDelete( true ); ; | 28 | accounts.setAutoDelete( true ); ; |
29 | updateAccounts(); | 29 | updateAccounts(); |
30 | //qDebug("++++++++++++++++++new settings "); | 30 | //qDebug("++++++++++++++++++new settings "); |
31 | } | 31 | } |
32 | 32 | ||
33 | void Settings::checkDirectory() | 33 | void Settings::checkDirectory() |
34 | { | 34 | { |
35 | return; | 35 | return; |
36 | locateLocal("data", "kopiemail" ); | 36 | locateLocal("data", "kopiemail" ); |
37 | /* | 37 | /* |
38 | if ( !QDir( (QString) getenv( "HOME" ) + "/Applications/opiemail/" ).exists() ) { | 38 | if ( !QDir( (QString) getenv( "HOME" ) + "/Applications/opiemail/" ).exists() ) { |
39 | system( "mkdir -p $HOME/Applications/opiemail" ); | 39 | system( "mkdir -p $HOME/Applications/opiemail" ); |
40 | qDebug("$HOME/Applications/opiemail created "); | 40 | qDebug("$HOME/Applications/opiemail created "); |
41 | } | 41 | } |
42 | */ | 42 | */ |
43 | } | 43 | } |
44 | 44 | ||
45 | QList<Account> Settings::getAccounts() | 45 | QList<Account> Settings::getAccounts() |
46 | { | 46 | { |
47 | return accounts; | 47 | return accounts; |
48 | } | 48 | } |
49 | 49 | ||
50 | void Settings::addAccount( Account *account ) | 50 | void Settings::addAccount( Account *account ) |
51 | { | 51 | { |
52 | accounts.append( account ); | 52 | accounts.append( account ); |
53 | } | 53 | } |
54 | 54 | ||
55 | void Settings::delAccount( Account *account ) | 55 | void Settings::delAccount( Account *account ) |
56 | { | 56 | { |
57 | account->remove(); | 57 | account->remove(); |
58 | accounts.remove( account ); | 58 | accounts.remove( account ); |
59 | } | 59 | } |
60 | 60 | ||
61 | void Settings::updateAccounts() | 61 | void Settings::updateAccounts() |
62 | { | 62 | { |
63 | accounts.clear(); | 63 | accounts.clear(); |
64 | QDir dir( locateLocal("data", "kopiemail" ) ); | 64 | QDir dir( locateLocal("data", "kopiemail" ) ); |
65 | QStringList::Iterator it; | 65 | QStringList::Iterator it; |
66 | 66 | ||
67 | QStringList imap = dir.entryList( "imap-*" ); | 67 | QStringList imap = dir.entryList( "imap-*" ); |
68 | for ( it = imap.begin(); it != imap.end(); it++ ) { | 68 | for ( it = imap.begin(); it != imap.end(); it++ ) { |
69 | IMAPaccount *account = new IMAPaccount( (*it).replace(0, 5, "") ); | 69 | IMAPaccount *account = new IMAPaccount( (*it).replace(0, 5, "") ); |
70 | accounts.append( account ); | 70 | accounts.append( account ); |
71 | } | 71 | } |
72 | 72 | ||
73 | QStringList pop3 = dir.entryList( "pop3-*" ); | 73 | QStringList pop3 = dir.entryList( "pop3-*" ); |
74 | for ( it = pop3.begin(); it != pop3.end(); it++ ) { | 74 | for ( it = pop3.begin(); it != pop3.end(); it++ ) { |
75 | POP3account *account = new POP3account( (*it).replace(0, 5, "") ); | 75 | POP3account *account = new POP3account( (*it).replace(0, 5, "") ); |
76 | accounts.append( account ); | 76 | accounts.append( account ); |
77 | } | 77 | } |
78 | 78 | ||
79 | QStringList smtp = dir.entryList( "smtp-*" ); | 79 | QStringList smtp = dir.entryList( "smtp-*" ); |
80 | for ( it = smtp.begin(); it != smtp.end(); it++ ) { | 80 | for ( it = smtp.begin(); it != smtp.end(); it++ ) { |
81 | SMTPaccount *account = new SMTPaccount( (*it).replace(0, 5, "") ); | 81 | SMTPaccount *account = new SMTPaccount( (*it).replace(0, 5, "") ); |
82 | accounts.append( account ); | 82 | accounts.append( account ); |
83 | } | 83 | } |
84 | 84 | ||
85 | QStringList nntp = dir.entryList( "nntp-*" ); | 85 | QStringList nntp = dir.entryList( "nntp-*" ); |
86 | for ( it = nntp.begin(); it != nntp.end(); it++ ) { | 86 | for ( it = nntp.begin(); it != nntp.end(); it++ ) { |
87 | NNTPaccount *account = new NNTPaccount( (*it).replace(0, 5, "") ); | 87 | NNTPaccount *account = new NNTPaccount( (*it).replace(0, 5, "") ); |
88 | accounts.append( account ); | 88 | accounts.append( account ); |
89 | } | 89 | } |
90 | 90 | ||
91 | readAccounts(); | 91 | readAccounts(); |
92 | } | 92 | } |
93 | 93 | ||
94 | void Settings::saveAccounts() | 94 | void Settings::saveAccounts() |
95 | { | 95 | { |
96 | checkDirectory(); | 96 | checkDirectory(); |
97 | Account *it; | 97 | Account *it; |
98 | 98 | ||
99 | for ( it = accounts.first(); it; it = accounts.next() ) { | 99 | for ( it = accounts.first(); it; it = accounts.next() ) { |
100 | it->save(); | 100 | it->save(); |
101 | } | 101 | } |
102 | } | 102 | } |
103 | 103 | ||
104 | void Settings::readAccounts() | 104 | void Settings::readAccounts() |
105 | { | 105 | { |
106 | checkDirectory(); | 106 | checkDirectory(); |
107 | Account *it; | 107 | Account *it; |
108 | 108 | ||
109 | for ( it = accounts.first(); it; it = accounts.next() ) { | 109 | for ( it = accounts.first(); it; it = accounts.next() ) { |
110 | it->read(); | 110 | it->read(); |
111 | } | 111 | } |
112 | } | 112 | } |
113 | 113 | ||
114 | Account::Account() | 114 | Account::Account() |
115 | { | 115 | { |
116 | accountName = "changeMe"; | 116 | accountName = "changeMe"; |
117 | type = MAILLIB::A_UNDEFINED; | 117 | type = MAILLIB::A_UNDEFINED; |
118 | ssl = false; | 118 | ssl = false; |
119 | connectionType = 1; | 119 | connectionType = 1; |
120 | offline = false; | 120 | offline = false; |
121 | maxMailSize = 0; | 121 | maxMailSize = 0; |
122 | lastFetch; | ||
123 | leaveOnServer = false; | 122 | leaveOnServer = false; |
124 | } | 123 | } |
125 | 124 | ||
126 | void Account::remove() | 125 | void Account::remove() |
127 | { | 126 | { |
128 | QFile file( getFileName() ); | 127 | QFile file( getFileName() ); |
129 | file.remove(); | 128 | file.remove(); |
130 | } | 129 | } |
131 | 130 | ||
132 | void Account::setPasswordList(const QStringList &str) | 131 | void Account::setPasswordList(const QStringList &str) |
133 | { | 132 | { |
134 | password = ""; | 133 | password = ""; |
135 | int i; | 134 | int i; |
136 | for ( i = 0; i < str.count() ; ++i ) { | 135 | for ( i = 0; i < str.count() ; ++i ) { |
137 | QChar c ( (str[i].toUInt()-131)/(str.count()- (i%3))); | 136 | QChar c ( (str[i].toUInt()-131)/(str.count()- (i%3))); |
138 | password.append( c ); | 137 | password.append( c ); |
139 | } | 138 | } |
140 | //qDebug("password %s ", password.latin1()); | 139 | //qDebug("password %s ", password.latin1()); |
141 | } | 140 | } |
142 | QStringList Account::getPasswordList() | 141 | QStringList Account::getPasswordList() |
143 | { | 142 | { |
144 | int i; | 143 | int i; |
145 | int len = password.length(); | 144 | int len = password.length(); |
146 | QStringList str; | 145 | QStringList str; |
147 | 146 | ||
148 | for ( i = 0; i < len ; ++i ) { | 147 | for ( i = 0; i < len ; ++i ) { |
149 | int val = password.at(i).unicode()*(len-(i%3))+131; | 148 | int val = password.at(i).unicode()*(len-(i%3))+131; |
150 | str.append( QString::number( val ) ); | 149 | str.append( QString::number( val ) ); |
151 | // qDebug("append %s ", str[i].latin1()); | 150 | // qDebug("append %s ", str[i].latin1()); |
152 | } | 151 | } |
153 | return str; | 152 | return str; |
154 | } | 153 | } |
155 | 154 | ||
156 | IMAPaccount::IMAPaccount() | 155 | IMAPaccount::IMAPaccount() |
157 | : Account() | 156 | : Account() |
158 | { | 157 | { |
159 | file = IMAPaccount::getUniqueFileName(); | 158 | file = IMAPaccount::getUniqueFileName(); |
160 | accountName = "New IMAP Account"; | 159 | accountName = "New IMAP Account"; |
161 | ssl = false; | 160 | ssl = false; |
162 | connectionType = 1; | 161 | connectionType = 1; |
163 | type = MAILLIB::A_IMAP; | 162 | type = MAILLIB::A_IMAP; |
164 | port = IMAP_PORT; | 163 | port = IMAP_PORT; |
165 | } | 164 | } |
166 | 165 | ||
167 | IMAPaccount::IMAPaccount( QString filename ) | 166 | IMAPaccount::IMAPaccount( QString filename ) |
168 | : Account() | 167 | : Account() |
169 | { | 168 | { |
170 | file = filename; | 169 | file = filename; |
171 | accountName = "New IMAP Account"; | 170 | accountName = "New IMAP Account"; |
172 | ssl = false; | 171 | ssl = false; |
173 | connectionType = 1; | 172 | connectionType = 1; |
174 | type = MAILLIB::A_IMAP; | 173 | type = MAILLIB::A_IMAP; |
175 | port = IMAP_PORT; | 174 | port = IMAP_PORT; |
176 | } | 175 | } |
177 | 176 | ||
178 | QString IMAPaccount::getUniqueFileName() | 177 | QString IMAPaccount::getUniqueFileName() |
179 | { | 178 | { |
180 | int num = 0; | 179 | int num = 0; |
181 | QString unique; | 180 | QString unique; |
182 | 181 | ||
183 | QDir dir( locateLocal("data", "kopiemail" ) ); | 182 | QDir dir( locateLocal("data", "kopiemail" ) ); |
184 | 183 | ||
185 | QStringList imap = dir.entryList( "imap-*" ); | 184 | QStringList imap = dir.entryList( "imap-*" ); |
186 | do { | 185 | do { |
187 | unique.setNum( num++ ); | 186 | unique.setNum( num++ ); |
188 | } while ( imap.contains( "imap-" + unique ) > 0 ); | 187 | } while ( imap.contains( "imap-" + unique ) > 0 ); |
189 | 188 | ||
190 | return unique; | 189 | return unique; |
191 | } | 190 | } |
192 | 191 | ||
193 | void IMAPaccount::read() | 192 | void IMAPaccount::read() |
194 | { | 193 | { |
195 | KConfig *conf = new KConfig( getFileName() ); | 194 | KConfig *conf = new KConfig( getFileName() ); |
196 | conf->setGroup( "IMAP Account" ); | 195 | conf->setGroup( "IMAP Account" ); |
197 | accountName = conf->readEntry( "Account","" ); | 196 | accountName = conf->readEntry( "Account","" ); |
198 | if (accountName.isNull()) accountName = ""; | 197 | if (accountName.isNull()) accountName = ""; |
199 | server = conf->readEntry( "Server","" ); | 198 | server = conf->readEntry( "Server","" ); |
200 | if (server.isNull()) server=""; | 199 | if (server.isNull()) server=""; |
201 | port = conf->readEntry( "Port","" ); | 200 | port = conf->readEntry( "Port","" ); |
202 | if (port.isNull()) port="143"; | 201 | if (port.isNull()) port="143"; |
203 | connectionType = conf->readNumEntry( "ConnectionType" ); | 202 | connectionType = conf->readNumEntry( "ConnectionType" ); |
204 | ssl = conf->readBoolEntry( "SSL",false ); | 203 | ssl = conf->readBoolEntry( "SSL",false ); |
205 | user = conf->readEntry( "User","" ); | 204 | user = conf->readEntry( "User","" ); |
206 | if (user.isNull()) user = ""; | 205 | if (user.isNull()) user = ""; |
207 | //password = conf->readEntryCrypt( "Password","" ); | 206 | //password = conf->readEntryCrypt( "Password","" ); |
208 | setPasswordList( conf->readListEntry( "FolderHistory")); | 207 | setPasswordList( conf->readListEntry( "FolderHistory")); |
209 | if (password.isNull()) password = ""; | 208 | if (password.isNull()) password = ""; |
210 | prefix = conf->readEntry("MailPrefix",""); | 209 | prefix = conf->readEntry("MailPrefix",""); |
211 | if (prefix.isNull()) prefix = ""; | 210 | if (prefix.isNull()) prefix = ""; |
212 | offline = conf->readBoolEntry("Offline",false); | 211 | offline = conf->readBoolEntry("Offline",false); |
213 | localFolder = conf->readEntry( "LocalFolder" ); | 212 | localFolder = conf->readEntry( "LocalFolder" ); |
214 | maxMailSize = conf->readNumEntry( "MaxSize",0 ); | 213 | maxMailSize = conf->readNumEntry( "MaxSize",0 ); |
215 | int lf = conf->readNumEntry( "LastFetch",0 ); | 214 | int lf = conf->readNumEntry( "LastFetch",0 ); |
216 | QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) ); | 215 | QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) ); |
217 | leaveOnServer = conf->readBoolEntry("LeaveOnServer",false); | 216 | leaveOnServer = conf->readBoolEntry("LeaveOnServer",false); |
218 | if ( lf < 0 ) lf = 0; | 217 | if ( lf < 0 ) lf = 0; |
219 | lastFetch = dt.addSecs( lf ); | 218 | lastFetch = dt.addSecs( lf ); |
220 | delete conf; | 219 | delete conf; |
221 | } | 220 | } |
222 | 221 | ||
223 | void IMAPaccount::save() | 222 | void IMAPaccount::save() |
224 | { | 223 | { |
225 | 224 | ||
226 | Settings::checkDirectory(); | 225 | Settings::checkDirectory(); |
227 | 226 | ||
228 | KConfig *conf = new KConfig( getFileName() ); | 227 | KConfig *conf = new KConfig( getFileName() ); |
229 | conf->setGroup( "IMAP Account" ); | 228 | conf->setGroup( "IMAP Account" ); |
230 | conf->writeEntry( "Account", accountName ); | 229 | conf->writeEntry( "Account", accountName ); |
231 | conf->writeEntry( "Server", server ); | 230 | conf->writeEntry( "Server", server ); |
232 | conf->writeEntry( "Port", port ); | 231 | conf->writeEntry( "Port", port ); |
233 | conf->writeEntry( "SSL", ssl ); | 232 | conf->writeEntry( "SSL", ssl ); |
234 | conf->writeEntry( "ConnectionType", connectionType ); | 233 | conf->writeEntry( "ConnectionType", connectionType ); |
235 | conf->writeEntry( "User", user ); | 234 | conf->writeEntry( "User", user ); |
236 | //conf->writeEntryCrypt( "Password", password ); | 235 | //conf->writeEntryCrypt( "Password", password ); |
237 | conf->writeEntry( "FolderHistory",getPasswordList() ); | 236 | conf->writeEntry( "FolderHistory",getPasswordList() ); |
238 | conf->writeEntry( "MailPrefix",prefix); | 237 | conf->writeEntry( "MailPrefix",prefix); |
239 | conf->writeEntry( "Offline",offline); | 238 | conf->writeEntry( "Offline",offline); |
240 | conf->writeEntry( "LocalFolder", localFolder ); | 239 | conf->writeEntry( "LocalFolder", localFolder ); |
241 | conf->writeEntry( "MaxSize", maxMailSize ); | 240 | conf->writeEntry( "MaxSize", maxMailSize ); |
242 | QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) ); | 241 | QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) ); |
243 | int lf = dt.secsTo ( lastFetch ); | 242 | int lf = dt.secsTo ( lastFetch ); |
244 | conf->writeEntry( "LastFetch", lf ); | 243 | conf->writeEntry( "LastFetch", lf ); |
245 | conf->writeEntry( "LeaveOnServer", leaveOnServer); | 244 | conf->writeEntry( "LeaveOnServer", leaveOnServer); |
246 | conf->sync(); | 245 | conf->sync(); |
247 | delete conf; | 246 | delete conf; |
248 | } | 247 | } |
249 | 248 | ||
250 | 249 | ||
251 | QString IMAPaccount::getFileName() | 250 | QString IMAPaccount::getFileName() |
252 | { | 251 | { |
253 | return locateLocal("data", "kopiemail" ) +"/imap-" + file; | 252 | return locateLocal("data", "kopiemail" ) +"/imap-" + file; |
254 | } | 253 | } |
255 | 254 | ||
256 | POP3account::POP3account() | 255 | POP3account::POP3account() |
257 | : Account() | 256 | : Account() |
258 | { | 257 | { |
259 | file = POP3account::getUniqueFileName(); | 258 | file = POP3account::getUniqueFileName(); |
260 | accountName = "New POP3 Account"; | 259 | accountName = "New POP3 Account"; |
261 | ssl = false; | 260 | ssl = false; |
262 | connectionType = 1; | 261 | connectionType = 1; |
263 | type = MAILLIB::A_POP3; | 262 | type = MAILLIB::A_POP3; |
264 | port = POP3_PORT; | 263 | port = POP3_PORT; |
265 | } | 264 | } |
266 | 265 | ||
267 | POP3account::POP3account( QString filename ) | 266 | POP3account::POP3account( QString filename ) |
268 | : Account() | 267 | : Account() |
269 | { | 268 | { |
270 | file = filename; | 269 | file = filename; |
271 | accountName = "New POP3 Account"; | 270 | accountName = "New POP3 Account"; |
272 | ssl = false; | 271 | ssl = false; |
273 | connectionType = 1; | 272 | connectionType = 1; |
274 | type = MAILLIB::A_POP3; | 273 | type = MAILLIB::A_POP3; |
275 | port = POP3_PORT; | 274 | port = POP3_PORT; |
276 | } | 275 | } |
277 | 276 | ||
278 | QString POP3account::getUniqueFileName() | 277 | QString POP3account::getUniqueFileName() |
279 | { | 278 | { |
280 | int num = 0; | 279 | int num = 0; |
281 | QString unique; | 280 | QString unique; |
282 | 281 | ||
283 | QDir dir( locateLocal("data", "kopiemail" ) ); | 282 | QDir dir( locateLocal("data", "kopiemail" ) ); |
284 | 283 | ||
285 | QStringList imap = dir.entryList( "pop3-*" ); | 284 | QStringList imap = dir.entryList( "pop3-*" ); |
286 | do { | 285 | do { |
287 | unique.setNum( num++ ); | 286 | unique.setNum( num++ ); |
288 | } while ( imap.contains( "pop3-" + unique ) > 0 ); | 287 | } while ( imap.contains( "pop3-" + unique ) > 0 ); |
289 | 288 | ||
290 | return unique; | 289 | return unique; |
291 | } | 290 | } |
292 | 291 | ||
293 | void POP3account::read() | 292 | void POP3account::read() |
294 | { | 293 | { |
295 | KConfig *conf = new KConfig( getFileName()); | 294 | KConfig *conf = new KConfig( getFileName()); |
296 | conf->setGroup( "POP3 Account" ); | 295 | conf->setGroup( "POP3 Account" ); |
297 | accountName = conf->readEntry( "Account" ); | 296 | accountName = conf->readEntry( "Account" ); |
298 | server = conf->readEntry( "Server" ); | 297 | server = conf->readEntry( "Server" ); |
299 | port = conf->readEntry( "Port" ); | 298 | port = conf->readEntry( "Port" ); |
300 | ssl = conf->readBoolEntry( "SSL" ); | 299 | ssl = conf->readBoolEntry( "SSL" ); |
301 | connectionType = conf->readNumEntry( "ConnectionType" ); | 300 | connectionType = conf->readNumEntry( "ConnectionType" ); |
302 | user = conf->readEntry( "User" ); | 301 | user = conf->readEntry( "User" ); |
303 | //password = conf->readEntryCrypt( "Password" ); | 302 | //password = conf->readEntryCrypt( "Password" ); |
304 | setPasswordList( conf->readListEntry( "FolderHistory")); | 303 | setPasswordList( conf->readListEntry( "FolderHistory")); |
305 | offline = conf->readBoolEntry("Offline",false); | 304 | offline = conf->readBoolEntry("Offline",false); |
306 | localFolder = conf->readEntry( "LocalFolder" ); | 305 | localFolder = conf->readEntry( "LocalFolder" ); |
307 | maxMailSize = conf->readNumEntry( "MaxSize",0 ); | 306 | maxMailSize = conf->readNumEntry( "MaxSize",0 ); |
308 | int lf = conf->readNumEntry( "LastFetch",0 ); | 307 | int lf = conf->readNumEntry( "LastFetch",0 ); |
309 | QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) ); | 308 | QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) ); |
310 | leaveOnServer = conf->readBoolEntry("LeaveOnServer",false); | 309 | leaveOnServer = conf->readBoolEntry("LeaveOnServer",false); |
311 | lastFetch = dt.addSecs( lf ); | 310 | lastFetch = dt.addSecs( lf ); |
312 | delete conf; | 311 | delete conf; |
313 | } | 312 | } |
314 | 313 | ||
315 | void POP3account::save() | 314 | void POP3account::save() |
316 | { | 315 | { |
317 | Settings::checkDirectory(); | 316 | Settings::checkDirectory(); |
318 | 317 | ||
319 | KConfig *conf = new KConfig( getFileName() ); | 318 | KConfig *conf = new KConfig( getFileName() ); |
320 | conf->setGroup( "POP3 Account" ); | 319 | conf->setGroup( "POP3 Account" ); |
321 | conf->writeEntry( "Account", accountName ); | 320 | conf->writeEntry( "Account", accountName ); |
322 | conf->writeEntry( "Server", server ); | 321 | conf->writeEntry( "Server", server ); |
323 | conf->writeEntry( "Port", port ); | 322 | conf->writeEntry( "Port", port ); |
324 | conf->writeEntry( "SSL", ssl ); | 323 | conf->writeEntry( "SSL", ssl ); |
325 | conf->writeEntry( "ConnectionType", connectionType ); | 324 | conf->writeEntry( "ConnectionType", connectionType ); |
326 | conf->writeEntry( "User", user ); | 325 | conf->writeEntry( "User", user ); |
327 | //conf->writeEntryCrypt( "Password", password ); | 326 | //conf->writeEntryCrypt( "Password", password ); |
328 | conf->writeEntry( "FolderHistory",getPasswordList() ); | 327 | conf->writeEntry( "FolderHistory",getPasswordList() ); |
329 | conf->writeEntry( "Offline",offline); | 328 | conf->writeEntry( "Offline",offline); |
330 | conf->writeEntry( "LocalFolder", localFolder ); | 329 | conf->writeEntry( "LocalFolder", localFolder ); |
331 | conf->writeEntry( "MaxSize", maxMailSize ); | 330 | conf->writeEntry( "MaxSize", maxMailSize ); |
332 | QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) ); | 331 | QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) ); |
333 | int lf = dt.secsTo ( lastFetch ); | 332 | int lf = dt.secsTo ( lastFetch ); |
334 | conf->writeEntry( "LastFetch", lf ); | 333 | conf->writeEntry( "LastFetch", lf ); |
335 | conf->writeEntry( "LeaveOnServer", leaveOnServer); | 334 | conf->writeEntry( "LeaveOnServer", leaveOnServer); |
336 | conf->sync(); | 335 | conf->sync(); |
337 | delete conf; | 336 | delete conf; |
338 | } | 337 | } |
339 | 338 | ||
340 | 339 | ||
341 | QString POP3account::getFileName() | 340 | QString POP3account::getFileName() |
342 | { | 341 | { |
343 | return locateLocal("data", "kopiemail" ) +"/pop3-" + file; | 342 | return locateLocal("data", "kopiemail" ) +"/pop3-" + file; |
344 | } | 343 | } |
345 | 344 | ||
346 | SMTPaccount::SMTPaccount() | 345 | SMTPaccount::SMTPaccount() |
347 | : Account() | 346 | : Account() |
348 | { | 347 | { |
349 | file = SMTPaccount::getUniqueFileName(); | 348 | file = SMTPaccount::getUniqueFileName(); |
350 | accountName = "New SMTP Account"; | 349 | accountName = "New SMTP Account"; |
351 | ssl = false; | 350 | ssl = false; |
352 | connectionType = 1; | 351 | connectionType = 1; |
353 | login = false; | 352 | login = false; |
354 | useCC = false; | 353 | useCC = false; |
355 | useBCC = false; | 354 | useBCC = false; |
356 | useReply = false; | 355 | useReply = false; |
357 | type = MAILLIB::A_SMTP; | 356 | type = MAILLIB::A_SMTP; |
358 | port = SMTP_PORT; | 357 | port = SMTP_PORT; |
359 | } | 358 | } |
360 | 359 | ||
361 | SMTPaccount::SMTPaccount( QString filename ) | 360 | SMTPaccount::SMTPaccount( QString filename ) |
362 | : Account() | 361 | : Account() |
363 | { | 362 | { |
364 | file = filename; | 363 | file = filename; |
365 | accountName = "New SMTP Account"; | 364 | accountName = "New SMTP Account"; |
366 | ssl = false; | 365 | ssl = false; |
367 | connectionType = 1; | 366 | connectionType = 1; |
368 | login = false; | 367 | login = false; |
369 | type = MAILLIB::A_SMTP; | 368 | type = MAILLIB::A_SMTP; |
370 | port = SMTP_PORT; | 369 | port = SMTP_PORT; |
371 | } | 370 | } |
372 | 371 | ||
373 | QString SMTPaccount::getSignature() | 372 | QString SMTPaccount::getSignature() |
374 | { | 373 | { |
375 | QFileInfo fi ( signature ); | 374 | QFileInfo fi ( signature ); |
376 | if ( ! fi.exists() ) | 375 | if ( ! fi.exists() ) |
377 | return QString(); | 376 | return QString(); |
378 | 377 | ||