summaryrefslogtreecommitdiff
Unidiff
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
@@ -1,90 +1,90 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2001 Trolltech AS. All rights reserved. 2** Copyright (C) 2001 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qt Palmtop Environment. 4** This file is part of Qt Palmtop Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include <qlayout.h> 20#include <qlayout.h>
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)
28 : QListViewItem(parent) 28 : QListViewItem(parent)
29{ 29{
30 /*file = fileInfo; 30 /*file = fileInfo;
31 type = fileType;*/ 31 type = fileType;*/
32 32
33 doclnk=dl; 33 doclnk=dl;
34 34
35 setText(0, doclnk->name()); 35 setText(0, doclnk->name());
36 36
37 /*if (fileType == "Picture") { 37 /*if (fileType == "Picture") {
38 setPixmap(0, Resource::loadPixmap("pixmap")); 38 setPixmap(0, Resource::loadPixmap("pixmap"));
39 } else if (fileType == "Document") { 39 } else if (fileType == "Document") {
40 setPixmap(0, Resource::loadPixmap("txt")); 40 setPixmap(0, Resource::loadPixmap("txt"));
41 } else if (fileType == "Sound") { 41 } else if (fileType == "Sound") {
42 setPixmap(0, Resource::loadPixmap("play")); 42 setPixmap(0, Resource::loadPixmap("play"));
43 } else if (fileType == "Movie") { 43 } else if (fileType == "Movie") {
44 setPixmap(0, Resource::loadPixmap("MPEGPlayer")); 44 setPixmap(0, Resource::loadPixmap("MPEGPlayer"));
45 } else if (fileType == "File") { 45 } else if (fileType == "File") {
46 setPixmap(0, Resource::loadPixmap("exec")); 46 setPixmap(0, Resource::loadPixmap("exec"));
47 }*/ 47 }*/
48} 48}
49 49
50FileItem::~FileItem() 50FileItem::~FileItem()
51{ 51{
52 if (doclnk!=NULL) delete doclnk; 52 if (doclnk!=NULL) delete doclnk;
53 doclnk=NULL; 53 doclnk=NULL;
54} 54}
55 55
56AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f) 56AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f)
57 : QDialog(parent, name, f) 57 : QDialog(parent, name, f)
58{ 58{
59 setCaption("Adding attatchments"); 59 setCaption("Adding attatchments");
60 60
61 QGridLayout *top = new QGridLayout(this, 1,1 ); 61 QGridLayout *top = new QGridLayout(this, 1,1 );
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);
70 fileCategories->insertItem("Document"); 70 fileCategories->insertItem("Document");
71 fileCategories->insertItem("Picture"); 71 fileCategories->insertItem("Picture");
72 fileCategories->insertItem("Sound"); 72 fileCategories->insertItem("Sound");
73 fileCategories->insertItem("Movie"); 73 fileCategories->insertItem("Movie");
74 fileCategories->insertItem("File"); 74 fileCategories->insertItem("File");
75 75
76 fileCategoryButton->setText("Document"); 76 fileCategoryButton->setText("Document");
77 top->addWidget(fileCategoryButton, 0, 0);*/ 77 top->addWidget(fileCategoryButton, 0, 0);*/
78 78
79 79
80 top->addWidget(buttons,1,0); 80 top->addWidget(buttons,1,0);
81 //buttons->addWidget(attatchButton,0,0); 81 //buttons->addWidget(attatchButton,0,0);
82 //buttons->addWidget(removeButton,0,1); 82 //buttons->addWidget(removeButton,0,1);
83 83
84 //connect(fileCategories, SIGNAL(activated(int)), this, 84 //connect(fileCategories, SIGNAL(activated(int)), this,
85 //SLOT(fileCategorySelected(int)) );*/ 85 //SLOT(fileCategorySelected(int)) );*/
86 connect(attatchButton, SIGNAL(clicked()), this, 86 connect(attatchButton, SIGNAL(clicked()), this,
87 SLOT(addAttatchment()) ); 87 SLOT(addAttatchment()) );
88 connect(removeButton, SIGNAL(clicked()), this, 88 connect(removeButton, SIGNAL(clicked()), this,
89 SLOT(removeAttatchment()) ); 89 SLOT(removeAttatchment()) );
90 90
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
@@ -3,59 +3,57 @@
3** 3**
4** This file is part of Qt Palmtop Environment. 4** This file is part of Qt Palmtop Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include <qfile.h> 20#include <qfile.h>
21#include <qtextstream.h> 21#include <qtextstream.h>
22#include <opie/ocontactaccess.h> 22#include <opie/ocontactaccess.h>
23#include <opie/ocontact.h> 23#include <opie/ocontact.h>
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
41void AddressList::addContact(QString email, QString name) 39void AddressList::addContact(QString email, QString name)
42{ 40{
43 //skip if not a valid email address, 41 //skip if not a valid email address,
44 if (email.find( '@') == -1) 42 if (email.find( '@') == -1)
45 return; 43 return;
46 44
47 if ( ! containsEmail(email) ) { 45 if ( ! containsEmail(email) ) {
48 Contact *in = new Contact; 46 Contact *in = new Contact;
49 in->email = email; 47 in->email = email;
50 in->name = name; 48 in->name = name;
51 addresses.append(in); 49 addresses.append(in);
52 dirty = TRUE; 50 dirty = TRUE;
53 } 51 }
54} 52}
55 53
56bool AddressList::containsEmail(QString email) 54bool AddressList::containsEmail(QString email)
57{ 55{
58 return ( getEmailRef(email) != -1 ); 56 return ( getEmailRef(email) != -1 );
59} 57}
60 58
61bool AddressList::containsName(QString name) 59bool AddressList::containsName(QString name)
@@ -99,83 +97,65 @@ int AddressList::getEmailRef(QString email)
99} 97}
100 98
101int AddressList::getNameRef(QString name) 99int AddressList::getNameRef(QString name)
102{ 100{
103 int pos = 0; 101 int pos = 0;
104 Contact *ptr; 102 Contact *ptr;
105 103
106 for (ptr = addresses.first(); ptr != 0; ptr = addresses.next() ) { 104 for (ptr = addresses.first(); ptr != 0; ptr = addresses.next() ) {
107 if (ptr->name == name) 105 if (ptr->name == name)
108 return pos; 106 return pos;
109 pos++; 107 pos++;
110 } 108 }
111 return -1; 109 return -1;
112} 110}
113 111
114QList<Contact>* AddressList::getContactList() 112QList<Contact>* AddressList::getContactList()
115{ 113{
116 return &addresses; 114 return &addresses;
117} 115}
118 116
119void AddressList::read() 117void 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 );
127 //OContact* oc; 124 //OContact* oc;
128 125
129 for ( it = m_list.begin(); it != m_list.end(); ++it ) 126 for ( it = m_list.begin(); it != m_list.end(); ++it )
130 { 127 {
131 //oc=(OContact*) it; 128 //oc=(OContact*) it;
132 if ((*it).defaultEmail().length()!=0) 129 if ((*it).defaultEmail().length()!=0)
133 addContact((*it).defaultEmail(),(*it).fullName()); 130 addContact((*it).defaultEmail(),(*it).fullName());
134 } 131 }
135 132
136 /*if (! f.open(IO_ReadOnly) ) 133 /*if (! f.open(IO_ReadOnly) )
137 return; 134 return;
138 135
139 QTextStream stream(&f); 136 QTextStream stream(&f);
140 137
141 while (! stream.atEnd() ) { 138 while (! stream.atEnd() ) {
142 lineEmail = stream.readLine(); 139 lineEmail = stream.readLine();
143 if (! stream.atEnd() ) 140 if (! stream.atEnd() )
144 lineName = stream.readLine(); 141 lineName = stream.readLine();
145 else return; 142 else return;
146 143
147 email = getRightString(lineEmail); 144 email = getRightString(lineEmail);
148 name = getRightString(lineName); 145 name = getRightString(lineName);
149 addContact(email, name); 146 addContact(email, name);
150 } 147 }
151 f.close();*/ 148 f.close();*/
152} 149}
153 150
154QString AddressList::getRightString(QString in) 151QString AddressList::getRightString(QString in)
155{ 152{
156 QString out = ""; 153 QString out = "";
157 154
158 int pos = in.find('='); 155 int pos = in.find('=');
159 if (pos != -1) { 156 if (pos != -1) {
160 out = in.mid(pos+1).stripWhiteSpace(); 157 out = in.mid(pos+1).stripWhiteSpace();
161 } 158 }
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
@@ -13,47 +13,46 @@
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#ifndef ADDRESSLIST_H 20#ifndef ADDRESSLIST_H
21#define ADDRESSLIST_H 21#define ADDRESSLIST_H
22 22
23#include <qobject.h> 23#include <qobject.h>
24#include <qlist.h> 24#include <qlist.h>
25 25
26struct Contact 26struct Contact
27{ 27{
28 QString email; 28 QString email;
29 QString name; 29 QString name;
30}; 30};
31 31
32class AddressList : public QObject 32class AddressList : public QObject
33{ 33{
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);
41 bool containsName(QString name); 41 bool containsName(QString name);
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);
49 int getNameRef(QString name); 48 int getNameRef(QString name);
50 QString getRightString(QString in); 49 QString getRightString(QString in);
51 void read(); 50 void read();
52 51
53private: 52private:
54 QList<Contact> addresses; 53 QList<Contact> addresses;
55 QString filename; 54 QString filename;
56 bool dirty; 55 bool dirty;
57}; 56};
58 57
59#endif 58#endif
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
@@ -1,120 +1,133 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2001 Trolltech AS. All rights reserved. 2** Copyright (C) 2001 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qt Palmtop Environment. 4** This file is part of Qt Palmtop Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
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 )
24 : QDialog(parent, name, fl) 25 : QDialog(parent, name, fl)
25{ 26{
26 setCaption( tr("Edit Account") ); 27 setCaption( tr("Edit Account") );
27 init(); 28 init();
28 popPasswInput->setEchoMode(QLineEdit::Password); 29 popPasswInput->setEchoMode(QLineEdit::Password);
29} 30}
30 31
31void EditAccount::setAccount(MailAccount *in, bool newOne) 32void EditAccount::setAccount(MailAccount *in, bool newOne)
32{ 33{
33 account = in; 34 account = in;
34 if (newOne) { 35 if (newOne) {
35 accountNameInput->setText(""); 36 accountNameInput->setText("");
36 nameInput->setText(""); 37 nameInput->setText("");
37 emailInput->setText(""); 38 emailInput->setText("");
38 popUserInput->setText(""); 39 popUserInput->setText("");
39 popPasswInput->setText(""); 40 popPasswInput->setText("");
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 {
46 accountNameInput->setText(account->accountName); 48 accountNameInput->setText(account->accountName);
47 nameInput->setText(account->name); 49 nameInput->setText(account->name);
48 emailInput->setText(account->emailAddress); 50 emailInput->setText(account->emailAddress);
49 popUserInput->setText(account->popUserName); 51 popUserInput->setText(account->popUserName);
50 popPasswInput->setText(account->popPasswd); 52 popPasswInput->setText(account->popPasswd);
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
57void EditAccount::init() 60void EditAccount::init()
58{ 61{
59 grid = new QGridLayout(this); 62 grid = new QGridLayout(this);
60 grid->setSpacing( 6 ); 63 grid->setSpacing( 6 );
61 grid->setMargin( 11 ); 64 grid->setMargin( 11 );
62 65
63 accountNameInputLabel = new QLabel(tr("Account name"), this); 66 accountNameInputLabel = new QLabel(tr("Account name"), this);
64 grid->addWidget( accountNameInputLabel, 0, 0 ); 67 grid->addWidget( accountNameInputLabel, 0, 0 );
65 accountNameInput = new QLineEdit( this, "account nameInput" ); 68 accountNameInput = new QLineEdit( this, "account nameInput" );
66 grid->addWidget( accountNameInput, 0, 1 ); 69 grid->addWidget( accountNameInput, 0, 1 );
67 70
68 nameInputLabel = new QLabel(tr("Your name"), this); 71 nameInputLabel = new QLabel(tr("Your name"), this);
69 grid->addWidget( nameInputLabel, 1, 0 ); 72 grid->addWidget( nameInputLabel, 1, 0 );
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
104void EditAccount::accept() 116void EditAccount::accept()
105{ 117{
106 account->accountName = accountNameInput->text(); 118 account->accountName = accountNameInput->text();
107 account->name = nameInput->text(); 119 account->name = nameInput->text();
108 account->emailAddress = emailInput->text(); 120 account->emailAddress = emailInput->text();
109 account->popUserName = popUserInput->text(); 121 account->popUserName = popUserInput->text();
110 account->popPasswd = popPasswInput->text(); 122 account->popPasswd = popPasswInput->text();
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}
117 130
118void EditAccount::reject() 131void EditAccount::reject()
119{ 132{
120} 133}
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
@@ -4,63 +4,66 @@
4** This file is part of Qt Palmtop Environment. 4** This file is part of Qt Palmtop Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#ifndef EDITACCOUNT_H 20#ifndef EDITACCOUNT_H
21#define EDITACCOUNT_H 21#define EDITACCOUNT_H
22 22
23#include <qdialog.h> 23#include <qdialog.h>
24#include <qlabel.h> 24#include <qlabel.h>
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
31{ 32{
32 Q_OBJECT 33 Q_OBJECT
33 34
34public: 35public:
35 EditAccount( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 36 EditAccount( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
36 void setAccount(MailAccount *in, bool newOne = TRUE); 37 void setAccount(MailAccount *in, bool newOne = TRUE);
37 void init(); 38 void init();
38 39
39public slots: 40public slots:
40 void accept(); 41 void accept();
41 void reject(); 42 void reject();
42 43
43private: 44private:
44 MailAccount thisAccount, *account; 45 MailAccount thisAccount, *account;
45 46
46 QLabel *accountNameInputLabel; 47 QLabel *accountNameInputLabel;
47 QLabel *nameInputLabel; 48 QLabel *nameInputLabel;
48 QLabel *emailInputLabel; 49 QLabel *emailInputLabel;
49 QLabel *popUserInputLabel; 50 QLabel *popUserInputLabel;
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;
56 QLineEdit *emailInput; 58 QLineEdit *emailInput;
57 QLineEdit *popUserInput; 59 QLineEdit *popUserInput;
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;
64}; 67};
65 68
66#endif 69#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
@@ -2,67 +2,67 @@
2** Copyright (C) 2001 Trolltech AS. All rights reserved. 2** Copyright (C) 2001 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qt Palmtop Environment. 4** This file is part of Qt Palmtop Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include <qapplication.h> 20#include <qapplication.h>
21#include <qmessagebox.h> 21#include <qmessagebox.h>
22#include <qfile.h> 22#include <qfile.h>
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)
30{ 30{
31 return dupl( (MailAccount *) d); 31 return dupl( (MailAccount *) d);
32} 32}
33 33
34MailAccount* AccountList::dupl(MailAccount *in) 34MailAccount* AccountList::dupl(MailAccount *in)
35{ 35{
36 ac = new MailAccount(*in); 36 ac = new MailAccount(*in);
37 return ac; 37 return ac;
38} 38}
39 39
40EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) 40EmailClient::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;
48 previewingMail = FALSE; 48 previewingMail = FALSE;
49 mailIdCount = 1; 49 mailIdCount = 1;
50 accountIdCount = 1; 50 accountIdCount = 1;
51 allAccounts = FALSE; 51 allAccounts = FALSE;
52 52
53 init(); 53 init();
54 54
55 connect(emailHandler, SIGNAL(mailSent()), this, SLOT(mailSent()) ); 55 connect(emailHandler, SIGNAL(mailSent()), this, SLOT(mailSent()) );
56 56
57 connect(emailHandler, SIGNAL(smtpError(int)), this, 57 connect(emailHandler, SIGNAL(smtpError(int)), this,
58 SLOT(smtpError(int)) ); 58 SLOT(smtpError(int)) );
59 connect(emailHandler, SIGNAL(popError(int)), this, 59 connect(emailHandler, SIGNAL(popError(int)), this,
60 SLOT(popError(int)) ); 60 SLOT(popError(int)) );
61 61
62 connect(inboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(inboxItemSelected()) ); 62 connect(inboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(inboxItemSelected()) );
63 connect(outboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(outboxItemSelected()) ); 63 connect(outboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(outboxItemSelected()) );
64 64
65 connect(emailHandler, SIGNAL(mailArrived(const Email &, bool)), this, 65 connect(emailHandler, SIGNAL(mailArrived(const Email &, bool)), this,
66 SLOT(mailArrived(const Email &, bool)) ); 66 SLOT(mailArrived(const Email &, bool)) );
67 connect(emailHandler, SIGNAL(mailTransfered(int)), this, 67 connect(emailHandler, SIGNAL(mailTransfered(int)), this,
68 SLOT(allMailArrived(int)) ); 68 SLOT(allMailArrived(int)) );
@@ -650,93 +650,101 @@ void EmailClient::readSettings()
650 if ( (pos = p->find("POPUSER",':', accountPos, TRUE)) != -1) 650 if ( (pos = p->find("POPUSER",':', accountPos, TRUE)) != -1)
651 account.popUserName = p->getString(& ++pos, 'z', TRUE); 651 account.popUserName = p->getString(& ++pos, 'z', TRUE);
652 if ( (pos = p->find("POPPASSWORD",':', accountPos, TRUE)) != -1) 652 if ( (pos = p->find("POPPASSWORD",':', accountPos, TRUE)) != -1)
653 account.popPasswd = p->getString(& ++pos, 'z', TRUE); 653 account.popPasswd = p->getString(& ++pos, 'z', TRUE);
654 if ( (pos = p->find("POPSERVER",':', accountPos, TRUE)) != -1) 654 if ( (pos = p->find("POPSERVER",':', accountPos, TRUE)) != -1)
655 account.popServer = p->getString(& ++pos, 'z', TRUE); 655 account.popServer = p->getString(& ++pos, 'z', TRUE);
656 if ( (pos = p->find("SMTPSERVER",':', accountPos, TRUE)) != -1) 656 if ( (pos = p->find("SMTPSERVER",':', accountPos, TRUE)) != -1)
657 account.smtpServer = p->getString(& ++pos, 'z', TRUE); 657 account.smtpServer = p->getString(& ++pos, 'z', TRUE);
658 if ( (pos = p->find("ACCOUNTID",':', accountPos, TRUE)) != -1) { 658 if ( (pos = p->find("ACCOUNTID",':', accountPos, TRUE)) != -1) {
659 s = p->getString(& ++pos, 'z', TRUE); 659 s = p->getString(& ++pos, 'z', TRUE);
660 account.id = s.toInt(); 660 account.id = s.toInt();
661 } 661 }
662 662
663 account.lastServerMailCount = 0; 663 account.lastServerMailCount = 0;
664 account.synchronize = FALSE; 664 account.synchronize = FALSE;
665 if ( (pos = p->find("SYNCHRONIZE",':', accountPos, TRUE)) != -1) { 665 if ( (pos = p->find("SYNCHRONIZE",':', accountPos, TRUE)) != -1) {
666 if (p->getString(& ++pos, 'z', TRUE).upper() == "YES") { 666 if (p->getString(& ++pos, 'z', TRUE).upper() == "YES") {
667 account.synchronize = TRUE; 667 account.synchronize = TRUE;
668 if ( (pos = p->find("LASTSERVERMAILCOUNT",':', accountPos, TRUE)) != -1) { 668 if ( (pos = p->find("LASTSERVERMAILCOUNT",':', accountPos, TRUE)) != -1) {
669 s = p->getString(& ++pos, 'z', TRUE); 669 s = p->getString(& ++pos, 'z', TRUE);
670 account.lastServerMailCount = s.toInt(); 670 account.lastServerMailCount = s.toInt();
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;
677 } 683 }
678 mailconf->setGroup("mailitglobal"); 684 mailconf->setGroup("mailitglobal");
679 if ( (y = mailconf->readNumEntry("mailidcount", -1)) != -1) { 685 if ( (y = mailconf->readNumEntry("mailidcount", -1)) != -1) {
680 mailIdCount = y; 686 mailIdCount = y;
681 } 687 }
682 if ( (y = mailconf->readNumEntry("accountidcount", -1)) != -1) { 688 if ( (y = mailconf->readNumEntry("accountidcount", -1)) != -1) {
683 accountIdCount = y; 689 accountIdCount = y;
684 } 690 }
685} 691}
686 692
687void EmailClient::saveSettings() 693void EmailClient::saveSettings()
688{ 694{
689 QString temp; 695 QString temp;
690 QFile f( getPath(FALSE) + "settings.txt"); 696 QFile f( getPath(FALSE) + "settings.txt");
691 MailAccount *accountPtr; 697 MailAccount *accountPtr;
692 698
693 if (! f.open(IO_WriteOnly) ) { 699 if (! f.open(IO_WriteOnly) ) {
694 qWarning("could not save settings file"); 700 qWarning("could not save settings file");
695 return; 701 return;
696 } 702 }
697 QTextStream t(&f); 703 QTextStream t(&f);
698 t << "#Settings for QPE Mailit program\n"; 704 t << "#Settings for QPE Mailit program\n";
699 705
700 for (accountPtr = accountList.first(); accountPtr != 0; 706 for (accountPtr = accountList.first(); accountPtr != 0;
701 accountPtr = accountList.next()) { 707 accountPtr = accountList.next()) {
702 708
703 t << "accountStart;\n"; 709 t << "accountStart;\n";
704 t << "AccountName: " + accountPtr->accountName + "\n"; 710 t << "AccountName: " + accountPtr->accountName + "\n";
705 t << "Name: " + accountPtr->name + "\n"; 711 t << "Name: " + accountPtr->name + "\n";
706 t << "Email: " + accountPtr->emailAddress + "\n"; 712 t << "Email: " + accountPtr->emailAddress + "\n";
707 t << "POPUser: " + accountPtr->popUserName + "\n"; 713 t << "POPUser: " + accountPtr->popUserName + "\n";
708 t << "POPPAssword: " + accountPtr->popPasswd + "\n"; 714 t << "POPPAssword: " + accountPtr->popPasswd + "\n";
709 t << "POPServer: " + accountPtr->popServer + "\n"; 715 t << "POPServer: " + accountPtr->popServer + "\n";
710 t << "SMTPServer: " + accountPtr->smtpServer + "\n"; 716 t << "SMTPServer: " + accountPtr->smtpServer + "\n";
711 t << "AccountId: " << accountPtr->id << "\n"; 717 t << "AccountId: " << accountPtr->id << "\n";
712 if (accountPtr->synchronize) { 718 if (accountPtr->synchronize) {
713 t << "Synchronize: Yes\n"; 719 t << "Synchronize: Yes\n";
714 t << "LastServerMailCount: "; 720 t << "LastServerMailCount: ";
715 t << accountPtr->lastServerMailCount << "\n"; 721 t << accountPtr->lastServerMailCount << "\n";
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();
722 730
723 mailconf->setGroup("mailitglobal"); 731 mailconf->setGroup("mailitglobal");
724 mailconf->writeEntry("mailidcount", mailIdCount); 732 mailconf->writeEntry("mailidcount", mailIdCount);
725 mailconf->writeEntry("accountidcount", accountIdCount); 733 mailconf->writeEntry("accountidcount", accountIdCount);
726} 734}
727 735
728void EmailClient::selectAccount(int id) 736void EmailClient::selectAccount(int id)
729{ 737{
730 if (accountList.count() > 0) { 738 if (accountList.count() > 0) {
731 currentAccount = accountList.at(id); 739 currentAccount = accountList.at(id);
732 emit newCaption("Mailit - " + currentAccount->accountName); 740 emit newCaption("Mailit - " + currentAccount->accountName);
733 getNewMail(); 741 getNewMail();
734 } else { 742 } else {
735 emit newCaption("Mailit ! No account defined"); 743 emit newCaption("Mailit ! No account defined");
736 } 744 }
737} 745}
738 746
739void EmailClient::editAccount(int id) 747void EmailClient::editAccount(int id)
740{ 748{
741 MailAccount *newAccount; 749 MailAccount *newAccount;
742 750
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
@@ -97,49 +97,49 @@ void EmailHandler::setAccount(MailAccount account)
97void EmailHandler::getMail() 97void EmailHandler::getMail()
98{ 98{
99 popClient->setAccount(mailAccount.popUserName, mailAccount.popPasswd); 99 popClient->setAccount(mailAccount.popUserName, mailAccount.popPasswd);
100 if (mailAccount.synchronize) { 100 if (mailAccount.synchronize) {
101 popClient->setSynchronize(mailAccount.lastServerMailCount); 101 popClient->setSynchronize(mailAccount.lastServerMailCount);
102 } else { 102 } else {
103 popClient->removeSynchronize(); 103 popClient->removeSynchronize();
104 } 104 }
105 105
106 headers = FALSE; 106 headers = FALSE;
107 popClient->headersOnly(headers, 0); 107 popClient->headersOnly(headers, 0);
108 popClient->newConnection(mailAccount.popServer, 110); 108 popClient->newConnection(mailAccount.popServer, 110);
109} 109}
110 110
111void EmailHandler::getMailHeaders() 111void EmailHandler::getMailHeaders()
112{ 112{
113 popClient->setAccount(mailAccount.popUserName, mailAccount.popPasswd); 113 popClient->setAccount(mailAccount.popUserName, mailAccount.popPasswd);
114 if (mailAccount.synchronize) { 114 if (mailAccount.synchronize) {
115 popClient->setSynchronize(mailAccount.lastServerMailCount); 115 popClient->setSynchronize(mailAccount.lastServerMailCount);
116 } else { 116 } else {
117 popClient->removeSynchronize(); 117 popClient->removeSynchronize();
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
125void EmailHandler::getMailByList(MailList *mailList) 125void EmailHandler::getMailByList(MailList *mailList)
126{ 126{
127 if (mailList->count() == 0) { //should not occur though 127 if (mailList->count() == 0) { //should not occur though
128 emit mailTransfered(0); 128 emit mailTransfered(0);
129 return; 129 return;
130 } 130 }
131 131
132 headers = FALSE; 132 headers = FALSE;
133 popClient->headersOnly(FALSE, 0); 133 popClient->headersOnly(FALSE, 0);
134 popClient->newConnection(mailAccount.popServer, 110); 134 popClient->newConnection(mailAccount.popServer, 110);
135 popClient->setSelectedMails(mailList); 135 popClient->setSelectedMails(mailList);
136} 136}
137 137
138void EmailHandler::messageArrived(const QString &message, int id, uint size, bool complete) 138void EmailHandler::messageArrived(const QString &message, int id, uint size, bool complete)
139{ 139{
140 Email mail; 140 Email mail;
141 141
142 mail.rawMail = message; 142 mail.rawMail = message;
143 mail.serverId = id; 143 mail.serverId = id;
144 mail.size = size; 144 mail.size = size;
145 mail.downloaded = complete; 145 mail.downloaded = complete;
@@ -179,60 +179,69 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail)
179 TextParser p(header, lineShift); 179 TextParser p(header, lineShift);
180 180
181 if ((pos = p.find("FROM",':', 0, TRUE)) != -1) { 181 if ((pos = p.find("FROM",':', 0, TRUE)) != -1) {
182 pos++; 182 pos++;
183 if (p.separatorAt(pos) == ' ') { 183 if (p.separatorAt(pos) == ' ') {
184 mail->from = p.getString(&pos, '<', false); 184 mail->from = p.getString(&pos, '<', false);
185 mail->from = mail->from.stripWhiteSpace(); 185 mail->from = mail->from.stripWhiteSpace();
186 if ( (mail->from.length() > 2) && (mail->from[0] == '"') ) { 186 if ( (mail->from.length() > 2) && (mail->from[0] == '"') ) {
187 mail->from = mail->from.left(mail->from.length() - 1); 187 mail->from = mail->from.left(mail->from.length() - 1);
188 mail->from = mail->from.right(mail->from.length() - 1); 188 mail->from = mail->from.right(mail->from.length() - 1);
189 } 189 }
190 pos++; 190 pos++;
191 mail->fromMail = p.getString(&pos, '>', false); 191 mail->fromMail = p.getString(&pos, '>', false);
192 } else { 192 } else {
193 if ((p.separatorAt(pos) == '<') 193 if ((p.separatorAt(pos) == '<')
194 || (p.separatorAt(pos) == ' ')) //No name.. nasty 194 || (p.separatorAt(pos) == ' ')) //No name.. nasty
195 pos++; 195 pos++;
196 pos++; 196 pos++;
197 mail->fromMail = p.getString(&pos, 'z', TRUE); 197 mail->fromMail = p.getString(&pos, 'z', TRUE);
198 if (mail->fromMail.at(mail->fromMail.length()-1) == '>') 198 if (mail->fromMail.at(mail->fromMail.length()-1) == '>')
199 mail->fromMail.truncate(mail->fromMail.length() - 1); 199 mail->fromMail.truncate(mail->fromMail.length() - 1);
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);
206 } 216 }
207 if ((pos = p.find("DATE",':', 0, TRUE)) != -1) { 217 if ((pos = p.find("DATE",':', 0, TRUE)) != -1) {
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") &&
218 (p.separatorAt(pos) == ':') ) { 227 (p.separatorAt(pos) == ':') ) {
219 228
220 id = p.getString(&pos, 'z', TRUE); 229 id = p.getString(&pos, 'z', TRUE);
221 mail->id = id; 230 mail->id = id;
222 } 231 }
223 } 232 }
224 233
225 pos = 0; 234 pos = 0;
226 while ( ((pos = p.find("MIME",'-', pos, TRUE)) != -1) ) { 235 while ( ((pos = p.find("MIME",'-', pos, TRUE)) != -1) ) {
227 pos++; 236 pos++;
228 if ( (p.wordAt(pos).upper() == "VERSION") && 237 if ( (p.wordAt(pos).upper() == "VERSION") &&
229 (p.separatorAt(pos) == ':') ) { 238 (p.separatorAt(pos) == ':') ) {
230 pos++; 239 pos++;
231 if (p.getString(&pos, 'z', true) == "1.0") { 240 if (p.getString(&pos, 'z', true) == "1.0") {
232 mail->mimeType = 1; 241 mail->mimeType = 1;
233 } 242 }
234 } 243 }
235 } 244 }
236 245
237 if (mail->mimeType == 1) { 246 if (mail->mimeType == 1) {
238 boundary = ""; 247 boundary = "";
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
@@ -73,48 +73,49 @@ struct Email
73 int serverId; 73 int serverId;
74 int internalId; 74 int internalId;
75 int fromAccountId; 75 int fromAccountId;
76 QString contentType; //0 = text 76 QString contentType; //0 = text
77 QString contentAttribute; //0 = plain, 1 = html 77 QString contentAttribute; //0 = plain, 1 = html
78 EnclosureList files; 78 EnclosureList files;
79 uint size; 79 uint size;
80 80
81 void addEnclosure(Enclosure *e) 81 void addEnclosure(Enclosure *e)
82 { 82 {
83 files.append(e); 83 files.append(e);
84 } 84 }
85}; 85};
86 86
87struct MailAccount 87struct MailAccount
88{ 88{
89 QString accountName; 89 QString accountName;
90 QString name; 90 QString name;
91 QString emailAddress; 91 QString emailAddress;
92 QString popUserName; 92 QString popUserName;
93 QString popPasswd; 93 QString popPasswd;
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};
100 101
101 const int ErrUnknownResponse = 1001; 102 const int ErrUnknownResponse = 1001;
102 const int ErrLoginFailed = 1002; 103 const int ErrLoginFailed = 1002;
103 const int ErrCancel = 1003; 104 const int ErrCancel = 1003;
104 105
105 106
106class EmailHandler : public QObject 107class EmailHandler : public QObject
107{ 108{
108 Q_OBJECT 109 Q_OBJECT
109 110
110public: 111public:
111 EmailHandler(); 112 EmailHandler();
112 void setAccount(MailAccount account); 113 void setAccount(MailAccount account);
113 void sendMail(QList<Email> *mailList); 114 void sendMail(QList<Email> *mailList);
114 void getMail(); 115 void getMail();
115 void getMailHeaders(); 116 void getMailHeaders();
116 void getMailByList(MailList *mailList); 117 void getMailByList(MailList *mailList);
117 bool parse(QString in, QString lineShift, Email *mail); 118 bool parse(QString in, QString lineShift, Email *mail);
118 bool getEnclosure(Enclosure *ePtr); 119 bool getEnclosure(Enclosure *ePtr);
119 int parse64base(char *src, char *dest); 120 int parse64base(char *src, char *dest);
120 int encodeMime(Email *mail); 121 int encodeMime(Email *mail);
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
@@ -1,64 +1,69 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2001 Trolltech AS. All rights reserved. 2** Copyright (C) 2001 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qt Palmtop Environment. 4** This file is part of Qt Palmtop Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
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)
24 : QListViewItem(parent) 25 : QListViewItem(parent)
25{ 26{
26 QString temp; 27 QString temp;
27 28
28 mail = mailIn; 29 mail = mailIn;
29 30
30 if (inbox) { 31 if (inbox) {
31 setText(0, mail.from); 32 setText(0, mail.from);
32 } else { 33 } else {
33 QStringList::Iterator it = mail.recipients.begin(); 34 QStringList::Iterator it = mail.recipients.begin();
34 temp = *it; 35 temp = *it;
35 if (mail.recipients.count() > 1) 36 if (mail.recipients.count() > 1)
36 temp += "..."; 37 temp += "...";
37 setText(0, temp); 38 setText(0, temp);
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
44Email* EmailListItem::getMail() 49Email* EmailListItem::getMail()
45{ 50{
46 return &mail; 51 return &mail;
47} 52}
48 53
49void EmailListItem::setMail(Email newMail) 54void EmailListItem::setMail(Email newMail)
50{ 55{
51 mail = newMail; 56 mail = newMail;
52 repaint(); 57 repaint();
53} 58}
54 59
55void EmailListItem::setItemSelected(bool enable) 60void EmailListItem::setItemSelected(bool enable)
56{ 61{
57 selected = enable; 62 selected = enable;
58 setSelected(enable); 63 setSelected(enable);
59 repaint(); 64 repaint();
60} 65}
61 66
62bool EmailListItem::isItemSelected() 67bool EmailListItem::isItemSelected()
63{ 68{
64 return selected; 69 return selected;
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
@@ -19,25 +19,42 @@ SOURCES = emailclient.cpp \
19 emailhandler.cpp \ 19 emailhandler.cpp \
20 emaillistitem.cpp \ 20 emaillistitem.cpp \
21 mailitwindow.cpp \ 21 mailitwindow.cpp \
22 main.cpp \ 22 main.cpp \
23 md5.c \ 23 md5.c \
24 popclient.cpp \ 24 popclient.cpp \
25 readmail.cpp \ 25 readmail.cpp \
26 smtpclient.cpp \ 26 smtpclient.cpp \
27 writemail.cpp \ 27 writemail.cpp \
28 textparser.cpp \ 28 textparser.cpp \
29 viewatt.cpp \ 29 viewatt.cpp \
30 addatt.cpp \ 30 addatt.cpp \
31 editaccount.cpp \ 31 editaccount.cpp \
32 maillist.cpp \ 32 maillist.cpp \
33 addresslist.cpp 33 addresslist.cpp
34 34
35INCLUDEPATH += $(OPIEDIR)/include 35INCLUDEPATH += $(OPIEDIR)/include
36DEPENDPATH += $(OPIEDIR)/include 36DEPENDPATH += $(OPIEDIR)/include
37LIBS += -lqpe -lopie 37LIBS += -lqpe -lopie
38# -lssl 38# -lssl
39MOC_DIR=qpeobj 39MOC_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
@@ -1,48 +1,48 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2001 Trolltech AS. All rights reserved. 2** Copyright (C) 2001 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qt Palmtop Environment. 4** This file is part of Qt Palmtop Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "readmail.h" 20#include "readmail.h"
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)
28{ 28{
29 plainTxt = FALSE; 29 plainTxt = FALSE;
30 30
31 init(); 31 init();
32 viewAtt = new ViewAtt(0, "View Attatchments"); 32 viewAtt = new ViewAtt(0, "View Attatchments");
33} 33}
34 34
35ReadMail::~ReadMail() 35ReadMail::~ReadMail()
36{ 36{
37 delete emailView->mimeSourceFactory(); 37 delete emailView->mimeSourceFactory();
38 delete viewAtt; 38 delete viewAtt;
39} 39}
40 40
41void ReadMail::init() 41void ReadMail::init()
42{ 42{
43 setToolBarsMovable(FALSE); 43 setToolBarsMovable(FALSE);
44 44
45 bar = new QToolBar(this); 45 bar = new QToolBar(this);
46 bar->setHorizontalStretchable( TRUE ); 46 bar->setHorizontalStretchable( TRUE );
47 47
48 menu = new QMenuBar( bar ); 48 menu = new QMenuBar( bar );
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
@@ -1,46 +1,46 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2001 Trolltech AS. All rights reserved. 2** Copyright (C) 2001 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qt Palmtop Environment. 4** This file is part of Qt Palmtop Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
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 )
26{ 26{
27 showingAddressList = FALSE; 27 showingAddressList = FALSE;
28 init(); 28 init();
29 29
30 addAtt = new AddAtt(0, "Add Attatchments"); 30 addAtt = new AddAtt(0, "Add Attatchments");
31} 31}
32 32
33WriteMail::~WriteMail() 33WriteMail::~WriteMail()
34{ 34{
35 delete addAtt; 35 delete addAtt;
36} 36}
37 37
38void WriteMail::setAddressList(AddressList *list) 38void WriteMail::setAddressList(AddressList *list)
39{ 39{
40 Contact *cPtr; 40 Contact *cPtr;
41 41
42 addressList = list; 42 addressList = list;
43 43
44 addressView->clear(); 44 addressView->clear();
45 QList<Contact> *cListPtr = addressList->getContactList(); 45 QList<Contact> *cListPtr = addressList->getContactList();
46 QListViewItem *item; 46 QListViewItem *item;
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
@@ -1,90 +1,90 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2001 Trolltech AS. All rights reserved. 2** Copyright (C) 2001 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qt Palmtop Environment. 4** This file is part of Qt Palmtop Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include <qlayout.h> 20#include <qlayout.h>
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)
28 : QListViewItem(parent) 28 : QListViewItem(parent)
29{ 29{
30 /*file = fileInfo; 30 /*file = fileInfo;
31 type = fileType;*/ 31 type = fileType;*/
32 32
33 doclnk=dl; 33 doclnk=dl;
34 34
35 setText(0, doclnk->name()); 35 setText(0, doclnk->name());
36 36
37 /*if (fileType == "Picture") { 37 /*if (fileType == "Picture") {
38 setPixmap(0, Resource::loadPixmap("pixmap")); 38 setPixmap(0, Resource::loadPixmap("pixmap"));
39 } else if (fileType == "Document") { 39 } else if (fileType == "Document") {
40 setPixmap(0, Resource::loadPixmap("txt")); 40 setPixmap(0, Resource::loadPixmap("txt"));
41 } else if (fileType == "Sound") { 41 } else if (fileType == "Sound") {
42 setPixmap(0, Resource::loadPixmap("play")); 42 setPixmap(0, Resource::loadPixmap("play"));
43 } else if (fileType == "Movie") { 43 } else if (fileType == "Movie") {
44 setPixmap(0, Resource::loadPixmap("MPEGPlayer")); 44 setPixmap(0, Resource::loadPixmap("MPEGPlayer"));
45 } else if (fileType == "File") { 45 } else if (fileType == "File") {
46 setPixmap(0, Resource::loadPixmap("exec")); 46 setPixmap(0, Resource::loadPixmap("exec"));
47 }*/ 47 }*/
48} 48}
49 49
50FileItem::~FileItem() 50FileItem::~FileItem()
51{ 51{
52 if (doclnk!=NULL) delete doclnk; 52 if (doclnk!=NULL) delete doclnk;
53 doclnk=NULL; 53 doclnk=NULL;
54} 54}
55 55
56AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f) 56AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f)
57 : QDialog(parent, name, f) 57 : QDialog(parent, name, f)
58{ 58{
59 setCaption("Adding attatchments"); 59 setCaption("Adding attatchments");
60 60
61 QGridLayout *top = new QGridLayout(this, 1,1 ); 61 QGridLayout *top = new QGridLayout(this, 1,1 );
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);
70 fileCategories->insertItem("Document"); 70 fileCategories->insertItem("Document");
71 fileCategories->insertItem("Picture"); 71 fileCategories->insertItem("Picture");
72 fileCategories->insertItem("Sound"); 72 fileCategories->insertItem("Sound");
73 fileCategories->insertItem("Movie"); 73 fileCategories->insertItem("Movie");
74 fileCategories->insertItem("File"); 74 fileCategories->insertItem("File");
75 75
76 fileCategoryButton->setText("Document"); 76 fileCategoryButton->setText("Document");
77 top->addWidget(fileCategoryButton, 0, 0);*/ 77 top->addWidget(fileCategoryButton, 0, 0);*/
78 78
79 79
80 top->addWidget(buttons,1,0); 80 top->addWidget(buttons,1,0);
81 //buttons->addWidget(attatchButton,0,0); 81 //buttons->addWidget(attatchButton,0,0);
82 //buttons->addWidget(removeButton,0,1); 82 //buttons->addWidget(removeButton,0,1);
83 83
84 //connect(fileCategories, SIGNAL(activated(int)), this, 84 //connect(fileCategories, SIGNAL(activated(int)), this,
85 //SLOT(fileCategorySelected(int)) );*/ 85 //SLOT(fileCategorySelected(int)) );*/
86 connect(attatchButton, SIGNAL(clicked()), this, 86 connect(attatchButton, SIGNAL(clicked()), this,
87 SLOT(addAttatchment()) ); 87 SLOT(addAttatchment()) );
88 connect(removeButton, SIGNAL(clicked()), this, 88 connect(removeButton, SIGNAL(clicked()), this,
89 SLOT(removeAttatchment()) ); 89 SLOT(removeAttatchment()) );
90 90
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
@@ -3,59 +3,57 @@
3** 3**
4** This file is part of Qt Palmtop Environment. 4** This file is part of Qt Palmtop Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include <qfile.h> 20#include <qfile.h>
21#include <qtextstream.h> 21#include <qtextstream.h>
22#include <opie/ocontactaccess.h> 22#include <opie/ocontactaccess.h>
23#include <opie/ocontact.h> 23#include <opie/ocontact.h>
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
41void AddressList::addContact(QString email, QString name) 39void AddressList::addContact(QString email, QString name)
42{ 40{
43 //skip if not a valid email address, 41 //skip if not a valid email address,
44 if (email.find( '@') == -1) 42 if (email.find( '@') == -1)
45 return; 43 return;
46 44
47 if ( ! containsEmail(email) ) { 45 if ( ! containsEmail(email) ) {
48 Contact *in = new Contact; 46 Contact *in = new Contact;
49 in->email = email; 47 in->email = email;
50 in->name = name; 48 in->name = name;
51 addresses.append(in); 49 addresses.append(in);
52 dirty = TRUE; 50 dirty = TRUE;
53 } 51 }
54} 52}
55 53
56bool AddressList::containsEmail(QString email) 54bool AddressList::containsEmail(QString email)
57{ 55{
58 return ( getEmailRef(email) != -1 ); 56 return ( getEmailRef(email) != -1 );
59} 57}
60 58
61bool AddressList::containsName(QString name) 59bool AddressList::containsName(QString name)
@@ -99,83 +97,65 @@ int AddressList::getEmailRef(QString email)
99} 97}
100 98
101int AddressList::getNameRef(QString name) 99int AddressList::getNameRef(QString name)
102{ 100{
103 int pos = 0; 101 int pos = 0;
104 Contact *ptr; 102 Contact *ptr;
105 103
106 for (ptr = addresses.first(); ptr != 0; ptr = addresses.next() ) { 104 for (ptr = addresses.first(); ptr != 0; ptr = addresses.next() ) {
107 if (ptr->name == name) 105 if (ptr->name == name)
108 return pos; 106 return pos;
109 pos++; 107 pos++;
110 } 108 }
111 return -1; 109 return -1;
112} 110}
113 111
114QList<Contact>* AddressList::getContactList() 112QList<Contact>* AddressList::getContactList()
115{ 113{
116 return &addresses; 114 return &addresses;
117} 115}
118 116
119void AddressList::read() 117void 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 );
127 //OContact* oc; 124 //OContact* oc;
128 125
129 for ( it = m_list.begin(); it != m_list.end(); ++it ) 126 for ( it = m_list.begin(); it != m_list.end(); ++it )
130 { 127 {
131 //oc=(OContact*) it; 128 //oc=(OContact*) it;
132 if ((*it).defaultEmail().length()!=0) 129 if ((*it).defaultEmail().length()!=0)
133 addContact((*it).defaultEmail(),(*it).fullName()); 130 addContact((*it).defaultEmail(),(*it).fullName());
134 } 131 }
135 132
136 /*if (! f.open(IO_ReadOnly) ) 133 /*if (! f.open(IO_ReadOnly) )
137 return; 134 return;
138 135
139 QTextStream stream(&f); 136 QTextStream stream(&f);
140 137
141 while (! stream.atEnd() ) { 138 while (! stream.atEnd() ) {
142 lineEmail = stream.readLine(); 139 lineEmail = stream.readLine();
143 if (! stream.atEnd() ) 140 if (! stream.atEnd() )
144 lineName = stream.readLine(); 141 lineName = stream.readLine();
145 else return; 142 else return;
146 143
147 email = getRightString(lineEmail); 144 email = getRightString(lineEmail);
148 name = getRightString(lineName); 145 name = getRightString(lineName);
149 addContact(email, name); 146 addContact(email, name);
150 } 147 }
151 f.close();*/ 148 f.close();*/
152} 149}
153 150
154QString AddressList::getRightString(QString in) 151QString AddressList::getRightString(QString in)
155{ 152{
156 QString out = ""; 153 QString out = "";
157 154
158 int pos = in.find('='); 155 int pos = in.find('=');
159 if (pos != -1) { 156 if (pos != -1) {
160 out = in.mid(pos+1).stripWhiteSpace(); 157 out = in.mid(pos+1).stripWhiteSpace();
161 } 158 }
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
@@ -13,47 +13,46 @@
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#ifndef ADDRESSLIST_H 20#ifndef ADDRESSLIST_H
21#define ADDRESSLIST_H 21#define ADDRESSLIST_H
22 22
23#include <qobject.h> 23#include <qobject.h>
24#include <qlist.h> 24#include <qlist.h>
25 25
26struct Contact 26struct Contact
27{ 27{
28 QString email; 28 QString email;
29 QString name; 29 QString name;
30}; 30};
31 31
32class AddressList : public QObject 32class AddressList : public QObject
33{ 33{
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);
41 bool containsName(QString name); 41 bool containsName(QString name);
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);
49 int getNameRef(QString name); 48 int getNameRef(QString name);
50 QString getRightString(QString in); 49 QString getRightString(QString in);
51 void read(); 50 void read();
52 51
53private: 52private:
54 QList<Contact> addresses; 53 QList<Contact> addresses;
55 QString filename; 54 QString filename;
56 bool dirty; 55 bool dirty;
57}; 56};
58 57
59#endif 58#endif
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
@@ -1,120 +1,133 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2001 Trolltech AS. All rights reserved. 2** Copyright (C) 2001 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qt Palmtop Environment. 4** This file is part of Qt Palmtop Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
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 )
24 : QDialog(parent, name, fl) 25 : QDialog(parent, name, fl)
25{ 26{
26 setCaption( tr("Edit Account") ); 27 setCaption( tr("Edit Account") );
27 init(); 28 init();
28 popPasswInput->setEchoMode(QLineEdit::Password); 29 popPasswInput->setEchoMode(QLineEdit::Password);
29} 30}
30 31
31void EditAccount::setAccount(MailAccount *in, bool newOne) 32void EditAccount::setAccount(MailAccount *in, bool newOne)
32{ 33{
33 account = in; 34 account = in;
34 if (newOne) { 35 if (newOne) {
35 accountNameInput->setText(""); 36 accountNameInput->setText("");
36 nameInput->setText(""); 37 nameInput->setText("");
37 emailInput->setText(""); 38 emailInput->setText("");
38 popUserInput->setText(""); 39 popUserInput->setText("");
39 popPasswInput->setText(""); 40 popPasswInput->setText("");
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 {
46 accountNameInput->setText(account->accountName); 48 accountNameInput->setText(account->accountName);
47 nameInput->setText(account->name); 49 nameInput->setText(account->name);
48 emailInput->setText(account->emailAddress); 50 emailInput->setText(account->emailAddress);
49 popUserInput->setText(account->popUserName); 51 popUserInput->setText(account->popUserName);
50 popPasswInput->setText(account->popPasswd); 52 popPasswInput->setText(account->popPasswd);
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
57void EditAccount::init() 60void EditAccount::init()
58{ 61{
59 grid = new QGridLayout(this); 62 grid = new QGridLayout(this);
60 grid->setSpacing( 6 ); 63 grid->setSpacing( 6 );
61 grid->setMargin( 11 ); 64 grid->setMargin( 11 );
62 65
63 accountNameInputLabel = new QLabel(tr("Account name"), this); 66 accountNameInputLabel = new QLabel(tr("Account name"), this);
64 grid->addWidget( accountNameInputLabel, 0, 0 ); 67 grid->addWidget( accountNameInputLabel, 0, 0 );
65 accountNameInput = new QLineEdit( this, "account nameInput" ); 68 accountNameInput = new QLineEdit( this, "account nameInput" );
66 grid->addWidget( accountNameInput, 0, 1 ); 69 grid->addWidget( accountNameInput, 0, 1 );
67 70
68 nameInputLabel = new QLabel(tr("Your name"), this); 71 nameInputLabel = new QLabel(tr("Your name"), this);
69 grid->addWidget( nameInputLabel, 1, 0 ); 72 grid->addWidget( nameInputLabel, 1, 0 );
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
104void EditAccount::accept() 116void EditAccount::accept()
105{ 117{
106 account->accountName = accountNameInput->text(); 118 account->accountName = accountNameInput->text();
107 account->name = nameInput->text(); 119 account->name = nameInput->text();
108 account->emailAddress = emailInput->text(); 120 account->emailAddress = emailInput->text();
109 account->popUserName = popUserInput->text(); 121 account->popUserName = popUserInput->text();
110 account->popPasswd = popPasswInput->text(); 122 account->popPasswd = popPasswInput->text();
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}
117 130
118void EditAccount::reject() 131void EditAccount::reject()
119{ 132{
120} 133}
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
@@ -4,63 +4,66 @@
4** This file is part of Qt Palmtop Environment. 4** This file is part of Qt Palmtop Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#ifndef EDITACCOUNT_H 20#ifndef EDITACCOUNT_H
21#define EDITACCOUNT_H 21#define EDITACCOUNT_H
22 22
23#include <qdialog.h> 23#include <qdialog.h>
24#include <qlabel.h> 24#include <qlabel.h>
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
31{ 32{
32 Q_OBJECT 33 Q_OBJECT
33 34
34public: 35public:
35 EditAccount( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 36 EditAccount( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
36 void setAccount(MailAccount *in, bool newOne = TRUE); 37 void setAccount(MailAccount *in, bool newOne = TRUE);
37 void init(); 38 void init();
38 39
39public slots: 40public slots:
40 void accept(); 41 void accept();
41 void reject(); 42 void reject();
42 43
43private: 44private:
44 MailAccount thisAccount, *account; 45 MailAccount thisAccount, *account;
45 46
46 QLabel *accountNameInputLabel; 47 QLabel *accountNameInputLabel;
47 QLabel *nameInputLabel; 48 QLabel *nameInputLabel;
48 QLabel *emailInputLabel; 49 QLabel *emailInputLabel;
49 QLabel *popUserInputLabel; 50 QLabel *popUserInputLabel;
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;
56 QLineEdit *emailInput; 58 QLineEdit *emailInput;
57 QLineEdit *popUserInput; 59 QLineEdit *popUserInput;
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;
64}; 67};
65 68
66#endif 69#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
@@ -2,67 +2,67 @@
2** Copyright (C) 2001 Trolltech AS. All rights reserved. 2** Copyright (C) 2001 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qt Palmtop Environment. 4** This file is part of Qt Palmtop Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include <qapplication.h> 20#include <qapplication.h>
21#include <qmessagebox.h> 21#include <qmessagebox.h>
22#include <qfile.h> 22#include <qfile.h>
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)
30{ 30{
31 return dupl( (MailAccount *) d); 31 return dupl( (MailAccount *) d);
32} 32}
33 33
34MailAccount* AccountList::dupl(MailAccount *in) 34MailAccount* AccountList::dupl(MailAccount *in)
35{ 35{
36 ac = new MailAccount(*in); 36 ac = new MailAccount(*in);
37 return ac; 37 return ac;
38} 38}
39 39
40EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) 40EmailClient::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;
48 previewingMail = FALSE; 48 previewingMail = FALSE;
49 mailIdCount = 1; 49 mailIdCount = 1;
50 accountIdCount = 1; 50 accountIdCount = 1;
51 allAccounts = FALSE; 51 allAccounts = FALSE;
52 52
53 init(); 53 init();
54 54
55 connect(emailHandler, SIGNAL(mailSent()), this, SLOT(mailSent()) ); 55 connect(emailHandler, SIGNAL(mailSent()), this, SLOT(mailSent()) );
56 56
57 connect(emailHandler, SIGNAL(smtpError(int)), this, 57 connect(emailHandler, SIGNAL(smtpError(int)), this,
58 SLOT(smtpError(int)) ); 58 SLOT(smtpError(int)) );
59 connect(emailHandler, SIGNAL(popError(int)), this, 59 connect(emailHandler, SIGNAL(popError(int)), this,
60 SLOT(popError(int)) ); 60 SLOT(popError(int)) );
61 61
62 connect(inboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(inboxItemSelected()) ); 62 connect(inboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(inboxItemSelected()) );
63 connect(outboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(outboxItemSelected()) ); 63 connect(outboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(outboxItemSelected()) );
64 64
65 connect(emailHandler, SIGNAL(mailArrived(const Email &, bool)), this, 65 connect(emailHandler, SIGNAL(mailArrived(const Email &, bool)), this,
66 SLOT(mailArrived(const Email &, bool)) ); 66 SLOT(mailArrived(const Email &, bool)) );
67 connect(emailHandler, SIGNAL(mailTransfered(int)), this, 67 connect(emailHandler, SIGNAL(mailTransfered(int)), this,
68 SLOT(allMailArrived(int)) ); 68 SLOT(allMailArrived(int)) );
@@ -650,93 +650,101 @@ void EmailClient::readSettings()
650 if ( (pos = p->find("POPUSER",':', accountPos, TRUE)) != -1) 650 if ( (pos = p->find("POPUSER",':', accountPos, TRUE)) != -1)
651 account.popUserName = p->getString(& ++pos, 'z', TRUE); 651 account.popUserName = p->getString(& ++pos, 'z', TRUE);
652 if ( (pos = p->find("POPPASSWORD",':', accountPos, TRUE)) != -1) 652 if ( (pos = p->find("POPPASSWORD",':', accountPos, TRUE)) != -1)
653 account.popPasswd = p->getString(& ++pos, 'z', TRUE); 653 account.popPasswd = p->getString(& ++pos, 'z', TRUE);
654 if ( (pos = p->find("POPSERVER",':', accountPos, TRUE)) != -1) 654 if ( (pos = p->find("POPSERVER",':', accountPos, TRUE)) != -1)
655 account.popServer = p->getString(& ++pos, 'z', TRUE); 655 account.popServer = p->getString(& ++pos, 'z', TRUE);
656 if ( (pos = p->find("SMTPSERVER",':', accountPos, TRUE)) != -1) 656 if ( (pos = p->find("SMTPSERVER",':', accountPos, TRUE)) != -1)
657 account.smtpServer = p->getString(& ++pos, 'z', TRUE); 657 account.smtpServer = p->getString(& ++pos, 'z', TRUE);
658 if ( (pos = p->find("ACCOUNTID",':', accountPos, TRUE)) != -1) { 658 if ( (pos = p->find("ACCOUNTID",':', accountPos, TRUE)) != -1) {
659 s = p->getString(& ++pos, 'z', TRUE); 659 s = p->getString(& ++pos, 'z', TRUE);
660 account.id = s.toInt(); 660 account.id = s.toInt();
661 } 661 }
662 662
663 account.lastServerMailCount = 0; 663 account.lastServerMailCount = 0;
664 account.synchronize = FALSE; 664 account.synchronize = FALSE;
665 if ( (pos = p->find("SYNCHRONIZE",':', accountPos, TRUE)) != -1) { 665 if ( (pos = p->find("SYNCHRONIZE",':', accountPos, TRUE)) != -1) {
666 if (p->getString(& ++pos, 'z', TRUE).upper() == "YES") { 666 if (p->getString(& ++pos, 'z', TRUE).upper() == "YES") {
667 account.synchronize = TRUE; 667 account.synchronize = TRUE;
668 if ( (pos = p->find("LASTSERVERMAILCOUNT",':', accountPos, TRUE)) != -1) { 668 if ( (pos = p->find("LASTSERVERMAILCOUNT",':', accountPos, TRUE)) != -1) {
669 s = p->getString(& ++pos, 'z', TRUE); 669 s = p->getString(& ++pos, 'z', TRUE);
670 account.lastServerMailCount = s.toInt(); 670 account.lastServerMailCount = s.toInt();
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;
677 } 683 }
678 mailconf->setGroup("mailitglobal"); 684 mailconf->setGroup("mailitglobal");
679 if ( (y = mailconf->readNumEntry("mailidcount", -1)) != -1) { 685 if ( (y = mailconf->readNumEntry("mailidcount", -1)) != -1) {
680 mailIdCount = y; 686 mailIdCount = y;
681 } 687 }
682 if ( (y = mailconf->readNumEntry("accountidcount", -1)) != -1) { 688 if ( (y = mailconf->readNumEntry("accountidcount", -1)) != -1) {
683 accountIdCount = y; 689 accountIdCount = y;
684 } 690 }
685} 691}
686 692
687void EmailClient::saveSettings() 693void EmailClient::saveSettings()
688{ 694{
689 QString temp; 695 QString temp;
690 QFile f( getPath(FALSE) + "settings.txt"); 696 QFile f( getPath(FALSE) + "settings.txt");
691 MailAccount *accountPtr; 697 MailAccount *accountPtr;
692 698
693 if (! f.open(IO_WriteOnly) ) { 699 if (! f.open(IO_WriteOnly) ) {
694 qWarning("could not save settings file"); 700 qWarning("could not save settings file");
695 return; 701 return;
696 } 702 }
697 QTextStream t(&f); 703 QTextStream t(&f);
698 t << "#Settings for QPE Mailit program\n"; 704 t << "#Settings for QPE Mailit program\n";
699 705
700 for (accountPtr = accountList.first(); accountPtr != 0; 706 for (accountPtr = accountList.first(); accountPtr != 0;
701 accountPtr = accountList.next()) { 707 accountPtr = accountList.next()) {
702 708
703 t << "accountStart;\n"; 709 t << "accountStart;\n";
704 t << "AccountName: " + accountPtr->accountName + "\n"; 710 t << "AccountName: " + accountPtr->accountName + "\n";
705 t << "Name: " + accountPtr->name + "\n"; 711 t << "Name: " + accountPtr->name + "\n";
706 t << "Email: " + accountPtr->emailAddress + "\n"; 712 t << "Email: " + accountPtr->emailAddress + "\n";
707 t << "POPUser: " + accountPtr->popUserName + "\n"; 713 t << "POPUser: " + accountPtr->popUserName + "\n";
708 t << "POPPAssword: " + accountPtr->popPasswd + "\n"; 714 t << "POPPAssword: " + accountPtr->popPasswd + "\n";
709 t << "POPServer: " + accountPtr->popServer + "\n"; 715 t << "POPServer: " + accountPtr->popServer + "\n";
710 t << "SMTPServer: " + accountPtr->smtpServer + "\n"; 716 t << "SMTPServer: " + accountPtr->smtpServer + "\n";
711 t << "AccountId: " << accountPtr->id << "\n"; 717 t << "AccountId: " << accountPtr->id << "\n";
712 if (accountPtr->synchronize) { 718 if (accountPtr->synchronize) {
713 t << "Synchronize: Yes\n"; 719 t << "Synchronize: Yes\n";
714 t << "LastServerMailCount: "; 720 t << "LastServerMailCount: ";
715 t << accountPtr->lastServerMailCount << "\n"; 721 t << accountPtr->lastServerMailCount << "\n";
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();
722 730
723 mailconf->setGroup("mailitglobal"); 731 mailconf->setGroup("mailitglobal");
724 mailconf->writeEntry("mailidcount", mailIdCount); 732 mailconf->writeEntry("mailidcount", mailIdCount);
725 mailconf->writeEntry("accountidcount", accountIdCount); 733 mailconf->writeEntry("accountidcount", accountIdCount);
726} 734}
727 735
728void EmailClient::selectAccount(int id) 736void EmailClient::selectAccount(int id)
729{ 737{
730 if (accountList.count() > 0) { 738 if (accountList.count() > 0) {
731 currentAccount = accountList.at(id); 739 currentAccount = accountList.at(id);
732 emit newCaption("Mailit - " + currentAccount->accountName); 740 emit newCaption("Mailit - " + currentAccount->accountName);
733 getNewMail(); 741 getNewMail();
734 } else { 742 } else {
735 emit newCaption("Mailit ! No account defined"); 743 emit newCaption("Mailit ! No account defined");
736 } 744 }
737} 745}
738 746
739void EmailClient::editAccount(int id) 747void EmailClient::editAccount(int id)
740{ 748{
741 MailAccount *newAccount; 749 MailAccount *newAccount;
742 750
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
@@ -97,49 +97,49 @@ void EmailHandler::setAccount(MailAccount account)
97void EmailHandler::getMail() 97void EmailHandler::getMail()
98{ 98{
99 popClient->setAccount(mailAccount.popUserName, mailAccount.popPasswd); 99 popClient->setAccount(mailAccount.popUserName, mailAccount.popPasswd);
100 if (mailAccount.synchronize) { 100 if (mailAccount.synchronize) {
101 popClient->setSynchronize(mailAccount.lastServerMailCount); 101 popClient->setSynchronize(mailAccount.lastServerMailCount);
102 } else { 102 } else {
103 popClient->removeSynchronize(); 103 popClient->removeSynchronize();
104 } 104 }
105 105
106 headers = FALSE; 106 headers = FALSE;
107 popClient->headersOnly(headers, 0); 107 popClient->headersOnly(headers, 0);
108 popClient->newConnection(mailAccount.popServer, 110); 108 popClient->newConnection(mailAccount.popServer, 110);
109} 109}
110 110
111void EmailHandler::getMailHeaders() 111void EmailHandler::getMailHeaders()
112{ 112{
113 popClient->setAccount(mailAccount.popUserName, mailAccount.popPasswd); 113 popClient->setAccount(mailAccount.popUserName, mailAccount.popPasswd);
114 if (mailAccount.synchronize) { 114 if (mailAccount.synchronize) {
115 popClient->setSynchronize(mailAccount.lastServerMailCount); 115 popClient->setSynchronize(mailAccount.lastServerMailCount);
116 } else { 116 } else {
117 popClient->removeSynchronize(); 117 popClient->removeSynchronize();
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
125void EmailHandler::getMailByList(MailList *mailList) 125void EmailHandler::getMailByList(MailList *mailList)
126{ 126{
127 if (mailList->count() == 0) { //should not occur though 127 if (mailList->count() == 0) { //should not occur though
128 emit mailTransfered(0); 128 emit mailTransfered(0);
129 return; 129 return;
130 } 130 }
131 131
132 headers = FALSE; 132 headers = FALSE;
133 popClient->headersOnly(FALSE, 0); 133 popClient->headersOnly(FALSE, 0);
134 popClient->newConnection(mailAccount.popServer, 110); 134 popClient->newConnection(mailAccount.popServer, 110);
135 popClient->setSelectedMails(mailList); 135 popClient->setSelectedMails(mailList);
136} 136}
137 137
138void EmailHandler::messageArrived(const QString &message, int id, uint size, bool complete) 138void EmailHandler::messageArrived(const QString &message, int id, uint size, bool complete)
139{ 139{
140 Email mail; 140 Email mail;
141 141
142 mail.rawMail = message; 142 mail.rawMail = message;
143 mail.serverId = id; 143 mail.serverId = id;
144 mail.size = size; 144 mail.size = size;
145 mail.downloaded = complete; 145 mail.downloaded = complete;
@@ -179,60 +179,69 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail)
179 TextParser p(header, lineShift); 179 TextParser p(header, lineShift);
180 180
181 if ((pos = p.find("FROM",':', 0, TRUE)) != -1) { 181 if ((pos = p.find("FROM",':', 0, TRUE)) != -1) {
182 pos++; 182 pos++;
183 if (p.separatorAt(pos) == ' ') { 183 if (p.separatorAt(pos) == ' ') {
184 mail->from = p.getString(&pos, '<', false); 184 mail->from = p.getString(&pos, '<', false);
185 mail->from = mail->from.stripWhiteSpace(); 185 mail->from = mail->from.stripWhiteSpace();
186 if ( (mail->from.length() > 2) && (mail->from[0] == '"') ) { 186 if ( (mail->from.length() > 2) && (mail->from[0] == '"') ) {
187 mail->from = mail->from.left(mail->from.length() - 1); 187 mail->from = mail->from.left(mail->from.length() - 1);
188 mail->from = mail->from.right(mail->from.length() - 1); 188 mail->from = mail->from.right(mail->from.length() - 1);
189 } 189 }
190 pos++; 190 pos++;
191 mail->fromMail = p.getString(&pos, '>', false); 191 mail->fromMail = p.getString(&pos, '>', false);
192 } else { 192 } else {
193 if ((p.separatorAt(pos) == '<') 193 if ((p.separatorAt(pos) == '<')
194 || (p.separatorAt(pos) == ' ')) //No name.. nasty 194 || (p.separatorAt(pos) == ' ')) //No name.. nasty
195 pos++; 195 pos++;
196 pos++; 196 pos++;
197 mail->fromMail = p.getString(&pos, 'z', TRUE); 197 mail->fromMail = p.getString(&pos, 'z', TRUE);
198 if (mail->fromMail.at(mail->fromMail.length()-1) == '>') 198 if (mail->fromMail.at(mail->fromMail.length()-1) == '>')
199 mail->fromMail.truncate(mail->fromMail.length() - 1); 199 mail->fromMail.truncate(mail->fromMail.length() - 1);
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);
206 } 216 }
207 if ((pos = p.find("DATE",':', 0, TRUE)) != -1) { 217 if ((pos = p.find("DATE",':', 0, TRUE)) != -1) {
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") &&
218 (p.separatorAt(pos) == ':') ) { 227 (p.separatorAt(pos) == ':') ) {
219 228
220 id = p.getString(&pos, 'z', TRUE); 229 id = p.getString(&pos, 'z', TRUE);
221 mail->id = id; 230 mail->id = id;
222 } 231 }
223 } 232 }
224 233
225 pos = 0; 234 pos = 0;
226 while ( ((pos = p.find("MIME",'-', pos, TRUE)) != -1) ) { 235 while ( ((pos = p.find("MIME",'-', pos, TRUE)) != -1) ) {
227 pos++; 236 pos++;
228 if ( (p.wordAt(pos).upper() == "VERSION") && 237 if ( (p.wordAt(pos).upper() == "VERSION") &&
229 (p.separatorAt(pos) == ':') ) { 238 (p.separatorAt(pos) == ':') ) {
230 pos++; 239 pos++;
231 if (p.getString(&pos, 'z', true) == "1.0") { 240 if (p.getString(&pos, 'z', true) == "1.0") {
232 mail->mimeType = 1; 241 mail->mimeType = 1;
233 } 242 }
234 } 243 }
235 } 244 }
236 245
237 if (mail->mimeType == 1) { 246 if (mail->mimeType == 1) {
238 boundary = ""; 247 boundary = "";
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
@@ -73,48 +73,49 @@ struct Email
73 int serverId; 73 int serverId;
74 int internalId; 74 int internalId;
75 int fromAccountId; 75 int fromAccountId;
76 QString contentType; //0 = text 76 QString contentType; //0 = text
77 QString contentAttribute; //0 = plain, 1 = html 77 QString contentAttribute; //0 = plain, 1 = html
78 EnclosureList files; 78 EnclosureList files;
79 uint size; 79 uint size;
80 80
81 void addEnclosure(Enclosure *e) 81 void addEnclosure(Enclosure *e)
82 { 82 {
83 files.append(e); 83 files.append(e);
84 } 84 }
85}; 85};
86 86
87struct MailAccount 87struct MailAccount
88{ 88{
89 QString accountName; 89 QString accountName;
90 QString name; 90 QString name;
91 QString emailAddress; 91 QString emailAddress;
92 QString popUserName; 92 QString popUserName;
93 QString popPasswd; 93 QString popPasswd;
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};
100 101
101 const int ErrUnknownResponse = 1001; 102 const int ErrUnknownResponse = 1001;
102 const int ErrLoginFailed = 1002; 103 const int ErrLoginFailed = 1002;
103 const int ErrCancel = 1003; 104 const int ErrCancel = 1003;
104 105
105 106
106class EmailHandler : public QObject 107class EmailHandler : public QObject
107{ 108{
108 Q_OBJECT 109 Q_OBJECT
109 110
110public: 111public:
111 EmailHandler(); 112 EmailHandler();
112 void setAccount(MailAccount account); 113 void setAccount(MailAccount account);
113 void sendMail(QList<Email> *mailList); 114 void sendMail(QList<Email> *mailList);
114 void getMail(); 115 void getMail();
115 void getMailHeaders(); 116 void getMailHeaders();
116 void getMailByList(MailList *mailList); 117 void getMailByList(MailList *mailList);
117 bool parse(QString in, QString lineShift, Email *mail); 118 bool parse(QString in, QString lineShift, Email *mail);
118 bool getEnclosure(Enclosure *ePtr); 119 bool getEnclosure(Enclosure *ePtr);
119 int parse64base(char *src, char *dest); 120 int parse64base(char *src, char *dest);
120 int encodeMime(Email *mail); 121 int encodeMime(Email *mail);
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
@@ -1,64 +1,69 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2001 Trolltech AS. All rights reserved. 2** Copyright (C) 2001 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qt Palmtop Environment. 4** This file is part of Qt Palmtop Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
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)
24 : QListViewItem(parent) 25 : QListViewItem(parent)
25{ 26{
26 QString temp; 27 QString temp;
27 28
28 mail = mailIn; 29 mail = mailIn;
29 30
30 if (inbox) { 31 if (inbox) {
31 setText(0, mail.from); 32 setText(0, mail.from);
32 } else { 33 } else {
33 QStringList::Iterator it = mail.recipients.begin(); 34 QStringList::Iterator it = mail.recipients.begin();
34 temp = *it; 35 temp = *it;
35 if (mail.recipients.count() > 1) 36 if (mail.recipients.count() > 1)
36 temp += "..."; 37 temp += "...";
37 setText(0, temp); 38 setText(0, temp);
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
44Email* EmailListItem::getMail() 49Email* EmailListItem::getMail()
45{ 50{
46 return &mail; 51 return &mail;
47} 52}
48 53
49void EmailListItem::setMail(Email newMail) 54void EmailListItem::setMail(Email newMail)
50{ 55{
51 mail = newMail; 56 mail = newMail;
52 repaint(); 57 repaint();
53} 58}
54 59
55void EmailListItem::setItemSelected(bool enable) 60void EmailListItem::setItemSelected(bool enable)
56{ 61{
57 selected = enable; 62 selected = enable;
58 setSelected(enable); 63 setSelected(enable);
59 repaint(); 64 repaint();
60} 65}
61 66
62bool EmailListItem::isItemSelected() 67bool EmailListItem::isItemSelected()
63{ 68{
64 return selected; 69 return selected;
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
@@ -19,25 +19,42 @@ SOURCES = emailclient.cpp \
19 emailhandler.cpp \ 19 emailhandler.cpp \
20 emaillistitem.cpp \ 20 emaillistitem.cpp \
21 mailitwindow.cpp \ 21 mailitwindow.cpp \
22 main.cpp \ 22 main.cpp \
23 md5.c \ 23 md5.c \
24 popclient.cpp \ 24 popclient.cpp \
25 readmail.cpp \ 25 readmail.cpp \
26 smtpclient.cpp \ 26 smtpclient.cpp \
27 writemail.cpp \ 27 writemail.cpp \
28 textparser.cpp \ 28 textparser.cpp \
29 viewatt.cpp \ 29 viewatt.cpp \
30 addatt.cpp \ 30 addatt.cpp \
31 editaccount.cpp \ 31 editaccount.cpp \
32 maillist.cpp \ 32 maillist.cpp \
33 addresslist.cpp 33 addresslist.cpp
34 34
35INCLUDEPATH += $(OPIEDIR)/include 35INCLUDEPATH += $(OPIEDIR)/include
36DEPENDPATH += $(OPIEDIR)/include 36DEPENDPATH += $(OPIEDIR)/include
37LIBS += -lqpe -lopie 37LIBS += -lqpe -lopie
38# -lssl 38# -lssl
39MOC_DIR=qpeobj 39MOC_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
@@ -1,48 +1,48 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2001 Trolltech AS. All rights reserved. 2** Copyright (C) 2001 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qt Palmtop Environment. 4** This file is part of Qt Palmtop Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "readmail.h" 20#include "readmail.h"
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)
28{ 28{
29 plainTxt = FALSE; 29 plainTxt = FALSE;
30 30
31 init(); 31 init();
32 viewAtt = new ViewAtt(0, "View Attatchments"); 32 viewAtt = new ViewAtt(0, "View Attatchments");
33} 33}
34 34
35ReadMail::~ReadMail() 35ReadMail::~ReadMail()
36{ 36{
37 delete emailView->mimeSourceFactory(); 37 delete emailView->mimeSourceFactory();
38 delete viewAtt; 38 delete viewAtt;
39} 39}
40 40
41void ReadMail::init() 41void ReadMail::init()
42{ 42{
43 setToolBarsMovable(FALSE); 43 setToolBarsMovable(FALSE);
44 44
45 bar = new QToolBar(this); 45 bar = new QToolBar(this);
46 bar->setHorizontalStretchable( TRUE ); 46 bar->setHorizontalStretchable( TRUE );
47 47
48 menu = new QMenuBar( bar ); 48 menu = new QMenuBar( bar );
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
@@ -1,46 +1,46 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2001 Trolltech AS. All rights reserved. 2** Copyright (C) 2001 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qt Palmtop Environment. 4** This file is part of Qt Palmtop Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
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 )
26{ 26{
27 showingAddressList = FALSE; 27 showingAddressList = FALSE;
28 init(); 28 init();
29 29
30 addAtt = new AddAtt(0, "Add Attatchments"); 30 addAtt = new AddAtt(0, "Add Attatchments");
31} 31}
32 32
33WriteMail::~WriteMail() 33WriteMail::~WriteMail()
34{ 34{
35 delete addAtt; 35 delete addAtt;
36} 36}
37 37
38void WriteMail::setAddressList(AddressList *list) 38void WriteMail::setAddressList(AddressList *list)
39{ 39{
40 Contact *cPtr; 40 Contact *cPtr;
41 41
42 addressList = list; 42 addressList = list;
43 43
44 addressView->clear(); 44 addressView->clear();
45 QList<Contact> *cListPtr = addressList->getContactList(); 45 QList<Contact> *cListPtr = addressList->getContactList();
46 QListViewItem *item; 46 QListViewItem *item;