summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/editaccounts.cpp12
-rw-r--r--kmicromail/libmailwrapper/pop3wrapper.cpp2
-rw-r--r--kmicromail/libmailwrapper/settings.cpp10
-rw-r--r--kmicromail/libmailwrapper/settings.h9
-rw-r--r--kmicromail/pop3configui.ui94
5 files changed, 122 insertions, 5 deletions
diff --git a/kmicromail/editaccounts.cpp b/kmicromail/editaccounts.cpp
index d272c3b..e7d2750 100644
--- a/kmicromail/editaccounts.cpp
+++ b/kmicromail/editaccounts.cpp
@@ -1,42 +1,43 @@
#include "defines.h"
#include "editaccounts.h"
#include "kapplication.h"
/* OPIE */
#include <qpe/qpeapplication.h>
/* QT */
#include <qstringlist.h>
#include <qcombobox.h>
#include <qcheckbox.h>
#include <qmessagebox.h>
#include <qpushbutton.h>
#include <qlineedit.h>
#include <qlabel.h>
#include <qtabwidget.h>
#include <qlistview.h>
+#include <qspinbox.h>
#include <libmailwrapper/nntpwrapper.h>
using namespace Opie::Core;
AccountListItem::AccountListItem( QListView *parent, Account *a)
: QListViewItem( parent )
{
account = a;
setText( 0, account->getAccountName() );
QString ttext = "";
switch (account->getType()) {
case MAILLIB::A_NNTP:
ttext="NNTP";
break;
case MAILLIB::A_POP3:
ttext = "POP3";
break;
case MAILLIB::A_IMAP:
ttext = "IMAP";
break;
case MAILLIB::A_SMTP:
ttext = "SMTP";
break;
@@ -399,58 +400,69 @@ void POP3config::slotConnectionToggle( int index )
// 2 is ssl connection
if ( index == 2 )
{
portLine->setText( POP3_SSL_PORT );
}
else if ( index == 3 )
{
portLine->setText( POP3_PORT );
CommandEdit->show();
}
else
{
portLine->setText( POP3_PORT );
}
}
void POP3config::fillValues()
{
accountLine->setText( data->getAccountName() );
serverLine->setText( data->getServer() );
portLine->setText( data->getPort() );
ComboBox1->setCurrentItem( data->ConnectionType() );
userLine->setText( data->getUser() );
passLine->setText( data->getPassword() );
+ localFolder->setText( data->getLocalFolder() );
+ int max = data->getMaxMailSize() ;
+ if ( max ) {
+ CheckBoxDown->setChecked( true );
+ SpinBoxDown->setValue ( max );
+ } else {
+ CheckBoxDown->setChecked( false );
+ SpinBoxDown->setValue ( 5 );
+ }
}
void POP3config::accept()
{
data->setAccountName( accountLine->text() );
data->setServer( serverLine->text() );
data->setPort( portLine->text() );
data->setConnectionType( ComboBox1->currentItem() );
data->setUser( userLine->text() );
data->setPassword( passLine->text() );
+ data->setLocalFolder( localFolder->text() );
+ data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ;
QDialog::accept();
}
/**
* SMTPconfig
*/
SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags )
: SMTPconfigUI( parent, name, modal, flags )
{
data = account;
connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) );
connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) );
fillValues();
connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) );
ComboBox1->insertItem( "Only if available", 0 );
ComboBox1->insertItem( "Always, Negotiated", 1 );
ComboBox1->insertItem( "Connect on secure port", 2 );
ComboBox1->insertItem( "Run command instead", 3 );
CommandEdit->hide();
diff --git a/kmicromail/libmailwrapper/pop3wrapper.cpp b/kmicromail/libmailwrapper/pop3wrapper.cpp
index 8d2f778..1edec9e 100644
--- a/kmicromail/libmailwrapper/pop3wrapper.cpp
+++ b/kmicromail/libmailwrapper/pop3wrapper.cpp
@@ -101,49 +101,49 @@ RecBodyP POP3wrapper::fetchBody( const RecMailP &mail ) {
void POP3wrapper::listMessages(const QString &, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb )
{
login();
if (!m_pop3)
return;
uint32_t res_messages,res_recent,res_unseen;
mailsession_status_folder(m_pop3->sto_session,"INBOX",&res_messages,&res_recent,&res_unseen);
parseList(target,m_pop3->sto_session,"INBOX", false, maxSizeInKb);
Global::statusMessage( tr("Mailbox contains %1 mail(s)").arg(res_messages));
}
void POP3wrapper::login()
{
if (account->getOffline())
return;
/* we'll hold the line */
if ( m_pop3 != NULL )
return;
QString server,user, pass;
uint16_t port;
int err = MAILPOP3_NO_ERROR;
- server = account->getServer().latin1();
+ server = account->getServer();
port = account->getPort().toUInt();
if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) {
qApp->processEvents();
LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true );
login.show();
if ( QDialog::Accepted == login.exec() ) {
// ok
user = login.getUser();
pass = login.getPassword();
} else {
// cancel
; // odebug << "POP3: Login canceled" << oendl;
return;
}
} else {
user = account->getUser();
pass = account->getPassword();
}
// bool ssl = account->getSSL();
m_pop3=mailstorage_new(NULL);
int conntypeset = account->ConnectionType();
int conntype = 0;
diff --git a/kmicromail/libmailwrapper/settings.cpp b/kmicromail/libmailwrapper/settings.cpp
index b0a539e..90e32fa 100644
--- a/kmicromail/libmailwrapper/settings.cpp
+++ b/kmicromail/libmailwrapper/settings.cpp
@@ -234,65 +234,75 @@ QString POP3account::getUniqueFileName()
QString unique;
QDir dir( locateLocal("data", "kopiemail" ) );
QStringList imap = dir.entryList( "pop3-*" );
do {
unique.setNum( num++ );
} while ( imap.contains( "pop3-" + unique ) > 0 );
return unique;
}
void POP3account::read()
{
Config *conf = new Config( getFileName(), Config::File );
conf->setGroup( "POP3 Account" );
accountName = conf->readEntry( "Account" );
server = conf->readEntry( "Server" );
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);
+ localFolder = conf->readEntry( "LocalFolder" );
+ maxMailSize = conf->readNumEntry( "MaxSize",0 );
+ int lf = conf->readNumEntry( "LastFetch",0 );
+ QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) );
+ lastFetch = dt.addSecs( lf );
delete conf;
}
void POP3account::save()
{
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( "LocalFolder", localFolder );
+ conf->writeEntry( "MaxSize", maxMailSize );
+ QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) );
+ int lf = dt.secsTo ( lastFetch );
+ conf->writeEntry( "LastFetch", lf );
conf->write();
delete conf;
}
QString POP3account::getFileName()
{
return locateLocal("data", "kopiemail" ) +"/pop3-" + file;
}
SMTPaccount::SMTPaccount()
: Account()
{
file = SMTPaccount::getUniqueFileName();
accountName = "New SMTP Account";
ssl = false;
connectionType = 1;
login = false;
useCC = false;
useBCC = false;
useReply = false;
type = MAILLIB::A_SMTP;
port = SMTP_PORT;
}
diff --git a/kmicromail/libmailwrapper/settings.h b/kmicromail/libmailwrapper/settings.h
index ba3ec89..c33c403 100644
--- a/kmicromail/libmailwrapper/settings.h
+++ b/kmicromail/libmailwrapper/settings.h
@@ -1,79 +1,88 @@
#ifndef SETTINGS_H
#define SETTINGS_H
#include "maildefines.h"
/* OPIE */
/* QT */
#include <qobject.h>
#include <qlist.h>
+#include <qdatetime.h>
class Account
{
public:
Account();
virtual ~Account() {}
void remove();
void setAccountName( QString name ) { accountName = name; }
const QString&getAccountName()const{ return accountName; }
MAILLIB::ATYPE getType()const{ return type; }
void setServer(const QString&str){ server = str; }
const QString&getServer()const{ return server; }
+ void setLocalFolder( QString name ) { localFolder = name; }
+ const QString& getLocalFolder()const{ return localFolder; }
+
void setPort(const QString&str) { port = str; }
const QString&getPort()const{ return port; }
void setUser(const QString&str){ user = str; }
const QString&getUser()const{ return user; }
void setPassword(const QString&str) { password = str; }
const QString&getPassword()const { return password; }
void setSSL( bool b ) { ssl = b; }
bool getSSL() { return ssl; }
void setConnectionType( int x ) { connectionType = x; }
int ConnectionType() { return connectionType; }
+ void setMaxMailSize( int x ) { maxMailSize = x; }
+ int getMaxMailSize() { return maxMailSize; }
void setOffline(bool b) {offline = b;}
bool getOffline()const{return offline;}
virtual QString getFileName() { return accountName; }
virtual void read() { ; }
virtual void save() { ; }
protected:
QString accountName, server, port, user, password;
bool ssl;
int connectionType;
bool offline;
MAILLIB::ATYPE type;
+ QString localFolder;
+ int maxMailSize;
+ QDateTime lastFetch;
};
class IMAPaccount : public Account
{
public:
IMAPaccount();
IMAPaccount( QString filename );
static QString getUniqueFileName();
virtual void read();
virtual void save();
virtual QString getFileName();
void setPrefix(const QString&str) {prefix=str;}
const QString&getPrefix()const{return prefix;}
private:
QString file,prefix;
};
class POP3account : public Account
diff --git a/kmicromail/pop3configui.ui b/kmicromail/pop3configui.ui
index 1014ef4..a2d43bd 100644
--- a/kmicromail/pop3configui.ui
+++ b/kmicromail/pop3configui.ui
@@ -1,59 +1,59 @@
<!DOCTYPE UI><UI>
<class>POP3configUI</class>
<widget>
<class>QDialog</class>
<property stdset="1">
<name>name</name>
<cstring>POP3configUI</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
- <width>314</width>
- <height>410</height>
+ <width>322</width>
+ <height>404</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>Configure POP3</string>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
<vbox>
<property stdset="1">
<name>margin</name>
- <number>3</number>
+ <number>11</number>
</property>
<property stdset="1">
<name>spacing</name>
- <number>3</number>
+ <number>6</number>
</property>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout12</cstring>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>accountLabel</cstring>
</property>
<property stdset="1">
<name>text</name>
@@ -298,48 +298,134 @@
<number>6</number>
</property>
<widget>
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>userLine</cstring>
</property>
</widget>
<widget>
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>passLine</cstring>
</property>
<property stdset="1">
<name>echoMode</name>
<enum>Password</enum>
</property>
</widget>
</vbox>
</widget>
</hbox>
</widget>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout9</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel1_2</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Local storage folder:</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>localFolder</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string></string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout10</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>CheckBoxDown</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Download only messages smaller</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QSpinBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>SpinBoxDown</cstring>
+ </property>
+ <property stdset="1">
+ <name>suffix</name>
+ <string>kB</string>
+ </property>
+ <property stdset="1">
+ <name>maxValue</name>
+ <number>99999</number>
+ </property>
+ <property stdset="1">
+ <name>minValue</name>
+ <number>1</number>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
<spacer>
<property>
<name>name</name>
<cstring>spacer</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Vertical</enum>
</property>
<property stdset="1">
<name>sizeType</name>
<enum>Expanding</enum>
</property>
<property>
<name>sizeHint</name>
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</vbox>
</widget>
<tabstops>