summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/editaccounts.cpp17
-rw-r--r--kmicromail/libmailwrapper/settings.cpp85
-rw-r--r--kmicromail/libmailwrapper/settings.h3
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
@@ -361,6 +361,16 @@ void IMAPconfig::fillValues()
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
366void IMAPconfig::accept() 376void IMAPconfig::accept()
@@ -371,7 +381,10 @@ void IMAPconfig::accept()
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}
@@ -430,6 +443,7 @@ void POP3config::fillValues()
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
435void POP3config::accept() 449void POP3config::accept()
@@ -442,6 +456,7 @@ void POP3config::accept()
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}
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
@@ -2,7 +2,7 @@
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"
@@ -112,7 +112,10 @@ Account::Account()
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
118void Account::remove() 121void Account::remove()
@@ -121,6 +124,30 @@ void Account::remove()
121 file.remove(); 124 file.remove();
122} 125}
123 126
127void 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}
137QStringList 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
124IMAPaccount::IMAPaccount() 151IMAPaccount::IMAPaccount()
125 : Account() 152 : Account()
126{ 153{
@@ -160,7 +187,7 @@ QString IMAPaccount::getUniqueFileName()
160 187
161void IMAPaccount::read() 188void 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 = "";
@@ -172,7 +199,8 @@ void IMAPaccount::read()
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 = "";
@@ -182,6 +210,8 @@ void IMAPaccount::read()
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}
@@ -191,7 +221,7 @@ void IMAPaccount::save()
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 );
@@ -199,7 +229,8 @@ void IMAPaccount::save()
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 );
@@ -208,7 +239,7 @@ void IMAPaccount::save()
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
@@ -257,7 +288,7 @@ QString POP3account::getUniqueFileName()
257 288
258void POP3account::read() 289void 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" );
@@ -265,7 +296,8 @@ void POP3account::read()
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 );
@@ -280,7 +312,7 @@ 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 );
@@ -288,7 +320,8 @@ void POP3account::save()
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 );
@@ -296,7 +329,7 @@ void POP3account::save()
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
@@ -350,7 +383,7 @@ QString SMTPaccount::getUniqueFileName()
350 383
351void SMTPaccount::read() 384void 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" );
@@ -359,7 +392,8 @@ void SMTPaccount::read()
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
@@ -367,7 +401,7 @@ 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 );
@@ -376,8 +410,9 @@ void SMTPaccount::save()
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
@@ -426,7 +461,7 @@ QString NNTPaccount::getUniqueFileName()
426 461
427void NNTPaccount::read() 462void 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" );
@@ -434,8 +469,9 @@ void NNTPaccount::read()
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
@@ -443,7 +479,7 @@ 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 );
@@ -451,9 +487,10 @@ void NNTPaccount::save()
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
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
@@ -37,6 +37,9 @@ public:
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