Diffstat (limited to 'noncore/net/mail/libmailwrapper/settings.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/libmailwrapper/settings.cpp | 47 |
1 files changed, 37 insertions, 10 deletions
diff --git a/noncore/net/mail/libmailwrapper/settings.cpp b/noncore/net/mail/libmailwrapper/settings.cpp index 3c9b25c..09be91b 100644 --- a/noncore/net/mail/libmailwrapper/settings.cpp +++ b/noncore/net/mail/libmailwrapper/settings.cpp | |||
@@ -16,7 +16,6 @@ | |||
16 | #define NNTP_PORT "119" | 16 | #define NNTP_PORT "119" |
17 | #define NNTP_SSL_PORT "563" | 17 | #define NNTP_SSL_PORT "563" |
18 | 18 | ||
19 | |||
20 | Settings::Settings() | 19 | Settings::Settings() |
21 | : QObject() | 20 | : QObject() |
22 | { | 21 | { |
@@ -27,7 +26,7 @@ void Settings::checkDirectory() | |||
27 | { | 26 | { |
28 | if ( !QDir( (QString) getenv( "HOME" ) + "/Applications/opiemail/" ).exists() ) { | 27 | if ( !QDir( (QString) getenv( "HOME" ) + "/Applications/opiemail/" ).exists() ) { |
29 | system( "mkdir -p $HOME/Applications/opiemail" ); | 28 | system( "mkdir -p $HOME/Applications/opiemail" ); |
30 | odebug << "$HOME/Applications/opiemail created" << oendl; | 29 | odebug << "$HOME/Applications/opiemail created" << oendl; |
31 | } | 30 | } |
32 | } | 31 | } |
33 | 32 | ||
@@ -55,28 +54,28 @@ void Settings::updateAccounts() | |||
55 | 54 | ||
56 | QStringList imap = dir.entryList( "imap-*" ); | 55 | QStringList imap = dir.entryList( "imap-*" ); |
57 | for ( it = imap.begin(); it != imap.end(); it++ ) { | 56 | for ( it = imap.begin(); it != imap.end(); it++ ) { |
58 | odebug << "Added IMAP account" << oendl; | 57 | odebug << "Added IMAP account" << oendl; |
59 | IMAPaccount *account = new IMAPaccount( (*it).replace(0, 5, "") ); | 58 | IMAPaccount *account = new IMAPaccount( (*it).replace(0, 5, "") ); |
60 | accounts.append( account ); | 59 | accounts.append( account ); |
61 | } | 60 | } |
62 | 61 | ||
63 | QStringList pop3 = dir.entryList( "pop3-*" ); | 62 | QStringList pop3 = dir.entryList( "pop3-*" ); |
64 | for ( it = pop3.begin(); it != pop3.end(); it++ ) { | 63 | for ( it = pop3.begin(); it != pop3.end(); it++ ) { |
65 | odebug << "Added POP account" << oendl; | 64 | odebug << "Added POP account" << oendl; |
66 | POP3account *account = new POP3account( (*it).replace(0, 5, "") ); | 65 | POP3account *account = new POP3account( (*it).replace(0, 5, "") ); |
67 | accounts.append( account ); | 66 | accounts.append( account ); |
68 | } | 67 | } |
69 | 68 | ||
70 | QStringList smtp = dir.entryList( "smtp-*" ); | 69 | QStringList smtp = dir.entryList( "smtp-*" ); |
71 | for ( it = smtp.begin(); it != smtp.end(); it++ ) { | 70 | for ( it = smtp.begin(); it != smtp.end(); it++ ) { |
72 | odebug << "Added SMTP account" << oendl; | 71 | odebug << "Added SMTP account" << oendl; |
73 | SMTPaccount *account = new SMTPaccount( (*it).replace(0, 5, "") ); | 72 | SMTPaccount *account = new SMTPaccount( (*it).replace(0, 5, "") ); |
74 | accounts.append( account ); | 73 | accounts.append( account ); |
75 | } | 74 | } |
76 | 75 | ||
77 | QStringList nntp = dir.entryList( "nntp-*" ); | 76 | QStringList nntp = dir.entryList( "nntp-*" ); |
78 | for ( it = nntp.begin(); it != nntp.end(); it++ ) { | 77 | for ( it = nntp.begin(); it != nntp.end(); it++ ) { |
79 | odebug << "Added NNTP account" << oendl; | 78 | odebug << "Added NNTP account" << oendl; |
80 | NNTPaccount *account = new NNTPaccount( (*it).replace(0, 5, "") ); | 79 | NNTPaccount *account = new NNTPaccount( (*it).replace(0, 5, "") ); |
81 | accounts.append( account ); | 80 | accounts.append( account ); |
82 | } | 81 | } |
@@ -180,7 +179,7 @@ void IMAPaccount::read() | |||
180 | 179 | ||
181 | void IMAPaccount::save() | 180 | void IMAPaccount::save() |
182 | { | 181 | { |
183 | odebug << "saving " + getFileName() << oendl; | 182 | odebug << "saving " + getFileName() << oendl; |
184 | Settings::checkDirectory(); | 183 | Settings::checkDirectory(); |
185 | 184 | ||
186 | Config *conf = new Config( getFileName(), Config::File ); | 185 | Config *conf = new Config( getFileName(), Config::File ); |
@@ -213,6 +212,8 @@ POP3account::POP3account() | |||
213 | connectionType = 1; | 212 | connectionType = 1; |
214 | type = MAILLIB::A_POP3; | 213 | type = MAILLIB::A_POP3; |
215 | port = POP3_PORT; | 214 | port = POP3_PORT; |
215 | m_CheckSize = true; | ||
216 | m_MaxSize = 1024; | ||
216 | } | 217 | } |
217 | 218 | ||
218 | POP3account::POP3account( QString filename ) | 219 | POP3account::POP3account( QString filename ) |
@@ -224,6 +225,8 @@ POP3account::POP3account( QString filename ) | |||
224 | connectionType = 1; | 225 | connectionType = 1; |
225 | type = MAILLIB::A_POP3; | 226 | type = MAILLIB::A_POP3; |
226 | port = POP3_PORT; | 227 | port = POP3_PORT; |
228 | m_CheckSize = true; | ||
229 | m_MaxSize = 1024; | ||
227 | } | 230 | } |
228 | 231 | ||
229 | QString POP3account::getUniqueFileName() | 232 | QString POP3account::getUniqueFileName() |
@@ -253,12 +256,14 @@ void POP3account::read() | |||
253 | user = conf->readEntry( "User" ); | 256 | user = conf->readEntry( "User" ); |
254 | password = conf->readEntryCrypt( "Password" ); | 257 | password = conf->readEntryCrypt( "Password" ); |
255 | offline = conf->readBoolEntry("Offline",false); | 258 | offline = conf->readBoolEntry("Offline",false); |
259 | m_CheckSize = conf->readBoolEntry("Checkmaxsize",true); | ||
260 | m_MaxSize = conf->readNumEntry("Maxsize",1024); | ||
256 | delete conf; | 261 | delete conf; |
257 | } | 262 | } |
258 | 263 | ||
259 | void POP3account::save() | 264 | void POP3account::save() |
260 | { | 265 | { |
261 | odebug << "saving " + getFileName() << oendl; | 266 | odebug << "saving " + getFileName() << oendl; |
262 | Settings::checkDirectory(); | 267 | Settings::checkDirectory(); |
263 | 268 | ||
264 | Config *conf = new Config( getFileName(), Config::File ); | 269 | Config *conf = new Config( getFileName(), Config::File ); |
@@ -271,6 +276,8 @@ void POP3account::save() | |||
271 | conf->writeEntry( "User", user ); | 276 | conf->writeEntry( "User", user ); |
272 | conf->writeEntryCrypt( "Password", password ); | 277 | conf->writeEntryCrypt( "Password", password ); |
273 | conf->writeEntry( "Offline",offline); | 278 | conf->writeEntry( "Offline",offline); |
279 | conf->writeEntry("Checkmaxsize",m_CheckSize); | ||
280 | conf->writeEntry("Maxsize",m_MaxSize); | ||
274 | conf->write(); | 281 | conf->write(); |
275 | delete conf; | 282 | delete conf; |
276 | } | 283 | } |
@@ -281,6 +288,26 @@ QString POP3account::getFileName() | |||
281 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/pop3-" + file; | 288 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/pop3-" + file; |
282 | } | 289 | } |
283 | 290 | ||
291 | bool POP3account::getCheckMaxSize()const | ||
292 | { | ||
293 | return m_CheckSize; | ||
294 | } | ||
295 | |||
296 | void POP3account::setCheckMaxSize(bool aValue) | ||
297 | { | ||
298 | m_CheckSize = aValue; | ||
299 | } | ||
300 | |||
301 | int POP3account::getMaxSize()const | ||
302 | { | ||
303 | return m_MaxSize; | ||
304 | } | ||
305 | |||
306 | void POP3account::setMaxSize(int aValue) | ||
307 | { | ||
308 | m_MaxSize = aValue; | ||
309 | } | ||
310 | |||
284 | SMTPaccount::SMTPaccount() | 311 | SMTPaccount::SMTPaccount() |
285 | : Account() | 312 | : Account() |
286 | { | 313 | { |
@@ -340,7 +367,7 @@ void SMTPaccount::read() | |||
340 | 367 | ||
341 | void SMTPaccount::save() | 368 | void SMTPaccount::save() |
342 | { | 369 | { |
343 | odebug << "saving " + getFileName() << oendl; | 370 | odebug << "saving " + getFileName() << oendl; |
344 | Settings::checkDirectory(); | 371 | Settings::checkDirectory(); |
345 | 372 | ||
346 | Config *conf = new Config( getFileName(), Config::File ); | 373 | Config *conf = new Config( getFileName(), Config::File ); |
@@ -417,7 +444,7 @@ void NNTPaccount::read() | |||
417 | 444 | ||
418 | void NNTPaccount::save() | 445 | void NNTPaccount::save() |
419 | { | 446 | { |
420 | odebug << "saving " + getFileName() << oendl; | 447 | odebug << "saving " + getFileName() << oendl; |
421 | Settings::checkDirectory(); | 448 | Settings::checkDirectory(); |
422 | 449 | ||
423 | Config *conf = new Config( getFileName(), Config::File ); | 450 | Config *conf = new Config( getFileName(), Config::File ); |