summaryrefslogtreecommitdiffabout
path: root/kmicromail
Side-by-side diff
Diffstat (limited to 'kmicromail') (more/less context) (show whitespace changes)
-rw-r--r--kmicromail/editaccounts.cpp15
-rw-r--r--kmicromail/libmailwrapper/settings.cpp83
-rw-r--r--kmicromail/libmailwrapper/settings.h3
3 files changed, 78 insertions, 23 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()
userLine->setText( data->getUser() );
passLine->setText( data->getPassword() );
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() );
}
void IMAPconfig::accept()
@@ -372,6 +382,9 @@ void IMAPconfig::accept()
data->setUser( userLine->text() );
data->setPassword( passLine->text() );
data->setPrefix(prefixLine->text());
+ data->setLocalFolder( localFolder->text() );
+ data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ;
+ data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() );
QDialog::accept();
}
@@ -430,6 +443,7 @@ void POP3config::fillValues()
CheckBoxDown->setChecked( false );
SpinBoxDown->setValue ( 5 );
}
+ CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() );
}
void POP3config::accept()
@@ -442,6 +456,7 @@ void POP3config::accept()
data->setPassword( passLine->text() );
data->setLocalFolder( localFolder->text() );
data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ;
+ data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() );
QDialog::accept();
}
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 @@
#include <qdir.h>
//#include <opie2/odebug.h>
-#include <qpe/config.h>
+#include <kconfig.h>
#include <kstandarddirs.h>
#include "settings.h"
@@ -113,6 +113,9 @@ Account::Account()
ssl = false;
connectionType = 1;
offline = false;
+ maxMailSize = 0;
+ lastFetch;
+ leaveOnServer = false;
}
void Account::remove()
@@ -121,6 +124,30 @@ void Account::remove()
file.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()
: Account()
{
@@ -160,7 +187,7 @@ QString IMAPaccount::getUniqueFileName()
void IMAPaccount::read()
{
- Config *conf = new Config( getFileName(), Config::File );
+ KConfig *conf = new KConfig( getFileName() );
conf->setGroup( "IMAP Account" );
accountName = conf->readEntry( "Account","" );
if (accountName.isNull()) accountName = "";
@@ -172,7 +199,8 @@ void IMAPaccount::read()
ssl = conf->readBoolEntry( "SSL",false );
user = conf->readEntry( "User","" );
if (user.isNull()) user = "";
- password = conf->readEntryCrypt( "Password","" );
+ //password = conf->readEntryCrypt( "Password","" );
+ setPasswordList( conf->readListEntry( "FolderHistory"));
if (password.isNull()) password = "";
prefix = conf->readEntry("MailPrefix","");
if (prefix.isNull()) prefix = "";
@@ -182,6 +210,8 @@ void IMAPaccount::read()
int lf = conf->readNumEntry( "LastFetch",0 );
QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) );
leaveOnServer = conf->readBoolEntry("LeaveOnServer",false);
+ qDebug("reading last fetch: %d ", lf);
+ if ( lf < 0 ) lf = 0;
lastFetch = dt.addSecs( lf );
delete conf;
}
@@ -191,7 +221,7 @@ void IMAPaccount::save()
qDebug("saving %s ",getFileName().latin1() );
Settings::checkDirectory();
- Config *conf = new Config( getFileName(), Config::File );
+ KConfig *conf = new KConfig( getFileName() );
conf->setGroup( "IMAP Account" );
conf->writeEntry( "Account", accountName );
conf->writeEntry( "Server", server );
@@ -199,7 +229,8 @@ void IMAPaccount::save()
conf->writeEntry( "SSL", ssl );
conf->writeEntry( "ConnectionType", connectionType );
conf->writeEntry( "User", user );
- conf->writeEntryCrypt( "Password", password );
+ //conf->writeEntryCrypt( "Password", password );
+ conf->writeEntry( "FolderHistory",getPasswordList() );
conf->writeEntry( "MailPrefix",prefix);
conf->writeEntry( "Offline",offline);
conf->writeEntry( "LocalFolder", localFolder );
@@ -208,7 +239,7 @@ void IMAPaccount::save()
int lf = dt.secsTo ( lastFetch );
conf->writeEntry( "LastFetch", lf );
conf->writeEntry( "LeaveOnServer", leaveOnServer);
- conf->write();
+ conf->sync();
delete conf;
}
@@ -257,7 +288,7 @@ QString POP3account::getUniqueFileName()
void POP3account::read()
{
- Config *conf = new Config( getFileName(), Config::File );
+ KConfig *conf = new KConfig( getFileName());
conf->setGroup( "POP3 Account" );
accountName = conf->readEntry( "Account" );
server = conf->readEntry( "Server" );
@@ -265,7 +296,8 @@ void POP3account::read()
ssl = conf->readBoolEntry( "SSL" );
connectionType = conf->readNumEntry( "ConnectionType" );
user = conf->readEntry( "User" );
- password = conf->readEntryCrypt( "Password" );
+ //password = conf->readEntryCrypt( "Password" );
+ setPasswordList( conf->readListEntry( "FolderHistory"));
offline = conf->readBoolEntry("Offline",false);
localFolder = conf->readEntry( "LocalFolder" );
maxMailSize = conf->readNumEntry( "MaxSize",0 );
@@ -280,7 +312,7 @@ void POP3account::save()
{
Settings::checkDirectory();
- Config *conf = new Config( getFileName(), Config::File );
+ KConfig *conf = new KConfig( getFileName() );
conf->setGroup( "POP3 Account" );
conf->writeEntry( "Account", accountName );
conf->writeEntry( "Server", server );
@@ -288,7 +320,8 @@ void POP3account::save()
conf->writeEntry( "SSL", ssl );
conf->writeEntry( "ConnectionType", connectionType );
conf->writeEntry( "User", user );
- conf->writeEntryCrypt( "Password", password );
+ //conf->writeEntryCrypt( "Password", password );
+ conf->writeEntry( "FolderHistory",getPasswordList() );
conf->writeEntry( "Offline",offline);
conf->writeEntry( "LocalFolder", localFolder );
conf->writeEntry( "MaxSize", maxMailSize );
@@ -296,7 +329,7 @@ void POP3account::save()
int lf = dt.secsTo ( lastFetch );
conf->writeEntry( "LastFetch", lf );
conf->writeEntry( "LeaveOnServer", leaveOnServer);
- conf->write();
+ conf->sync();
delete conf;
}
@@ -350,7 +383,7 @@ QString SMTPaccount::getUniqueFileName()
void SMTPaccount::read()
{
- Config *conf = new Config( getFileName(), Config::File );
+ KConfig *conf = new KConfig( getFileName() );
conf->setGroup( "SMTP Account" );
accountName = conf->readEntry( "Account" );
server = conf->readEntry( "Server" );
@@ -359,7 +392,8 @@ void SMTPaccount::read()
connectionType = conf->readNumEntry( "ConnectionType" );
login = conf->readBoolEntry( "Login" );
user = conf->readEntry( "User" );
- password = conf->readEntryCrypt( "Password" );
+ //password = conf->readEntryCrypt( "Password" );
+ setPasswordList( conf->readListEntry( "FolderHistory"));
delete conf;
}
@@ -367,7 +401,7 @@ void SMTPaccount::save()
{
Settings::checkDirectory();
- Config *conf = new Config( getFileName(), Config::File );
+ KConfig *conf = new KConfig( getFileName() );
conf->setGroup( "SMTP Account" );
conf->writeEntry( "Account", accountName );
conf->writeEntry( "Server", server );
@@ -376,8 +410,9 @@ void SMTPaccount::save()
conf->writeEntry( "ConnectionType", connectionType );
conf->writeEntry( "Login", login );
conf->writeEntry( "User", user );
- conf->writeEntryCrypt( "Password", password );
- conf->write();
+ //conf->writeEntryCrypt( "Password", password );
+ conf->writeEntry( "FolderHistory",getPasswordList() );
+ conf->sync();
delete conf;
}
@@ -426,7 +461,7 @@ QString NNTPaccount::getUniqueFileName()
void NNTPaccount::read()
{
- Config *conf = new Config( getFileName(), Config::File );
+ KConfig *conf = new KConfig( getFileName() );
conf->setGroup( "NNTP Account" );
accountName = conf->readEntry( "Account" );
server = conf->readEntry( "Server" );
@@ -434,8 +469,9 @@ void NNTPaccount::read()
ssl = conf->readBoolEntry( "SSL" );
login = conf->readBoolEntry( "Login" );
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;
}
@@ -443,7 +479,7 @@ void NNTPaccount::save()
{
Settings::checkDirectory();
- Config *conf = new Config( getFileName(), Config::File );
+ KConfig *conf = new KConfig( getFileName() );
conf->setGroup( "NNTP Account" );
conf->writeEntry( "Account", accountName );
conf->writeEntry( "Server", server );
@@ -451,9 +487,10 @@ void NNTPaccount::save()
conf->writeEntry( "SSL", ssl );
conf->writeEntry( "Login", login );
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
@@ -37,6 +37,9 @@ public:
void setPassword(const QString&str) { password = str; }
const QString&getPassword()const { return password; }
+ void setPasswordList(const QStringList &str);
+ QStringList getPasswordList();
+
void setSSL( bool b ) { ssl = b; }
bool getSSL() { return ssl; }