summaryrefslogtreecommitdiff
path: root/noncore/unsupported/mailit
Unidiff
Diffstat (limited to 'noncore/unsupported/mailit') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/mailit/addatt.cpp4
-rw-r--r--noncore/unsupported/mailit/emailclient.cpp32
-rw-r--r--noncore/unsupported/mailit/emailhandler.cpp22
-rw-r--r--noncore/unsupported/mailit/mailitwindow.cpp36
4 files changed, 47 insertions, 47 deletions
diff --git a/noncore/unsupported/mailit/addatt.cpp b/noncore/unsupported/mailit/addatt.cpp
index 19ac58f..420f84c 100644
--- a/noncore/unsupported/mailit/addatt.cpp
+++ b/noncore/unsupported/mailit/addatt.cpp
@@ -1,196 +1,196 @@
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 <qpe/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(tr("Adding attachments") ); 59 setCaption(tr("Adding attachments") );
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 attachButton = new QPushButton(tr("attach..."), buttons); 65 attachButton = new QPushButton(tr("attach..."), buttons);
66 removeButton = new QPushButton(tr("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(attachButton,0,0); 81 //buttons->addWidget(attachButton,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(attachButton, SIGNAL(clicked()), this, 86 connect(attachButton, SIGNAL(clicked()), this,
87 SLOT(addattachment()) ); 87 SLOT(addattachment()) );
88 connect(removeButton, SIGNAL(clicked()), this, 88 connect(removeButton, SIGNAL(clicked()), this,
89 SLOT(removeattachment()) ); 89 SLOT(removeattachment()) );
90 90
91 /*listView = new QListView(this, "AttView"); 91 /*listView = new QListView(this, "AttView");
92 listView->addColumn("Documents");* 92 listView->addColumn("Documents");*
93 connect(listView, SIGNAL(doubleClicked(QListViewItem *)), this, 93 connect(listView, SIGNAL(doubleClicked(QListViewItem*)), this,
94 SLOT(addattachment()) );*/ 94 SLOT(addattachment()) );*/
95 95
96 96
97 attView = new QListView(this, "Selected"); 97 attView = new QListView(this, "Selected");
98 attView->addColumn(tr("Attached")); 98 attView->addColumn(tr("Attached"));
99 attView->addColumn(tr("File type")); 99 attView->addColumn(tr("File type"));
100 connect(attView, SIGNAL(doubleClicked(QListViewItem *)), this, 100 connect(attView, SIGNAL(doubleClicked(QListViewItem*)), this,
101 SLOT(removeattachment()) ); 101 SLOT(removeattachment()) );
102 102
103 //top->addWidget(ofs, 0,0); 103 //top->addWidget(ofs, 0,0);
104 top->addWidget(attView, 0,0); 104 top->addWidget(attView, 0,0);
105 105
106 clear(); 106 clear();
107 107
108 108
109} 109}
110 110
111void AddAtt::clear() 111void AddAtt::clear()
112{ 112{
113 attView->clear(); 113 attView->clear();
114 //getFiles(); 114 //getFiles();
115 modified = FALSE; 115 modified = FALSE;
116} 116}
117 117
118/*void AddAtt::fileCategorySelected(int id) 118/*void AddAtt::fileCategorySelected(int id)
119{ 119{
120 fileCategoryButton->setText(fileCategories->text(id)); 120 fileCategoryButton->setText(fileCategories->text(id));
121 getFiles(); 121 getFiles();
122}*/ 122}*/
123 123
124void AddAtt::addattachment() 124void AddAtt::addattachment()
125 {// ### FIXME wrong use -zecke 125 {// ### FIXME wrong use -zecke
126 OFileDialog ofs("Attachments",this,0,0,"/root/Documents"); 126 OFileDialog ofs("Attachments",this,0,0,"/root/Documents");
127 127
128 ofs.showMaximized(); 128 ofs.showMaximized();
129 129
130 if (ofs.exec()==QDialog::Accepted) 130 if (ofs.exec()==QDialog::Accepted)
131 { 131 {
132 DocLnk* dl=new DocLnk(ofs.selectedDocument()); 132 DocLnk* dl=new DocLnk(ofs.selectedDocument());
133 FileItem* fi=new FileItem(attView,dl); 133 FileItem* fi=new FileItem(attView,dl);
134 fi->setPixmap(0,dl->pixmap()); 134 fi->setPixmap(0,dl->pixmap());
135 fi->setText(1,dl->type()); 135 fi->setText(1,dl->type());
136 attView->insertItem(fi); 136 attView->insertItem(fi);
137 modified = TRUE; 137 modified = TRUE;
138 } 138 }
139} 139}
140 140
141void AddAtt::removeattachment() 141void AddAtt::removeattachment()
142{ 142{
143 if (attView->selectedItem() != NULL) 143 if (attView->selectedItem() != NULL)
144 { 144 {
145 attView->takeItem(attView->selectedItem()); 145 attView->takeItem(attView->selectedItem());
146 } 146 }
147 modified = TRUE; 147 modified = TRUE;
148} 148}
149 149
150void AddAtt::reject() 150void AddAtt::reject()
151{ 151{
152 if (modified) { 152 if (modified) {
153 attView->clear(); 153 attView->clear();
154 modified = FALSE; 154 modified = FALSE;
155 } 155 }
156} 156}
157 157
158void AddAtt::accept() 158void AddAtt::accept()
159{ 159{
160 modified = FALSE; 160 modified = FALSE;
161 hide(); 161 hide();
162} 162}
163 163
164void AddAtt::getFiles() 164void AddAtt::getFiles()
165{ 165{
166 QString path, selected; 166 QString path, selected;
167 167
168 /*listView->clear(); 168 /*listView->clear();
169 169
170 selected = fileCategoryButton->text(); 170 selected = fileCategoryButton->text();
171 if (selected == "Picture") { 171 if (selected == "Picture") {
172 path = "../pics/"; 172 path = "../pics/";
173 } else if (selected == "Document") { 173 } else if (selected == "Document") {
174 path = "" ; //sub-dirs not decided 174 path = "" ; //sub-dirs not decided
175 } else if (selected == "Sound") { 175 } else if (selected == "Sound") {
176 path = "../sounds/"; //sub-dirs not decided 176 path = "../sounds/"; //sub-dirs not decided
177 } else if (selected == "Movie") { 177 } else if (selected == "Movie") {
178 path = ""; //sub-dirs not decided 178 path = ""; //sub-dirs not decided
179 } else if (selected == "File") { 179 } else if (selected == "File") {
180 path = ""; //sub-dirs not decided 180 path = ""; //sub-dirs not decided
181 } 181 }
182 182
183 dir = new QDir(path); 183 dir = new QDir(path);
184 dir->setFilter(QDir::Files); 184 dir->setFilter(QDir::Files);
185 const QFileInfoList *dirInfoList = dir->entryInfoList(); 185 const QFileInfoList *dirInfoList = dir->entryInfoList();
186 186
187 QFileInfoListIterator it(*dirInfoList); // create list iterator 187 QFileInfoListIterator it(*dirInfoList); // create list iterator
188 188
189 while ( (fi=it.current()) ) { // for each file... 189 while ( (fi=it.current()) ) { // for each file...
190 item = new FileItem(lis+ütView, *fi, selected); 190 item = new FileItem(lis+ütView, *fi, selected);
191 ++it; // goto next list element 191 ++it; // goto next list element
192 }*/ 192 }*/
193} 193}
194 194
195QStringList AddAtt::returnattachedFiles() 195QStringList AddAtt::returnattachedFiles()
196{ 196{
diff --git a/noncore/unsupported/mailit/emailclient.cpp b/noncore/unsupported/mailit/emailclient.cpp
index 8359acf..86c7987 100644
--- a/noncore/unsupported/mailit/emailclient.cpp
+++ b/noncore/unsupported/mailit/emailclient.cpp
@@ -1,319 +1,319 @@
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 <qapplication.h> 20#include <qapplication.h>
21#include <qmessagebox.h> 21#include <qmessagebox.h>
22#include <qvbox.h> 22#include <qvbox.h>
23#include <qfile.h> 23#include <qfile.h>
24#include <qcheckbox.h> 24#include <qcheckbox.h>
25#include <qmenubar.h> 25#include <qmenubar.h>
26#include <qaction.h> 26#include <qaction.h>
27#include <qwhatsthis.h> 27#include <qwhatsthis.h>
28#include <qpe/resource.h> 28#include <qpe/resource.h>
29#include "emailclient.h" 29#include "emailclient.h"
30#include "writemail.h" 30#include "writemail.h"
31 31
32QCollection::Item AccountList::newItem(QCollection::Item d) 32QCollection::Item AccountList::newItem(QCollection::Item d)
33{ 33{
34 return dupl( (MailAccount *) d); 34 return dupl( (MailAccount *) d);
35} 35}
36 36
37MailAccount* AccountList::dupl(MailAccount *in) 37MailAccount* AccountList::dupl(MailAccount *in)
38{ 38{
39 ac = new MailAccount(*in); 39 ac = new MailAccount(*in);
40 return ac; 40 return ac;
41} 41}
42 42
43EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) 43EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl )
44 : QMainWindow( parent, name, fl ) 44 : QMainWindow( parent, name, fl )
45{ 45{
46 emailHandler = new EmailHandler(); 46 emailHandler = new EmailHandler();
47 addressList = new AddressList(); 47 addressList = new AddressList();
48 48
49 sending = FALSE; 49 sending = FALSE;
50 receiving = FALSE; 50 receiving = FALSE;
51 previewingMail = FALSE; 51 previewingMail = FALSE;
52 mailIdCount = 1; 52 mailIdCount = 1;
53 accountIdCount = 1; 53 accountIdCount = 1;
54 allAccounts = FALSE; 54 allAccounts = FALSE;
55 55
56 init(); 56 init();
57 57
58 58
59 59
60 connect(emailHandler, SIGNAL(mailSent()), this, SLOT(mailSent()) ); 60 connect(emailHandler, SIGNAL(mailSent()), this, SLOT(mailSent()) );
61 61
62 connect(emailHandler, SIGNAL(smtpError(int,const QString &)), this, 62 connect(emailHandler, SIGNAL(smtpError(int,const QString&)), this,
63 SLOT(smtpError(int,const QString &)) ); 63 SLOT(smtpError(int,const QString&)) );
64 connect(emailHandler, SIGNAL(popError(int,const QString &)), this, 64 connect(emailHandler, SIGNAL(popError(int,const QString&)), this,
65 SLOT(popError(int,const QString &)) ); 65 SLOT(popError(int,const QString&)) );
66 66
67 connect(inboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(inboxItemSelected()) ); 67 connect(inboxView, SIGNAL(doubleClicked(QListViewItem*)), this, SLOT(inboxItemSelected()) );
68 connect(outboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(outboxItemSelected()) ); 68 connect(outboxView, SIGNAL(doubleClicked(QListViewItem*)), this, SLOT(outboxItemSelected()) );
69 69
70 connect(inboxView, SIGNAL(pressed(QListViewItem *)), this, SLOT(inboxItemPressed()) ); 70 connect(inboxView, SIGNAL(pressed(QListViewItem*)), this, SLOT(inboxItemPressed()) );
71 connect(inboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(inboxItemReleased()) ); 71 connect(inboxView, SIGNAL(clicked(QListViewItem*)), this, SLOT(inboxItemReleased()) );
72 72
73 connect(emailHandler, SIGNAL(mailArrived(const Email &, bool)), this, 73 connect(emailHandler, SIGNAL(mailArrived(const Email&,bool)), this,
74 SLOT(mailArrived(const Email &, bool)) ); 74 SLOT(mailArrived(const Email&,bool)) );
75 connect(emailHandler, SIGNAL(mailTransfered(int)), this, 75 connect(emailHandler, SIGNAL(mailTransfered(int)), this,
76 SLOT(allMailArrived(int)) ); 76 SLOT(allMailArrived(int)) );
77 77
78 mailconf = new Config("mailit"); 78 mailconf = new Config("mailit");
79 //In case Synchronize is not defined in settings.txt 79 //In case Synchronize is not defined in settings.txt
80 80
81 readSettings(); 81 readSettings();
82 82
83 updateAccounts(); 83 updateAccounts();
84 84
85 lineShift = "\n"; 85 lineShift = "\n";
86 readMail(); 86 readMail();
87 lineShift = "\r\n"; 87 lineShift = "\r\n";
88 88
89 mailboxView->setCurrentTab(0); //ensure that inbox has focus 89 mailboxView->setCurrentTab(0); //ensure that inbox has focus
90 90
91 /*channel = new QCopChannel( "QPE/Application/mailit", this ); 91 /*channel = new QCopChannel( "QPE/Application/mailit", this );
92 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 92 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
93 this, SLOT(receive(const QCString&, const QByteArray&)) );*/ 93 this, SLOT(receive(const QCString&,const QByteArray&)) );*/
94 94
95} 95}
96 96
97 97
98EmailClient::~EmailClient() 98EmailClient::~EmailClient()
99{ 99{
100 //needs to be moved from destructor to closewindow event 100 //needs to be moved from destructor to closewindow event
101 saveMail(getPath(FALSE) + "inbox.txt", inboxView); 101 saveMail(getPath(FALSE) + "inbox.txt", inboxView);
102 //does not currently work. Defining outbox in the same 102 //does not currently work. Defining outbox in the same
103 //format as inbox is not a good solution as they have 103 //format as inbox is not a good solution as they have
104 //different properties 104 //different properties
105 saveMail(getPath(FALSE) + "outbox.txt", outboxView); 105 saveMail(getPath(FALSE) + "outbox.txt", outboxView);
106 saveSettings(); 106 saveSettings();
107 107
108 mailconf->write(); 108 mailconf->write();
109 delete mailconf; 109 delete mailconf;
110 110
111} 111}
112 112
113void EmailClient::init() 113void EmailClient::init()
114{ 114{
115 initStatusBar(this); 115 initStatusBar(this);
116 116
117 setToolBarsMovable(FALSE); 117 setToolBarsMovable(FALSE);
118 118
119 bar = new QToolBar(this); 119 bar = new QToolBar(this);
120 QWhatsThis::add(bar,tr("Main operation toolbar")); 120 QWhatsThis::add(bar,tr("Main operation toolbar"));
121 bar->setHorizontalStretchable( TRUE ); 121 bar->setHorizontalStretchable( TRUE );
122 122
123 mb = new QMenuBar( bar ); 123 mb = new QMenuBar( bar );
124 124
125 QPopupMenu *mail = new QPopupMenu(mb); 125 QPopupMenu *mail = new QPopupMenu(mb);
126 mb->insertItem( tr( "&Mail" ), mail); 126 mb->insertItem( tr( "&Mail" ), mail);
127 127
128 QPopupMenu *configure = new QPopupMenu(mb); 128 QPopupMenu *configure = new QPopupMenu(mb);
129 mb->insertItem( tr( "Accounts" ), configure); 129 mb->insertItem( tr( "Accounts" ), configure);
130 130
131 selectAccountMenu = new QPopupMenu(mb); 131 selectAccountMenu = new QPopupMenu(mb);
132 editAccountMenu = new QPopupMenu(mb); 132 editAccountMenu = new QPopupMenu(mb);
133 deleteAccountMenu = new QPopupMenu(mb); 133 deleteAccountMenu = new QPopupMenu(mb);
134 134
135 mail->insertItem(tr("Get Mail in"), selectAccountMenu); 135 mail->insertItem(tr("Get Mail in"), selectAccountMenu);
136 configure->insertItem(tr("Edit account"), editAccountMenu); 136 configure->insertItem(tr("Edit account"), editAccountMenu);
137 configure->insertItem(tr("Delete account"), deleteAccountMenu); 137 configure->insertItem(tr("Delete account"), deleteAccountMenu);
138 138
139 bar = new QToolBar(this); 139 bar = new QToolBar(this);
140 140
141 getMailButton = new QToolButton(Resource::loadPixmap("mailit/getmail"),tr("getMail"),tr("select account"), this,SLOT(getAllNewMail()),bar); 141 getMailButton = new QToolButton(Resource::loadPixmap("mailit/getmail"),tr("getMail"),tr("select account"), this,SLOT(getAllNewMail()),bar);
142 QWhatsThis::add(getMailButton,tr("Click to download mail via all available accounts.\n Press and hold to select the desired account.")); 142 QWhatsThis::add(getMailButton,tr("Click to download mail via all available accounts.\n Press and hold to select the desired account."));
143 143
144 getMailButton->setPopup(selectAccountMenu); 144 getMailButton->setPopup(selectAccountMenu);
145 145
146 sendMailButton = new QAction(tr("Send mail"), Resource::loadPixmap("mailit/sendqueue"), QString::null, 0, this, 0); 146 sendMailButton = new QAction(tr("Send mail"), Resource::loadPixmap("mailit/sendqueue"), QString::null, 0, this, 0);
147 connect(sendMailButton, SIGNAL(activated()), this, SLOT(sendQuedMail()) ); 147 connect(sendMailButton, SIGNAL(activated()), this, SLOT(sendQuedMail()) );
148 sendMailButton->addTo(bar); 148 sendMailButton->addTo(bar);
149 sendMailButton->addTo(mail); 149 sendMailButton->addTo(mail);
150 sendMailButton->setWhatsThis("Send mail queued in the outbox"); 150 sendMailButton->setWhatsThis("Send mail queued in the outbox");
151 151
152 composeButton = new QAction(tr("Compose"), Resource::loadPixmap("new"), QString::null, 0, this, 0); 152 composeButton = new QAction(tr("Compose"), Resource::loadPixmap("new"), QString::null, 0, this, 0);
153 connect(composeButton, SIGNAL(activated()), this, SLOT(compose()) ); 153 connect(composeButton, SIGNAL(activated()), this, SLOT(compose()) );
154 composeButton->addTo(bar); 154 composeButton->addTo(bar);
155 composeButton->addTo(mail); 155 composeButton->addTo(mail);
156 composeButton->setWhatsThis("Compose a new mail"); 156 composeButton->setWhatsThis("Compose a new mail");
157 157
158 cancelButton = new QAction(tr("Cancel transfer"), Resource::loadPixmap("close"), QString::null, 0, this, 0); 158 cancelButton = new QAction(tr("Cancel transfer"), Resource::loadPixmap("close"), QString::null, 0, this, 0);
159 connect(cancelButton, SIGNAL(activated()), this, SLOT(cancel()) ); 159 connect(cancelButton, SIGNAL(activated()), this, SLOT(cancel()) );
160 cancelButton->addTo(mail); 160 cancelButton->addTo(mail);
161 cancelButton->addTo(bar); 161 cancelButton->addTo(bar);
162 cancelButton->setEnabled(FALSE); 162 cancelButton->setEnabled(FALSE);
163 cancelButton->setWhatsThis("Stop the currently active mail transfer"); 163 cancelButton->setWhatsThis("Stop the currently active mail transfer");
164 164
165 165
166 deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); 166 deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 );
167 connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) ); 167 connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) );
168 deleteButton->addTo(bar); 168 deleteButton->addTo(bar);
169 deleteButton->setWhatsThis("Remove the currently selected eMail(s)"); 169 deleteButton->setWhatsThis("Remove the currently selected eMail(s)");
170 170
171 mailboxView = new OTabWidget( this, "mailboxView" ); 171 mailboxView = new OTabWidget( this, "mailboxView" );
172 172
173 QWidget* widget = new QWidget( mailboxView, "widget" ); 173 QWidget* widget = new QWidget( mailboxView, "widget" );
174 grid_2 = new QGridLayout( widget ); 174 grid_2 = new QGridLayout( widget );
175// grid_2->setSpacing(6); 175// grid_2->setSpacing(6);
176// grid_2->setMargin( 11 ); 176// grid_2->setMargin( 11 );
177 177
178 inboxView = new QListView( widget, "inboxView" ); 178 inboxView = new QListView( widget, "inboxView" );
179 inboxView->addColumn( tr( "From" ) ); 179 inboxView->addColumn( tr( "From" ) );
180 inboxView->addColumn( tr( "Subject" ) ); 180 inboxView->addColumn( tr( "Subject" ) );
181 inboxView->addColumn( tr( "Date" ) ); 181 inboxView->addColumn( tr( "Date" ) );
182 inboxView->setMinimumSize( QSize( 0, 0 ) ); 182 inboxView->setMinimumSize( QSize( 0, 0 ) );
183 inboxView->setAllColumnsShowFocus(TRUE); 183 inboxView->setAllColumnsShowFocus(TRUE);
184 QWhatsThis::add(inboxView,QWidget::tr("This is the inbox view.\n" 184 QWhatsThis::add(inboxView,QWidget::tr("This is the inbox view.\n"
185 "It keeps the fetched mail which can be \n" 185 "It keeps the fetched mail which can be \n"
186 "viewed by double clicking the entry.\n" 186 "viewed by double clicking the entry.\n"
187 "blue attachment icon shows whether this \n" 187 "blue attachment icon shows whether this \n"
188 "mailhas attachments.\n")); 188 "mailhas attachments.\n"));
189 189
190 grid_2->addWidget( inboxView, 2, 0 ); 190 grid_2->addWidget( inboxView, 2, 0 );
191 mailboxView->addTab( widget, "mailit/inbox", tr( "Inbox" ) ); 191 mailboxView->addTab( widget, "mailit/inbox", tr( "Inbox" ) );
192 192
193 QWidget* widget_2 = new QWidget( mailboxView, "widget_2" ); 193 QWidget* widget_2 = new QWidget( mailboxView, "widget_2" );
194 grid_3 = new QGridLayout( widget_2 ); 194 grid_3 = new QGridLayout( widget_2 );
195// grid_3->setSpacing(6); 195// grid_3->setSpacing(6);
196// grid_3->setMargin( 11 ); 196// grid_3->setMargin( 11 );
197 197
198 outboxView = new QListView( widget_2, "outboxView" ); 198 outboxView = new QListView( widget_2, "outboxView" );
199 outboxView->addColumn( tr( "To" ) ); 199 outboxView->addColumn( tr( "To" ) );
200 outboxView->addColumn( tr( "Subject" ) ); 200 outboxView->addColumn( tr( "Subject" ) );
201 outboxView->setAllColumnsShowFocus(TRUE); 201 outboxView->setAllColumnsShowFocus(TRUE);
202 202
203 QWhatsThis::add(outboxView,QWidget::tr("This is the outbox view.\n" 203 QWhatsThis::add(outboxView,QWidget::tr("This is the outbox view.\n"
204 "It keeps the queued mails to send which can be \n" 204 "It keeps the queued mails to send which can be \n"
205 "reviewed by double clicking the entry.")); 205 "reviewed by double clicking the entry."));
206 grid_3->addWidget( outboxView, 0, 0 ); 206 grid_3->addWidget( outboxView, 0, 0 );
207 mailboxView->addTab( widget_2,"mailit/outbox", tr( "Outbox" ) ); 207 mailboxView->addTab( widget_2,"mailit/outbox", tr( "Outbox" ) );
208 208
209 setCentralWidget(mailboxView); 209 setCentralWidget(mailboxView);
210 210
211} 211}
212 212
213void EmailClient::initStatusBar(QWidget* parent) 213void EmailClient::initStatusBar(QWidget* parent)
214{ 214{
215 statusBar = new QStatusBar(parent); 215 statusBar = new QStatusBar(parent);
216 statusBar->setSizeGripEnabled(FALSE); 216 statusBar->setSizeGripEnabled(FALSE);
217 217
218 status1Label = new QLabel( tr("Idle"), statusBar); 218 status1Label = new QLabel( tr("Idle"), statusBar);
219 status2Label = new QLabel("", statusBar); 219 status2Label = new QLabel("", statusBar);
220 connect(emailHandler, SIGNAL(updatePopStatus(const QString &)), 220 connect(emailHandler, SIGNAL(updatePopStatus(const QString&)),
221 status2Label, SLOT(setText(const QString &)) ); 221 status2Label, SLOT(setText(const QString&)) );
222 connect(emailHandler, SIGNAL(updateSmtpStatus(const QString &)), 222 connect(emailHandler, SIGNAL(updateSmtpStatus(const QString&)),
223 status2Label, SLOT(setText(const QString &)) ); 223 status2Label, SLOT(setText(const QString&)) );
224 224
225 progressBar = new QProgressBar(statusBar); 225 progressBar = new QProgressBar(statusBar);
226 226
227 connect(emailHandler, SIGNAL(mailboxSize(int)), 227 connect(emailHandler, SIGNAL(mailboxSize(int)),
228 this, SLOT(setTotalSize(int)) ); 228 this, SLOT(setTotalSize(int)) );
229 connect(emailHandler, SIGNAL(currentMailSize(int)), 229 connect(emailHandler, SIGNAL(currentMailSize(int)),
230 this, SLOT(setMailSize(int)) ); 230 this, SLOT(setMailSize(int)) );
231 connect(emailHandler, SIGNAL(downloadedSize(int)), 231 connect(emailHandler, SIGNAL(downloadedSize(int)),
232 this, SLOT(setDownloadedSize(int)) ); 232 this, SLOT(setDownloadedSize(int)) );
233 233
234 statusBar->addWidget(status1Label); 234 statusBar->addWidget(status1Label);
235 statusBar->addWidget(progressBar); 235 statusBar->addWidget(progressBar);
236 statusBar->addWidget(status2Label); 236 statusBar->addWidget(status2Label);
237 237
238} 238}
239 239
240void EmailClient::compose() 240void EmailClient::compose()
241{ 241{
242 emit composeRequested(); 242 emit composeRequested();
243} 243}
244 244
245void EmailClient::cancel() 245void EmailClient::cancel()
246{ 246{
247 emailHandler->cancel(); 247 emailHandler->cancel();
248} 248}
249 249
250AddressList* EmailClient::getAdrListRef() 250AddressList* EmailClient::getAdrListRef()
251{ 251{
252 return addressList; 252 return addressList;
253} 253}
254 254
255//this needs to be rewritten to syncronize with outboxView 255//this needs to be rewritten to syncronize with outboxView
256void EmailClient::enqueMail(const Email &mail) 256void EmailClient::enqueMail(const Email &mail)
257{ 257{
258 if (accountList.count() == 0) { 258 if (accountList.count() == 0) {
259 QMessageBox::warning(qApp->activeWindow(), 259 QMessageBox::warning(qApp->activeWindow(),
260 tr("No account selected"), tr("You must create an account"), "OK\n"); 260 tr("No account selected"), tr("You must create an account"), "OK\n");
261 return; 261 return;
262 } 262 }
263 263
264 if (accountList.count() > 0) { 264 if (accountList.count() > 0) {
265 currentAccount = accountList.first(); 265 currentAccount = accountList.first();
266 qWarning("using account " + currentAccount->name); 266 qWarning("using account " + currentAccount->name);
267 } 267 }
268 268
269 Email addMail = mail; 269 Email addMail = mail;
270 addMail.from = currentAccount->name; 270 addMail.from = currentAccount->name;
271 addMail.fromMail = currentAccount->emailAddress; 271 addMail.fromMail = currentAccount->emailAddress;
272 addMail.rawMail.prepend("From: \"" + addMail.from + "\" <" + addMail.fromMail + ">\n"); 272 addMail.rawMail.prepend("From: \"" + addMail.from + "\" <" + addMail.fromMail + ">\n");
273 item = new EmailListItem(outboxView, addMail, false); 273 item = new EmailListItem(outboxView, addMail, false);
274 274
275 mailboxView->setCurrentTab(1); 275 mailboxView->setCurrentTab(1);
276 276
277} 277}
278 278
279void EmailClient::sendQuedMail() 279void EmailClient::sendQuedMail()
280{ 280{
281 int count = 0; 281 int count = 0;
282 282
283 if (accountList.count() == 0) { 283 if (accountList.count() == 0) {
284 QMessageBox::warning(qApp->activeWindow(), tr("No account selected"), tr("You must create an account"), "OK\n"); 284 QMessageBox::warning(qApp->activeWindow(), tr("No account selected"), tr("You must create an account"), "OK\n");
285 return; 285 return;
286 } 286 }
287 //traverse listview, find messages to send 287 //traverse listview, find messages to send
288 if (! sending) { 288 if (! sending) {
289 item = (EmailListItem *) outboxView->firstChild(); 289 item = (EmailListItem *) outboxView->firstChild();
290 if (item != NULL) { 290 if (item != NULL) {
291 while (item != NULL) { 291 while (item != NULL) {
292 quedMessages.append(item->getMail()); 292 quedMessages.append(item->getMail());
293 item = (EmailListItem *) item->nextSibling(); 293 item = (EmailListItem *) item->nextSibling();
294 count++; 294 count++;
295 } 295 }
296 setMailAccount(); 296 setMailAccount();
297 emailHandler->sendMail(&quedMessages); 297 emailHandler->sendMail(&quedMessages);
298 sending = TRUE; 298 sending = TRUE;
299 sendMailButton->setEnabled(FALSE); 299 sendMailButton->setEnabled(FALSE);
300 cancelButton->setEnabled(TRUE); 300 cancelButton->setEnabled(TRUE);
301 } else { 301 } else {
302 qWarning("sendQuedMail(): no messages to send"); 302 qWarning("sendQuedMail(): no messages to send");
303 } 303 }
304 } 304 }
305} 305}
306 306
307void EmailClient::setMailAccount() 307void EmailClient::setMailAccount()
308{ 308{
309 emailHandler->setAccount(*currentAccount); 309 emailHandler->setAccount(*currentAccount);
310} 310}
311 311
312void EmailClient::mailSent() 312void EmailClient::mailSent()
313{ 313{
314 sending = FALSE; 314 sending = FALSE;
315 sendMailButton->setEnabled(TRUE); 315 sendMailButton->setEnabled(TRUE);
316 316
317 quedMessages.clear(); 317 quedMessages.clear();
318 outboxView->clear(); //should be moved to an sentBox 318 outboxView->clear(); //should be moved to an sentBox
319} 319}
diff --git a/noncore/unsupported/mailit/emailhandler.cpp b/noncore/unsupported/mailit/emailhandler.cpp
index 06e978d..02b3e9a 100644
--- a/noncore/unsupported/mailit/emailhandler.cpp
+++ b/noncore/unsupported/mailit/emailhandler.cpp
@@ -1,154 +1,154 @@
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 <qfileinfo.h> 20#include <qfileinfo.h>
21#include <stdlib.h> 21#include <stdlib.h>
22#include <qapplication.h> 22#include <qapplication.h>
23#include <qmessagebox.h> 23#include <qmessagebox.h>
24#include <qcstring.h> 24#include <qcstring.h>
25#include "emailhandler.h" 25#include "emailhandler.h"
26#include <qpe/applnk.h> 26#include <qpe/applnk.h>
27#include <qpe/filemanager.h> 27#include <qpe/filemanager.h>
28 28
29QCollection::Item EnclosureList::newItem(QCollection::Item d) 29QCollection::Item EnclosureList::newItem(QCollection::Item d)
30{ 30{
31 return dupl( (Enclosure *) d); 31 return dupl( (Enclosure *) d);
32} 32}
33 33
34Enclosure* EnclosureList::dupl(Enclosure *in) 34Enclosure* EnclosureList::dupl(Enclosure *in)
35{ 35{
36 ac = new Enclosure(*in); 36 ac = new Enclosure(*in);
37 return ac; 37 return ac;
38} 38}
39 39
40EmailHandler::EmailHandler() 40EmailHandler::EmailHandler()
41{ 41{
42 qDebug("EMailHandler::EmailHandler"); 42 qDebug("EMailHandler::EmailHandler");
43 43
44 smtpClient = new SmtpClient(); 44 smtpClient = new SmtpClient();
45 popClient = new PopClient(); 45 popClient = new PopClient();
46 46
47 connect(smtpClient, SIGNAL(errorOccurred(int, const QString &)), this, 47 connect(smtpClient, SIGNAL(errorOccurred(int,const QString&)), this,
48 SIGNAL(smtpError(int, const QString &)) ); 48 SIGNAL(smtpError(int,const QString&)) );
49 connect(smtpClient, SIGNAL(mailSent()), this, SIGNAL(mailSent()) ); 49 connect(smtpClient, SIGNAL(mailSent()), this, SIGNAL(mailSent()) );
50 connect(smtpClient, SIGNAL(updateStatus(const QString &)), this, 50 connect(smtpClient, SIGNAL(updateStatus(const QString&)), this,
51 SIGNAL(updateSmtpStatus(const QString &)) ); 51 SIGNAL(updateSmtpStatus(const QString&)) );
52 52
53 connect(popClient, SIGNAL(errorOccurred(int, const QString &)), this, 53 connect(popClient, SIGNAL(errorOccurred(int,const QString&)), this,
54 SIGNAL(popError(int, const QString &)) ); 54 SIGNAL(popError(int,const QString&)) );
55 connect(popClient, SIGNAL(newMessage(const QString &, int, uint, bool)), 55 connect(popClient, SIGNAL(newMessage(const QString&,int,uint,bool)),
56 this, SLOT(messageArrived(const QString &, int, uint, bool)) ); 56 this, SLOT(messageArrived(const QString&,int,uint,bool)) );
57 connect(popClient, SIGNAL(updateStatus(const QString &)), this, 57 connect(popClient, SIGNAL(updateStatus(const QString&)), this,
58 SIGNAL(updatePopStatus(const QString &)) ); 58 SIGNAL(updatePopStatus(const QString&)) );
59 connect(popClient, SIGNAL(mailTransfered(int)), this, 59 connect(popClient, SIGNAL(mailTransfered(int)), this,
60 SIGNAL(mailTransfered(int)) ); 60 SIGNAL(mailTransfered(int)) );
61 61
62 62
63 //relaying size information 63 //relaying size information
64 connect(popClient, SIGNAL(currentMailSize(int)), 64 connect(popClient, SIGNAL(currentMailSize(int)),
65 this, SIGNAL(currentMailSize(int)) ); 65 this, SIGNAL(currentMailSize(int)) );
66 connect(popClient, SIGNAL(downloadedSize(int)), 66 connect(popClient, SIGNAL(downloadedSize(int)),
67 this, SIGNAL(downloadedSize(int)) ); 67 this, SIGNAL(downloadedSize(int)) );
68} 68}
69 69
70void EmailHandler::sendMail(QList<Email> *mailList) 70void EmailHandler::sendMail(QList<Email> *mailList)
71{ 71{
72 Email *currentMail; 72 Email *currentMail;
73 QString temp; 73 QString temp;
74 QString userName = QString::null; 74 QString userName = QString::null;
75 // not supported by ALL SMTP servers in the MAIL From field 75 // not supported by ALL SMTP servers in the MAIL From field
76 // userName = "\""+mailAccount.name+"\""; 76 // userName = "\""+mailAccount.name+"\"";
77 userName += "<" + mailAccount.emailAddress + ">"; 77 userName += "<" + mailAccount.emailAddress + ">";
78 78
79 for (currentMail = mailList->first(); currentMail != 0; 79 for (currentMail = mailList->first(); currentMail != 0;
80 currentMail = mailList->next()) { 80 currentMail = mailList->next()) {
81 81
82 if (encodeMime(currentMail) == 0) { 82 if (encodeMime(currentMail) == 0) {
83 smtpClient->addMail(userName, currentMail->subject, 83 smtpClient->addMail(userName, currentMail->subject,
84 currentMail->recipients, currentMail->rawMail); 84 currentMail->recipients, currentMail->rawMail);
85 } else { //error 85 } else { //error
86 temp = tr("Could not locate all files in \nmail with subject: ") + 86 temp = tr("Could not locate all files in \nmail with subject: ") +
87 currentMail->subject; 87 currentMail->subject;
88 temp += tr("\nMail has NOT been sent"); 88 temp += tr("\nMail has NOT been sent");
89 QMessageBox::warning(qApp->activeWindow(), tr("Attachment error"), temp, tr("OK\n")); 89 QMessageBox::warning(qApp->activeWindow(), tr("Attachment error"), temp, tr("OK\n"));
90 90
91 } 91 }
92 } 92 }
93 smtpClient->newConnection(mailAccount.smtpServer, 25); 93 smtpClient->newConnection(mailAccount.smtpServer, 25);
94} 94}
95 95
96void EmailHandler::setAccount(MailAccount account) 96void EmailHandler::setAccount(MailAccount account)
97{ 97{
98 mailAccount = account; 98 mailAccount = account;
99} 99}
100 100
101void EmailHandler::getMail() 101void EmailHandler::getMail()
102{ 102{
103 popClient->setAccount(mailAccount.popUserName, mailAccount.popPasswd); 103 popClient->setAccount(mailAccount.popUserName, mailAccount.popPasswd);
104 if (mailAccount.synchronize) { 104 if (mailAccount.synchronize) {
105 popClient->setSynchronize(mailAccount.lastServerMailCount); 105 popClient->setSynchronize(mailAccount.lastServerMailCount);
106 } else { 106 } else {
107 popClient->removeSynchronize(); 107 popClient->removeSynchronize();
108 } 108 }
109 109
110 headers = FALSE; 110 headers = FALSE;
111 //popClient->headersOnly(headers, 0); 111 //popClient->headersOnly(headers, 0);
112 popClient->newConnection(mailAccount.popServer, 110); 112 popClient->newConnection(mailAccount.popServer, 110);
113} 113}
114 114
115void EmailHandler::getMailHeaders() 115void EmailHandler::getMailHeaders()
116{ 116{
117 popClient->setAccount(mailAccount.popUserName, mailAccount.popPasswd); 117 popClient->setAccount(mailAccount.popUserName, mailAccount.popPasswd);
118 mailAccount.synchronize ? popClient->setSynchronize(mailAccount.lastServerMailCount): popClient->removeSynchronize(); 118 mailAccount.synchronize ? popClient->setSynchronize(mailAccount.lastServerMailCount): popClient->removeSynchronize();
119 119
120 headers = TRUE; 120 headers = TRUE;
121 popClient->headersOnly(headers, mailAccount.syncLimit); //less than requested syncLimit, download all 121 popClient->headersOnly(headers, mailAccount.syncLimit); //less than requested syncLimit, download all
122 qDebug("Initiating connection"); 122 qDebug("Initiating connection");
123 popClient->newConnection(mailAccount.popServer, 110); 123 popClient->newConnection(mailAccount.popServer, 110);
124} 124}
125 125
126void EmailHandler::getMailByList(MailList *mailList) 126void EmailHandler::getMailByList(MailList *mailList)
127{ 127{
128 if (mailList->count() == 0) { //should not occur though 128 if (mailList->count() == 0) { //should not occur though
129 emit mailTransfered(0); 129 emit mailTransfered(0);
130 return; 130 return;
131 } 131 }
132 132
133 headers = FALSE; 133 headers = FALSE;
134 popClient->headersOnly(FALSE, 0); 134 popClient->headersOnly(FALSE, 0);
135 135
136 popClient->setAccount(mailAccount.popUserName,mailAccount.popPasswd); 136 popClient->setAccount(mailAccount.popUserName,mailAccount.popPasswd);
137 popClient->setSelectedMails(mailList); 137 popClient->setSelectedMails(mailList);
138 popClient->newConnection(mailAccount.popServer, 110); 138 popClient->newConnection(mailAccount.popServer, 110);
139 } 139 }
140 140
141void EmailHandler::messageArrived(const QString &message, int id, uint size, bool complete) 141void EmailHandler::messageArrived(const QString &message, int id, uint size, bool complete)
142{ 142{
143 Email mail; 143 Email mail;
144 144
145 mail.rawMail = message; 145 mail.rawMail = message;
146 mail.serverId = id; 146 mail.serverId = id;
147 mail.size = size; 147 mail.size = size;
148 mail.downloaded = complete; 148 mail.downloaded = complete;
149 149
150 emit mailArrived(mail, FALSE); 150 emit mailArrived(mail, FALSE);
151} 151}
152 152
153bool EmailHandler::parse(const QString &in, const QString &lineShift, Email *mail) 153bool EmailHandler::parse(const QString &in, const QString &lineShift, Email *mail)
154{ 154{
diff --git a/noncore/unsupported/mailit/mailitwindow.cpp b/noncore/unsupported/mailit/mailitwindow.cpp
index 6e298c7..fec4d78 100644
--- a/noncore/unsupported/mailit/mailitwindow.cpp
+++ b/noncore/unsupported/mailit/mailitwindow.cpp
@@ -1,161 +1,161 @@
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 <qwhatsthis.h> 20#include <qwhatsthis.h>
21#include <qmessagebox.h> 21#include <qmessagebox.h>
22#include "mailitwindow.h" 22#include "mailitwindow.h"
23 23
24MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags /*fl*/) 24MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags /*fl*/)
25 : QMainWindow(parent, name, WStyle_ContextHelp) 25 : QMainWindow(parent, name, WStyle_ContextHelp)
26{ 26{
27 currentCaption = tr("Mailit"); 27 currentCaption = tr("Mailit");
28 setCaption(tr(currentCaption)); 28 setCaption(tr(currentCaption));
29 views = new QWidgetStack(this); 29 views = new QWidgetStack(this);
30 setCentralWidget(views); 30 setCentralWidget(views);
31 QWhatsThis::add(views,tr("Central view area")); 31 QWhatsThis::add(views,tr("Central view area"));
32 emailClient = new EmailClient(views, "client"); 32 emailClient = new EmailClient(views, "client");
33 writeMail = new WriteMail(views, "writing"); 33 writeMail = new WriteMail(views, "writing");
34 readMail = new ReadMail(views, "reading"); 34 readMail = new ReadMail(views, "reading");
35 35
36 views->raiseWidget(emailClient); 36 views->raiseWidget(emailClient);
37 37
38 connect(emailClient, SIGNAL(composeRequested()), 38 connect(emailClient, SIGNAL(composeRequested()),
39 this, SLOT(compose()) ); 39 this, SLOT(compose()) );
40 connect(emailClient, SIGNAL(viewEmail(QListView *, Email *)), this, 40 connect(emailClient, SIGNAL(viewEmail(QListView*,Email*)), this,
41 SLOT(viewMail(QListView *, Email *)) ); 41 SLOT(viewMail(QListView*,Email*)) );
42 connect(emailClient, SIGNAL(mailUpdated(Email *)), this, 42 connect(emailClient, SIGNAL(mailUpdated(Email*)), this,
43 SLOT(updateMailView(Email *)) ); 43 SLOT(updateMailView(Email*)) );
44 44
45 connect(writeMail, SIGNAL(cancelMail()), this, SLOT(showEmailClient()) ); 45 connect(writeMail, SIGNAL(cancelMail()), this, SLOT(showEmailClient()) );
46 connect(writeMail, SIGNAL(sendMailRequested(const Email &)), this, 46 connect(writeMail, SIGNAL(sendMailRequested(const Email&)), this,
47 SLOT(showEmailClient()) ); 47 SLOT(showEmailClient()) );
48 connect(writeMail, SIGNAL(sendMailRequested(const Email &)), emailClient, 48 connect(writeMail, SIGNAL(sendMailRequested(const Email&)), emailClient,
49 SLOT(enqueMail(const Email &)) ); 49 SLOT(enqueMail(const Email&)) );
50 50
51 connect(readMail, SIGNAL(cancelView()), this, SLOT(showEmailClient()) ); 51 connect(readMail, SIGNAL(cancelView()), this, SLOT(showEmailClient()) );
52 connect(readMail, SIGNAL(replyRequested(Email &, bool&)), this, 52 connect(readMail, SIGNAL(replyRequested(Email&,bool&)), this,
53 SLOT(composeReply(Email &, bool&)) ); 53 SLOT(composeReply(Email&,bool&)) );
54 connect(readMail, SIGNAL(forwardRequested(Email &)), this, 54 connect(readMail, SIGNAL(forwardRequested(Email&)), this,
55 SLOT(composeForward(Email &)) ); 55 SLOT(composeForward(Email&)) );
56 56
57 connect(readMail, SIGNAL(removeItem(EmailListItem *, bool &)), emailClient, 57 connect(readMail, SIGNAL(removeItem(EmailListItem*,bool&)), emailClient,
58 SLOT(deleteMail(EmailListItem *, bool &)) ); 58 SLOT(deleteMail(EmailListItem*,bool&)) );
59 connect(readMail, SIGNAL(viewingMail(Email *)), emailClient, 59 connect(readMail, SIGNAL(viewingMail(Email*)), emailClient,
60 SLOT(moveMailFront(Email *)) ); 60 SLOT(moveMailFront(Email*)) );
61 61
62 connect(emailClient, SIGNAL(newCaption(const QString &)), 62 connect(emailClient, SIGNAL(newCaption(const QString&)),
63 this, SLOT(updateCaption(const QString &)) ); 63 this, SLOT(updateCaption(const QString&)) );
64 64
65 connect(readMail, SIGNAL(download(Email *)), emailClient, SLOT(download(Email*)) ); 65 connect(readMail, SIGNAL(download(Email*)), emailClient, SLOT(download(Email*)) );
66 66
67 viewingMail = FALSE; 67 viewingMail = FALSE;
68} 68}
69 69
70MailItWindow::~MailItWindow() 70MailItWindow::~MailItWindow()
71{ 71{
72} 72}
73 73
74void MailItWindow::closeEvent(QCloseEvent *e) 74void MailItWindow::closeEvent(QCloseEvent *e)
75{ 75{
76 if (views->visibleWidget() == emailClient) { 76 if (views->visibleWidget() == emailClient) {
77 e->accept(); 77 e->accept();
78 } else { 78 } else {
79 showEmailClient(); 79 showEmailClient();
80 } 80 }
81} 81}
82 82
83void MailItWindow::compose() 83void MailItWindow::compose()
84{ 84{
85 viewingMail = FALSE; 85 viewingMail = FALSE;
86 emailClient->hide(); 86 emailClient->hide();
87 readMail->hide(); 87 readMail->hide();
88 views->raiseWidget(writeMail); 88 views->raiseWidget(writeMail);
89 writeMail->setAddressList(emailClient->getAdrListRef()); 89 writeMail->setAddressList(emailClient->getAdrListRef());
90 writeMail->newMail(); 90 writeMail->newMail();
91 setCaption( tr( "Write mail" ) ); 91 setCaption( tr( "Write mail" ) );
92} 92}
93 93
94void MailItWindow::composeReply(Email &mail, bool& replyAll) 94void MailItWindow::composeReply(Email &mail, bool& replyAll)
95{ 95{
96 compose(); 96 compose();
97 writeMail->reply(mail,replyAll) ; 97 writeMail->reply(mail,replyAll) ;
98} 98}
99 99
100void MailItWindow::composeForward(Email &mail) 100void MailItWindow::composeForward(Email &mail)
101{ 101{
102 compose(); 102 compose();
103 writeMail->forward(mail) ; 103 writeMail->forward(mail) ;
104} 104}
105 105
106 106
107void MailItWindow::showEmailClient() 107void MailItWindow::showEmailClient()
108{ 108{
109 viewingMail = FALSE; 109 viewingMail = FALSE;
110 writeMail->hide(); 110 writeMail->hide();
111 readMail->hide(); 111 readMail->hide();
112 views->raiseWidget(emailClient); 112 views->raiseWidget(emailClient);
113 setCaption( tr(currentCaption) ); 113 setCaption( tr(currentCaption) );
114} 114}
115 115
116void MailItWindow::viewMail(QListView *view, Email *mail) 116void MailItWindow::viewMail(QListView *view, Email *mail)
117{ 117{
118 viewingMail = TRUE; 118 viewingMail = TRUE;
119 emailClient->hide(); 119 emailClient->hide();
120 120
121 int result=0; 121 int result=0;
122 122
123 if ((mail->received)&&(!mail->downloaded)) 123 if ((mail->received)&&(!mail->downloaded))
124 { 124 {
125 QMessageBox mb( tr("Mail not downloaded"), 125 QMessageBox mb( tr("Mail not downloaded"),
126 tr("The mail you have clicked \n" 126 tr("The mail you have clicked \n"
127 "has not been downloaded yet.\n " 127 "has not been downloaded yet.\n "
128 "Would you like to do it now ?"), 128 "Would you like to do it now ?"),
129 QMessageBox::Information, 129 QMessageBox::Information,
130 QMessageBox::Yes | QMessageBox::Default, 130 QMessageBox::Yes | QMessageBox::Default,
131 QMessageBox::No | QMessageBox::Escape,0 ); 131 QMessageBox::No | QMessageBox::Escape,0 );
132 132
133 result=mb.exec(); 133 result=mb.exec();
134 134
135 if (result==QMessageBox::Yes) 135 if (result==QMessageBox::Yes)
136 { 136 {
137 emailClient->download(mail); 137 emailClient->download(mail);
138 } 138 }
139 } 139 }
140 140
141 readMail->update(view, mail); 141 readMail->update(view, mail);
142 views->raiseWidget(readMail); 142 views->raiseWidget(readMail);
143 setCaption( tr( "Read Mail" ) ); 143 setCaption( tr( "Read Mail" ) );
144} 144}
145 145
146void MailItWindow::updateMailView(Email *mail) 146void MailItWindow::updateMailView(Email *mail)
147{ 147{
148 if (viewingMail) { 148 if (viewingMail) {
149 readMail->mailUpdated(mail); 149 readMail->mailUpdated(mail);
150 } 150 }
151} 151}
152 152
153void MailItWindow::updateCaption(const QString &newCaption) 153void MailItWindow::updateCaption(const QString &newCaption)
154{ 154{
155 currentCaption = newCaption; 155 currentCaption = newCaption;
156 setCaption(tr(currentCaption)); 156 setCaption(tr(currentCaption));
157} 157}
158 158
159void MailItWindow::setDocument(const QString &_address) 159void MailItWindow::setDocument(const QString &_address)
160{ 160{
161 // strip leading 'mailto:' 161 // strip leading 'mailto:'