summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-09-11 10:30:57 (UTC)
committer zautrix <zautrix>2004-09-11 10:30:57 (UTC)
commitd7a273f40838f56205c1377ed0bcc5457bd46ea3 (patch) (side-by-side diff)
tree9f01120382589404ff8dca3170f9472bdd0f18fb
parent0f45c977d7530b6ca827b7a7c7da7469f01800ca (diff)
downloadkdepimpi-d7a273f40838f56205c1377ed0bcc5457bd46ea3.zip
kdepimpi-d7a273f40838f56205c1377ed0bcc5457bd46ea3.tar.gz
kdepimpi-d7a273f40838f56205c1377ed0bcc5457bd46ea3.tar.bz2
More mail settings
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
@@ -362,4 +362,14 @@ void IMAPconfig::fillValues()
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() );
}
@@ -372,5 +382,8 @@ void IMAPconfig::accept()
data->setUser( userLine->text() );
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() );
QDialog::accept();
@@ -431,4 +444,5 @@ void POP3config::fillValues()
SpinBoxDown->setValue ( 5 );
}
+ CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() );
}
@@ -443,4 +457,5 @@ void POP3config::accept()
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
@@ -3,5 +3,5 @@
//#include <opie2/odebug.h>
-#include <qpe/config.h>
+#include <kconfig.h>
#include <kstandarddirs.h>
@@ -113,5 +113,8 @@ Account::Account()
ssl = false;
connectionType = 1;
- offline = false;
+ offline = false;
+ maxMailSize = 0;
+ lastFetch;
+ leaveOnServer = false;
}
@@ -122,4 +125,28 @@ 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()
: Account()
@@ -161,5 +188,5 @@ 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","" );
@@ -173,5 +200,6 @@ void IMAPaccount::read()
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","");
@@ -183,4 +211,6 @@ void IMAPaccount::read()
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;
@@ -192,5 +222,5 @@ void IMAPaccount::save()
Settings::checkDirectory();
- Config *conf = new Config( getFileName(), Config::File );
+ KConfig *conf = new KConfig( getFileName() );
conf->setGroup( "IMAP Account" );
conf->writeEntry( "Account", accountName );
@@ -200,5 +230,6 @@ void IMAPaccount::save()
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);
@@ -209,5 +240,5 @@ void IMAPaccount::save()
conf->writeEntry( "LastFetch", lf );
conf->writeEntry( "LeaveOnServer", leaveOnServer);
- conf->write();
+ conf->sync();
delete conf;
}
@@ -258,5 +289,5 @@ 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" );
@@ -266,5 +297,6 @@ void POP3account::read()
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" );
@@ -281,5 +313,5 @@ 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 );
@@ -289,5 +321,6 @@ void POP3account::save()
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 );
@@ -297,5 +330,5 @@ void POP3account::save()
conf->writeEntry( "LastFetch", lf );
conf->writeEntry( "LeaveOnServer", leaveOnServer);
- conf->write();
+ conf->sync();
delete conf;
}
@@ -351,5 +384,5 @@ 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" );
@@ -360,5 +393,6 @@ void SMTPaccount::read()
login = conf->readBoolEntry( "Login" );
user = conf->readEntry( "User" );
- password = conf->readEntryCrypt( "Password" );
+ //password = conf->readEntryCrypt( "Password" );
+ setPasswordList( conf->readListEntry( "FolderHistory"));
delete conf;
}
@@ -368,5 +402,5 @@ 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 );
@@ -377,6 +411,7 @@ void SMTPaccount::save()
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;
}
@@ -427,5 +462,5 @@ 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" );
@@ -435,6 +470,7 @@ void NNTPaccount::read()
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;
}
@@ -444,5 +480,5 @@ 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 );
@@ -452,7 +488,8 @@ void NNTPaccount::save()
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
@@ -38,4 +38,7 @@ public:
const QString&getPassword()const { return password; }
+ void setPasswordList(const QStringList &str);
+ QStringList getPasswordList();
+
void setSSL( bool b ) { ssl = b; }
bool getSSL() { return ssl; }