summaryrefslogtreecommitdiffabout
Side-by-side diff
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
@@ -363,2 +363,12 @@ void IMAPconfig::fillValues()
prefixLine->setText(data->getPrefix());
+ localFolder->setText( data->getLocalFolder() );
+ int max = data->getMaxMailSize() ;
+ if ( max ) {
+ CheckBoxDown->setChecked( true );
+ SpinBoxDown->setValue ( max );
+ } else {
+ CheckBoxDown->setChecked( false );
+ SpinBoxDown->setValue ( 5 );
+ }
+ CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() );
}
@@ -373,3 +383,6 @@ void IMAPconfig::accept()
data->setPassword( passLine->text() );
- data->setPrefix(prefixLine->text());
+ data->setPrefix(prefixLine->text());
+ data->setLocalFolder( localFolder->text() );
+ data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ;
+ data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() );
@@ -432,2 +445,3 @@ void POP3config::fillValues()
}
+ CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() );
}
@@ -444,2 +458,3 @@ void POP3config::accept()
data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ;
+ data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() );
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 @@
//#include <opie2/odebug.h>
-#include <qpe/config.h>
+#include <kconfig.h>
@@ -114,3 +114,6 @@ Account::Account()
connectionType = 1;
- offline = false;
+ offline = false;
+ maxMailSize = 0;
+ lastFetch;
+ leaveOnServer = false;
}
@@ -123,2 +126,26 @@ void Account::remove()
+void Account::setPasswordList(const QStringList &str)
+{
+ password = "";
+ int i;
+ for ( i = 0; i < str.count() ; ++i ) {
+ QChar c ( (str[i].toUInt()-131)/(str.count()- (i%3)));
+ password.append( c );
+ }
+ //qDebug("password %s ", password.latin1());
+}
+QStringList Account::getPasswordList()
+{
+ int i;
+ int len = password.length();
+ QStringList str;
+
+ for ( i = 0; i < len ; ++i ) {
+ int val = password.at(i).unicode()*(len-(i%3))+131;
+ str.append( QString::number( val ) );
+ // qDebug("append %s ", str[i].latin1());
+ }
+ return str;
+}
+
IMAPaccount::IMAPaccount()
@@ -162,3 +189,3 @@ void IMAPaccount::read()
{
- Config *conf = new Config( getFileName(), Config::File );
+ KConfig *conf = new KConfig( getFileName() );
conf->setGroup( "IMAP Account" );
@@ -174,3 +201,4 @@ void IMAPaccount::read()
if (user.isNull()) user = "";
- password = conf->readEntryCrypt( "Password","" );
+ //password = conf->readEntryCrypt( "Password","" );
+ setPasswordList( conf->readListEntry( "FolderHistory"));
if (password.isNull()) password = "";
@@ -184,2 +212,4 @@ void IMAPaccount::read()
leaveOnServer = conf->readBoolEntry("LeaveOnServer",false);
+ qDebug("reading last fetch: %d ", lf);
+ if ( lf < 0 ) lf = 0;
lastFetch = dt.addSecs( lf );
@@ -193,3 +223,3 @@ void IMAPaccount::save()
- Config *conf = new Config( getFileName(), Config::File );
+ KConfig *conf = new KConfig( getFileName() );
conf->setGroup( "IMAP Account" );
@@ -201,3 +231,4 @@ void IMAPaccount::save()
conf->writeEntry( "User", user );
- conf->writeEntryCrypt( "Password", password );
+ //conf->writeEntryCrypt( "Password", password );
+ conf->writeEntry( "FolderHistory",getPasswordList() );
conf->writeEntry( "MailPrefix",prefix);
@@ -210,3 +241,3 @@ void IMAPaccount::save()
conf->writeEntry( "LeaveOnServer", leaveOnServer);
- conf->write();
+ conf->sync();
delete conf;
@@ -259,3 +290,3 @@ void POP3account::read()
{
- Config *conf = new Config( getFileName(), Config::File );
+ KConfig *conf = new KConfig( getFileName());
conf->setGroup( "POP3 Account" );
@@ -267,3 +298,4 @@ void POP3account::read()
user = conf->readEntry( "User" );
- password = conf->readEntryCrypt( "Password" );
+ //password = conf->readEntryCrypt( "Password" );
+ setPasswordList( conf->readListEntry( "FolderHistory"));
offline = conf->readBoolEntry("Offline",false);
@@ -282,3 +314,3 @@ void POP3account::save()
- Config *conf = new Config( getFileName(), Config::File );
+ KConfig *conf = new KConfig( getFileName() );
conf->setGroup( "POP3 Account" );
@@ -290,3 +322,4 @@ void POP3account::save()
conf->writeEntry( "User", user );
- conf->writeEntryCrypt( "Password", password );
+ //conf->writeEntryCrypt( "Password", password );
+ conf->writeEntry( "FolderHistory",getPasswordList() );
conf->writeEntry( "Offline",offline);
@@ -298,3 +331,3 @@ void POP3account::save()
conf->writeEntry( "LeaveOnServer", leaveOnServer);
- conf->write();
+ conf->sync();
delete conf;
@@ -352,3 +385,3 @@ void SMTPaccount::read()
{
- Config *conf = new Config( getFileName(), Config::File );
+ KConfig *conf = new KConfig( getFileName() );
conf->setGroup( "SMTP Account" );
@@ -361,3 +394,4 @@ void SMTPaccount::read()
user = conf->readEntry( "User" );
- password = conf->readEntryCrypt( "Password" );
+ //password = conf->readEntryCrypt( "Password" );
+ setPasswordList( conf->readListEntry( "FolderHistory"));
delete conf;
@@ -369,3 +403,3 @@ void SMTPaccount::save()
- Config *conf = new Config( getFileName(), Config::File );
+ KConfig *conf = new KConfig( getFileName() );
conf->setGroup( "SMTP Account" );
@@ -378,4 +412,5 @@ void SMTPaccount::save()
conf->writeEntry( "User", user );
- conf->writeEntryCrypt( "Password", password );
- conf->write();
+ //conf->writeEntryCrypt( "Password", password );
+ conf->writeEntry( "FolderHistory",getPasswordList() );
+ conf->sync();
delete conf;
@@ -428,3 +463,3 @@ void NNTPaccount::read()
{
- Config *conf = new Config( getFileName(), Config::File );
+ KConfig *conf = new KConfig( getFileName() );
conf->setGroup( "NNTP Account" );
@@ -436,4 +471,5 @@ void NNTPaccount::read()
user = conf->readEntry( "User" );
- password = conf->readEntryCrypt( "Password" );
- subscribedGroups = conf->readListEntry( "Subscribed", ',' );
+ //password = conf->readEntryCrypt( "Password" );
+ setPasswordList( conf->readListEntry( "FolderHistory"));
+ subscribedGroups = conf->readListEntry( "Subscribed");
delete conf;
@@ -445,3 +481,3 @@ void NNTPaccount::save()
- Config *conf = new Config( getFileName(), Config::File );
+ KConfig *conf = new KConfig( getFileName() );
conf->setGroup( "NNTP Account" );
@@ -453,5 +489,6 @@ void NNTPaccount::save()
conf->writeEntry( "User", user );
- conf->writeEntryCrypt( "Password", password );
- conf->writeEntry( "Subscribed" , subscribedGroups, ',' );
- conf->write();
+ //conf->writeEntryCrypt( "Password", password );
+ conf->writeEntry( "FolderHistory",getPasswordList() );
+ conf->writeEntry( "Subscribed" , subscribedGroups );
+ conf->sync();
delete conf;
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
@@ -39,2 +39,5 @@ public:
+ void setPasswordList(const QStringList &str);
+ QStringList getPasswordList();
+
void setSSL( bool b ) { ssl = b; }