summaryrefslogtreecommitdiffabout
path: root/kmicromail/libmailwrapper/settings.cpp
Unidiff
Diffstat (limited to 'kmicromail/libmailwrapper/settings.cpp') (more/less context) (show whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/settings.cpp83
1 files changed, 60 insertions, 23 deletions
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
@@ -4,3 +4,3 @@
4//#include <opie2/odebug.h> 4//#include <opie2/odebug.h>
5#include <qpe/config.h> 5#include <kconfig.h>
6 6
@@ -115,2 +115,5 @@ Account::Account()
115 offline = false; 115 offline = false;
116 maxMailSize = 0;
117 lastFetch;
118 leaveOnServer = false;
116} 119}
@@ -123,2 +126,26 @@ void Account::remove()
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()
@@ -162,3 +189,3 @@ 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" );
@@ -174,3 +201,4 @@ void IMAPaccount::read()
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 = "";
@@ -184,2 +212,4 @@ void IMAPaccount::read()
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 );
@@ -193,3 +223,3 @@ void IMAPaccount::save()
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" );
@@ -201,3 +231,4 @@ void IMAPaccount::save()
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);
@@ -210,3 +241,3 @@ void IMAPaccount::save()
210 conf->writeEntry( "LeaveOnServer", leaveOnServer); 241 conf->writeEntry( "LeaveOnServer", leaveOnServer);
211 conf->write(); 242 conf->sync();
212 delete conf; 243 delete conf;
@@ -259,3 +290,3 @@ 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" );
@@ -267,3 +298,4 @@ void POP3account::read()
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);
@@ -282,3 +314,3 @@ void POP3account::save()
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" );
@@ -290,3 +322,4 @@ void POP3account::save()
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);
@@ -298,3 +331,3 @@ void POP3account::save()
298 conf->writeEntry( "LeaveOnServer", leaveOnServer); 331 conf->writeEntry( "LeaveOnServer", leaveOnServer);
299 conf->write(); 332 conf->sync();
300 delete conf; 333 delete conf;
@@ -352,3 +385,3 @@ 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" );
@@ -361,3 +394,4 @@ void SMTPaccount::read()
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;
@@ -369,3 +403,3 @@ void SMTPaccount::save()
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" );
@@ -378,4 +412,5 @@ void SMTPaccount::save()
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;
@@ -428,3 +463,3 @@ 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" );
@@ -436,4 +471,5 @@ void NNTPaccount::read()
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;
@@ -445,3 +481,3 @@ void NNTPaccount::save()
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" );
@@ -453,5 +489,6 @@ void NNTPaccount::save()
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;