summaryrefslogtreecommitdiff
path: root/noncore/net/mailit/emailclient.cpp
Unidiff
Diffstat (limited to 'noncore/net/mailit/emailclient.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mailit/emailclient.cpp140
1 files changed, 102 insertions, 38 deletions
diff --git a/noncore/net/mailit/emailclient.cpp b/noncore/net/mailit/emailclient.cpp
index dff1888..2cedc51 100644
--- a/noncore/net/mailit/emailclient.cpp
+++ b/noncore/net/mailit/emailclient.cpp
@@ -20,4 +20,5 @@
20#include <qapplication.h> 20#include <qapplication.h>
21#include <qmessagebox.h> 21#include <qmessagebox.h>
22#include <qvbox.h>
22#include <qfile.h> 23#include <qfile.h>
23#include <qcheckbox.h> 24#include <qcheckbox.h>
@@ -27,4 +28,5 @@
27#include <qpe/resource.h> 28#include <qpe/resource.h>
28#include "emailclient.h" 29#include "emailclient.h"
30#include "writemail.h"
29 31
30QCollection::Item AccountList::newItem(QCollection::Item d) 32QCollection::Item AccountList::newItem(QCollection::Item d)
@@ -41,5 +43,5 @@ MailAccount* AccountList::dupl(MailAccount *in)
41EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) 43EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl )
42 : QMainWindow( parent, name, fl ) 44 : QMainWindow( parent, name, fl )
43{ 45{
44 emailHandler = new EmailHandler(); 46 emailHandler = new EmailHandler();
45 addressList = new AddressList(); 47 addressList = new AddressList();
@@ -54,4 +56,6 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl )
54 init(); 56 init();
55 57
58
59
56 connect(emailHandler, SIGNAL(mailSent()), this, SLOT(mailSent()) ); 60 connect(emailHandler, SIGNAL(mailSent()), this, SLOT(mailSent()) );
57 61
@@ -66,6 +70,5 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl )
66 connect(inboxView, SIGNAL(pressed(QListViewItem *)), this, SLOT(inboxItemPressed()) ); 70 connect(inboxView, SIGNAL(pressed(QListViewItem *)), this, SLOT(inboxItemPressed()) );
67 connect(inboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(inboxItemReleased()) ); 71 connect(inboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(inboxItemReleased()) );
68 72
69
70 connect(emailHandler, SIGNAL(mailArrived(const Email &, bool)), this, 73 connect(emailHandler, SIGNAL(mailArrived(const Email &, bool)), this,
71 SLOT(mailArrived(const Email &, bool)) ); 74 SLOT(mailArrived(const Email &, bool)) );
@@ -85,4 +88,9 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl )
85 88
86 mailboxView->setCurrentTab(0); //ensure that inbox has focus 89 mailboxView->setCurrentTab(0); //ensure that inbox has focus
90
91 /*channel = new QCopChannel( "QPE/Application/mailit", this );
92 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
93 this, SLOT(receive(const QCString&, const QByteArray&)) );*/
94
87} 95}
88 96
@@ -105,27 +113,6 @@ EmailClient::~EmailClient()
105void EmailClient::init() 113void EmailClient::init()
106{ 114{
107 statusBar = new QStatusBar(this); 115 initStatusBar(this);
108 statusBar->setSizeGripEnabled(FALSE); 116
109
110 status1Label = new QLabel( tr("Idle"), statusBar);
111 status2Label = new QLabel("", statusBar);
112 connect(emailHandler, SIGNAL(updatePopStatus(const QString &)),
113 status2Label, SLOT(setText(const QString &)) );
114 connect(emailHandler, SIGNAL(updateSmtpStatus(const QString &)),
115 status2Label, SLOT(setText(const QString &)) );
116
117 progressBar = new QProgressBar(statusBar);
118
119 connect(emailHandler, SIGNAL(mailboxSize(int)),
120 this, SLOT(setTotalSize(int)) );
121 connect(emailHandler, SIGNAL(currentMailSize(int)),
122 this, SLOT(setMailSize(int)) );
123 connect(emailHandler, SIGNAL(downloadedSize(int)),
124 this, SLOT(setDownloadedSize(int)) );
125
126 statusBar->addWidget(status1Label);
127 statusBar->addWidget(progressBar);
128 statusBar->addWidget(status2Label);
129
130 setToolBarsMovable(FALSE); 117 setToolBarsMovable(FALSE);
131 118
@@ -195,6 +182,9 @@ void EmailClient::init()
195 inboxView->setMinimumSize( QSize( 0, 0 ) ); 182 inboxView->setMinimumSize( QSize( 0, 0 ) );
196 inboxView->setAllColumnsShowFocus(TRUE); 183 inboxView->setAllColumnsShowFocus(TRUE);
197 QWhatsThis::add(inboxView,QWidget::tr("This is the inbox view.\n It keeps the fetched mail which can be viewed by double clicking the entry.\n" 184 QWhatsThis::add(inboxView,QWidget::tr("This is the inbox view.\n"
198 " A blue attachment icon shows whether this mail has attachments.")); 185 "It keeps the fetched mail which can be \n"
186 "viewed by double clicking the entry.\n"
187 "blue attachment icon shows whether this \n"
188 "mailhas attachments.\n"));
199 189
200 grid_2->addWidget( inboxView, 2, 0 ); 190 grid_2->addWidget( inboxView, 2, 0 );
@@ -211,5 +201,7 @@ void EmailClient::init()
211 outboxView->setAllColumnsShowFocus(TRUE); 201 outboxView->setAllColumnsShowFocus(TRUE);
212 202
213 QWhatsThis::add(outboxView,QWidget::tr("This is the oubox view.\n It keeps the queued mails to send which can be reviewed by double clicking the entry.")); 203 QWhatsThis::add(outboxView,QWidget::tr("This is the outbox view.\n"
204 "It keeps the queued mails to send which can be \n"
205 "reviewed by double clicking the entry."));
214 grid_3->addWidget( outboxView, 0, 0 ); 206 grid_3->addWidget( outboxView, 0, 0 );
215 mailboxView->addTab( widget_2,"mailit/outbox", tr( "Outbox" ) ); 207 mailboxView->addTab( widget_2,"mailit/outbox", tr( "Outbox" ) );
@@ -219,4 +211,31 @@ void EmailClient::init()
219} 211}
220 212
213void EmailClient::initStatusBar(QWidget* parent)
214{
215 statusBar = new QStatusBar(parent);
216 statusBar->setSizeGripEnabled(FALSE);
217
218 status1Label = new QLabel( tr("Idle"), statusBar);
219 status2Label = new QLabel("", statusBar);
220 connect(emailHandler, SIGNAL(updatePopStatus(const QString &)),
221 status2Label, SLOT(setText(const QString &)) );
222 connect(emailHandler, SIGNAL(updateSmtpStatus(const QString &)),
223 status2Label, SLOT(setText(const QString &)) );
224
225 progressBar = new QProgressBar(statusBar);
226
227 connect(emailHandler, SIGNAL(mailboxSize(int)),
228 this, SLOT(setTotalSize(int)) );
229 connect(emailHandler, SIGNAL(currentMailSize(int)),
230 this, SLOT(setMailSize(int)) );
231 connect(emailHandler, SIGNAL(downloadedSize(int)),
232 this, SLOT(setDownloadedSize(int)) );
233
234 statusBar->addWidget(status1Label);
235 statusBar->addWidget(progressBar);
236 statusBar->addWidget(status2Label);
237
238}
239
221void EmailClient::compose() 240void EmailClient::compose()
222{ 241{
@@ -320,5 +339,5 @@ void EmailClient::getNewMail() {
320 339
321 //get any previous mails not downloaded and add to queue 340 //get any previous mails not downloaded and add to queue
322 mailDownloadList.clear(); 341 /*mailDownloadList.clear();
323 Email *mailPtr; 342 Email *mailPtr;
324 item = (EmailListItem *) inboxView->firstChild(); 343 item = (EmailListItem *) inboxView->firstChild();
@@ -329,5 +348,5 @@ void EmailClient::getNewMail() {
329 } 348 }
330 item = (EmailListItem *) item->nextSibling(); 349 item = (EmailListItem *) item->nextSibling();
331 } 350 }*/
332 351
333 emailHandler->getMailHeaders(); 352 emailHandler->getMailHeaders();
@@ -339,5 +358,5 @@ void EmailClient::getAllNewMail()
339 allAccounts = TRUE; 358 allAccounts = TRUE;
340 currentAccount = accountList.first(); 359 currentAccount = accountList.first();
341 getNewMail(); 360 getNewMail();
342} 361}
343 362
@@ -349,7 +368,8 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk)
349 emailHandler->parse(mail.rawMail, lineShift, &newMail); 368 emailHandler->parse(mail.rawMail, lineShift, &newMail);
350 mailconf->setGroup(newMail.id); 369 mailconf->setGroup(newMail.id);
351 370
352 if (fromDisk) 371 if (fromDisk)
353 { 372 {
373
354 newMail.downloaded = mailconf->readBoolEntry("downloaded"); 374 newMail.downloaded = mailconf->readBoolEntry("downloaded");
355 newMail.size = mailconf->readNumEntry("size"); 375 newMail.size = mailconf->readNumEntry("size");
@@ -359,4 +379,5 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk)
359 else 379 else
360 { //mail arrived from server 380 { //mail arrived from server
381
361 newMail.serverId = mail.serverId; 382 newMail.serverId = mail.serverId;
362 newMail.size = mail.size; 383 newMail.size = mail.size;
@@ -919,5 +940,5 @@ void EmailClient::inboxItemReleased()
919} 940}
920 941
921void EmailClient::timerEvent(QTimerEvent *e) 942/*void EmailClient::timerEvent(QTimerEvent *e)
922{ 943{
923 /*killTimer(timerID); 944 /*killTimer(timerID);
@@ -936,6 +957,6 @@ void EmailClient::timerEvent(QTimerEvent *e)
936 957
937 if (action) delete action; 958 if (action) delete action;
938 */ 959
939} 960}*/
940 961
941Email* EmailClient::getCurrentMail() 962Email* EmailClient::getCurrentMail()
@@ -954,6 +975,4 @@ void EmailClient::download(Email* mail)
954 tempMailDownloadList.clear(); 975 tempMailDownloadList.clear();
955 tempMailDownloadList.sizeInsert(mail->serverId, mail->size); 976 tempMailDownloadList.sizeInsert(mail->serverId, mail->size);
956 if (accountList.count()>0)
957 qDebug("Accounts present");
958 977
959 acc=accountList.at(mail->fromAccountId-1); 978 acc=accountList.at(mail->fromAccountId-1);
@@ -967,2 +986,47 @@ void EmailClient::download(Email* mail)
967 tr("No account associated"), tr("There is no active account \nassociated to this mail\n it can not be downloaded"), "Abort\n"); 986 tr("No account associated"), tr("There is no active account \nassociated to this mail\n it can not be downloaded"), "Abort\n");
968} 987}
988
989void EmailClient::receive(const QCString& msg, const QByteArray& data)
990{
991 /*if (msg=="getMail()")
992 {
993 /*QDialog qd(qApp->activeWindow(),"Getting mail",true);
994 QVBoxLayout *vbProg = new QVBoxLayout( &qd );
995
996 initStatusBar(&qd);
997
998 if (statusBar==0)
999 {
1000 qDebug("No Bar ...");
1001 //statusBar=new ProgressBar(&qd);
1002 }
1003 statusBar->show();
1004 vbProg->addWidget(statusBar);
1005 qd.showMaximized();
1006 qd.show();
1007 emit getAllNewMail();
1008 //qd.exec();
1009 }
1010 else if (msg=="compose()")
1011 {
1012 QDialog qd(qApp->activeWindow(),"Getting mail",true);
1013
1014 WriteMail wm(&qd,"write new mail");
1015 QVBoxLayout vbProg( &qd );
1016
1017 wm.showMaximized();
1018 vbProg.addWidget(&wm);
1019
1020 qd.showMaximized();
1021
1022 emit composeRequested();
1023 qd.exec();
1024
1025 QMessageBox::warning(qApp->activeWindow(),tr("Info"), tr("Info"), "OK\n");
1026 }
1027
1028 else if (msg=="dialog()")
1029 {
1030 QMessageBox::warning(qApp->activeWindow(),tr("Info"), tr("Info"), "OK\n");
1031 }*/
1032}