summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/config.in2
-rw-r--r--noncore/net/mail/libmailwrapper/.cvsignore6
-rw-r--r--noncore/net/mail/libmailwrapper/config.in4
-rw-r--r--noncore/net/mail/libmailwrapper/libmailwrapper.pro44
-rw-r--r--noncore/net/mail/libmailwrapper/mailwrapper.cpp15
-rw-r--r--noncore/net/mail/libmailwrapper/settings.cpp36
-rw-r--r--noncore/net/mail/libmailwrapper/smtpwrapper.cpp4
-rw-r--r--noncore/net/mail/mail.pro26
-rw-r--r--noncore/net/mail/mainwindow.cpp7
9 files changed, 99 insertions, 45 deletions
diff --git a/noncore/net/mail/config.in b/noncore/net/mail/config.in
index 43ecc6f..b5173ae 100644
--- a/noncore/net/mail/config.in
+++ b/noncore/net/mail/config.in
@@ -1,4 +1,4 @@
config MAIL3
boolean "opie-mail3 (a mail client)"
default "y"
- depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE
+ depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && LIBMAILWRAPPER
diff --git a/noncore/net/mail/libmailwrapper/.cvsignore b/noncore/net/mail/libmailwrapper/.cvsignore
new file mode 100644
index 0000000..581c299
--- a/dev/null
+++ b/noncore/net/mail/libmailwrapper/.cvsignore
@@ -0,0 +1,6 @@
+logindialogui.cpp
+logindialogui.h
+sendmailprogressui.cpp
+sendmailprogressui.h
+.moc
+Makefile
diff --git a/noncore/net/mail/libmailwrapper/config.in b/noncore/net/mail/libmailwrapper/config.in
new file mode 100644
index 0000000..790891e
--- a/dev/null
+++ b/noncore/net/mail/libmailwrapper/config.in
@@ -0,0 +1,4 @@
+ config LIBMAILWRAPPER
+ boolean "libmailwrapper ( wrapper arround libetpan needed by mail3"
+ default "y"
+ depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE
diff --git a/noncore/net/mail/libmailwrapper/libmailwrapper.pro b/noncore/net/mail/libmailwrapper/libmailwrapper.pro
new file mode 100644
index 0000000..4b4a4f1
--- a/dev/null
+++ b/noncore/net/mail/libmailwrapper/libmailwrapper.pro
@@ -0,0 +1,44 @@
+TEMPLATE = lib
+CONFIG += qt warn_on debug
+
+HEADERS = mailwrapper.h \
+ imapwrapper.h \
+ mailtypes.h \
+ pop3wrapper.h \
+ abstractmail.h \
+ smtpwrapper.h \
+ genericwrapper.h \
+ mboxwrapper.h \
+ settings.h \
+ logindialog.h \
+ sendmailprogress.h
+
+SOURCES = imapwrapper.cpp \
+ mailwrapper.cpp \
+ mailtypes.cpp \
+ pop3wrapper.cpp \
+ abstractmail.cpp \
+ smtpwrapper.cpp \
+ genericwrapper.cpp \
+ mboxwrapper.cpp \
+ settings.cpp \
+ logindialog.cpp \
+ sendmailprogress.cpp
+
+INTERFACES = logindialogui.ui \
+ sendmailprogressui.ui
+
+
+INCLUDEPATH += $(OPIEDIR)/include
+
+CONFTEST = $$system( echo $CONFIG_TARGET_MACOSX )
+contains( CONFTEST, y ){
+ LIBS += -lqpe -letpan -lssl -lcrypto -liconv
+}else{
+ LIBS += -lqpe -letpan -lssl -lcrypto
+}
+
+DESTDIR = $(OPIEDIR)/lib$(PROJMAK)
+TARGET = mailwrapper
+
+include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/net/mail/libmailwrapper/mailwrapper.cpp b/noncore/net/mail/libmailwrapper/mailwrapper.cpp
index 9398823..75b9343 100644
--- a/noncore/net/mail/libmailwrapper/mailwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/mailwrapper.cpp
@@ -1,27 +1,38 @@
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <qdir.h>
#include "mailwrapper.h"
-#include "logindialog.h"
-#include "defines.h"
+//#include "logindialog.h"
+//#include "defines.h"
+
+#define UNDEFINED 64
+#define MAXLINE 76
+#define UTF16MASK 0x03FFUL
+#define UTF16SHIFT 10
+#define UTF16BASE 0x10000UL
+#define UTF16HIGHSTART 0xD800UL
+#define UTF16HIGHEND 0xDBFFUL
+#define UTF16LOSTART 0xDC00UL
+#define UTF16LOEND 0xDFFFUL
+
Attachment::Attachment( DocLnk lnk )
{
doc = lnk;
size = QFileInfo( doc.file() ).size();
}
Folder::Folder(const QString&tmp_name, const QString&sep )
{
name = tmp_name;
nameDisplay = name;
separator = sep;
}
const QString& Folder::Separator()const
{
diff --git a/noncore/net/mail/libmailwrapper/settings.cpp b/noncore/net/mail/libmailwrapper/settings.cpp
index 17aa1b0..c5187f5 100644
--- a/noncore/net/mail/libmailwrapper/settings.cpp
+++ b/noncore/net/mail/libmailwrapper/settings.cpp
@@ -1,23 +1,33 @@
#include <stdlib.h>
#include <qdir.h>
#include <qpe/config.h>
#include "settings.h"
-#include "defines.h"
+//#include "defines.h"
+
+#define IMAP_PORT "143"
+#define IMAP_SSL_PORT "993"
+#define SMTP_PORT "25"
+#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" );
qDebug( "$HOME/Applications/opiemail created" );
}
}
QList<Account> Settings::getAccounts()
@@ -49,56 +59,56 @@ void Settings::updateAccounts()
accounts.append( account );
}
QStringList pop3 = dir.entryList( "pop3-*" );
for ( it = pop3.begin(); it != pop3.end(); it++ ) {
qDebug( "Added POP account" );
POP3account *account = new POP3account( (*it).replace(0, 5, "") );
accounts.append( account );
}
QStringList smtp = dir.entryList( "smtp-*" );
for ( it = smtp.begin(); it != smtp.end(); it++ ) {
qDebug( "Added SMTP account" );
SMTPaccount *account = new SMTPaccount( (*it).replace(0, 5, "") );
accounts.append( account );
}
-
+
QStringList nntp = dir.entryList( "nntp-*" );
for ( it = nntp.begin(); it != nntp.end(); it++ ) {
qDebug( "Added NNTP account" );
NNTPaccount *account = new NNTPaccount( (*it).replace(0, 5, "") );
accounts.append( account );
}
-
+
readAccounts();
}
void Settings::saveAccounts()
{
- checkDirectory();
+ checkDirectory();
Account *it;
for ( it = accounts.first(); it; it = accounts.next() ) {
it->save();
}
}
void Settings::readAccounts()
{
- checkDirectory();
+ checkDirectory();
Account *it;
for ( it = accounts.first(); it; it = accounts.next() ) {
it->read();
}
}
Account::Account()
{
accountName = "changeMe";
type = "changeMe";
ssl = false;
}
void Account::remove()
{
@@ -117,33 +127,33 @@ IMAPaccount::IMAPaccount()
}
IMAPaccount::IMAPaccount( QString filename )
: Account()
{
file = filename;
accountName = "New IMAP Account";
ssl = false;
type = "IMAP";
port = IMAP_PORT;
}
QString IMAPaccount::getUniqueFileName()
{
int num = 0;
QString unique;
-
+
QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" );
QStringList imap = dir.entryList( "imap-*" );
do {
unique.setNum( num++ );
} while ( imap.contains( "imap-" + unique ) > 0 );
return unique;
}
void IMAPaccount::read()
{
Config *conf = new Config( getFileName(), Config::File );
conf->setGroup( "IMAP Account" );
accountName = conf->readEntry( "Account","" );
if (accountName.isNull()) accountName = "";
@@ -151,33 +161,33 @@ void IMAPaccount::read()
if (server.isNull()) server="";
port = conf->readEntry( "Port","" );
if (port.isNull()) port="143";
ssl = conf->readBoolEntry( "SSL",false );
user = conf->readEntry( "User","" );
if (user.isNull()) user = "";
password = conf->readEntryCrypt( "Password","" );
if (password.isNull()) password = "";
prefix = conf->readEntry("MailPrefix","");
if (prefix.isNull()) prefix = "";
}
void IMAPaccount::save()
{
qDebug( "saving " + getFileName() );
Settings::checkDirectory();
-
+
Config *conf = new Config( getFileName(), Config::File );
conf->setGroup( "IMAP Account" );
conf->writeEntry( "Account", accountName );
conf->writeEntry( "Server", server );
conf->writeEntry( "Port", port );
conf->writeEntry( "SSL", ssl );
conf->writeEntry( "User", user );
conf->writeEntryCrypt( "Password", password );
conf->writeEntry( "MailPrefix",prefix);
conf->write();
}
QString IMAPaccount::getFileName()
{
return (QString) getenv( "HOME" ) + "/Applications/opiemail/imap-" + file;
@@ -194,60 +204,60 @@ POP3account::POP3account()
}
POP3account::POP3account( QString filename )
: Account()
{
file = filename;
accountName = "New POP3 Account";
ssl = false;
type = "POP3";
port = POP3_PORT;
}
QString POP3account::getUniqueFileName()
{
int num = 0;
QString unique;
-
+
QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" );
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" );
user = conf->readEntry( "User" );
password = conf->readEntryCrypt( "Password" );
}
void POP3account::save()
{
qDebug( "saving " + getFileName() );
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( "User", user );
conf->writeEntryCrypt( "Password", password );
conf->write();
}
QString POP3account::getFileName()
{
return (QString) getenv( "HOME" ) + "/Applications/opiemail/pop3-" + file;
}
@@ -268,61 +278,61 @@ SMTPaccount::SMTPaccount()
SMTPaccount::SMTPaccount( QString filename )
: Account()
{
file = filename;
accountName = "New SMTP Account";
ssl = false;
login = false;
type = "SMTP";
port = SMTP_PORT;
}
QString SMTPaccount::getUniqueFileName()
{
int num = 0;
QString unique;
-
+
QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" );
QStringList imap = dir.entryList( "smtp-*" );
do {
unique.setNum( num++ );
} while ( imap.contains( "smtp-" + unique ) > 0 );
return unique;
}
void SMTPaccount::read()
{
Config *conf = new Config( getFileName(), Config::File );
conf->setGroup( "SMTP Account" );
accountName = conf->readEntry( "Account" );
server = conf->readEntry( "Server" );
port = conf->readEntry( "Port" );
ssl = conf->readBoolEntry( "SSL" );
login = conf->readBoolEntry( "Login" );
user = conf->readEntry( "User" );
password = conf->readEntryCrypt( "Password" );
}
void SMTPaccount::save()
{
qDebug( "saving " + getFileName() );
Settings::checkDirectory();
-
+
Config *conf = new Config( getFileName(), Config::File );
conf->setGroup( "SMTP Account" );
conf->writeEntry( "Account", accountName );
conf->writeEntry( "Server", server );
conf->writeEntry( "Port", port );
conf->writeEntry( "SSL", ssl );
conf->writeEntry( "Login", login );
conf->writeEntry( "User", user );
conf->writeEntryCrypt( "Password", password );
conf->write();
}
QString SMTPaccount::getFileName()
{
return (QString) getenv( "HOME" ) + "/Applications/opiemail/smtp-" + file;
@@ -341,61 +351,61 @@ NNTPaccount::NNTPaccount()
NNTPaccount::NNTPaccount( QString filename )
: Account()
{
file = filename;
accountName = "New NNTP Account";
ssl = false;
login = false;
type = "NNTP";
port = NNTP_PORT;
}
QString NNTPaccount::getUniqueFileName()
{
int num = 0;
QString unique;
-
+
QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" );
QStringList imap = dir.entryList( "nntp-*" );
do {
unique.setNum( num++ );
} while ( imap.contains( "nntp-" + unique ) > 0 );
return unique;
}
void NNTPaccount::read()
{
Config *conf = new Config( getFileName(), Config::File );
conf->setGroup( "NNTP Account" );
accountName = conf->readEntry( "Account" );
server = conf->readEntry( "Server" );
port = conf->readEntry( "Port" );
ssl = conf->readBoolEntry( "SSL" );
login = conf->readBoolEntry( "Login" );
user = conf->readEntry( "User" );
password = conf->readEntryCrypt( "Password" );
}
void NNTPaccount::save()
{
qDebug( "saving " + getFileName() );
Settings::checkDirectory();
-
+
Config *conf = new Config( getFileName(), Config::File );
conf->setGroup( "NNTP Account" );
conf->writeEntry( "Account", accountName );
conf->writeEntry( "Server", server );
conf->writeEntry( "Port", port );
conf->writeEntry( "SSL", ssl );
conf->writeEntry( "Login", login );
conf->writeEntry( "User", user );
conf->writeEntryCrypt( "Password", password );
conf->write();
}
QString NNTPaccount::getFileName()
{
return (QString) getenv( "HOME" ) + "/Applications/opiemail/nntp-" + file;
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
index 7e03af9..b9c4ff2 100644
--- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
@@ -4,35 +4,37 @@
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <qdir.h>
#include <qt.h>
#include <qpe/config.h>
#include <qpe/qcopenvelope_qws.h>
#include <libetpan/libetpan.h>
#include "smtpwrapper.h"
#include "mailwrapper.h"
#include "mboxwrapper.h"
#include "logindialog.h"
#include "mailtypes.h"
-#include "defines.h"
+//#include "defines.h"
#include "sendmailprogress.h"
+#define USER_AGENT "OpieMail v0.1"
+
progressMailSend*SMTPwrapper::sendProgress = 0;
SMTPwrapper::SMTPwrapper( Settings *s )
: QObject()
{
settings = s;
Config cfg( "mail" );
cfg.setGroup( "Status" );
m_queuedMail = cfg.readNumEntry( "outgoing", 0 );
emit queuedMails( m_queuedMail );
connect( this, SIGNAL( queuedMails( int ) ), this, SLOT( emitQCop( int ) ) );
}
void SMTPwrapper::emitQCop( int queued ) {
QCopEnvelope env( "QPE/Pim", "outgoingMails(int)" );
env << queued;
diff --git a/noncore/net/mail/mail.pro b/noncore/net/mail/mail.pro
index 2c15a7b..69e1450 100644
--- a/noncore/net/mail/mail.pro
+++ b/noncore/net/mail/mail.pro
@@ -1,76 +1,52 @@
CONFIG += qt warn_on debug quick-app
HEADERS = defines.h \
- logindialog.h \
- settings.h \
editaccounts.h \
- mailwrapper.h \
composemail.h \
accountview.h \
mainwindow.h \
viewmail.h \
viewmailbase.h \
opiemail.h \
- imapwrapper.h \
- mailtypes.h \
mailistviewitem.h \
- pop3wrapper.h \
- abstractmail.h \
settingsdialog.h \
statuswidget.h \
- smtpwrapper.h \
- genericwrapper.h \
- mboxwrapper.h \
- sendmailprogress.h \
newmaildir.h
SOURCES = main.cpp \
opiemail.cpp \
mainwindow.cpp \
accountview.cpp \
composemail.cpp \
- mailwrapper.cpp \
- imapwrapper.cpp \
addresspicker.cpp \
editaccounts.cpp \
- logindialog.cpp \
viewmail.cpp \
viewmailbase.cpp \
- settings.cpp \
- mailtypes.cpp \
- pop3wrapper.cpp \
- abstractmail.cpp \
settingsdialog.cpp \
statuswidget.cpp \
- smtpwrapper.cpp \
- genericwrapper.cpp \
- mboxwrapper.cpp \
- sendmailprogress.cpp \
newmaildir.cpp
INTERFACES = editaccountsui.ui \
selectmailtypeui.ui \
imapconfigui.ui \
pop3configui.ui \
nntpconfigui.ui \
smtpconfigui.ui \
addresspickerui.ui \
- logindialogui.ui \
composemailui.ui \
settingsdialogui.ui \
statuswidgetui.ui \
- sendmailprogressui.ui \
newmaildirui.ui
INCLUDEPATH += $(OPIEDIR)/include
CONFTEST = $$system( echo $CONFIG_TARGET_MACOSX )
contains( CONFTEST, y ){
LIBS += -lqpe -letpan -lssl -lcrypto -lopie -liconv
}else{
- LIBS += -lqpe -letpan -lssl -lcrypto -lopie
+ LIBS += -lqpe -lopie -llibmailwrapper
}
TARGET = opiemail
include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp
index 2a74286..6511b1f 100644
--- a/noncore/net/mail/mainwindow.cpp
+++ b/noncore/net/mail/mainwindow.cpp
@@ -6,32 +6,33 @@
#include <qmessagebox.h>
#include <qtextstream.h>
#include <qpe/qpeapplication.h>
#include <qpe/resource.h>
#include "defines.h"
#include "mainwindow.h"
#include "viewmail.h"
#include "mailtypes.h"
#include "mailistviewitem.h"
MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
: QMainWindow( parent, name, flags )
{
+
setCaption( tr( "Mail" ) );
setToolBarsMovable( false );
toolBar = new QToolBar( this );
menuBar = new QMenuBar( toolBar );
mailMenu = new QPopupMenu( menuBar );
menuBar->insertItem( tr( "Mail" ), mailMenu );
settingsMenu = new QPopupMenu( menuBar );
menuBar->insertItem( tr( "Settings" ), settingsMenu );
addToolBar( toolBar );
toolBar->setHorizontalStretchable( true );
QLabel *spacer = new QLabel( toolBar );
spacer->setBackgroundMode( QWidget::PaletteButton );
toolBar->setStretchableWidget( spacer );
@@ -103,40 +104,40 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
mailView->addColumn( tr( "" ) );
mailView->addColumn( tr( "Subject" ),QListView::Manual );
mailView->addColumn( tr( "Sender" ),QListView::Manual );
mailView->addColumn( tr( "Size" ),QListView::Manual);
mailView->addColumn( tr( "Date" ));
mailView->setAllColumnsShowFocus(true);
mailView->setSorting(-1);
statusWidget = new StatusWidget( wrapperBox );
statusWidget->hide();
layout->addWidget( mailView );
layout->setStretchFactor( folderView, 1 );
layout->setStretchFactor( mailView, 2 );
slotAdjustLayout();
-
+
QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold);
QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold);
connect( mailView, SIGNAL( mouseButtonClicked(int, QListViewItem *,const QPoint&,int ) ),this,
- SLOT( mailLeftClicked( int, QListViewItem *,const QPoint&,int ) ) );
+ SLOT( mailLeftClicked( int, QListViewItem *,const QPoint&,int ) ) );
connect( mailView, SIGNAL( mouseButtonPressed(int, QListViewItem *,const QPoint&,int ) ),this,
- SLOT( mailHold( int, QListViewItem *,const QPoint&,int ) ) );
+ SLOT( mailHold( int, QListViewItem *,const QPoint&,int ) ) );
connect(folderView, SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*)));
QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) );
}
void MainWindow::slotAdjustLayout() {
QWidget *d = QApplication::desktop();
if ( d->width() < d->height() ) {
layout->setDirection( QBoxLayout::TopToBottom );
} else {
layout->setDirection( QBoxLayout::LeftToRight );
}
}