summaryrefslogtreecommitdiff
authorgroucho <groucho>2003-04-14 08:22:55 (UTC)
committer groucho <groucho>2003-04-14 08:22:55 (UTC)
commit4624a73cd100f860371fb01facea442737e9336e (patch) (unidiff)
treeae06cfd24013ca39816a5ca035605988f4033dcd
parent6d737040698a9c7ebc6492ba4234b64bf4db6c0b (diff)
downloadopie-4624a73cd100f860371fb01facea442737e9336e.zip
opie-4624a73cd100f860371fb01facea442737e9336e.tar.gz
opie-4624a73cd100f860371fb01facea442737e9336e.tar.bz2
- Buttonlayout changed in attach dialog
- Removed file access for address list (reduces size) - Added header size sping box for accounts - mailit shows an icon in the message list if attachments are present - Added translations in pro file - Removed resource.* references in header files, uses qpe/resource.h instead
Diffstat (more/less context) (show 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.h3
-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.h3
-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, 154 insertions, 84 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
@@ -21,7 +21,7 @@
21#include <qhbox.h> 21#include <qhbox.h>
22#include <qdir.h> 22#include <qdir.h>
23#include <qstringlist.h> 23#include <qstringlist.h>
24#include "resource.h" 24#include <qpe/resource.h>
25#include "addatt.h" 25#include "addatt.h"
26 26
27FileItem::FileItem(QListView *parent, DocLnk* dl) 27FileItem::FileItem(QListView *parent, DocLnk* dl)
@@ -62,8 +62,8 @@ AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f)
62 62
63 QHBox *buttons=new QHBox(this); 63 QHBox *buttons=new QHBox(this);
64 /*fileCategoryButton = new QPushButton(this);*/ 64 /*fileCategoryButton = new QPushButton(this);*/
65 attatchButton = new QPushButton("Attatch ->", buttons); 65 attatchButton = new QPushButton(tr("Attatch..."), buttons);
66 removeButton = new QPushButton("Remove", buttons); 66 removeButton = new QPushButton(tr("Remove"), buttons);
67 67
68 /*fileCategories = new QPopupMenu(fileCategoryButton); 68 /*fileCategories = new QPopupMenu(fileCategoryButton);
69 fileCategoryButton->setPopup(fileCategories); 69 fileCategoryButton->setPopup(fileCategories);
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
@@ -24,17 +24,15 @@
24 24
25#include "addresslist.h" 25#include "addresslist.h"
26 26
27AddressList::AddressList(QString file) 27AddressList::AddressList()
28{ 28{
29 addresses.setAutoDelete(TRUE); 29 addresses.setAutoDelete(TRUE);
30 filename = file;
31 read(); 30 read();
32 dirty = FALSE; 31 dirty = FALSE;
33} 32}
34 33
35AddressList::~AddressList() 34AddressList::~AddressList()
36{ 35{
37 write();
38 addresses.clear(); 36 addresses.clear();
39} 37}
40 38
@@ -120,7 +118,6 @@ void AddressList::read()
120{ 118{
121 OContactAccess::List::Iterator it; 119 OContactAccess::List::Iterator it;
122 120
123 //QFile f(filename);
124 QString lineEmail, lineName, email, name; 121 QString lineEmail, lineName, email, name;
125 OContactAccess m_contactdb("mailit"); 122 OContactAccess m_contactdb("mailit");
126 OContactAccess::List m_list = m_contactdb.sorted( true, 0, 0, 0 ); 123 OContactAccess::List m_list = m_contactdb.sorted( true, 0, 0, 0 );
@@ -162,20 +159,3 @@ QString AddressList::getRightString(QString in)
162 return out; 159 return out;
163} 160}
164 161
165void AddressList::write()
166{
167 if ( (addresses.count() == 0) || (!dirty) )
168 return;
169
170 QFile f(filename);
171 if (! f.open(IO_WriteOnly) )
172 return;
173
174 QTextStream stream(&f);
175 Contact *ptr;
176 for (ptr = addresses.first(); ptr != 0; ptr = addresses.next() ) {
177 stream << "email = " + ptr->email + "\n";
178 stream << "name = " + ptr->name + "\n";
179 }
180 f.close();
181}
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
@@ -34,7 +34,7 @@ class AddressList : public QObject
34 Q_OBJECT 34 Q_OBJECT
35 35
36public: 36public:
37 AddressList(QString file); 37 AddressList();
38 ~AddressList(); 38 ~AddressList();
39 void addContact(QString email, QString name); 39 void addContact(QString email, QString name);
40 bool containsEmail(QString email); 40 bool containsEmail(QString email);
@@ -42,7 +42,6 @@ public:
42 QString getNameByEmail(QString email); 42 QString getNameByEmail(QString email);
43 QString getEmailByName(QString name); 43 QString getEmailByName(QString name);
44 QList<Contact>* getContactList(); 44 QList<Contact>* getContactList();
45 void write();
46 45
47private: 46private:
48 int getEmailRef(QString email); 47 int getEmailRef(QString email);
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
@@ -18,6 +18,7 @@
18*** 18***
19**********************************************************************/ 19**********************************************************************/
20 20
21#include <qhbox.h>
21#include "editaccount.h" 22#include "editaccount.h"
22 23
23EditAccount::EditAccount( QWidget* parent, const char* name, WFlags fl ) 24EditAccount::EditAccount( QWidget* parent, const char* name, WFlags fl )
@@ -40,6 +41,7 @@ void EditAccount::setAccount(MailAccount *in, bool newOne)
40 popServerInput->setText(""); 41 popServerInput->setText("");
41 smtpServerInput->setText(""); 42 smtpServerInput->setText("");
42 syncCheckBox->setChecked(TRUE); 43 syncCheckBox->setChecked(TRUE);
44 syncLimitInput->setValue(2);
43 45
44 setCaption( tr("Create new Account") ); 46 setCaption( tr("Create new Account") );
45 } else { 47 } else {
@@ -51,6 +53,7 @@ void EditAccount::setAccount(MailAccount *in, bool newOne)
51 popServerInput->setText(account->popServer); 53 popServerInput->setText(account->popServer);
52 smtpServerInput->setText(account->smtpServer); 54 smtpServerInput->setText(account->smtpServer);
53 syncCheckBox->setChecked(account->synchronize); 55 syncCheckBox->setChecked(account->synchronize);
56 syncLimitInput->setValue(account->syncLimit/1000);
54 } 57 }
55} 58}
56 59
@@ -70,34 +73,43 @@ void EditAccount::init()
70 nameInput = new QLineEdit( this, "nameInput" ); 73 nameInput = new QLineEdit( this, "nameInput" );
71 grid->addWidget( nameInput, 1, 1 ); 74 grid->addWidget( nameInput, 1, 1 );
72 75
73 emailInputLabel = new QLabel("Email", this); 76 emailInputLabel = new QLabel(tr("Email"), this);
74 grid->addWidget(emailInputLabel, 2, 0 ); 77 grid->addWidget(emailInputLabel, 2, 0 );
75 emailInput = new QLineEdit( this, "emailInput" ); 78 emailInput = new QLineEdit( this, "emailInput" );
76 grid->addWidget( emailInput, 2, 1 ); 79 grid->addWidget( emailInput, 2, 1 );
77 80
78 popUserInputLabel = new QLabel("POP username", this); 81 popUserInputLabel = new QLabel(tr("POP username"), this);
79 grid->addWidget( popUserInputLabel, 3, 0 ); 82 grid->addWidget( popUserInputLabel, 3, 0 );
80 popUserInput = new QLineEdit( this, "popUserInput" ); 83 popUserInput = new QLineEdit( this, "popUserInput" );
81 grid->addWidget( popUserInput, 3, 1 ); 84 grid->addWidget( popUserInput, 3, 1 );
82 85
83 popPasswInputLabel = new QLabel( "POP password", this); 86 popPasswInputLabel = new QLabel( tr("POP password"), this);
84 grid->addWidget( popPasswInputLabel, 4, 0 ); 87 grid->addWidget( popPasswInputLabel, 4, 0 );
85 popPasswInput = new QLineEdit( this, "popPasswInput" ); 88 popPasswInput = new QLineEdit( this, "popPasswInput" );
86 grid->addWidget( popPasswInput, 4, 1 ); 89 grid->addWidget( popPasswInput, 4, 1 );
87 90
88 popServerInputLabel = new QLabel("POP server", this); 91 popServerInputLabel = new QLabel(tr("POP server"), this);
89 grid->addWidget( popServerInputLabel, 5, 0 ); 92 grid->addWidget( popServerInputLabel, 5, 0 );
90 popServerInput = new QLineEdit( this, "popServerInput" ); 93 popServerInput = new QLineEdit( this, "popServerInput" );
91 grid->addWidget( popServerInput, 5, 1 ); 94 grid->addWidget( popServerInput, 5, 1 );
92 95
93 smtpServerInputLabel = new QLabel("SMTP server", this ); 96 smtpServerInputLabel = new QLabel(tr("SMTP server"), this );
94 grid->addWidget( smtpServerInputLabel, 6, 0 ); 97 grid->addWidget( smtpServerInputLabel, 6, 0 );
95 smtpServerInput = new QLineEdit( this, "smtpServerInput" ); 98 smtpServerInput = new QLineEdit( this, "smtpServerInput" );
96 grid->addWidget( smtpServerInput, 6, 1 ); 99 grid->addWidget( smtpServerInput, 6, 1 );
97 100
98 syncCheckBox = new QCheckBox( tr( "Synchronize with server" ), this); 101 QHBox* syncBox=new QHBox(this);
102 grid->addWidget( syncBox, 7, 1 );
103
104 syncCheckBox = new QCheckBox( tr( "Synchronize" ), this);
99 syncCheckBox->setChecked( TRUE ); 105 syncCheckBox->setChecked( TRUE );
100 grid->addMultiCellWidget( syncCheckBox, 7, 7, 0, 1 ); 106 grid->addWidget( syncCheckBox,7,0);
107
108 syncLimitInputLabel = new QLabel(tr("Mail Size (k)"), syncBox);
109 //syncBox->addWidget( syncLimitInputLabel);
110 syncLimitInput = new QSpinBox( syncBox, "syncSize" );
111 //syncBox->addWidget(syncLimitInput);
112
101} 113}
102 114
103 115
@@ -111,6 +123,7 @@ void EditAccount::accept()
111 account->popServer = popServerInput->text(); 123 account->popServer = popServerInput->text();
112 account->smtpServer = smtpServerInput->text(); 124 account->smtpServer = smtpServerInput->text();
113 account->synchronize = syncCheckBox->isChecked(); 125 account->synchronize = syncCheckBox->isChecked();
126 account->syncLimit = syncLimitInput->value()*1000;//Display in kB
114 127
115 QDialog::accept(); 128 QDialog::accept();
116} 129}
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
@@ -25,6 +25,7 @@
25#include <qlineedit.h> 25#include <qlineedit.h>
26#include <qcheckbox.h> 26#include <qcheckbox.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qspinbox.h>
28#include "emailhandler.h" 29#include "emailhandler.h"
29 30
30class EditAccount : public QDialog 31class EditAccount : public QDialog
@@ -50,6 +51,7 @@ private:
50 QLabel *popPasswInputLabel; 51 QLabel *popPasswInputLabel;
51 QLabel *popServerInputLabel; 52 QLabel *popServerInputLabel;
52 QLabel *smtpServerInputLabel; 53 QLabel *smtpServerInputLabel;
54 QLabel *syncLimitInputLabel;
53 55
54 QLineEdit *accountNameInput; 56 QLineEdit *accountNameInput;
55 QLineEdit *nameInput; 57 QLineEdit *nameInput;
@@ -58,6 +60,7 @@ private:
58 QLineEdit *popPasswInput; 60 QLineEdit *popPasswInput;
59 QLineEdit *popServerInput; 61 QLineEdit *popServerInput;
60 QLineEdit *smtpServerInput; 62 QLineEdit *smtpServerInput;
63 QSpinBox *syncLimitInput;
61 QCheckBox *syncCheckBox; 64 QCheckBox *syncCheckBox;
62 65
63 QGridLayout *grid; 66 QGridLayout *grid;
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
@@ -23,7 +23,7 @@
23#include <qcheckbox.h> 23#include <qcheckbox.h>
24#include <qmenubar.h> 24#include <qmenubar.h>
25#include <qaction.h> 25#include <qaction.h>
26#include "resource.h" 26#include <qpe/resource.h>
27#include "emailclient.h" 27#include "emailclient.h"
28 28
29QCollection::Item AccountList::newItem(QCollection::Item d) 29QCollection::Item AccountList::newItem(QCollection::Item d)
@@ -41,7 +41,7 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl )
41 : QMainWindow( parent, name, fl ) 41 : QMainWindow( parent, name, fl )
42{ 42{
43 emailHandler = new EmailHandler(); 43 emailHandler = new EmailHandler();
44 addressList = new AddressList( getPath(FALSE) + "mail_adr"); 44 addressList = new AddressList();
45 45
46 sending = FALSE; 46 sending = FALSE;
47 receiving = FALSE; 47 receiving = FALSE;
@@ -671,6 +671,12 @@ void EmailClient::readSettings()
671 } 671 }
672 } 672 }
673 } 673 }
674
675 if ( (pos = p->find("SYNCLIMIT",':', accountPos, TRUE)) != -1) {
676 account.syncLimit = p->getString(& ++pos, 'z', TRUE).toInt();
677 }
678
679
674 accountList.append(&account); 680 accountList.append(&account);
675 } 681 }
676 delete p; 682 delete p;
@@ -716,6 +722,8 @@ void EmailClient::saveSettings()
716 } else { 722 } else {
717 t << "Synchronize: No\n"; 723 t << "Synchronize: No\n";
718 } 724 }
725 t << "SyncLimit: ";
726 t << accountPtr->syncLimit << "\n";
719 t << "accountEnd;\n"; 727 t << "accountEnd;\n";
720 } 728 }
721 f.close(); 729 f.close();
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
@@ -118,7 +118,7 @@ void EmailHandler::getMailHeaders()
118 } 118 }
119 119
120 headers = TRUE; 120 headers = TRUE;
121 popClient->headersOnly(headers, 2000); //less than 2000, download all 121 popClient->headersOnly(headers, mailAccount.syncLimit); //less than requested syncLimit, download all
122 popClient->newConnection(mailAccount.popServer, 110); 122 popClient->newConnection(mailAccount.popServer, 110);
123} 123}
124 124
@@ -200,6 +200,16 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail)
200 mail->from=mail->fromMail; 200 mail->from=mail->fromMail;
201 } 201 }
202 } 202 }
203
204 //@@@ToDo: Rewrite the parser as To: stops at the first occurence- which is Delivered-To:
205 if (pos = p.find("TO",':', pos, TRUE) != -1)
206 {
207 pos++;
208 mail->recipients.append (p.getString(&pos, 'z', TRUE) );
209 }
210
211
212
203 if ((pos = p.find("SUBJECT",':', 0, TRUE)) != -1) { 213 if ((pos = p.find("SUBJECT",':', 0, TRUE)) != -1) {
204 pos++; 214 pos++;
205 mail->subject = p.getString(&pos, 'z', TRUE); 215 mail->subject = p.getString(&pos, 'z', TRUE);
@@ -208,10 +218,9 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail)
208 pos++; 218 pos++;
209 mail->date = p.getString(&pos, 'z', true); 219 mail->date = p.getString(&pos, 'z', true);
210 } 220 }
211 if ((pos = p.find("TO",':', 0, TRUE)) != -1) { 221
212 pos++; 222
213 mail->recipients.append (p.getString(&pos, 'z', TRUE) ); 223
214 }
215 if ((pos = p.find("MESSAGE",'-', 0, TRUE)) != -1) { 224 if ((pos = p.find("MESSAGE",'-', 0, TRUE)) != -1) {
216 pos++; 225 pos++;
217 if ( (p.wordAt(pos).upper() == "ID") && 226 if ( (p.wordAt(pos).upper() == "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
@@ -94,6 +94,7 @@ struct MailAccount
94 QString popServer; 94 QString popServer;
95 QString smtpServer; 95 QString smtpServer;
96 bool synchronize; 96 bool synchronize;
97 int syncLimit;
97 int lastServerMailCount; 98 int lastServerMailCount;
98 int id; 99 int id;
99}; 100};
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
@@ -18,6 +18,7 @@
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include <qstring.h> 20#include <qstring.h>
21#include <qpe/resource.h>
21#include "emaillistitem.h" 22#include "emaillistitem.h"
22 23
23EmailListItem::EmailListItem(QListView *parent, Email mailIn, bool inbox) 24EmailListItem::EmailListItem(QListView *parent, Email mailIn, bool inbox)
@@ -38,6 +39,10 @@ EmailListItem::EmailListItem(QListView *parent, Email mailIn, bool inbox)
38 } 39 }
39 setText(1, mail.subject); 40 setText(1, mail.subject);
40 41
42 if (mailIn.files.count()>0)
43 {
44 setPixmap(0, Resource::loadPixmap("mailit/attach"));
45 }
41 selected = FALSE; 46 selected = FALSE;
42} 47}
43 48
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
@@ -40,4 +40,21 @@ MOC_DIR=qpeobj
40OBJECTS_DIR=qpeobj 40OBJECTS_DIR=qpeobj
41DESTDIR=$(OPIEDIR)/bin 41DESTDIR=$(OPIEDIR)/bin
42 42
43TRANSLATIONS = ../../../i18n/de/mailit.ts \
44 ../../../i18n/da/mailit.ts \
45 ../../../i18n/xx/mailit.ts \
46 ../../../i18n/en/mailit.ts \
47 ../../../i18n/es/mailit.ts \
48 ../../../i18n/fr/mailit.ts \
49 ../../../i18n/hu/mailit.ts \
50 ../../../i18n/ja/mailit.ts \
51 ../../../i18n/ko/mailit.ts \
52 ../../../i18n/no/mailit.ts \
53 ../../../i18n/pl/mailit.ts \
54 ../../../i18n/pt/mailit.ts \
55 ../../../i18n/pt_BR/mailit.ts \
56 ../../../i18n/sl/mailit.ts \
57 ../../../i18n/zh_CN/mailit.ts \
58 ../../../i18n/zh_TW/mailit.ts
59
43include ( $(OPIEDIR)/include.pro ) 60include ( $(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
@@ -21,7 +21,7 @@
21#include <qimage.h> 21#include <qimage.h>
22#include <qmime.h> 22#include <qmime.h>
23#include <qaction.h> 23#include <qaction.h>
24#include "resource.h" 24#include <qpe/resource.h>
25 25
26ReadMail::ReadMail( QWidget* parent, const char* name, WFlags fl ) 26ReadMail::ReadMail( QWidget* parent, const char* name, WFlags fl )
27 : QMainWindow(parent, name, fl) 27 : QMainWindow(parent, name, fl)
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
@@ -19,7 +19,7 @@
19**********************************************************************/ 19**********************************************************************/
20#include <qmessagebox.h> 20#include <qmessagebox.h>
21#include "writemail.h" 21#include "writemail.h"
22#include "resource.h" 22#include <qpe/resource.h>
23 23
24WriteMail::WriteMail( QWidget* parent, const char* name, WFlags fl ) 24WriteMail::WriteMail( QWidget* parent, const char* name, WFlags fl )
25 : QMainWindow( parent, name, fl ) 25 : QMainWindow( parent, name, fl )
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
@@ -21,7 +21,7 @@
21#include <qhbox.h> 21#include <qhbox.h>
22#include <qdir.h> 22#include <qdir.h>
23#include <qstringlist.h> 23#include <qstringlist.h>
24#include "resource.h" 24#include <qpe/resource.h>
25#include "addatt.h" 25#include "addatt.h"
26 26
27FileItem::FileItem(QListView *parent, DocLnk* dl) 27FileItem::FileItem(QListView *parent, DocLnk* dl)
@@ -62,8 +62,8 @@ AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f)
62 62
63 QHBox *buttons=new QHBox(this); 63 QHBox *buttons=new QHBox(this);
64 /*fileCategoryButton = new QPushButton(this);*/ 64 /*fileCategoryButton = new QPushButton(this);*/
65 attatchButton = new QPushButton("Attatch ->", buttons); 65 attatchButton = new QPushButton(tr("Attatch..."), buttons);
66 removeButton = new QPushButton("Remove", buttons); 66 removeButton = new QPushButton(tr("Remove"), buttons);
67 67
68 /*fileCategories = new QPopupMenu(fileCategoryButton); 68 /*fileCategories = new QPopupMenu(fileCategoryButton);
69 fileCategoryButton->setPopup(fileCategories); 69 fileCategoryButton->setPopup(fileCategories);
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
@@ -24,17 +24,15 @@
24 24
25#include "addresslist.h" 25#include "addresslist.h"
26 26
27AddressList::AddressList(QString file) 27AddressList::AddressList()
28{ 28{
29 addresses.setAutoDelete(TRUE); 29 addresses.setAutoDelete(TRUE);
30 filename = file;
31 read(); 30 read();
32 dirty = FALSE; 31 dirty = FALSE;
33} 32}
34 33
35AddressList::~AddressList() 34AddressList::~AddressList()
36{ 35{
37 write();
38 addresses.clear(); 36 addresses.clear();
39} 37}
40 38
@@ -120,7 +118,6 @@ void AddressList::read()
120{ 118{
121 OContactAccess::List::Iterator it; 119 OContactAccess::List::Iterator it;
122 120
123 //QFile f(filename);
124 QString lineEmail, lineName, email, name; 121 QString lineEmail, lineName, email, name;
125 OContactAccess m_contactdb("mailit"); 122 OContactAccess m_contactdb("mailit");
126 OContactAccess::List m_list = m_contactdb.sorted( true, 0, 0, 0 ); 123 OContactAccess::List m_list = m_contactdb.sorted( true, 0, 0, 0 );
@@ -162,20 +159,3 @@ QString AddressList::getRightString(QString in)
162 return out; 159 return out;
163} 160}
164 161
165void AddressList::write()
166{
167 if ( (addresses.count() == 0) || (!dirty) )
168 return;
169
170 QFile f(filename);
171 if (! f.open(IO_WriteOnly) )
172 return;
173
174 QTextStream stream(&f);
175 Contact *ptr;
176 for (ptr = addresses.first(); ptr != 0; ptr = addresses.next() ) {
177 stream << "email = " + ptr->email + "\n";
178 stream << "name = " + ptr->name + "\n";
179 }
180 f.close();
181}
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
@@ -34,7 +34,7 @@ class AddressList : public QObject
34 Q_OBJECT 34 Q_OBJECT
35 35
36public: 36public:
37 AddressList(QString file); 37 AddressList();
38 ~AddressList(); 38 ~AddressList();
39 void addContact(QString email, QString name); 39 void addContact(QString email, QString name);
40 bool containsEmail(QString email); 40 bool containsEmail(QString email);
@@ -42,7 +42,6 @@ public:
42 QString getNameByEmail(QString email); 42 QString getNameByEmail(QString email);
43 QString getEmailByName(QString name); 43 QString getEmailByName(QString name);
44 QList<Contact>* getContactList(); 44 QList<Contact>* getContactList();
45 void write();
46 45
47private: 46private:
48 int getEmailRef(QString email); 47 int getEmailRef(QString email);
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
@@ -18,6 +18,7 @@
18*** 18***
19**********************************************************************/ 19**********************************************************************/
20 20
21#include <qhbox.h>
21#include "editaccount.h" 22#include "editaccount.h"
22 23
23EditAccount::EditAccount( QWidget* parent, const char* name, WFlags fl ) 24EditAccount::EditAccount( QWidget* parent, const char* name, WFlags fl )
@@ -40,6 +41,7 @@ void EditAccount::setAccount(MailAccount *in, bool newOne)
40 popServerInput->setText(""); 41 popServerInput->setText("");
41 smtpServerInput->setText(""); 42 smtpServerInput->setText("");
42 syncCheckBox->setChecked(TRUE); 43 syncCheckBox->setChecked(TRUE);
44 syncLimitInput->setValue(2);
43 45
44 setCaption( tr("Create new Account") ); 46 setCaption( tr("Create new Account") );
45 } else { 47 } else {
@@ -51,6 +53,7 @@ void EditAccount::setAccount(MailAccount *in, bool newOne)
51 popServerInput->setText(account->popServer); 53 popServerInput->setText(account->popServer);
52 smtpServerInput->setText(account->smtpServer); 54 smtpServerInput->setText(account->smtpServer);
53 syncCheckBox->setChecked(account->synchronize); 55 syncCheckBox->setChecked(account->synchronize);
56 syncLimitInput->setValue(account->syncLimit/1000);
54 } 57 }
55} 58}
56 59
@@ -70,34 +73,43 @@ void EditAccount::init()
70 nameInput = new QLineEdit( this, "nameInput" ); 73 nameInput = new QLineEdit( this, "nameInput" );
71 grid->addWidget( nameInput, 1, 1 ); 74 grid->addWidget( nameInput, 1, 1 );
72 75
73 emailInputLabel = new QLabel("Email", this); 76 emailInputLabel = new QLabel(tr("Email"), this);
74 grid->addWidget(emailInputLabel, 2, 0 ); 77 grid->addWidget(emailInputLabel, 2, 0 );
75 emailInput = new QLineEdit( this, "emailInput" ); 78 emailInput = new QLineEdit( this, "emailInput" );
76 grid->addWidget( emailInput, 2, 1 ); 79 grid->addWidget( emailInput, 2, 1 );
77 80
78 popUserInputLabel = new QLabel("POP username", this); 81 popUserInputLabel = new QLabel(tr("POP username"), this);
79 grid->addWidget( popUserInputLabel, 3, 0 ); 82 grid->addWidget( popUserInputLabel, 3, 0 );
80 popUserInput = new QLineEdit( this, "popUserInput" ); 83 popUserInput = new QLineEdit( this, "popUserInput" );
81 grid->addWidget( popUserInput, 3, 1 ); 84 grid->addWidget( popUserInput, 3, 1 );
82 85
83 popPasswInputLabel = new QLabel( "POP password", this); 86 popPasswInputLabel = new QLabel( tr("POP password"), this);
84 grid->addWidget( popPasswInputLabel, 4, 0 ); 87 grid->addWidget( popPasswInputLabel, 4, 0 );
85 popPasswInput = new QLineEdit( this, "popPasswInput" ); 88 popPasswInput = new QLineEdit( this, "popPasswInput" );
86 grid->addWidget( popPasswInput, 4, 1 ); 89 grid->addWidget( popPasswInput, 4, 1 );
87 90
88 popServerInputLabel = new QLabel("POP server", this); 91 popServerInputLabel = new QLabel(tr("POP server"), this);
89 grid->addWidget( popServerInputLabel, 5, 0 ); 92 grid->addWidget( popServerInputLabel, 5, 0 );
90 popServerInput = new QLineEdit( this, "popServerInput" ); 93 popServerInput = new QLineEdit( this, "popServerInput" );
91 grid->addWidget( popServerInput, 5, 1 ); 94 grid->addWidget( popServerInput, 5, 1 );
92 95
93 smtpServerInputLabel = new QLabel("SMTP server", this ); 96 smtpServerInputLabel = new QLabel(tr("SMTP server"), this );
94 grid->addWidget( smtpServerInputLabel, 6, 0 ); 97 grid->addWidget( smtpServerInputLabel, 6, 0 );
95 smtpServerInput = new QLineEdit( this, "smtpServerInput" ); 98 smtpServerInput = new QLineEdit( this, "smtpServerInput" );
96 grid->addWidget( smtpServerInput, 6, 1 ); 99 grid->addWidget( smtpServerInput, 6, 1 );
97 100
98 syncCheckBox = new QCheckBox( tr( "Synchronize with server" ), this); 101 QHBox* syncBox=new QHBox(this);
102 grid->addWidget( syncBox, 7, 1 );
103
104 syncCheckBox = new QCheckBox( tr( "Synchronize" ), this);
99 syncCheckBox->setChecked( TRUE ); 105 syncCheckBox->setChecked( TRUE );
100 grid->addMultiCellWidget( syncCheckBox, 7, 7, 0, 1 ); 106 grid->addWidget( syncCheckBox,7,0);
107
108 syncLimitInputLabel = new QLabel(tr("Mail Size (k)"), syncBox);
109 //syncBox->addWidget( syncLimitInputLabel);
110 syncLimitInput = new QSpinBox( syncBox, "syncSize" );
111 //syncBox->addWidget(syncLimitInput);
112
101} 113}
102 114
103 115
@@ -111,6 +123,7 @@ void EditAccount::accept()
111 account->popServer = popServerInput->text(); 123 account->popServer = popServerInput->text();
112 account->smtpServer = smtpServerInput->text(); 124 account->smtpServer = smtpServerInput->text();
113 account->synchronize = syncCheckBox->isChecked(); 125 account->synchronize = syncCheckBox->isChecked();
126 account->syncLimit = syncLimitInput->value()*1000;//Display in kB
114 127
115 QDialog::accept(); 128 QDialog::accept();
116} 129}
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
@@ -25,6 +25,7 @@
25#include <qlineedit.h> 25#include <qlineedit.h>
26#include <qcheckbox.h> 26#include <qcheckbox.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qspinbox.h>
28#include "emailhandler.h" 29#include "emailhandler.h"
29 30
30class EditAccount : public QDialog 31class EditAccount : public QDialog
@@ -50,6 +51,7 @@ private:
50 QLabel *popPasswInputLabel; 51 QLabel *popPasswInputLabel;
51 QLabel *popServerInputLabel; 52 QLabel *popServerInputLabel;
52 QLabel *smtpServerInputLabel; 53 QLabel *smtpServerInputLabel;
54 QLabel *syncLimitInputLabel;
53 55
54 QLineEdit *accountNameInput; 56 QLineEdit *accountNameInput;
55 QLineEdit *nameInput; 57 QLineEdit *nameInput;
@@ -58,6 +60,7 @@ private:
58 QLineEdit *popPasswInput; 60 QLineEdit *popPasswInput;
59 QLineEdit *popServerInput; 61 QLineEdit *popServerInput;
60 QLineEdit *smtpServerInput; 62 QLineEdit *smtpServerInput;
63 QSpinBox *syncLimitInput;
61 QCheckBox *syncCheckBox; 64 QCheckBox *syncCheckBox;
62 65
63 QGridLayout *grid; 66 QGridLayout *grid;
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
@@ -23,7 +23,7 @@
23#include <qcheckbox.h> 23#include <qcheckbox.h>
24#include <qmenubar.h> 24#include <qmenubar.h>
25#include <qaction.h> 25#include <qaction.h>
26#include "resource.h" 26#include <qpe/resource.h>
27#include "emailclient.h" 27#include "emailclient.h"
28 28
29QCollection::Item AccountList::newItem(QCollection::Item d) 29QCollection::Item AccountList::newItem(QCollection::Item d)
@@ -41,7 +41,7 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl )
41 : QMainWindow( parent, name, fl ) 41 : QMainWindow( parent, name, fl )
42{ 42{
43 emailHandler = new EmailHandler(); 43 emailHandler = new EmailHandler();
44 addressList = new AddressList( getPath(FALSE) + "mail_adr"); 44 addressList = new AddressList();
45 45
46 sending = FALSE; 46 sending = FALSE;
47 receiving = FALSE; 47 receiving = FALSE;
@@ -671,6 +671,12 @@ void EmailClient::readSettings()
671 } 671 }
672 } 672 }
673 } 673 }
674
675 if ( (pos = p->find("SYNCLIMIT",':', accountPos, TRUE)) != -1) {
676 account.syncLimit = p->getString(& ++pos, 'z', TRUE).toInt();
677 }
678
679
674 accountList.append(&account); 680 accountList.append(&account);
675 } 681 }
676 delete p; 682 delete p;
@@ -716,6 +722,8 @@ void EmailClient::saveSettings()
716 } else { 722 } else {
717 t << "Synchronize: No\n"; 723 t << "Synchronize: No\n";
718 } 724 }
725 t << "SyncLimit: ";
726 t << accountPtr->syncLimit << "\n";
719 t << "accountEnd;\n"; 727 t << "accountEnd;\n";
720 } 728 }
721 f.close(); 729 f.close();
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
@@ -118,7 +118,7 @@ void EmailHandler::getMailHeaders()
118 } 118 }
119 119
120 headers = TRUE; 120 headers = TRUE;
121 popClient->headersOnly(headers, 2000); //less than 2000, download all 121 popClient->headersOnly(headers, mailAccount.syncLimit); //less than requested syncLimit, download all
122 popClient->newConnection(mailAccount.popServer, 110); 122 popClient->newConnection(mailAccount.popServer, 110);
123} 123}
124 124
@@ -200,6 +200,16 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail)
200 mail->from=mail->fromMail; 200 mail->from=mail->fromMail;
201 } 201 }
202 } 202 }
203
204 //@@@ToDo: Rewrite the parser as To: stops at the first occurence- which is Delivered-To:
205 if (pos = p.find("TO",':', pos, TRUE) != -1)
206 {
207 pos++;
208 mail->recipients.append (p.getString(&pos, 'z', TRUE) );
209 }
210
211
212
203 if ((pos = p.find("SUBJECT",':', 0, TRUE)) != -1) { 213 if ((pos = p.find("SUBJECT",':', 0, TRUE)) != -1) {
204 pos++; 214 pos++;
205 mail->subject = p.getString(&pos, 'z', TRUE); 215 mail->subject = p.getString(&pos, 'z', TRUE);
@@ -208,10 +218,9 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail)
208 pos++; 218 pos++;
209 mail->date = p.getString(&pos, 'z', true); 219 mail->date = p.getString(&pos, 'z', true);
210 } 220 }
211 if ((pos = p.find("TO",':', 0, TRUE)) != -1) { 221
212 pos++; 222
213 mail->recipients.append (p.getString(&pos, 'z', TRUE) ); 223
214 }
215 if ((pos = p.find("MESSAGE",'-', 0, TRUE)) != -1) { 224 if ((pos = p.find("MESSAGE",'-', 0, TRUE)) != -1) {
216 pos++; 225 pos++;
217 if ( (p.wordAt(pos).upper() == "ID") && 226 if ( (p.wordAt(pos).upper() == "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
@@ -94,6 +94,7 @@ struct MailAccount
94 QString popServer; 94 QString popServer;
95 QString smtpServer; 95 QString smtpServer;
96 bool synchronize; 96 bool synchronize;
97 int syncLimit;
97 int lastServerMailCount; 98 int lastServerMailCount;
98 int id; 99 int id;
99}; 100};
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
@@ -18,6 +18,7 @@
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include <qstring.h> 20#include <qstring.h>
21#include <qpe/resource.h>
21#include "emaillistitem.h" 22#include "emaillistitem.h"
22 23
23EmailListItem::EmailListItem(QListView *parent, Email mailIn, bool inbox) 24EmailListItem::EmailListItem(QListView *parent, Email mailIn, bool inbox)
@@ -38,6 +39,10 @@ EmailListItem::EmailListItem(QListView *parent, Email mailIn, bool inbox)
38 } 39 }
39 setText(1, mail.subject); 40 setText(1, mail.subject);
40 41
42 if (mailIn.files.count()>0)
43 {
44 setPixmap(0, Resource::loadPixmap("mailit/attach"));
45 }
41 selected = FALSE; 46 selected = FALSE;
42} 47}
43 48
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
@@ -40,4 +40,21 @@ MOC_DIR=qpeobj
40OBJECTS_DIR=qpeobj 40OBJECTS_DIR=qpeobj
41DESTDIR=$(OPIEDIR)/bin 41DESTDIR=$(OPIEDIR)/bin
42 42
43TRANSLATIONS = ../../../i18n/de/mailit.ts \
44 ../../../i18n/da/mailit.ts \
45 ../../../i18n/xx/mailit.ts \
46 ../../../i18n/en/mailit.ts \
47 ../../../i18n/es/mailit.ts \
48 ../../../i18n/fr/mailit.ts \
49 ../../../i18n/hu/mailit.ts \
50 ../../../i18n/ja/mailit.ts \
51 ../../../i18n/ko/mailit.ts \
52 ../../../i18n/no/mailit.ts \
53 ../../../i18n/pl/mailit.ts \
54 ../../../i18n/pt/mailit.ts \
55 ../../../i18n/pt_BR/mailit.ts \
56 ../../../i18n/sl/mailit.ts \
57 ../../../i18n/zh_CN/mailit.ts \
58 ../../../i18n/zh_TW/mailit.ts
59
43include ( $(OPIEDIR)/include.pro ) 60include ( $(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
@@ -21,7 +21,7 @@
21#include <qimage.h> 21#include <qimage.h>
22#include <qmime.h> 22#include <qmime.h>
23#include <qaction.h> 23#include <qaction.h>
24#include "resource.h" 24#include <qpe/resource.h>
25 25
26ReadMail::ReadMail( QWidget* parent, const char* name, WFlags fl ) 26ReadMail::ReadMail( QWidget* parent, const char* name, WFlags fl )
27 : QMainWindow(parent, name, fl) 27 : QMainWindow(parent, name, fl)
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
@@ -19,7 +19,7 @@
19**********************************************************************/ 19**********************************************************************/
20#include <qmessagebox.h> 20#include <qmessagebox.h>
21#include "writemail.h" 21#include "writemail.h"
22#include "resource.h" 22#include <qpe/resource.h>
23 23
24WriteMail::WriteMail( QWidget* parent, const char* name, WFlags fl ) 24WriteMail::WriteMail( QWidget* parent, const char* name, WFlags fl )
25 : QMainWindow( parent, name, fl ) 25 : QMainWindow( parent, name, fl )