author | harlekin <harlekin> | 2004-01-04 02:35:03 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2004-01-04 02:35:03 (UTC) |
commit | d93529cebc9ea9ab4adf674e93e204f5a53d8906 (patch) (unidiff) | |
tree | 727ebb146a3518a2303d515c8e3e5e093397b9dc /noncore/net/mail/libmailwrapper/settings.cpp | |
parent | 55df8c221c43d81f6132d033553a173276954f7c (diff) | |
download | opie-d93529cebc9ea9ab4adf674e93e204f5a53d8906.zip opie-d93529cebc9ea9ab4adf674e93e204f5a53d8906.tar.gz opie-d93529cebc9ea9ab4adf674e93e204f5a53d8906.tar.bz2 |
adapt build system to lib etc and get it build
Diffstat (limited to 'noncore/net/mail/libmailwrapper/settings.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/libmailwrapper/settings.cpp | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/noncore/net/mail/libmailwrapper/settings.cpp b/noncore/net/mail/libmailwrapper/settings.cpp index 17aa1b0..c5187f5 100644 --- a/noncore/net/mail/libmailwrapper/settings.cpp +++ b/noncore/net/mail/libmailwrapper/settings.cpp | |||
@@ -1,13 +1,23 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | #include <qdir.h> | 2 | #include <qdir.h> |
3 | 3 | ||
4 | #include <qpe/config.h> | 4 | #include <qpe/config.h> |
5 | 5 | ||
6 | #include "settings.h" | 6 | #include "settings.h" |
7 | #include "defines.h" | 7 | //#include "defines.h" |
8 | |||
9 | #define IMAP_PORT "143" | ||
10 | #define IMAP_SSL_PORT "993" | ||
11 | #define SMTP_PORT "25" | ||
12 | #define SMTP_SSL_PORT "465" | ||
13 | #define POP3_PORT "110" | ||
14 | #define POP3_SSL_PORT "995" | ||
15 | #define NNTP_PORT "119" | ||
16 | #define NNTP_SSL_PORT "563" | ||
17 | |||
8 | 18 | ||
9 | Settings::Settings() | 19 | Settings::Settings() |
10 | : QObject() | 20 | : QObject() |
11 | { | 21 | { |
12 | updateAccounts(); | 22 | updateAccounts(); |
13 | } | 23 | } |
@@ -59,36 +69,36 @@ void Settings::updateAccounts() | |||
59 | QStringList smtp = dir.entryList( "smtp-*" ); | 69 | QStringList smtp = dir.entryList( "smtp-*" ); |
60 | for ( it = smtp.begin(); it != smtp.end(); it++ ) { | 70 | for ( it = smtp.begin(); it != smtp.end(); it++ ) { |
61 | qDebug( "Added SMTP account" ); | 71 | qDebug( "Added SMTP account" ); |
62 | SMTPaccount *account = new SMTPaccount( (*it).replace(0, 5, "") ); | 72 | SMTPaccount *account = new SMTPaccount( (*it).replace(0, 5, "") ); |
63 | accounts.append( account ); | 73 | accounts.append( account ); |
64 | } | 74 | } |
65 | 75 | ||
66 | QStringList nntp = dir.entryList( "nntp-*" ); | 76 | QStringList nntp = dir.entryList( "nntp-*" ); |
67 | for ( it = nntp.begin(); it != nntp.end(); it++ ) { | 77 | for ( it = nntp.begin(); it != nntp.end(); it++ ) { |
68 | qDebug( "Added NNTP account" ); | 78 | qDebug( "Added NNTP account" ); |
69 | NNTPaccount *account = new NNTPaccount( (*it).replace(0, 5, "") ); | 79 | NNTPaccount *account = new NNTPaccount( (*it).replace(0, 5, "") ); |
70 | accounts.append( account ); | 80 | accounts.append( account ); |
71 | } | 81 | } |
72 | 82 | ||
73 | readAccounts(); | 83 | readAccounts(); |
74 | } | 84 | } |
75 | 85 | ||
76 | void Settings::saveAccounts() | 86 | void Settings::saveAccounts() |
77 | { | 87 | { |
78 | checkDirectory(); | 88 | checkDirectory(); |
79 | Account *it; | 89 | Account *it; |
80 | 90 | ||
81 | for ( it = accounts.first(); it; it = accounts.next() ) { | 91 | for ( it = accounts.first(); it; it = accounts.next() ) { |
82 | it->save(); | 92 | it->save(); |
83 | } | 93 | } |
84 | } | 94 | } |
85 | 95 | ||
86 | void Settings::readAccounts() | 96 | void Settings::readAccounts() |
87 | { | 97 | { |
88 | checkDirectory(); | 98 | checkDirectory(); |
89 | Account *it; | 99 | Account *it; |
90 | 100 | ||
91 | for ( it = accounts.first(); it; it = accounts.next() ) { | 101 | for ( it = accounts.first(); it; it = accounts.next() ) { |
92 | it->read(); | 102 | it->read(); |
93 | } | 103 | } |
94 | } | 104 | } |
@@ -127,13 +137,13 @@ IMAPaccount::IMAPaccount( QString filename ) | |||
127 | } | 137 | } |
128 | 138 | ||
129 | QString IMAPaccount::getUniqueFileName() | 139 | QString IMAPaccount::getUniqueFileName() |
130 | { | 140 | { |
131 | int num = 0; | 141 | int num = 0; |
132 | QString unique; | 142 | QString unique; |
133 | 143 | ||
134 | QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); | 144 | QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); |
135 | 145 | ||
136 | QStringList imap = dir.entryList( "imap-*" ); | 146 | QStringList imap = dir.entryList( "imap-*" ); |
137 | do { | 147 | do { |
138 | unique.setNum( num++ ); | 148 | unique.setNum( num++ ); |
139 | } while ( imap.contains( "imap-" + unique ) > 0 ); | 149 | } while ( imap.contains( "imap-" + unique ) > 0 ); |
@@ -161,13 +171,13 @@ void IMAPaccount::read() | |||
161 | } | 171 | } |
162 | 172 | ||
163 | void IMAPaccount::save() | 173 | void IMAPaccount::save() |
164 | { | 174 | { |
165 | qDebug( "saving " + getFileName() ); | 175 | qDebug( "saving " + getFileName() ); |
166 | Settings::checkDirectory(); | 176 | Settings::checkDirectory(); |
167 | 177 | ||
168 | Config *conf = new Config( getFileName(), Config::File ); | 178 | Config *conf = new Config( getFileName(), Config::File ); |
169 | conf->setGroup( "IMAP Account" ); | 179 | conf->setGroup( "IMAP Account" ); |
170 | conf->writeEntry( "Account", accountName ); | 180 | conf->writeEntry( "Account", accountName ); |
171 | conf->writeEntry( "Server", server ); | 181 | conf->writeEntry( "Server", server ); |
172 | conf->writeEntry( "Port", port ); | 182 | conf->writeEntry( "Port", port ); |
173 | conf->writeEntry( "SSL", ssl ); | 183 | conf->writeEntry( "SSL", ssl ); |
@@ -204,13 +214,13 @@ POP3account::POP3account( QString filename ) | |||
204 | } | 214 | } |
205 | 215 | ||
206 | QString POP3account::getUniqueFileName() | 216 | QString POP3account::getUniqueFileName() |
207 | { | 217 | { |
208 | int num = 0; | 218 | int num = 0; |
209 | QString unique; | 219 | QString unique; |
210 | 220 | ||
211 | QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); | 221 | QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); |
212 | 222 | ||
213 | QStringList imap = dir.entryList( "pop3-*" ); | 223 | QStringList imap = dir.entryList( "pop3-*" ); |
214 | do { | 224 | do { |
215 | unique.setNum( num++ ); | 225 | unique.setNum( num++ ); |
216 | } while ( imap.contains( "pop3-" + unique ) > 0 ); | 226 | } while ( imap.contains( "pop3-" + unique ) > 0 ); |
@@ -231,13 +241,13 @@ void POP3account::read() | |||
231 | } | 241 | } |
232 | 242 | ||
233 | void POP3account::save() | 243 | void POP3account::save() |
234 | { | 244 | { |
235 | qDebug( "saving " + getFileName() ); | 245 | qDebug( "saving " + getFileName() ); |
236 | Settings::checkDirectory(); | 246 | Settings::checkDirectory(); |
237 | 247 | ||
238 | Config *conf = new Config( getFileName(), Config::File ); | 248 | Config *conf = new Config( getFileName(), Config::File ); |
239 | conf->setGroup( "POP3 Account" ); | 249 | conf->setGroup( "POP3 Account" ); |
240 | conf->writeEntry( "Account", accountName ); | 250 | conf->writeEntry( "Account", accountName ); |
241 | conf->writeEntry( "Server", server ); | 251 | conf->writeEntry( "Server", server ); |
242 | conf->writeEntry( "Port", port ); | 252 | conf->writeEntry( "Port", port ); |
243 | conf->writeEntry( "SSL", ssl ); | 253 | conf->writeEntry( "SSL", ssl ); |
@@ -278,13 +288,13 @@ SMTPaccount::SMTPaccount( QString filename ) | |||
278 | } | 288 | } |
279 | 289 | ||
280 | QString SMTPaccount::getUniqueFileName() | 290 | QString SMTPaccount::getUniqueFileName() |
281 | { | 291 | { |
282 | int num = 0; | 292 | int num = 0; |
283 | QString unique; | 293 | QString unique; |
284 | 294 | ||
285 | QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); | 295 | QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); |
286 | 296 | ||
287 | QStringList imap = dir.entryList( "smtp-*" ); | 297 | QStringList imap = dir.entryList( "smtp-*" ); |
288 | do { | 298 | do { |
289 | unique.setNum( num++ ); | 299 | unique.setNum( num++ ); |
290 | } while ( imap.contains( "smtp-" + unique ) > 0 ); | 300 | } while ( imap.contains( "smtp-" + unique ) > 0 ); |
@@ -306,13 +316,13 @@ void SMTPaccount::read() | |||
306 | } | 316 | } |
307 | 317 | ||
308 | void SMTPaccount::save() | 318 | void SMTPaccount::save() |
309 | { | 319 | { |
310 | qDebug( "saving " + getFileName() ); | 320 | qDebug( "saving " + getFileName() ); |
311 | Settings::checkDirectory(); | 321 | Settings::checkDirectory(); |
312 | 322 | ||
313 | Config *conf = new Config( getFileName(), Config::File ); | 323 | Config *conf = new Config( getFileName(), Config::File ); |
314 | conf->setGroup( "SMTP Account" ); | 324 | conf->setGroup( "SMTP Account" ); |
315 | conf->writeEntry( "Account", accountName ); | 325 | conf->writeEntry( "Account", accountName ); |
316 | conf->writeEntry( "Server", server ); | 326 | conf->writeEntry( "Server", server ); |
317 | conf->writeEntry( "Port", port ); | 327 | conf->writeEntry( "Port", port ); |
318 | conf->writeEntry( "SSL", ssl ); | 328 | conf->writeEntry( "SSL", ssl ); |
@@ -351,13 +361,13 @@ NNTPaccount::NNTPaccount( QString filename ) | |||
351 | } | 361 | } |
352 | 362 | ||
353 | QString NNTPaccount::getUniqueFileName() | 363 | QString NNTPaccount::getUniqueFileName() |
354 | { | 364 | { |
355 | int num = 0; | 365 | int num = 0; |
356 | QString unique; | 366 | QString unique; |
357 | 367 | ||
358 | QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); | 368 | QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); |
359 | 369 | ||
360 | QStringList imap = dir.entryList( "nntp-*" ); | 370 | QStringList imap = dir.entryList( "nntp-*" ); |
361 | do { | 371 | do { |
362 | unique.setNum( num++ ); | 372 | unique.setNum( num++ ); |
363 | } while ( imap.contains( "nntp-" + unique ) > 0 ); | 373 | } while ( imap.contains( "nntp-" + unique ) > 0 ); |
@@ -379,13 +389,13 @@ void NNTPaccount::read() | |||
379 | } | 389 | } |
380 | 390 | ||
381 | void NNTPaccount::save() | 391 | void NNTPaccount::save() |
382 | { | 392 | { |
383 | qDebug( "saving " + getFileName() ); | 393 | qDebug( "saving " + getFileName() ); |
384 | Settings::checkDirectory(); | 394 | Settings::checkDirectory(); |
385 | 395 | ||
386 | Config *conf = new Config( getFileName(), Config::File ); | 396 | Config *conf = new Config( getFileName(), Config::File ); |
387 | conf->setGroup( "NNTP Account" ); | 397 | conf->setGroup( "NNTP Account" ); |
388 | conf->writeEntry( "Account", accountName ); | 398 | conf->writeEntry( "Account", accountName ); |
389 | conf->writeEntry( "Server", server ); | 399 | conf->writeEntry( "Server", server ); |
390 | conf->writeEntry( "Port", port ); | 400 | conf->writeEntry( "Port", port ); |
391 | conf->writeEntry( "SSL", ssl ); | 401 | conf->writeEntry( "SSL", ssl ); |