summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mailit/addatt.cpp6
-rw-r--r--noncore/net/mailit/addresslist.cpp22
-rw-r--r--noncore/net/mailit/addresslist.h3
-rw-r--r--noncore/net/mailit/editaccount.cpp27
-rw-r--r--noncore/net/mailit/editaccount.h5
-rw-r--r--noncore/net/mailit/emailclient.cpp12
-rw-r--r--noncore/net/mailit/emailhandler.cpp19
-rw-r--r--noncore/net/mailit/emailhandler.h1
-rw-r--r--noncore/net/mailit/emaillistitem.cpp5
-rw-r--r--noncore/net/mailit/mailit.pro17
-rw-r--r--noncore/net/mailit/readmail.cpp2
-rw-r--r--noncore/net/mailit/writemail.cpp2
-rw-r--r--noncore/unsupported/mailit/addatt.cpp6
-rw-r--r--noncore/unsupported/mailit/addresslist.cpp22
-rw-r--r--noncore/unsupported/mailit/addresslist.h3
-rw-r--r--noncore/unsupported/mailit/editaccount.cpp27
-rw-r--r--noncore/unsupported/mailit/editaccount.h5
-rw-r--r--noncore/unsupported/mailit/emailclient.cpp12
-rw-r--r--noncore/unsupported/mailit/emailhandler.cpp19
-rw-r--r--noncore/unsupported/mailit/emailhandler.h1
-rw-r--r--noncore/unsupported/mailit/emaillistitem.cpp5
-rw-r--r--noncore/unsupported/mailit/mailit.pro17
-rw-r--r--noncore/unsupported/mailit/readmail.cpp2
-rw-r--r--noncore/unsupported/mailit/writemail.cpp2
24 files changed, 156 insertions, 86 deletions
diff --git a/noncore/net/mailit/addatt.cpp b/noncore/net/mailit/addatt.cpp
index c8be865..d268f1f 100644
--- a/noncore/net/mailit/addatt.cpp
+++ b/noncore/net/mailit/addatt.cpp
@@ -16,17 +16,17 @@
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include <qlayout.h>
#include <qhbox.h>
#include <qdir.h>
#include <qstringlist.h>
-#include "resource.h"
+#include <qpe/resource.h>
#include "addatt.h"
FileItem::FileItem(QListView *parent, DocLnk* dl)
: QListViewItem(parent)
{
/*file = fileInfo;
type = fileType;*/
@@ -57,18 +57,18 @@ AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f)
: QDialog(parent, name, f)
{
setCaption("Adding attatchments");
QGridLayout *top = new QGridLayout(this, 1,1 );
QHBox *buttons=new QHBox(this);
/*fileCategoryButton = new QPushButton(this);*/
- attatchButton = new QPushButton("Attatch ->", buttons);
- removeButton = new QPushButton("Remove", buttons);
+ attatchButton = new QPushButton(tr("Attatch..."), buttons);
+ removeButton = new QPushButton(tr("Remove"), buttons);
/*fileCategories = new QPopupMenu(fileCategoryButton);
fileCategoryButton->setPopup(fileCategories);
fileCategories->insertItem("Document");
fileCategories->insertItem("Picture");
fileCategories->insertItem("Sound");
fileCategories->insertItem("Movie");
fileCategories->insertItem("File");
diff --git a/noncore/net/mailit/addresslist.cpp b/noncore/net/mailit/addresslist.cpp
index 43e3830..9fe558a 100644
--- a/noncore/net/mailit/addresslist.cpp
+++ b/noncore/net/mailit/addresslist.cpp
@@ -19,27 +19,25 @@
**********************************************************************/
#include <qfile.h>
#include <qtextstream.h>
#include <opie/ocontactaccess.h>
#include <opie/ocontact.h>
#include "addresslist.h"
-AddressList::AddressList(QString file)
+AddressList::AddressList()
{
addresses.setAutoDelete(TRUE);
- filename = file;
read();
dirty = FALSE;
}
AddressList::~AddressList()
{
- write();
addresses.clear();
}
void AddressList::addContact(QString email, QString name)
{
//skip if not a valid email address,
if (email.find( '@') == -1)
return;
@@ -115,17 +113,16 @@ QList<Contact>* AddressList::getContactList()
{
return &addresses;
}
void AddressList::read()
{
OContactAccess::List::Iterator it;
- //QFile f(filename);
QString lineEmail, lineName, email, name;
OContactAccess m_contactdb("mailit");
OContactAccess::List m_list = m_contactdb.sorted( true, 0, 0, 0 );
//OContact* oc;
for ( it = m_list.begin(); it != m_list.end(); ++it )
{
//oc=(OContact*) it;
@@ -157,25 +154,8 @@ QString AddressList::getRightString(QString in)
int pos = in.find('=');
if (pos != -1) {
out = in.mid(pos+1).stripWhiteSpace();
}
return out;
}
-void AddressList::write()
-{
- if ( (addresses.count() == 0) || (!dirty) )
- return;
-
- QFile f(filename);
- if (! f.open(IO_WriteOnly) )
- return;
-
- QTextStream stream(&f);
- Contact *ptr;
- for (ptr = addresses.first(); ptr != 0; ptr = addresses.next() ) {
- stream << "email = " + ptr->email + "\n";
- stream << "name = " + ptr->name + "\n";
- }
- f.close();
-}
diff --git a/noncore/net/mailit/addresslist.h b/noncore/net/mailit/addresslist.h
index e87d6f1..99cef9a 100644
--- a/noncore/net/mailit/addresslist.h
+++ b/noncore/net/mailit/addresslist.h
@@ -29,25 +29,24 @@ struct Contact
QString name;
};
class AddressList : public QObject
{
Q_OBJECT
public:
- AddressList(QString file);
+ AddressList();
~AddressList();
void addContact(QString email, QString name);
bool containsEmail(QString email);
bool containsName(QString name);
QString getNameByEmail(QString email);
QString getEmailByName(QString name);
QList<Contact>* getContactList();
- void write();
private:
int getEmailRef(QString email);
int getNameRef(QString name);
QString getRightString(QString in);
void read();
private:
diff --git a/noncore/net/mailit/editaccount.cpp b/noncore/net/mailit/editaccount.cpp
index c4f95ea..c0afbb2 100644
--- a/noncore/net/mailit/editaccount.cpp
+++ b/noncore/net/mailit/editaccount.cpp
@@ -13,16 +13,17 @@
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
***
**********************************************************************/
+#include <qhbox.h>
#include "editaccount.h"
EditAccount::EditAccount( QWidget* parent, const char* name, WFlags fl )
: QDialog(parent, name, fl)
{
setCaption( tr("Edit Account") );
init();
popPasswInput->setEchoMode(QLineEdit::Password);
@@ -35,27 +36,29 @@ void EditAccount::setAccount(MailAccount *in, bool newOne)
accountNameInput->setText("");
nameInput->setText("");
emailInput->setText("");
popUserInput->setText("");
popPasswInput->setText("");
popServerInput->setText("");
smtpServerInput->setText("");
syncCheckBox->setChecked(TRUE);
+ syncLimitInput->setValue(2);
setCaption( tr("Create new Account") );
} else {
accountNameInput->setText(account->accountName);
nameInput->setText(account->name);
emailInput->setText(account->emailAddress);
popUserInput->setText(account->popUserName);
popPasswInput->setText(account->popPasswd);
popServerInput->setText(account->popServer);
smtpServerInput->setText(account->smtpServer);
syncCheckBox->setChecked(account->synchronize);
+ syncLimitInput->setValue(account->syncLimit/1000);
}
}
void EditAccount::init()
{
grid = new QGridLayout(this);
grid->setSpacing( 6 );
grid->setMargin( 11 );
@@ -65,56 +68,66 @@ void EditAccount::init()
accountNameInput = new QLineEdit( this, "account nameInput" );
grid->addWidget( accountNameInput, 0, 1 );
nameInputLabel = new QLabel(tr("Your name"), this);
grid->addWidget( nameInputLabel, 1, 0 );
nameInput = new QLineEdit( this, "nameInput" );
grid->addWidget( nameInput, 1, 1 );
- emailInputLabel = new QLabel("Email", this);
+ emailInputLabel = new QLabel(tr("Email"), this);
grid->addWidget(emailInputLabel, 2, 0 );
emailInput = new QLineEdit( this, "emailInput" );
grid->addWidget( emailInput, 2, 1 );
- popUserInputLabel = new QLabel("POP username", this);
+ popUserInputLabel = new QLabel(tr("POP username"), this);
grid->addWidget( popUserInputLabel, 3, 0 );
popUserInput = new QLineEdit( this, "popUserInput" );
grid->addWidget( popUserInput, 3, 1 );
- popPasswInputLabel = new QLabel( "POP password", this);
+ popPasswInputLabel = new QLabel( tr("POP password"), this);
grid->addWidget( popPasswInputLabel, 4, 0 );
popPasswInput = new QLineEdit( this, "popPasswInput" );
grid->addWidget( popPasswInput, 4, 1 );
- popServerInputLabel = new QLabel("POP server", this);
+ popServerInputLabel = new QLabel(tr("POP server"), this);
grid->addWidget( popServerInputLabel, 5, 0 );
popServerInput = new QLineEdit( this, "popServerInput" );
grid->addWidget( popServerInput, 5, 1 );
- smtpServerInputLabel = new QLabel("SMTP server", this );
+ smtpServerInputLabel = new QLabel(tr("SMTP server"), this );
grid->addWidget( smtpServerInputLabel, 6, 0 );
smtpServerInput = new QLineEdit( this, "smtpServerInput" );
grid->addWidget( smtpServerInput, 6, 1 );
- syncCheckBox = new QCheckBox( tr( "Synchronize with server" ), this);
+ QHBox* syncBox=new QHBox(this);
+ grid->addWidget( syncBox, 7, 1 );
+
+ syncCheckBox = new QCheckBox( tr( "Synchronize" ), this);
syncCheckBox->setChecked( TRUE );
- grid->addMultiCellWidget( syncCheckBox, 7, 7, 0, 1 );
+ grid->addWidget( syncCheckBox,7,0);
+
+ syncLimitInputLabel = new QLabel(tr("Mail Size (k)"), syncBox);
+ //syncBox->addWidget( syncLimitInputLabel);
+ syncLimitInput = new QSpinBox( syncBox, "syncSize" );
+ //syncBox->addWidget(syncLimitInput);
+
}
void EditAccount::accept()
{
account->accountName = accountNameInput->text();
account->name = nameInput->text();
account->emailAddress = emailInput->text();
account->popUserName = popUserInput->text();
account->popPasswd = popPasswInput->text();
account->popServer = popServerInput->text();
account->smtpServer = smtpServerInput->text();
account->synchronize = syncCheckBox->isChecked();
+ account->syncLimit = syncLimitInput->value()*1000; //Display in kB
QDialog::accept();
}
void EditAccount::reject()
{
}
diff --git a/noncore/net/mailit/editaccount.h b/noncore/net/mailit/editaccount.h
index 7a90e50..1e15047 100644
--- a/noncore/net/mailit/editaccount.h
+++ b/noncore/net/mailit/editaccount.h
@@ -20,16 +20,17 @@
#ifndef EDITACCOUNT_H
#define EDITACCOUNT_H
#include <qdialog.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qcheckbox.h>
#include <qlayout.h>
+#include <qspinbox.h>
#include "emailhandler.h"
class EditAccount : public QDialog
{
Q_OBJECT
public:
EditAccount( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
@@ -45,22 +46,24 @@ private:
QLabel *accountNameInputLabel;
QLabel *nameInputLabel;
QLabel *emailInputLabel;
QLabel *popUserInputLabel;
QLabel *popPasswInputLabel;
QLabel *popServerInputLabel;
QLabel *smtpServerInputLabel;
-
+ QLabel *syncLimitInputLabel;
+
QLineEdit *accountNameInput;
QLineEdit *nameInput;
QLineEdit *emailInput;
QLineEdit *popUserInput;
QLineEdit *popPasswInput;
QLineEdit *popServerInput;
QLineEdit *smtpServerInput;
+ QSpinBox *syncLimitInput;
QCheckBox *syncCheckBox;
QGridLayout *grid;
};
#endif
diff --git a/noncore/net/mailit/emailclient.cpp b/noncore/net/mailit/emailclient.cpp
index 2943986..6612541 100644
--- a/noncore/net/mailit/emailclient.cpp
+++ b/noncore/net/mailit/emailclient.cpp
@@ -18,17 +18,17 @@
**
**********************************************************************/
#include <qapplication.h>
#include <qmessagebox.h>
#include <qfile.h>
#include <qcheckbox.h>
#include <qmenubar.h>
#include <qaction.h>
-#include "resource.h"
+#include <qpe/resource.h>
#include "emailclient.h"
QCollection::Item AccountList::newItem(QCollection::Item d)
{
return dupl( (MailAccount *) d);
}
MailAccount* AccountList::dupl(MailAccount *in)
@@ -36,17 +36,17 @@ MailAccount* AccountList::dupl(MailAccount *in)
ac = new MailAccount(*in);
return ac;
}
EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl )
: QMainWindow( parent, name, fl )
{
emailHandler = new EmailHandler();
- addressList = new AddressList( getPath(FALSE) + "mail_adr");
+ addressList = new AddressList();
sending = FALSE;
receiving = FALSE;
previewingMail = FALSE;
mailIdCount = 1;
accountIdCount = 1;
allAccounts = FALSE;
@@ -666,16 +666,22 @@ void EmailClient::readSettings()
if (p->getString(& ++pos, 'z', TRUE).upper() == "YES") {
account.synchronize = TRUE;
if ( (pos = p->find("LASTSERVERMAILCOUNT",':', accountPos, TRUE)) != -1) {
s = p->getString(& ++pos, 'z', TRUE);
account.lastServerMailCount = s.toInt();
}
}
}
+
+ if ( (pos = p->find("SYNCLIMIT",':', accountPos, TRUE)) != -1) {
+ account.syncLimit = p->getString(& ++pos, 'z', TRUE).toInt();
+ }
+
+
accountList.append(&account);
}
delete p;
}
mailconf->setGroup("mailitglobal");
if ( (y = mailconf->readNumEntry("mailidcount", -1)) != -1) {
mailIdCount = y;
}
@@ -711,16 +717,18 @@ void EmailClient::saveSettings()
t << "AccountId: " << accountPtr->id << "\n";
if (accountPtr->synchronize) {
t << "Synchronize: Yes\n";
t << "LastServerMailCount: ";
t << accountPtr->lastServerMailCount << "\n";
} else {
t << "Synchronize: No\n";
}
+ t << "SyncLimit: ";
+ t << accountPtr->syncLimit << "\n";
t << "accountEnd;\n";
}
f.close();
mailconf->setGroup("mailitglobal");
mailconf->writeEntry("mailidcount", mailIdCount);
mailconf->writeEntry("accountidcount", accountIdCount);
}
diff --git a/noncore/net/mailit/emailhandler.cpp b/noncore/net/mailit/emailhandler.cpp
index 1be16d4..9c1c814 100644
--- a/noncore/net/mailit/emailhandler.cpp
+++ b/noncore/net/mailit/emailhandler.cpp
@@ -113,17 +113,17 @@ void EmailHandler::getMailHeaders()
popClient->setAccount(mailAccount.popUserName, mailAccount.popPasswd);
if (mailAccount.synchronize) {
popClient->setSynchronize(mailAccount.lastServerMailCount);
} else {
popClient->removeSynchronize();
}
headers = TRUE;
- popClient->headersOnly(headers, 2000); //less than 2000, download all
+ popClient->headersOnly(headers, mailAccount.syncLimit); //less than requested syncLimit, download all
popClient->newConnection(mailAccount.popServer, 110);
}
void EmailHandler::getMailByList(MailList *mailList)
{
if (mailList->count() == 0) { //should not occur though
emit mailTransfered(0);
return;
@@ -195,28 +195,37 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail)
pos++;
pos++;
mail->fromMail = p.getString(&pos, 'z', TRUE);
if (mail->fromMail.at(mail->fromMail.length()-1) == '>')
mail->fromMail.truncate(mail->fromMail.length() - 1);
mail->from=mail->fromMail;
}
}
+
+ //@@@ToDo: Rewrite the parser as To: stops at the first occurence- which is Delivered-To:
+ if (pos = p.find("TO",':', pos, TRUE) != -1)
+ {
+ pos++;
+ mail->recipients.append (p.getString(&pos, 'z', TRUE) );
+ }
+
+
+
if ((pos = p.find("SUBJECT",':', 0, TRUE)) != -1) {
pos++;
mail->subject = p.getString(&pos, 'z', TRUE);
}
if ((pos = p.find("DATE",':', 0, TRUE)) != -1) {
pos++;
mail->date = p.getString(&pos, 'z', true);
}
- if ((pos = p.find("TO",':', 0, TRUE)) != -1) {
- pos++;
- mail->recipients.append (p.getString(&pos, 'z', TRUE) );
- }
+
+
+
if ((pos = p.find("MESSAGE",'-', 0, TRUE)) != -1) {
pos++;
if ( (p.wordAt(pos).upper() == "ID") &&
(p.separatorAt(pos) == ':') ) {
id = p.getString(&pos, 'z', TRUE);
mail->id = id;
}
diff --git a/noncore/net/mailit/emailhandler.h b/noncore/net/mailit/emailhandler.h
index 17c4414..e47fd9a 100644
--- a/noncore/net/mailit/emailhandler.h
+++ b/noncore/net/mailit/emailhandler.h
@@ -89,16 +89,17 @@ struct MailAccount
QString accountName;
QString name;
QString emailAddress;
QString popUserName;
QString popPasswd;
QString popServer;
QString smtpServer;
bool synchronize;
+ int syncLimit;
int lastServerMailCount;
int id;
};
const int ErrUnknownResponse = 1001;
const int ErrLoginFailed = 1002;
const int ErrCancel = 1003;
diff --git a/noncore/net/mailit/emaillistitem.cpp b/noncore/net/mailit/emaillistitem.cpp
index d47b0b7..a325766 100644
--- a/noncore/net/mailit/emaillistitem.cpp
+++ b/noncore/net/mailit/emaillistitem.cpp
@@ -13,16 +13,17 @@
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include <qstring.h>
+#include <qpe/resource.h>
#include "emaillistitem.h"
EmailListItem::EmailListItem(QListView *parent, Email mailIn, bool inbox)
: QListViewItem(parent)
{
QString temp;
mail = mailIn;
@@ -33,16 +34,20 @@ EmailListItem::EmailListItem(QListView *parent, Email mailIn, bool inbox)
QStringList::Iterator it = mail.recipients.begin();
temp = *it;
if (mail.recipients.count() > 1)
temp += "...";
setText(0, temp);
}
setText(1, mail.subject);
+ if (mailIn.files.count()>0)
+ {
+ setPixmap(0, Resource::loadPixmap("mailit/attach"));
+ }
selected = FALSE;
}
Email* EmailListItem::getMail()
{
return &mail;
}
diff --git a/noncore/net/mailit/mailit.pro b/noncore/net/mailit/mailit.pro
index a404884..b262f9a 100644
--- a/noncore/net/mailit/mailit.pro
+++ b/noncore/net/mailit/mailit.pro
@@ -35,9 +35,26 @@ SOURCES = emailclient.cpp \
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe -lopie
# -lssl
MOC_DIR=qpeobj
OBJECTS_DIR=qpeobj
DESTDIR=$(OPIEDIR)/bin
+TRANSLATIONS = ../../../i18n/de/mailit.ts \
+ ../../../i18n/da/mailit.ts \
+ ../../../i18n/xx/mailit.ts \
+ ../../../i18n/en/mailit.ts \
+ ../../../i18n/es/mailit.ts \
+ ../../../i18n/fr/mailit.ts \
+ ../../../i18n/hu/mailit.ts \
+ ../../../i18n/ja/mailit.ts \
+ ../../../i18n/ko/mailit.ts \
+ ../../../i18n/no/mailit.ts \
+ ../../../i18n/pl/mailit.ts \
+ ../../../i18n/pt/mailit.ts \
+ ../../../i18n/pt_BR/mailit.ts \
+ ../../../i18n/sl/mailit.ts \
+ ../../../i18n/zh_CN/mailit.ts \
+ ../../../i18n/zh_TW/mailit.ts
+
include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/net/mailit/readmail.cpp b/noncore/net/mailit/readmail.cpp
index 2011ecf..a5e7147 100644
--- a/noncore/net/mailit/readmail.cpp
+++ b/noncore/net/mailit/readmail.cpp
@@ -16,17 +16,17 @@
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "readmail.h"
#include <qimage.h>
#include <qmime.h>
#include <qaction.h>
-#include "resource.h"
+#include <qpe/resource.h>
ReadMail::ReadMail( QWidget* parent, const char* name, WFlags fl )
: QMainWindow(parent, name, fl)
{
plainTxt = FALSE;
init();
viewAtt = new ViewAtt(0, "View Attatchments");
diff --git a/noncore/net/mailit/writemail.cpp b/noncore/net/mailit/writemail.cpp
index a45cfd2..38a2596 100644
--- a/noncore/net/mailit/writemail.cpp
+++ b/noncore/net/mailit/writemail.cpp
@@ -14,17 +14,17 @@
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include <qmessagebox.h>
#include "writemail.h"
-#include "resource.h"
+#include <qpe/resource.h>
WriteMail::WriteMail( QWidget* parent, const char* name, WFlags fl )
: QMainWindow( parent, name, fl )
{
showingAddressList = FALSE;
init();
addAtt = new AddAtt(0, "Add Attatchments");
diff --git a/noncore/unsupported/mailit/addatt.cpp b/noncore/unsupported/mailit/addatt.cpp
index c8be865..d268f1f 100644
--- a/noncore/unsupported/mailit/addatt.cpp
+++ b/noncore/unsupported/mailit/addatt.cpp
@@ -16,17 +16,17 @@
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include <qlayout.h>
#include <qhbox.h>
#include <qdir.h>
#include <qstringlist.h>
-#include "resource.h"
+#include <qpe/resource.h>
#include "addatt.h"
FileItem::FileItem(QListView *parent, DocLnk* dl)
: QListViewItem(parent)
{
/*file = fileInfo;
type = fileType;*/
@@ -57,18 +57,18 @@ AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f)
: QDialog(parent, name, f)
{
setCaption("Adding attatchments");
QGridLayout *top = new QGridLayout(this, 1,1 );
QHBox *buttons=new QHBox(this);
/*fileCategoryButton = new QPushButton(this);*/
- attatchButton = new QPushButton("Attatch ->", buttons);
- removeButton = new QPushButton("Remove", buttons);
+ attatchButton = new QPushButton(tr("Attatch..."), buttons);
+ removeButton = new QPushButton(tr("Remove"), buttons);
/*fileCategories = new QPopupMenu(fileCategoryButton);
fileCategoryButton->setPopup(fileCategories);
fileCategories->insertItem("Document");
fileCategories->insertItem("Picture");
fileCategories->insertItem("Sound");
fileCategories->insertItem("Movie");
fileCategories->insertItem("File");
diff --git a/noncore/unsupported/mailit/addresslist.cpp b/noncore/unsupported/mailit/addresslist.cpp
index 43e3830..9fe558a 100644
--- a/noncore/unsupported/mailit/addresslist.cpp
+++ b/noncore/unsupported/mailit/addresslist.cpp
@@ -19,27 +19,25 @@
**********************************************************************/
#include <qfile.h>
#include <qtextstream.h>
#include <opie/ocontactaccess.h>
#include <opie/ocontact.h>
#include "addresslist.h"
-AddressList::AddressList(QString file)
+AddressList::AddressList()
{
addresses.setAutoDelete(TRUE);
- filename = file;
read();
dirty = FALSE;
}
AddressList::~AddressList()
{
- write();
addresses.clear();
}
void AddressList::addContact(QString email, QString name)
{
//skip if not a valid email address,
if (email.find( '@') == -1)
return;
@@ -115,17 +113,16 @@ QList<Contact>* AddressList::getContactList()
{
return &addresses;
}
void AddressList::read()
{
OContactAccess::List::Iterator it;
- //QFile f(filename);
QString lineEmail, lineName, email, name;
OContactAccess m_contactdb("mailit");
OContactAccess::List m_list = m_contactdb.sorted( true, 0, 0, 0 );
//OContact* oc;
for ( it = m_list.begin(); it != m_list.end(); ++it )
{
//oc=(OContact*) it;
@@ -157,25 +154,8 @@ QString AddressList::getRightString(QString in)
int pos = in.find('=');
if (pos != -1) {
out = in.mid(pos+1).stripWhiteSpace();
}
return out;
}
-void AddressList::write()
-{
- if ( (addresses.count() == 0) || (!dirty) )
- return;
-
- QFile f(filename);
- if (! f.open(IO_WriteOnly) )
- return;
-
- QTextStream stream(&f);
- Contact *ptr;
- for (ptr = addresses.first(); ptr != 0; ptr = addresses.next() ) {
- stream << "email = " + ptr->email + "\n";
- stream << "name = " + ptr->name + "\n";
- }
- f.close();
-}
diff --git a/noncore/unsupported/mailit/addresslist.h b/noncore/unsupported/mailit/addresslist.h
index e87d6f1..99cef9a 100644
--- a/noncore/unsupported/mailit/addresslist.h
+++ b/noncore/unsupported/mailit/addresslist.h
@@ -29,25 +29,24 @@ struct Contact
QString name;
};
class AddressList : public QObject
{
Q_OBJECT
public:
- AddressList(QString file);
+ AddressList();
~AddressList();
void addContact(QString email, QString name);
bool containsEmail(QString email);
bool containsName(QString name);
QString getNameByEmail(QString email);
QString getEmailByName(QString name);
QList<Contact>* getContactList();
- void write();
private:
int getEmailRef(QString email);
int getNameRef(QString name);
QString getRightString(QString in);
void read();
private:
diff --git a/noncore/unsupported/mailit/editaccount.cpp b/noncore/unsupported/mailit/editaccount.cpp
index c4f95ea..c0afbb2 100644
--- a/noncore/unsupported/mailit/editaccount.cpp
+++ b/noncore/unsupported/mailit/editaccount.cpp
@@ -13,16 +13,17 @@
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
***
**********************************************************************/
+#include <qhbox.h>
#include "editaccount.h"
EditAccount::EditAccount( QWidget* parent, const char* name, WFlags fl )
: QDialog(parent, name, fl)
{
setCaption( tr("Edit Account") );
init();
popPasswInput->setEchoMode(QLineEdit::Password);
@@ -35,27 +36,29 @@ void EditAccount::setAccount(MailAccount *in, bool newOne)
accountNameInput->setText("");
nameInput->setText("");
emailInput->setText("");
popUserInput->setText("");
popPasswInput->setText("");
popServerInput->setText("");
smtpServerInput->setText("");
syncCheckBox->setChecked(TRUE);
+ syncLimitInput->setValue(2);
setCaption( tr("Create new Account") );
} else {
accountNameInput->setText(account->accountName);
nameInput->setText(account->name);
emailInput->setText(account->emailAddress);
popUserInput->setText(account->popUserName);
popPasswInput->setText(account->popPasswd);
popServerInput->setText(account->popServer);
smtpServerInput->setText(account->smtpServer);
syncCheckBox->setChecked(account->synchronize);
+ syncLimitInput->setValue(account->syncLimit/1000);
}
}
void EditAccount::init()
{
grid = new QGridLayout(this);
grid->setSpacing( 6 );
grid->setMargin( 11 );
@@ -65,56 +68,66 @@ void EditAccount::init()
accountNameInput = new QLineEdit( this, "account nameInput" );
grid->addWidget( accountNameInput, 0, 1 );
nameInputLabel = new QLabel(tr("Your name"), this);
grid->addWidget( nameInputLabel, 1, 0 );
nameInput = new QLineEdit( this, "nameInput" );
grid->addWidget( nameInput, 1, 1 );
- emailInputLabel = new QLabel("Email", this);
+ emailInputLabel = new QLabel(tr("Email"), this);
grid->addWidget(emailInputLabel, 2, 0 );
emailInput = new QLineEdit( this, "emailInput" );
grid->addWidget( emailInput, 2, 1 );
- popUserInputLabel = new QLabel("POP username", this);
+ popUserInputLabel = new QLabel(tr("POP username"), this);
grid->addWidget( popUserInputLabel, 3, 0 );
popUserInput = new QLineEdit( this, "popUserInput" );
grid->addWidget( popUserInput, 3, 1 );
- popPasswInputLabel = new QLabel( "POP password", this);
+ popPasswInputLabel = new QLabel( tr("POP password"), this);
grid->addWidget( popPasswInputLabel, 4, 0 );
popPasswInput = new QLineEdit( this, "popPasswInput" );
grid->addWidget( popPasswInput, 4, 1 );
- popServerInputLabel = new QLabel("POP server", this);
+ popServerInputLabel = new QLabel(tr("POP server"), this);
grid->addWidget( popServerInputLabel, 5, 0 );
popServerInput = new QLineEdit( this, "popServerInput" );
grid->addWidget( popServerInput, 5, 1 );
- smtpServerInputLabel = new QLabel("SMTP server", this );
+ smtpServerInputLabel = new QLabel(tr("SMTP server"), this );
grid->addWidget( smtpServerInputLabel, 6, 0 );
smtpServerInput = new QLineEdit( this, "smtpServerInput" );
grid->addWidget( smtpServerInput, 6, 1 );
- syncCheckBox = new QCheckBox( tr( "Synchronize with server" ), this);
+ QHBox* syncBox=new QHBox(this);
+ grid->addWidget( syncBox, 7, 1 );
+
+ syncCheckBox = new QCheckBox( tr( "Synchronize" ), this);
syncCheckBox->setChecked( TRUE );
- grid->addMultiCellWidget( syncCheckBox, 7, 7, 0, 1 );
+ grid->addWidget( syncCheckBox,7,0);
+
+ syncLimitInputLabel = new QLabel(tr("Mail Size (k)"), syncBox);
+ //syncBox->addWidget( syncLimitInputLabel);
+ syncLimitInput = new QSpinBox( syncBox, "syncSize" );
+ //syncBox->addWidget(syncLimitInput);
+
}
void EditAccount::accept()
{
account->accountName = accountNameInput->text();
account->name = nameInput->text();
account->emailAddress = emailInput->text();
account->popUserName = popUserInput->text();
account->popPasswd = popPasswInput->text();
account->popServer = popServerInput->text();
account->smtpServer = smtpServerInput->text();
account->synchronize = syncCheckBox->isChecked();
+ account->syncLimit = syncLimitInput->value()*1000; //Display in kB
QDialog::accept();
}
void EditAccount::reject()
{
}
diff --git a/noncore/unsupported/mailit/editaccount.h b/noncore/unsupported/mailit/editaccount.h
index 7a90e50..1e15047 100644
--- a/noncore/unsupported/mailit/editaccount.h
+++ b/noncore/unsupported/mailit/editaccount.h
@@ -20,16 +20,17 @@
#ifndef EDITACCOUNT_H
#define EDITACCOUNT_H
#include <qdialog.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qcheckbox.h>
#include <qlayout.h>
+#include <qspinbox.h>
#include "emailhandler.h"
class EditAccount : public QDialog
{
Q_OBJECT
public:
EditAccount( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
@@ -45,22 +46,24 @@ private:
QLabel *accountNameInputLabel;
QLabel *nameInputLabel;
QLabel *emailInputLabel;
QLabel *popUserInputLabel;
QLabel *popPasswInputLabel;
QLabel *popServerInputLabel;
QLabel *smtpServerInputLabel;
-
+ QLabel *syncLimitInputLabel;
+
QLineEdit *accountNameInput;
QLineEdit *nameInput;
QLineEdit *emailInput;
QLineEdit *popUserInput;
QLineEdit *popPasswInput;
QLineEdit *popServerInput;
QLineEdit *smtpServerInput;
+ QSpinBox *syncLimitInput;
QCheckBox *syncCheckBox;
QGridLayout *grid;
};
#endif
diff --git a/noncore/unsupported/mailit/emailclient.cpp b/noncore/unsupported/mailit/emailclient.cpp
index 2943986..6612541 100644
--- a/noncore/unsupported/mailit/emailclient.cpp
+++ b/noncore/unsupported/mailit/emailclient.cpp
@@ -18,17 +18,17 @@
**
**********************************************************************/
#include <qapplication.h>
#include <qmessagebox.h>
#include <qfile.h>
#include <qcheckbox.h>
#include <qmenubar.h>
#include <qaction.h>
-#include "resource.h"
+#include <qpe/resource.h>
#include "emailclient.h"
QCollection::Item AccountList::newItem(QCollection::Item d)
{
return dupl( (MailAccount *) d);
}
MailAccount* AccountList::dupl(MailAccount *in)
@@ -36,17 +36,17 @@ MailAccount* AccountList::dupl(MailAccount *in)
ac = new MailAccount(*in);
return ac;
}
EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl )
: QMainWindow( parent, name, fl )
{
emailHandler = new EmailHandler();
- addressList = new AddressList( getPath(FALSE) + "mail_adr");
+ addressList = new AddressList();
sending = FALSE;
receiving = FALSE;
previewingMail = FALSE;
mailIdCount = 1;
accountIdCount = 1;
allAccounts = FALSE;
@@ -666,16 +666,22 @@ void EmailClient::readSettings()
if (p->getString(& ++pos, 'z', TRUE).upper() == "YES") {
account.synchronize = TRUE;
if ( (pos = p->find("LASTSERVERMAILCOUNT",':', accountPos, TRUE)) != -1) {
s = p->getString(& ++pos, 'z', TRUE);
account.lastServerMailCount = s.toInt();
}
}
}
+
+ if ( (pos = p->find("SYNCLIMIT",':', accountPos, TRUE)) != -1) {
+ account.syncLimit = p->getString(& ++pos, 'z', TRUE).toInt();
+ }
+
+
accountList.append(&account);
}
delete p;
}
mailconf->setGroup("mailitglobal");
if ( (y = mailconf->readNumEntry("mailidcount", -1)) != -1) {
mailIdCount = y;
}
@@ -711,16 +717,18 @@ void EmailClient::saveSettings()
t << "AccountId: " << accountPtr->id << "\n";
if (accountPtr->synchronize) {
t << "Synchronize: Yes\n";
t << "LastServerMailCount: ";
t << accountPtr->lastServerMailCount << "\n";
} else {
t << "Synchronize: No\n";
}
+ t << "SyncLimit: ";
+ t << accountPtr->syncLimit << "\n";
t << "accountEnd;\n";
}
f.close();
mailconf->setGroup("mailitglobal");
mailconf->writeEntry("mailidcount", mailIdCount);
mailconf->writeEntry("accountidcount", accountIdCount);
}
diff --git a/noncore/unsupported/mailit/emailhandler.cpp b/noncore/unsupported/mailit/emailhandler.cpp
index 1be16d4..9c1c814 100644
--- a/noncore/unsupported/mailit/emailhandler.cpp
+++ b/noncore/unsupported/mailit/emailhandler.cpp
@@ -113,17 +113,17 @@ void EmailHandler::getMailHeaders()
popClient->setAccount(mailAccount.popUserName, mailAccount.popPasswd);
if (mailAccount.synchronize) {
popClient->setSynchronize(mailAccount.lastServerMailCount);
} else {
popClient->removeSynchronize();
}
headers = TRUE;
- popClient->headersOnly(headers, 2000); //less than 2000, download all
+ popClient->headersOnly(headers, mailAccount.syncLimit); //less than requested syncLimit, download all
popClient->newConnection(mailAccount.popServer, 110);
}
void EmailHandler::getMailByList(MailList *mailList)
{
if (mailList->count() == 0) { //should not occur though
emit mailTransfered(0);
return;
@@ -195,28 +195,37 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail)
pos++;
pos++;
mail->fromMail = p.getString(&pos, 'z', TRUE);
if (mail->fromMail.at(mail->fromMail.length()-1) == '>')
mail->fromMail.truncate(mail->fromMail.length() - 1);
mail->from=mail->fromMail;
}
}
+
+ //@@@ToDo: Rewrite the parser as To: stops at the first occurence- which is Delivered-To:
+ if (pos = p.find("TO",':', pos, TRUE) != -1)
+ {
+ pos++;
+ mail->recipients.append (p.getString(&pos, 'z', TRUE) );
+ }
+
+
+
if ((pos = p.find("SUBJECT",':', 0, TRUE)) != -1) {
pos++;
mail->subject = p.getString(&pos, 'z', TRUE);
}
if ((pos = p.find("DATE",':', 0, TRUE)) != -1) {
pos++;
mail->date = p.getString(&pos, 'z', true);
}
- if ((pos = p.find("TO",':', 0, TRUE)) != -1) {
- pos++;
- mail->recipients.append (p.getString(&pos, 'z', TRUE) );
- }
+
+
+
if ((pos = p.find("MESSAGE",'-', 0, TRUE)) != -1) {
pos++;
if ( (p.wordAt(pos).upper() == "ID") &&
(p.separatorAt(pos) == ':') ) {
id = p.getString(&pos, 'z', TRUE);
mail->id = id;
}
diff --git a/noncore/unsupported/mailit/emailhandler.h b/noncore/unsupported/mailit/emailhandler.h
index 17c4414..e47fd9a 100644
--- a/noncore/unsupported/mailit/emailhandler.h
+++ b/noncore/unsupported/mailit/emailhandler.h
@@ -89,16 +89,17 @@ struct MailAccount
QString accountName;
QString name;
QString emailAddress;
QString popUserName;
QString popPasswd;
QString popServer;
QString smtpServer;
bool synchronize;
+ int syncLimit;
int lastServerMailCount;
int id;
};
const int ErrUnknownResponse = 1001;
const int ErrLoginFailed = 1002;
const int ErrCancel = 1003;
diff --git a/noncore/unsupported/mailit/emaillistitem.cpp b/noncore/unsupported/mailit/emaillistitem.cpp
index d47b0b7..a325766 100644
--- a/noncore/unsupported/mailit/emaillistitem.cpp
+++ b/noncore/unsupported/mailit/emaillistitem.cpp
@@ -13,16 +13,17 @@
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include <qstring.h>
+#include <qpe/resource.h>
#include "emaillistitem.h"
EmailListItem::EmailListItem(QListView *parent, Email mailIn, bool inbox)
: QListViewItem(parent)
{
QString temp;
mail = mailIn;
@@ -33,16 +34,20 @@ EmailListItem::EmailListItem(QListView *parent, Email mailIn, bool inbox)
QStringList::Iterator it = mail.recipients.begin();
temp = *it;
if (mail.recipients.count() > 1)
temp += "...";
setText(0, temp);
}
setText(1, mail.subject);
+ if (mailIn.files.count()>0)
+ {
+ setPixmap(0, Resource::loadPixmap("mailit/attach"));
+ }
selected = FALSE;
}
Email* EmailListItem::getMail()
{
return &mail;
}
diff --git a/noncore/unsupported/mailit/mailit.pro b/noncore/unsupported/mailit/mailit.pro
index a404884..b262f9a 100644
--- a/noncore/unsupported/mailit/mailit.pro
+++ b/noncore/unsupported/mailit/mailit.pro
@@ -35,9 +35,26 @@ SOURCES = emailclient.cpp \
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe -lopie
# -lssl
MOC_DIR=qpeobj
OBJECTS_DIR=qpeobj
DESTDIR=$(OPIEDIR)/bin
+TRANSLATIONS = ../../../i18n/de/mailit.ts \
+ ../../../i18n/da/mailit.ts \
+ ../../../i18n/xx/mailit.ts \
+ ../../../i18n/en/mailit.ts \
+ ../../../i18n/es/mailit.ts \
+ ../../../i18n/fr/mailit.ts \
+ ../../../i18n/hu/mailit.ts \
+ ../../../i18n/ja/mailit.ts \
+ ../../../i18n/ko/mailit.ts \
+ ../../../i18n/no/mailit.ts \
+ ../../../i18n/pl/mailit.ts \
+ ../../../i18n/pt/mailit.ts \
+ ../../../i18n/pt_BR/mailit.ts \
+ ../../../i18n/sl/mailit.ts \
+ ../../../i18n/zh_CN/mailit.ts \
+ ../../../i18n/zh_TW/mailit.ts
+
include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/unsupported/mailit/readmail.cpp b/noncore/unsupported/mailit/readmail.cpp
index 2011ecf..a5e7147 100644
--- a/noncore/unsupported/mailit/readmail.cpp
+++ b/noncore/unsupported/mailit/readmail.cpp
@@ -16,17 +16,17 @@
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "readmail.h"
#include <qimage.h>
#include <qmime.h>
#include <qaction.h>
-#include "resource.h"
+#include <qpe/resource.h>
ReadMail::ReadMail( QWidget* parent, const char* name, WFlags fl )
: QMainWindow(parent, name, fl)
{
plainTxt = FALSE;
init();
viewAtt = new ViewAtt(0, "View Attatchments");
diff --git a/noncore/unsupported/mailit/writemail.cpp b/noncore/unsupported/mailit/writemail.cpp
index a45cfd2..38a2596 100644
--- a/noncore/unsupported/mailit/writemail.cpp
+++ b/noncore/unsupported/mailit/writemail.cpp
@@ -14,17 +14,17 @@
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include <qmessagebox.h>
#include "writemail.h"
-#include "resource.h"
+#include <qpe/resource.h>
WriteMail::WriteMail( QWidget* parent, const char* name, WFlags fl )
: QMainWindow( parent, name, fl )
{
showingAddressList = FALSE;
init();
addAtt = new AddAtt(0, "Add Attatchments");