author | zautrix <zautrix> | 2004-09-11 10:30:57 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-11 10:30:57 (UTC) |
commit | d7a273f40838f56205c1377ed0bcc5457bd46ea3 (patch) (unidiff) | |
tree | 9f01120382589404ff8dca3170f9472bdd0f18fb /kmicromail | |
parent | 0f45c977d7530b6ca827b7a7c7da7469f01800ca (diff) | |
download | kdepimpi-d7a273f40838f56205c1377ed0bcc5457bd46ea3.zip kdepimpi-d7a273f40838f56205c1377ed0bcc5457bd46ea3.tar.gz kdepimpi-d7a273f40838f56205c1377ed0bcc5457bd46ea3.tar.bz2 |
More mail settings
-rw-r--r-- | kmicromail/editaccounts.cpp | 17 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/settings.cpp | 85 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/settings.h | 3 |
3 files changed, 80 insertions, 25 deletions
diff --git a/kmicromail/editaccounts.cpp b/kmicromail/editaccounts.cpp index e7d2750..d43d23b 100644 --- a/kmicromail/editaccounts.cpp +++ b/kmicromail/editaccounts.cpp | |||
@@ -356,27 +356,40 @@ void IMAPconfig::fillValues() | |||
356 | { | 356 | { |
357 | accountLine->setText( data->getAccountName() ); | 357 | accountLine->setText( data->getAccountName() ); |
358 | serverLine->setText( data->getServer() ); | 358 | serverLine->setText( data->getServer() ); |
359 | portLine->setText( data->getPort() ); | 359 | portLine->setText( data->getPort() ); |
360 | ComboBox1->setCurrentItem( data->ConnectionType() ); | 360 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
361 | userLine->setText( data->getUser() ); | 361 | userLine->setText( data->getUser() ); |
362 | passLine->setText( data->getPassword() ); | 362 | passLine->setText( data->getPassword() ); |
363 | prefixLine->setText(data->getPrefix()); | 363 | prefixLine->setText(data->getPrefix()); |
364 | localFolder->setText( data->getLocalFolder() ); | ||
365 | int max = data->getMaxMailSize() ; | ||
366 | if ( max ) { | ||
367 | CheckBoxDown->setChecked( true ); | ||
368 | SpinBoxDown->setValue ( max ); | ||
369 | } else { | ||
370 | CheckBoxDown->setChecked( false ); | ||
371 | SpinBoxDown->setValue ( 5 ); | ||
372 | } | ||
373 | CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() ); | ||
364 | } | 374 | } |
365 | 375 | ||
366 | void IMAPconfig::accept() | 376 | void IMAPconfig::accept() |
367 | { | 377 | { |
368 | data->setAccountName( accountLine->text() ); | 378 | data->setAccountName( accountLine->text() ); |
369 | data->setServer( serverLine->text() ); | 379 | data->setServer( serverLine->text() ); |
370 | data->setPort( portLine->text() ); | 380 | data->setPort( portLine->text() ); |
371 | data->setConnectionType( ComboBox1->currentItem() ); | 381 | data->setConnectionType( ComboBox1->currentItem() ); |
372 | data->setUser( userLine->text() ); | 382 | data->setUser( userLine->text() ); |
373 | data->setPassword( passLine->text() ); | 383 | data->setPassword( passLine->text() ); |
374 | data->setPrefix(prefixLine->text()); | 384 | data->setPrefix(prefixLine->text()); |
385 | data->setLocalFolder( localFolder->text() ); | ||
386 | data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; | ||
387 | data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); | ||
375 | 388 | ||
376 | QDialog::accept(); | 389 | QDialog::accept(); |
377 | } | 390 | } |
378 | 391 | ||
379 | /** | 392 | /** |
380 | * POP3config | 393 | * POP3config |
381 | */ | 394 | */ |
382 | 395 | ||
@@ -425,28 +438,30 @@ void POP3config::fillValues() | |||
425 | int max = data->getMaxMailSize() ; | 438 | int max = data->getMaxMailSize() ; |
426 | if ( max ) { | 439 | if ( max ) { |
427 | CheckBoxDown->setChecked( true ); | 440 | CheckBoxDown->setChecked( true ); |
428 | SpinBoxDown->setValue ( max ); | 441 | SpinBoxDown->setValue ( max ); |
429 | } else { | 442 | } else { |
430 | CheckBoxDown->setChecked( false ); | 443 | CheckBoxDown->setChecked( false ); |
431 | SpinBoxDown->setValue ( 5 ); | 444 | SpinBoxDown->setValue ( 5 ); |
432 | } | 445 | } |
446 | CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() ); | ||
433 | } | 447 | } |
434 | 448 | ||
435 | void POP3config::accept() | 449 | void POP3config::accept() |
436 | { | 450 | { |
437 | data->setAccountName( accountLine->text() ); | 451 | data->setAccountName( accountLine->text() ); |
438 | data->setServer( serverLine->text() ); | 452 | data->setServer( serverLine->text() ); |
439 | data->setPort( portLine->text() ); | 453 | data->setPort( portLine->text() ); |
440 | data->setConnectionType( ComboBox1->currentItem() ); | 454 | data->setConnectionType( ComboBox1->currentItem() ); |
441 | data->setUser( userLine->text() ); | 455 | data->setUser( userLine->text() ); |
442 | data->setPassword( passLine->text() ); | 456 | data->setPassword( passLine->text() ); |
443 | data->setLocalFolder( localFolder->text() ); | 457 | data->setLocalFolder( localFolder->text() ); |
444 | data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; | 458 | data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; |
459 | data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); | ||
445 | 460 | ||
446 | QDialog::accept(); | 461 | QDialog::accept(); |
447 | } | 462 | } |
448 | 463 | ||
449 | /** | 464 | /** |
450 | * SMTPconfig | 465 | * SMTPconfig |
451 | */ | 466 | */ |
452 | 467 | ||
diff --git a/kmicromail/libmailwrapper/settings.cpp b/kmicromail/libmailwrapper/settings.cpp index f996d9c..766eba0 100644 --- a/kmicromail/libmailwrapper/settings.cpp +++ b/kmicromail/libmailwrapper/settings.cpp | |||
@@ -1,13 +1,13 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | #include <qdir.h> | 2 | #include <qdir.h> |
3 | 3 | ||
4 | //#include <opie2/odebug.h> | 4 | //#include <opie2/odebug.h> |
5 | #include <qpe/config.h> | 5 | #include <kconfig.h> |
6 | 6 | ||
7 | #include <kstandarddirs.h> | 7 | #include <kstandarddirs.h> |
8 | #include "settings.h" | 8 | #include "settings.h" |
9 | //#include "defines.h" | 9 | //#include "defines.h" |
10 | 10 | ||
11 | #define IMAP_PORT "143" | 11 | #define IMAP_PORT "143" |
12 | #define IMAP_SSL_PORT "993" | 12 | #define IMAP_SSL_PORT "993" |
13 | #define SMTP_PORT "25" | 13 | #define SMTP_PORT "25" |
@@ -107,25 +107,52 @@ void Settings::readAccounts() | |||
107 | } | 107 | } |
108 | 108 | ||
109 | Account::Account() | 109 | Account::Account() |
110 | { | 110 | { |
111 | accountName = "changeMe"; | 111 | accountName = "changeMe"; |
112 | type = MAILLIB::A_UNDEFINED; | 112 | type = MAILLIB::A_UNDEFINED; |
113 | ssl = false; | 113 | ssl = false; |
114 | connectionType = 1; | 114 | connectionType = 1; |
115 | offline = false; | 115 | offline = false; |
116 | maxMailSize = 0; | ||
117 | lastFetch; | ||
118 | leaveOnServer = false; | ||
116 | } | 119 | } |
117 | 120 | ||
118 | void Account::remove() | 121 | void Account::remove() |
119 | { | 122 | { |
120 | QFile file( getFileName() ); | 123 | QFile file( getFileName() ); |
121 | file.remove(); | 124 | file.remove(); |
122 | } | 125 | } |
123 | 126 | ||
127 | void Account::setPasswordList(const QStringList &str) | ||
128 | { | ||
129 | password = ""; | ||
130 | int i; | ||
131 | for ( i = 0; i < str.count() ; ++i ) { | ||
132 | QChar c ( (str[i].toUInt()-131)/(str.count()- (i%3))); | ||
133 | password.append( c ); | ||
134 | } | ||
135 | //qDebug("password %s ", password.latin1()); | ||
136 | } | ||
137 | QStringList Account::getPasswordList() | ||
138 | { | ||
139 | int i; | ||
140 | int len = password.length(); | ||
141 | QStringList str; | ||
142 | |||
143 | for ( i = 0; i < len ; ++i ) { | ||
144 | int val = password.at(i).unicode()*(len-(i%3))+131; | ||
145 | str.append( QString::number( val ) ); | ||
146 | // qDebug("append %s ", str[i].latin1()); | ||
147 | } | ||
148 | return str; | ||
149 | } | ||
150 | |||
124 | IMAPaccount::IMAPaccount() | 151 | IMAPaccount::IMAPaccount() |
125 | : Account() | 152 | : Account() |
126 | { | 153 | { |
127 | file = IMAPaccount::getUniqueFileName(); | 154 | file = IMAPaccount::getUniqueFileName(); |
128 | accountName = "New IMAP Account"; | 155 | accountName = "New IMAP Account"; |
129 | ssl = false; | 156 | ssl = false; |
130 | connectionType = 1; | 157 | connectionType = 1; |
131 | type = MAILLIB::A_IMAP; | 158 | type = MAILLIB::A_IMAP; |
@@ -155,65 +182,69 @@ QString IMAPaccount::getUniqueFileName() | |||
155 | unique.setNum( num++ ); | 182 | unique.setNum( num++ ); |
156 | } while ( imap.contains( "imap-" + unique ) > 0 ); | 183 | } while ( imap.contains( "imap-" + unique ) > 0 ); |
157 | 184 | ||
158 | return unique; | 185 | return unique; |
159 | } | 186 | } |
160 | 187 | ||
161 | void IMAPaccount::read() | 188 | void IMAPaccount::read() |
162 | { | 189 | { |
163 | Config *conf = new Config( getFileName(), Config::File ); | 190 | KConfig *conf = new KConfig( getFileName() ); |
164 | conf->setGroup( "IMAP Account" ); | 191 | conf->setGroup( "IMAP Account" ); |
165 | accountName = conf->readEntry( "Account","" ); | 192 | accountName = conf->readEntry( "Account","" ); |
166 | if (accountName.isNull()) accountName = ""; | 193 | if (accountName.isNull()) accountName = ""; |
167 | server = conf->readEntry( "Server","" ); | 194 | server = conf->readEntry( "Server","" ); |
168 | if (server.isNull()) server=""; | 195 | if (server.isNull()) server=""; |
169 | port = conf->readEntry( "Port","" ); | 196 | port = conf->readEntry( "Port","" ); |
170 | if (port.isNull()) port="143"; | 197 | if (port.isNull()) port="143"; |
171 | connectionType = conf->readNumEntry( "ConnectionType" ); | 198 | connectionType = conf->readNumEntry( "ConnectionType" ); |
172 | ssl = conf->readBoolEntry( "SSL",false ); | 199 | ssl = conf->readBoolEntry( "SSL",false ); |
173 | user = conf->readEntry( "User","" ); | 200 | user = conf->readEntry( "User","" ); |
174 | if (user.isNull()) user = ""; | 201 | if (user.isNull()) user = ""; |
175 | password = conf->readEntryCrypt( "Password","" ); | 202 | //password = conf->readEntryCrypt( "Password","" ); |
203 | setPasswordList( conf->readListEntry( "FolderHistory")); | ||
176 | if (password.isNull()) password = ""; | 204 | if (password.isNull()) password = ""; |
177 | prefix = conf->readEntry("MailPrefix",""); | 205 | prefix = conf->readEntry("MailPrefix",""); |
178 | if (prefix.isNull()) prefix = ""; | 206 | if (prefix.isNull()) prefix = ""; |
179 | offline = conf->readBoolEntry("Offline",false); | 207 | offline = conf->readBoolEntry("Offline",false); |
180 | localFolder = conf->readEntry( "LocalFolder" ); | 208 | localFolder = conf->readEntry( "LocalFolder" ); |
181 | maxMailSize = conf->readNumEntry( "MaxSize",0 ); | 209 | maxMailSize = conf->readNumEntry( "MaxSize",0 ); |
182 | int lf = conf->readNumEntry( "LastFetch",0 ); | 210 | int lf = conf->readNumEntry( "LastFetch",0 ); |
183 | QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) ); | 211 | QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) ); |
184 | leaveOnServer = conf->readBoolEntry("LeaveOnServer",false); | 212 | leaveOnServer = conf->readBoolEntry("LeaveOnServer",false); |
213 | qDebug("reading last fetch: %d ", lf); | ||
214 | if ( lf < 0 ) lf = 0; | ||
185 | lastFetch = dt.addSecs( lf ); | 215 | lastFetch = dt.addSecs( lf ); |
186 | delete conf; | 216 | delete conf; |
187 | } | 217 | } |
188 | 218 | ||
189 | void IMAPaccount::save() | 219 | void IMAPaccount::save() |
190 | { | 220 | { |
191 | qDebug("saving %s ",getFileName().latin1() ); | 221 | qDebug("saving %s ",getFileName().latin1() ); |
192 | Settings::checkDirectory(); | 222 | Settings::checkDirectory(); |
193 | 223 | ||
194 | Config *conf = new Config( getFileName(), Config::File ); | 224 | KConfig *conf = new KConfig( getFileName() ); |
195 | conf->setGroup( "IMAP Account" ); | 225 | conf->setGroup( "IMAP Account" ); |
196 | conf->writeEntry( "Account", accountName ); | 226 | conf->writeEntry( "Account", accountName ); |
197 | conf->writeEntry( "Server", server ); | 227 | conf->writeEntry( "Server", server ); |
198 | conf->writeEntry( "Port", port ); | 228 | conf->writeEntry( "Port", port ); |
199 | conf->writeEntry( "SSL", ssl ); | 229 | conf->writeEntry( "SSL", ssl ); |
200 | conf->writeEntry( "ConnectionType", connectionType ); | 230 | conf->writeEntry( "ConnectionType", connectionType ); |
201 | conf->writeEntry( "User", user ); | 231 | conf->writeEntry( "User", user ); |
202 | conf->writeEntryCrypt( "Password", password ); | 232 | //conf->writeEntryCrypt( "Password", password ); |
233 | conf->writeEntry( "FolderHistory",getPasswordList() ); | ||
203 | conf->writeEntry( "MailPrefix",prefix); | 234 | conf->writeEntry( "MailPrefix",prefix); |
204 | conf->writeEntry( "Offline",offline); | 235 | conf->writeEntry( "Offline",offline); |
205 | conf->writeEntry( "LocalFolder", localFolder ); | 236 | conf->writeEntry( "LocalFolder", localFolder ); |
206 | conf->writeEntry( "MaxSize", maxMailSize ); | 237 | conf->writeEntry( "MaxSize", maxMailSize ); |
207 | QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) ); | 238 | QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) ); |
208 | int lf = dt.secsTo ( lastFetch ); | 239 | int lf = dt.secsTo ( lastFetch ); |
209 | conf->writeEntry( "LastFetch", lf ); | 240 | conf->writeEntry( "LastFetch", lf ); |
210 | conf->writeEntry( "LeaveOnServer", leaveOnServer); | 241 | conf->writeEntry( "LeaveOnServer", leaveOnServer); |
211 | conf->write(); | 242 | conf->sync(); |
212 | delete conf; | 243 | delete conf; |
213 | } | 244 | } |
214 | 245 | ||
215 | 246 | ||
216 | QString IMAPaccount::getFileName() | 247 | QString IMAPaccount::getFileName() |
217 | { | 248 | { |
218 | return locateLocal("data", "kopiemail" ) +"/imap-" + file; | 249 | return locateLocal("data", "kopiemail" ) +"/imap-" + file; |
219 | } | 250 | } |
@@ -252,56 +283,58 @@ QString POP3account::getUniqueFileName() | |||
252 | unique.setNum( num++ ); | 283 | unique.setNum( num++ ); |
253 | } while ( imap.contains( "pop3-" + unique ) > 0 ); | 284 | } while ( imap.contains( "pop3-" + unique ) > 0 ); |
254 | 285 | ||
255 | return unique; | 286 | return unique; |
256 | } | 287 | } |
257 | 288 | ||
258 | void POP3account::read() | 289 | void POP3account::read() |
259 | { | 290 | { |
260 | Config *conf = new Config( getFileName(), Config::File ); | 291 | KConfig *conf = new KConfig( getFileName()); |
261 | conf->setGroup( "POP3 Account" ); | 292 | conf->setGroup( "POP3 Account" ); |
262 | accountName = conf->readEntry( "Account" ); | 293 | accountName = conf->readEntry( "Account" ); |
263 | server = conf->readEntry( "Server" ); | 294 | server = conf->readEntry( "Server" ); |
264 | port = conf->readEntry( "Port" ); | 295 | port = conf->readEntry( "Port" ); |
265 | ssl = conf->readBoolEntry( "SSL" ); | 296 | ssl = conf->readBoolEntry( "SSL" ); |
266 | connectionType = conf->readNumEntry( "ConnectionType" ); | 297 | connectionType = conf->readNumEntry( "ConnectionType" ); |
267 | user = conf->readEntry( "User" ); | 298 | user = conf->readEntry( "User" ); |
268 | password = conf->readEntryCrypt( "Password" ); | 299 | //password = conf->readEntryCrypt( "Password" ); |
300 | setPasswordList( conf->readListEntry( "FolderHistory")); | ||
269 | offline = conf->readBoolEntry("Offline",false); | 301 | offline = conf->readBoolEntry("Offline",false); |
270 | localFolder = conf->readEntry( "LocalFolder" ); | 302 | localFolder = conf->readEntry( "LocalFolder" ); |
271 | maxMailSize = conf->readNumEntry( "MaxSize",0 ); | 303 | maxMailSize = conf->readNumEntry( "MaxSize",0 ); |
272 | int lf = conf->readNumEntry( "LastFetch",0 ); | 304 | int lf = conf->readNumEntry( "LastFetch",0 ); |
273 | QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) ); | 305 | QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) ); |
274 | leaveOnServer = conf->readBoolEntry("LeaveOnServer",false); | 306 | leaveOnServer = conf->readBoolEntry("LeaveOnServer",false); |
275 | lastFetch = dt.addSecs( lf ); | 307 | lastFetch = dt.addSecs( lf ); |
276 | delete conf; | 308 | delete conf; |
277 | } | 309 | } |
278 | 310 | ||
279 | void POP3account::save() | 311 | void POP3account::save() |
280 | { | 312 | { |
281 | Settings::checkDirectory(); | 313 | Settings::checkDirectory(); |
282 | 314 | ||
283 | Config *conf = new Config( getFileName(), Config::File ); | 315 | KConfig *conf = new KConfig( getFileName() ); |
284 | conf->setGroup( "POP3 Account" ); | 316 | conf->setGroup( "POP3 Account" ); |
285 | conf->writeEntry( "Account", accountName ); | 317 | conf->writeEntry( "Account", accountName ); |
286 | conf->writeEntry( "Server", server ); | 318 | conf->writeEntry( "Server", server ); |
287 | conf->writeEntry( "Port", port ); | 319 | conf->writeEntry( "Port", port ); |
288 | conf->writeEntry( "SSL", ssl ); | 320 | conf->writeEntry( "SSL", ssl ); |
289 | conf->writeEntry( "ConnectionType", connectionType ); | 321 | conf->writeEntry( "ConnectionType", connectionType ); |
290 | conf->writeEntry( "User", user ); | 322 | conf->writeEntry( "User", user ); |
291 | conf->writeEntryCrypt( "Password", password ); | 323 | //conf->writeEntryCrypt( "Password", password ); |
324 | conf->writeEntry( "FolderHistory",getPasswordList() ); | ||
292 | conf->writeEntry( "Offline",offline); | 325 | conf->writeEntry( "Offline",offline); |
293 | conf->writeEntry( "LocalFolder", localFolder ); | 326 | conf->writeEntry( "LocalFolder", localFolder ); |
294 | conf->writeEntry( "MaxSize", maxMailSize ); | 327 | conf->writeEntry( "MaxSize", maxMailSize ); |
295 | QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) ); | 328 | QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) ); |
296 | int lf = dt.secsTo ( lastFetch ); | 329 | int lf = dt.secsTo ( lastFetch ); |
297 | conf->writeEntry( "LastFetch", lf ); | 330 | conf->writeEntry( "LastFetch", lf ); |
298 | conf->writeEntry( "LeaveOnServer", leaveOnServer); | 331 | conf->writeEntry( "LeaveOnServer", leaveOnServer); |
299 | conf->write(); | 332 | conf->sync(); |
300 | delete conf; | 333 | delete conf; |
301 | } | 334 | } |
302 | 335 | ||
303 | 336 | ||
304 | QString POP3account::getFileName() | 337 | QString POP3account::getFileName() |
305 | { | 338 | { |
306 | return locateLocal("data", "kopiemail" ) +"/pop3-" + file; | 339 | return locateLocal("data", "kopiemail" ) +"/pop3-" + file; |
307 | } | 340 | } |
@@ -345,44 +378,46 @@ QString SMTPaccount::getUniqueFileName() | |||
345 | unique.setNum( num++ ); | 378 | unique.setNum( num++ ); |
346 | } while ( imap.contains( "smtp-" + unique ) > 0 ); | 379 | } while ( imap.contains( "smtp-" + unique ) > 0 ); |
347 | 380 | ||
348 | return unique; | 381 | return unique; |
349 | } | 382 | } |
350 | 383 | ||
351 | void SMTPaccount::read() | 384 | void SMTPaccount::read() |
352 | { | 385 | { |
353 | Config *conf = new Config( getFileName(), Config::File ); | 386 | KConfig *conf = new KConfig( getFileName() ); |
354 | conf->setGroup( "SMTP Account" ); | 387 | conf->setGroup( "SMTP Account" ); |
355 | accountName = conf->readEntry( "Account" ); | 388 | accountName = conf->readEntry( "Account" ); |
356 | server = conf->readEntry( "Server" ); | 389 | server = conf->readEntry( "Server" ); |
357 | port = conf->readEntry( "Port" ); | 390 | port = conf->readEntry( "Port" ); |
358 | ssl = conf->readBoolEntry( "SSL" ); | 391 | ssl = conf->readBoolEntry( "SSL" ); |
359 | connectionType = conf->readNumEntry( "ConnectionType" ); | 392 | connectionType = conf->readNumEntry( "ConnectionType" ); |
360 | login = conf->readBoolEntry( "Login" ); | 393 | login = conf->readBoolEntry( "Login" ); |
361 | user = conf->readEntry( "User" ); | 394 | user = conf->readEntry( "User" ); |
362 | password = conf->readEntryCrypt( "Password" ); | 395 | //password = conf->readEntryCrypt( "Password" ); |
396 | setPasswordList( conf->readListEntry( "FolderHistory")); | ||
363 | delete conf; | 397 | delete conf; |
364 | } | 398 | } |
365 | 399 | ||
366 | void SMTPaccount::save() | 400 | void SMTPaccount::save() |
367 | { | 401 | { |
368 | Settings::checkDirectory(); | 402 | Settings::checkDirectory(); |
369 | 403 | ||
370 | Config *conf = new Config( getFileName(), Config::File ); | 404 | KConfig *conf = new KConfig( getFileName() ); |
371 | conf->setGroup( "SMTP Account" ); | 405 | conf->setGroup( "SMTP Account" ); |
372 | conf->writeEntry( "Account", accountName ); | 406 | conf->writeEntry( "Account", accountName ); |
373 | conf->writeEntry( "Server", server ); | 407 | conf->writeEntry( "Server", server ); |
374 | conf->writeEntry( "Port", port ); | 408 | conf->writeEntry( "Port", port ); |
375 | conf->writeEntry( "SSL", ssl ); | 409 | conf->writeEntry( "SSL", ssl ); |
376 | conf->writeEntry( "ConnectionType", connectionType ); | 410 | conf->writeEntry( "ConnectionType", connectionType ); |
377 | conf->writeEntry( "Login", login ); | 411 | conf->writeEntry( "Login", login ); |
378 | conf->writeEntry( "User", user ); | 412 | conf->writeEntry( "User", user ); |
379 | conf->writeEntryCrypt( "Password", password ); | 413 | //conf->writeEntryCrypt( "Password", password ); |
380 | conf->write(); | 414 | conf->writeEntry( "FolderHistory",getPasswordList() ); |
415 | conf->sync(); | ||
381 | delete conf; | 416 | delete conf; |
382 | } | 417 | } |
383 | 418 | ||
384 | 419 | ||
385 | QString SMTPaccount::getFileName() | 420 | QString SMTPaccount::getFileName() |
386 | { | 421 | { |
387 | return locateLocal("data", "kopiemail" ) +"/smtp-" + file; | 422 | return locateLocal("data", "kopiemail" ) +"/smtp-" + file; |
388 | } | 423 | } |
@@ -421,44 +456,46 @@ QString NNTPaccount::getUniqueFileName() | |||
421 | unique.setNum( num++ ); | 456 | unique.setNum( num++ ); |
422 | } while ( imap.contains( "nntp-" + unique ) > 0 ); | 457 | } while ( imap.contains( "nntp-" + unique ) > 0 ); |
423 | 458 | ||
424 | return unique; | 459 | return unique; |
425 | } | 460 | } |
426 | 461 | ||
427 | void NNTPaccount::read() | 462 | void NNTPaccount::read() |
428 | { | 463 | { |
429 | Config *conf = new Config( getFileName(), Config::File ); | 464 | KConfig *conf = new KConfig( getFileName() ); |
430 | conf->setGroup( "NNTP Account" ); | 465 | conf->setGroup( "NNTP Account" ); |
431 | accountName = conf->readEntry( "Account" ); | 466 | accountName = conf->readEntry( "Account" ); |
432 | server = conf->readEntry( "Server" ); | 467 | server = conf->readEntry( "Server" ); |
433 | port = conf->readEntry( "Port" ); | 468 | port = conf->readEntry( "Port" ); |
434 | ssl = conf->readBoolEntry( "SSL" ); | 469 | ssl = conf->readBoolEntry( "SSL" ); |
435 | login = conf->readBoolEntry( "Login" ); | 470 | login = conf->readBoolEntry( "Login" ); |
436 | user = conf->readEntry( "User" ); | 471 | user = conf->readEntry( "User" ); |
437 | password = conf->readEntryCrypt( "Password" ); | 472 | //password = conf->readEntryCrypt( "Password" ); |
438 | subscribedGroups = conf->readListEntry( "Subscribed", ',' ); | 473 | setPasswordList( conf->readListEntry( "FolderHistory")); |
474 | subscribedGroups = conf->readListEntry( "Subscribed"); | ||
439 | delete conf; | 475 | delete conf; |
440 | } | 476 | } |
441 | 477 | ||
442 | void NNTPaccount::save() | 478 | void NNTPaccount::save() |
443 | { | 479 | { |
444 | Settings::checkDirectory(); | 480 | Settings::checkDirectory(); |
445 | 481 | ||
446 | Config *conf = new Config( getFileName(), Config::File ); | 482 | KConfig *conf = new KConfig( getFileName() ); |
447 | conf->setGroup( "NNTP Account" ); | 483 | conf->setGroup( "NNTP Account" ); |
448 | conf->writeEntry( "Account", accountName ); | 484 | conf->writeEntry( "Account", accountName ); |
449 | conf->writeEntry( "Server", server ); | 485 | conf->writeEntry( "Server", server ); |
450 | conf->writeEntry( "Port", port ); | 486 | conf->writeEntry( "Port", port ); |
451 | conf->writeEntry( "SSL", ssl ); | 487 | conf->writeEntry( "SSL", ssl ); |
452 | conf->writeEntry( "Login", login ); | 488 | conf->writeEntry( "Login", login ); |
453 | conf->writeEntry( "User", user ); | 489 | conf->writeEntry( "User", user ); |
454 | conf->writeEntryCrypt( "Password", password ); | 490 | //conf->writeEntryCrypt( "Password", password ); |
455 | conf->writeEntry( "Subscribed" , subscribedGroups, ',' ); | 491 | conf->writeEntry( "FolderHistory",getPasswordList() ); |
456 | conf->write(); | 492 | conf->writeEntry( "Subscribed" , subscribedGroups ); |
493 | conf->sync(); | ||
457 | delete conf; | 494 | delete conf; |
458 | } | 495 | } |
459 | 496 | ||
460 | 497 | ||
461 | QString NNTPaccount::getFileName() | 498 | QString NNTPaccount::getFileName() |
462 | { | 499 | { |
463 | return locateLocal("data", "kopiemail" ) +"/nntp-" + file; | 500 | return locateLocal("data", "kopiemail" ) +"/nntp-" + file; |
464 | } | 501 | } |
diff --git a/kmicromail/libmailwrapper/settings.h b/kmicromail/libmailwrapper/settings.h index 85b817c..61051dd 100644 --- a/kmicromail/libmailwrapper/settings.h +++ b/kmicromail/libmailwrapper/settings.h | |||
@@ -32,16 +32,19 @@ public: | |||
32 | const QString&getPort()const{ return port; } | 32 | const QString&getPort()const{ return port; } |
33 | 33 | ||
34 | void setUser(const QString&str){ user = str; } | 34 | void setUser(const QString&str){ user = str; } |
35 | const QString&getUser()const{ return user; } | 35 | const QString&getUser()const{ return user; } |
36 | 36 | ||
37 | void setPassword(const QString&str) { password = str; } | 37 | void setPassword(const QString&str) { password = str; } |
38 | const QString&getPassword()const { return password; } | 38 | const QString&getPassword()const { return password; } |
39 | 39 | ||
40 | void setPasswordList(const QStringList &str); | ||
41 | QStringList getPasswordList(); | ||
42 | |||
40 | void setSSL( bool b ) { ssl = b; } | 43 | void setSSL( bool b ) { ssl = b; } |
41 | bool getSSL() { return ssl; } | 44 | bool getSSL() { return ssl; } |
42 | 45 | ||
43 | void setConnectionType( int x ) { connectionType = x; } | 46 | void setConnectionType( int x ) { connectionType = x; } |
44 | int ConnectionType() { return connectionType; } | 47 | int ConnectionType() { return connectionType; } |
45 | 48 | ||
46 | void setMaxMailSize( int x ) { maxMailSize = x; } | 49 | void setMaxMailSize( int x ) { maxMailSize = x; } |
47 | int getMaxMailSize() { return maxMailSize; } | 50 | int getMaxMailSize() { return maxMailSize; } |