summaryrefslogtreecommitdiff
path: root/noncore/net/mail/libmailwrapper/settings.cpp
authoralwin <alwin>2004-10-24 00:55:14 (UTC)
committer alwin <alwin>2004-10-24 00:55:14 (UTC)
commit9755bc969d17fc683791abc5c6fbd50fa3112486 (patch) (side-by-side diff)
tree0fdcf7b52b2f4627dd3efcd7330b116c4d9c4d98 /noncore/net/mail/libmailwrapper/settings.cpp
parent12eed25c7f18285f0e342d49fd3c41eb4b14e151 (diff)
downloadopie-9755bc969d17fc683791abc5c6fbd50fa3112486.zip
opie-9755bc969d17fc683791abc5c6fbd50fa3112486.tar.gz
opie-9755bc969d17fc683791abc5c6fbd50fa3112486.tar.bz2
new options for pop3 accounts
KATE eated a lot of last spaces in files some tryouts
Diffstat (limited to 'noncore/net/mail/libmailwrapper/settings.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/libmailwrapper/settings.cpp47
1 files changed, 37 insertions, 10 deletions
diff --git a/noncore/net/mail/libmailwrapper/settings.cpp b/noncore/net/mail/libmailwrapper/settings.cpp
index 3c9b25c..09be91b 100644
--- a/noncore/net/mail/libmailwrapper/settings.cpp
+++ b/noncore/net/mail/libmailwrapper/settings.cpp
@@ -13,24 +13,23 @@
#define SMTP_SSL_PORT "465"
#define POP3_PORT "110"
#define POP3_SSL_PORT "995"
#define NNTP_PORT "119"
#define NNTP_SSL_PORT "563"
-
Settings::Settings()
: QObject()
{
updateAccounts();
}
void Settings::checkDirectory()
{
if ( !QDir( (QString) getenv( "HOME" ) + "/Applications/opiemail/" ).exists() ) {
system( "mkdir -p $HOME/Applications/opiemail" );
- odebug << "$HOME/Applications/opiemail created" << oendl;
+ odebug << "$HOME/Applications/opiemail created" << oendl;
}
}
QList<Account> Settings::getAccounts()
{
return accounts;
@@ -52,34 +51,34 @@ void Settings::updateAccounts()
accounts.clear();
QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" );
QStringList::Iterator it;
QStringList imap = dir.entryList( "imap-*" );
for ( it = imap.begin(); it != imap.end(); it++ ) {
- odebug << "Added IMAP account" << oendl;
+ odebug << "Added IMAP account" << oendl;
IMAPaccount *account = new IMAPaccount( (*it).replace(0, 5, "") );
accounts.append( account );
}
QStringList pop3 = dir.entryList( "pop3-*" );
for ( it = pop3.begin(); it != pop3.end(); it++ ) {
- odebug << "Added POP account" << oendl;
+ odebug << "Added POP account" << oendl;
POP3account *account = new POP3account( (*it).replace(0, 5, "") );
accounts.append( account );
}
QStringList smtp = dir.entryList( "smtp-*" );
for ( it = smtp.begin(); it != smtp.end(); it++ ) {
- odebug << "Added SMTP account" << oendl;
+ odebug << "Added SMTP account" << oendl;
SMTPaccount *account = new SMTPaccount( (*it).replace(0, 5, "") );
accounts.append( account );
}
QStringList nntp = dir.entryList( "nntp-*" );
for ( it = nntp.begin(); it != nntp.end(); it++ ) {
- odebug << "Added NNTP account" << oendl;
+ odebug << "Added NNTP account" << oendl;
NNTPaccount *account = new NNTPaccount( (*it).replace(0, 5, "") );
accounts.append( account );
}
readAccounts();
}
@@ -177,13 +176,13 @@ void IMAPaccount::read()
offline = conf->readBoolEntry("Offline",false);
delete conf;
}
void IMAPaccount::save()
{
- odebug << "saving " + getFileName() << oendl;
+ odebug << "saving " + getFileName() << oendl;
Settings::checkDirectory();
Config *conf = new Config( getFileName(), Config::File );
conf->setGroup( "IMAP Account" );
conf->writeEntry( "Account", accountName );
conf->writeEntry( "Server", server );
@@ -210,23 +209,27 @@ POP3account::POP3account()
file = POP3account::getUniqueFileName();
accountName = "New POP3 Account";
ssl = false;
connectionType = 1;
type = MAILLIB::A_POP3;
port = POP3_PORT;
+ m_CheckSize = true;
+ m_MaxSize = 1024;
}
POP3account::POP3account( QString filename )
: Account()
{
file = filename;
accountName = "New POP3 Account";
ssl = false;
connectionType = 1;
type = MAILLIB::A_POP3;
port = POP3_PORT;
+ m_CheckSize = true;
+ m_MaxSize = 1024;
}
QString POP3account::getUniqueFileName()
{
int num = 0;
QString unique;
@@ -250,40 +253,64 @@ void POP3account::read()
port = conf->readEntry( "Port" );
ssl = conf->readBoolEntry( "SSL" );
connectionType = conf->readNumEntry( "ConnectionType" );
user = conf->readEntry( "User" );
password = conf->readEntryCrypt( "Password" );
offline = conf->readBoolEntry("Offline",false);
+ m_CheckSize = conf->readBoolEntry("Checkmaxsize",true);
+ m_MaxSize = conf->readNumEntry("Maxsize",1024);
delete conf;
}
void POP3account::save()
{
- odebug << "saving " + getFileName() << oendl;
+ odebug << "saving " + getFileName() << oendl;
Settings::checkDirectory();
Config *conf = new Config( getFileName(), Config::File );
conf->setGroup( "POP3 Account" );
conf->writeEntry( "Account", accountName );
conf->writeEntry( "Server", server );
conf->writeEntry( "Port", port );
conf->writeEntry( "SSL", ssl );
conf->writeEntry( "ConnectionType", connectionType );
conf->writeEntry( "User", user );
conf->writeEntryCrypt( "Password", password );
conf->writeEntry( "Offline",offline);
+ conf->writeEntry("Checkmaxsize",m_CheckSize);
+ conf->writeEntry("Maxsize",m_MaxSize);
conf->write();
delete conf;
}
QString POP3account::getFileName()
{
return (QString) getenv( "HOME" ) + "/Applications/opiemail/pop3-" + file;
}
+bool POP3account::getCheckMaxSize()const
+{
+ return m_CheckSize;
+}
+
+void POP3account::setCheckMaxSize(bool aValue)
+{
+ m_CheckSize = aValue;
+}
+
+int POP3account::getMaxSize()const
+{
+ return m_MaxSize;
+}
+
+void POP3account::setMaxSize(int aValue)
+{
+ m_MaxSize = aValue;
+}
+
SMTPaccount::SMTPaccount()
: Account()
{
file = SMTPaccount::getUniqueFileName();
accountName = "New SMTP Account";
ssl = false;
@@ -337,13 +364,13 @@ void SMTPaccount::read()
password = conf->readEntryCrypt( "Password" );
delete conf;
}
void SMTPaccount::save()
{
- odebug << "saving " + getFileName() << oendl;
+ odebug << "saving " + getFileName() << oendl;
Settings::checkDirectory();
Config *conf = new Config( getFileName(), Config::File );
conf->setGroup( "SMTP Account" );
conf->writeEntry( "Account", accountName );
conf->writeEntry( "Server", server );
@@ -414,13 +441,13 @@ void NNTPaccount::read()
subscribedGroups = conf->readListEntry( "Subscribed", ',' );
delete conf;
}
void NNTPaccount::save()
{
- odebug << "saving " + getFileName() << oendl;
+ odebug << "saving " + getFileName() << oendl;
Settings::checkDirectory();
Config *conf = new Config( getFileName(), Config::File );
conf->setGroup( "NNTP Account" );
conf->writeEntry( "Account", accountName );
conf->writeEntry( "Server", server );