author | zautrix <zautrix> | 2004-09-10 22:52:50 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-10 22:52:50 (UTC) |
commit | 1b41a0e3bf63364940daf132446939e3570c57ad (patch) (unidiff) | |
tree | 81db8e427beadcf3bbd5356962b5d08b970a87e4 /kmicromail/libmailwrapper/settings.cpp | |
parent | c280882f788b31f874f928e23fc29c2aaca991eb (diff) | |
download | kdepimpi-1b41a0e3bf63364940daf132446939e3570c57ad.zip kdepimpi-1b41a0e3bf63364940daf132446939e3570c57ad.tar.gz kdepimpi-1b41a0e3bf63364940daf132446939e3570c57ad.tar.bz2 |
Added pop3 settings
Diffstat (limited to 'kmicromail/libmailwrapper/settings.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kmicromail/libmailwrapper/settings.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/kmicromail/libmailwrapper/settings.cpp b/kmicromail/libmailwrapper/settings.cpp index b0a539e..90e32fa 100644 --- a/kmicromail/libmailwrapper/settings.cpp +++ b/kmicromail/libmailwrapper/settings.cpp | |||
@@ -210,113 +210,123 @@ POP3account::POP3account() | |||
210 | : Account() | 210 | : Account() |
211 | { | 211 | { |
212 | file = POP3account::getUniqueFileName(); | 212 | file = POP3account::getUniqueFileName(); |
213 | accountName = "New POP3 Account"; | 213 | accountName = "New POP3 Account"; |
214 | ssl = false; | 214 | ssl = false; |
215 | connectionType = 1; | 215 | connectionType = 1; |
216 | type = MAILLIB::A_POP3; | 216 | type = MAILLIB::A_POP3; |
217 | port = POP3_PORT; | 217 | port = POP3_PORT; |
218 | } | 218 | } |
219 | 219 | ||
220 | POP3account::POP3account( QString filename ) | 220 | POP3account::POP3account( QString filename ) |
221 | : Account() | 221 | : Account() |
222 | { | 222 | { |
223 | file = filename; | 223 | file = filename; |
224 | accountName = "New POP3 Account"; | 224 | accountName = "New POP3 Account"; |
225 | ssl = false; | 225 | ssl = false; |
226 | connectionType = 1; | 226 | connectionType = 1; |
227 | type = MAILLIB::A_POP3; | 227 | type = MAILLIB::A_POP3; |
228 | port = POP3_PORT; | 228 | port = POP3_PORT; |
229 | } | 229 | } |
230 | 230 | ||
231 | QString POP3account::getUniqueFileName() | 231 | QString POP3account::getUniqueFileName() |
232 | { | 232 | { |
233 | int num = 0; | 233 | int num = 0; |
234 | QString unique; | 234 | QString unique; |
235 | 235 | ||
236 | QDir dir( locateLocal("data", "kopiemail" ) ); | 236 | QDir dir( locateLocal("data", "kopiemail" ) ); |
237 | 237 | ||
238 | QStringList imap = dir.entryList( "pop3-*" ); | 238 | QStringList imap = dir.entryList( "pop3-*" ); |
239 | do { | 239 | do { |
240 | unique.setNum( num++ ); | 240 | unique.setNum( num++ ); |
241 | } while ( imap.contains( "pop3-" + unique ) > 0 ); | 241 | } while ( imap.contains( "pop3-" + unique ) > 0 ); |
242 | 242 | ||
243 | return unique; | 243 | return unique; |
244 | } | 244 | } |
245 | 245 | ||
246 | void POP3account::read() | 246 | void POP3account::read() |
247 | { | 247 | { |
248 | Config *conf = new Config( getFileName(), Config::File ); | 248 | Config *conf = new Config( getFileName(), Config::File ); |
249 | conf->setGroup( "POP3 Account" ); | 249 | conf->setGroup( "POP3 Account" ); |
250 | accountName = conf->readEntry( "Account" ); | 250 | accountName = conf->readEntry( "Account" ); |
251 | server = conf->readEntry( "Server" ); | 251 | server = conf->readEntry( "Server" ); |
252 | port = conf->readEntry( "Port" ); | 252 | port = conf->readEntry( "Port" ); |
253 | ssl = conf->readBoolEntry( "SSL" ); | 253 | ssl = conf->readBoolEntry( "SSL" ); |
254 | connectionType = conf->readNumEntry( "ConnectionType" ); | 254 | connectionType = conf->readNumEntry( "ConnectionType" ); |
255 | user = conf->readEntry( "User" ); | 255 | user = conf->readEntry( "User" ); |
256 | password = conf->readEntryCrypt( "Password" ); | 256 | password = conf->readEntryCrypt( "Password" ); |
257 | offline = conf->readBoolEntry("Offline",false); | 257 | offline = conf->readBoolEntry("Offline",false); |
258 | localFolder = conf->readEntry( "LocalFolder" ); | ||
259 | maxMailSize = conf->readNumEntry( "MaxSize",0 ); | ||
260 | int lf = conf->readNumEntry( "LastFetch",0 ); | ||
261 | QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) ); | ||
262 | lastFetch = dt.addSecs( lf ); | ||
258 | delete conf; | 263 | delete conf; |
259 | } | 264 | } |
260 | 265 | ||
261 | void POP3account::save() | 266 | void POP3account::save() |
262 | { | 267 | { |
263 | Settings::checkDirectory(); | 268 | Settings::checkDirectory(); |
264 | 269 | ||
265 | Config *conf = new Config( getFileName(), Config::File ); | 270 | Config *conf = new Config( getFileName(), Config::File ); |
266 | conf->setGroup( "POP3 Account" ); | 271 | conf->setGroup( "POP3 Account" ); |
267 | conf->writeEntry( "Account", accountName ); | 272 | conf->writeEntry( "Account", accountName ); |
268 | conf->writeEntry( "Server", server ); | 273 | conf->writeEntry( "Server", server ); |
269 | conf->writeEntry( "Port", port ); | 274 | conf->writeEntry( "Port", port ); |
270 | conf->writeEntry( "SSL", ssl ); | 275 | conf->writeEntry( "SSL", ssl ); |
271 | conf->writeEntry( "ConnectionType", connectionType ); | 276 | conf->writeEntry( "ConnectionType", connectionType ); |
272 | conf->writeEntry( "User", user ); | 277 | conf->writeEntry( "User", user ); |
273 | conf->writeEntryCrypt( "Password", password ); | 278 | conf->writeEntryCrypt( "Password", password ); |
274 | conf->writeEntry( "Offline",offline); | 279 | conf->writeEntry( "Offline",offline); |
280 | conf->writeEntry( "LocalFolder", localFolder ); | ||
281 | conf->writeEntry( "MaxSize", maxMailSize ); | ||
282 | QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) ); | ||
283 | int lf = dt.secsTo ( lastFetch ); | ||
284 | conf->writeEntry( "LastFetch", lf ); | ||
275 | conf->write(); | 285 | conf->write(); |
276 | delete conf; | 286 | delete conf; |
277 | } | 287 | } |
278 | 288 | ||
279 | 289 | ||
280 | QString POP3account::getFileName() | 290 | QString POP3account::getFileName() |
281 | { | 291 | { |
282 | return locateLocal("data", "kopiemail" ) +"/pop3-" + file; | 292 | return locateLocal("data", "kopiemail" ) +"/pop3-" + file; |
283 | } | 293 | } |
284 | 294 | ||
285 | SMTPaccount::SMTPaccount() | 295 | SMTPaccount::SMTPaccount() |
286 | : Account() | 296 | : Account() |
287 | { | 297 | { |
288 | file = SMTPaccount::getUniqueFileName(); | 298 | file = SMTPaccount::getUniqueFileName(); |
289 | accountName = "New SMTP Account"; | 299 | accountName = "New SMTP Account"; |
290 | ssl = false; | 300 | ssl = false; |
291 | connectionType = 1; | 301 | connectionType = 1; |
292 | login = false; | 302 | login = false; |
293 | useCC = false; | 303 | useCC = false; |
294 | useBCC = false; | 304 | useBCC = false; |
295 | useReply = false; | 305 | useReply = false; |
296 | type = MAILLIB::A_SMTP; | 306 | type = MAILLIB::A_SMTP; |
297 | port = SMTP_PORT; | 307 | port = SMTP_PORT; |
298 | } | 308 | } |
299 | 309 | ||
300 | SMTPaccount::SMTPaccount( QString filename ) | 310 | SMTPaccount::SMTPaccount( QString filename ) |
301 | : Account() | 311 | : Account() |
302 | { | 312 | { |
303 | file = filename; | 313 | file = filename; |
304 | accountName = "New SMTP Account"; | 314 | accountName = "New SMTP Account"; |
305 | ssl = false; | 315 | ssl = false; |
306 | connectionType = 1; | 316 | connectionType = 1; |
307 | login = false; | 317 | login = false; |
308 | type = MAILLIB::A_SMTP; | 318 | type = MAILLIB::A_SMTP; |
309 | port = SMTP_PORT; | 319 | port = SMTP_PORT; |
310 | } | 320 | } |
311 | 321 | ||
312 | QString SMTPaccount::getUniqueFileName() | 322 | QString SMTPaccount::getUniqueFileName() |
313 | { | 323 | { |
314 | int num = 0; | 324 | int num = 0; |
315 | QString unique; | 325 | QString unique; |
316 | 326 | ||
317 | QDir dir( locateLocal("data", "kopiemail" ) ); | 327 | QDir dir( locateLocal("data", "kopiemail" ) ); |
318 | 328 | ||
319 | QStringList imap = dir.entryList( "smtp-*" ); | 329 | QStringList imap = dir.entryList( "smtp-*" ); |
320 | do { | 330 | do { |
321 | unique.setNum( num++ ); | 331 | unique.setNum( num++ ); |
322 | } while ( imap.contains( "smtp-" + unique ) > 0 ); | 332 | } while ( imap.contains( "smtp-" + unique ) > 0 ); |