Diffstat (limited to 'noncore/net/mail/libmailwrapper/settings.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/mail/libmailwrapper/settings.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/noncore/net/mail/libmailwrapper/settings.cpp b/noncore/net/mail/libmailwrapper/settings.cpp index c5187f5..02a80a3 100644 --- a/noncore/net/mail/libmailwrapper/settings.cpp +++ b/noncore/net/mail/libmailwrapper/settings.cpp | |||
@@ -159,41 +159,45 @@ void IMAPaccount::read() | |||
159 | if (accountName.isNull()) accountName = ""; | 159 | if (accountName.isNull()) accountName = ""; |
160 | server = conf->readEntry( "Server","" ); | 160 | server = conf->readEntry( "Server","" ); |
161 | if (server.isNull()) server=""; | 161 | if (server.isNull()) server=""; |
162 | port = conf->readEntry( "Port","" ); | 162 | port = conf->readEntry( "Port","" ); |
163 | if (port.isNull()) port="143"; | 163 | if (port.isNull()) port="143"; |
164 | ssl = conf->readBoolEntry( "SSL",false ); | 164 | ssl = conf->readBoolEntry( "SSL",false ); |
165 | user = conf->readEntry( "User","" ); | 165 | user = conf->readEntry( "User","" ); |
166 | if (user.isNull()) user = ""; | 166 | if (user.isNull()) user = ""; |
167 | password = conf->readEntryCrypt( "Password","" ); | 167 | password = conf->readEntryCrypt( "Password","" ); |
168 | if (password.isNull()) password = ""; | 168 | if (password.isNull()) password = ""; |
169 | prefix = conf->readEntry("MailPrefix",""); | 169 | prefix = conf->readEntry("MailPrefix",""); |
170 | if (prefix.isNull()) prefix = ""; | 170 | if (prefix.isNull()) prefix = ""; |
171 | offline = conf->readBoolEntry("Offline",false); | ||
172 | delete conf; | ||
171 | } | 173 | } |
172 | 174 | ||
173 | void IMAPaccount::save() | 175 | void IMAPaccount::save() |
174 | { | 176 | { |
175 | qDebug( "saving " + getFileName() ); | 177 | qDebug( "saving " + getFileName() ); |
176 | Settings::checkDirectory(); | 178 | Settings::checkDirectory(); |
177 | 179 | ||
178 | Config *conf = new Config( getFileName(), Config::File ); | 180 | Config *conf = new Config( getFileName(), Config::File ); |
179 | conf->setGroup( "IMAP Account" ); | 181 | conf->setGroup( "IMAP Account" ); |
180 | conf->writeEntry( "Account", accountName ); | 182 | conf->writeEntry( "Account", accountName ); |
181 | conf->writeEntry( "Server", server ); | 183 | conf->writeEntry( "Server", server ); |
182 | conf->writeEntry( "Port", port ); | 184 | conf->writeEntry( "Port", port ); |
183 | conf->writeEntry( "SSL", ssl ); | 185 | conf->writeEntry( "SSL", ssl ); |
184 | conf->writeEntry( "User", user ); | 186 | conf->writeEntry( "User", user ); |
185 | conf->writeEntryCrypt( "Password", password ); | 187 | conf->writeEntryCrypt( "Password", password ); |
186 | conf->writeEntry( "MailPrefix",prefix); | 188 | conf->writeEntry( "MailPrefix",prefix); |
189 | conf->writeEntry( "Offline",offline); | ||
187 | conf->write(); | 190 | conf->write(); |
191 | delete conf; | ||
188 | } | 192 | } |
189 | 193 | ||
190 | 194 | ||
191 | QString IMAPaccount::getFileName() | 195 | QString IMAPaccount::getFileName() |
192 | { | 196 | { |
193 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/imap-" + file; | 197 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/imap-" + file; |
194 | } | 198 | } |
195 | 199 | ||
196 | POP3account::POP3account() | 200 | POP3account::POP3account() |
197 | : Account() | 201 | : Account() |
198 | { | 202 | { |
199 | file = POP3account::getUniqueFileName(); | 203 | file = POP3account::getUniqueFileName(); |
@@ -229,40 +233,44 @@ QString POP3account::getUniqueFileName() | |||
229 | } | 233 | } |
230 | 234 | ||
231 | void POP3account::read() | 235 | void POP3account::read() |
232 | { | 236 | { |
233 | Config *conf = new Config( getFileName(), Config::File ); | 237 | Config *conf = new Config( getFileName(), Config::File ); |
234 | conf->setGroup( "POP3 Account" ); | 238 | conf->setGroup( "POP3 Account" ); |
235 | accountName = conf->readEntry( "Account" ); | 239 | accountName = conf->readEntry( "Account" ); |
236 | server = conf->readEntry( "Server" ); | 240 | server = conf->readEntry( "Server" ); |
237 | port = conf->readEntry( "Port" ); | 241 | port = conf->readEntry( "Port" ); |
238 | ssl = conf->readBoolEntry( "SSL" ); | 242 | ssl = conf->readBoolEntry( "SSL" ); |
239 | user = conf->readEntry( "User" ); | 243 | user = conf->readEntry( "User" ); |
240 | password = conf->readEntryCrypt( "Password" ); | 244 | password = conf->readEntryCrypt( "Password" ); |
245 | offline = conf->readBoolEntry("Offline",false); | ||
246 | delete conf; | ||
241 | } | 247 | } |
242 | 248 | ||
243 | void POP3account::save() | 249 | void POP3account::save() |
244 | { | 250 | { |
245 | qDebug( "saving " + getFileName() ); | 251 | qDebug( "saving " + getFileName() ); |
246 | Settings::checkDirectory(); | 252 | Settings::checkDirectory(); |
247 | 253 | ||
248 | Config *conf = new Config( getFileName(), Config::File ); | 254 | Config *conf = new Config( getFileName(), Config::File ); |
249 | conf->setGroup( "POP3 Account" ); | 255 | conf->setGroup( "POP3 Account" ); |
250 | conf->writeEntry( "Account", accountName ); | 256 | conf->writeEntry( "Account", accountName ); |
251 | conf->writeEntry( "Server", server ); | 257 | conf->writeEntry( "Server", server ); |
252 | conf->writeEntry( "Port", port ); | 258 | conf->writeEntry( "Port", port ); |
253 | conf->writeEntry( "SSL", ssl ); | 259 | conf->writeEntry( "SSL", ssl ); |
254 | conf->writeEntry( "User", user ); | 260 | conf->writeEntry( "User", user ); |
255 | conf->writeEntryCrypt( "Password", password ); | 261 | conf->writeEntryCrypt( "Password", password ); |
262 | conf->writeEntry( "Offline",offline); | ||
256 | conf->write(); | 263 | conf->write(); |
264 | delete conf; | ||
257 | } | 265 | } |
258 | 266 | ||
259 | 267 | ||
260 | QString POP3account::getFileName() | 268 | QString POP3account::getFileName() |
261 | { | 269 | { |
262 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/pop3-" + file; | 270 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/pop3-" + file; |
263 | } | 271 | } |
264 | 272 | ||
265 | SMTPaccount::SMTPaccount() | 273 | SMTPaccount::SMTPaccount() |
266 | : Account() | 274 | : Account() |
267 | { | 275 | { |
268 | file = SMTPaccount::getUniqueFileName(); | 276 | file = SMTPaccount::getUniqueFileName(); |
@@ -304,41 +312,43 @@ QString SMTPaccount::getUniqueFileName() | |||
304 | 312 | ||
305 | void SMTPaccount::read() | 313 | void SMTPaccount::read() |
306 | { | 314 | { |
307 | Config *conf = new Config( getFileName(), Config::File ); | 315 | Config *conf = new Config( getFileName(), Config::File ); |
308 | conf->setGroup( "SMTP Account" ); | 316 | conf->setGroup( "SMTP Account" ); |
309 | accountName = conf->readEntry( "Account" ); | 317 | accountName = conf->readEntry( "Account" ); |
310 | server = conf->readEntry( "Server" ); | 318 | server = conf->readEntry( "Server" ); |
311 | port = conf->readEntry( "Port" ); | 319 | port = conf->readEntry( "Port" ); |
312 | ssl = conf->readBoolEntry( "SSL" ); | 320 | ssl = conf->readBoolEntry( "SSL" ); |
313 | login = conf->readBoolEntry( "Login" ); | 321 | login = conf->readBoolEntry( "Login" ); |
314 | user = conf->readEntry( "User" ); | 322 | user = conf->readEntry( "User" ); |
315 | password = conf->readEntryCrypt( "Password" ); | 323 | password = conf->readEntryCrypt( "Password" ); |
324 | delete conf; | ||
316 | } | 325 | } |
317 | 326 | ||
318 | void SMTPaccount::save() | 327 | void SMTPaccount::save() |
319 | { | 328 | { |
320 | qDebug( "saving " + getFileName() ); | 329 | qDebug( "saving " + getFileName() ); |
321 | Settings::checkDirectory(); | 330 | Settings::checkDirectory(); |
322 | 331 | ||
323 | Config *conf = new Config( getFileName(), Config::File ); | 332 | Config *conf = new Config( getFileName(), Config::File ); |
324 | conf->setGroup( "SMTP Account" ); | 333 | conf->setGroup( "SMTP Account" ); |
325 | conf->writeEntry( "Account", accountName ); | 334 | conf->writeEntry( "Account", accountName ); |
326 | conf->writeEntry( "Server", server ); | 335 | conf->writeEntry( "Server", server ); |
327 | conf->writeEntry( "Port", port ); | 336 | conf->writeEntry( "Port", port ); |
328 | conf->writeEntry( "SSL", ssl ); | 337 | conf->writeEntry( "SSL", ssl ); |
329 | conf->writeEntry( "Login", login ); | 338 | conf->writeEntry( "Login", login ); |
330 | conf->writeEntry( "User", user ); | 339 | conf->writeEntry( "User", user ); |
331 | conf->writeEntryCrypt( "Password", password ); | 340 | conf->writeEntryCrypt( "Password", password ); |
332 | conf->write(); | 341 | conf->write(); |
342 | delete conf; | ||
333 | } | 343 | } |
334 | 344 | ||
335 | 345 | ||
336 | QString SMTPaccount::getFileName() | 346 | QString SMTPaccount::getFileName() |
337 | { | 347 | { |
338 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/smtp-" + file; | 348 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/smtp-" + file; |
339 | } | 349 | } |
340 | 350 | ||
341 | NNTPaccount::NNTPaccount() | 351 | NNTPaccount::NNTPaccount() |
342 | : Account() | 352 | : Account() |
343 | { | 353 | { |
344 | file = NNTPaccount::getUniqueFileName(); | 354 | file = NNTPaccount::getUniqueFileName(); |
@@ -377,37 +387,39 @@ QString NNTPaccount::getUniqueFileName() | |||
377 | 387 | ||
378 | void NNTPaccount::read() | 388 | void NNTPaccount::read() |
379 | { | 389 | { |
380 | Config *conf = new Config( getFileName(), Config::File ); | 390 | Config *conf = new Config( getFileName(), Config::File ); |
381 | conf->setGroup( "NNTP Account" ); | 391 | conf->setGroup( "NNTP Account" ); |
382 | accountName = conf->readEntry( "Account" ); | 392 | accountName = conf->readEntry( "Account" ); |
383 | server = conf->readEntry( "Server" ); | 393 | server = conf->readEntry( "Server" ); |
384 | port = conf->readEntry( "Port" ); | 394 | port = conf->readEntry( "Port" ); |
385 | ssl = conf->readBoolEntry( "SSL" ); | 395 | ssl = conf->readBoolEntry( "SSL" ); |
386 | login = conf->readBoolEntry( "Login" ); | 396 | login = conf->readBoolEntry( "Login" ); |
387 | user = conf->readEntry( "User" ); | 397 | user = conf->readEntry( "User" ); |
388 | password = conf->readEntryCrypt( "Password" ); | 398 | password = conf->readEntryCrypt( "Password" ); |
399 | delete conf; | ||
389 | } | 400 | } |
390 | 401 | ||
391 | void NNTPaccount::save() | 402 | void NNTPaccount::save() |
392 | { | 403 | { |
393 | qDebug( "saving " + getFileName() ); | 404 | qDebug( "saving " + getFileName() ); |
394 | Settings::checkDirectory(); | 405 | Settings::checkDirectory(); |
395 | 406 | ||
396 | Config *conf = new Config( getFileName(), Config::File ); | 407 | Config *conf = new Config( getFileName(), Config::File ); |
397 | conf->setGroup( "NNTP Account" ); | 408 | conf->setGroup( "NNTP Account" ); |
398 | conf->writeEntry( "Account", accountName ); | 409 | conf->writeEntry( "Account", accountName ); |
399 | conf->writeEntry( "Server", server ); | 410 | conf->writeEntry( "Server", server ); |
400 | conf->writeEntry( "Port", port ); | 411 | conf->writeEntry( "Port", port ); |
401 | conf->writeEntry( "SSL", ssl ); | 412 | conf->writeEntry( "SSL", ssl ); |
402 | conf->writeEntry( "Login", login ); | 413 | conf->writeEntry( "Login", login ); |
403 | conf->writeEntry( "User", user ); | 414 | conf->writeEntry( "User", user ); |
404 | conf->writeEntryCrypt( "Password", password ); | 415 | conf->writeEntryCrypt( "Password", password ); |
405 | conf->write(); | 416 | conf->write(); |
417 | delete conf; | ||
406 | } | 418 | } |
407 | 419 | ||
408 | 420 | ||
409 | QString NNTPaccount::getFileName() | 421 | QString NNTPaccount::getFileName() |
410 | { | 422 | { |
411 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/nntp-" + file; | 423 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/nntp-" + file; |
412 | } | 424 | } |
413 | 425 | ||