-rw-r--r-- | noncore/unsupported/mailit/emailclient.cpp | 130 | ||||
-rw-r--r-- | noncore/unsupported/mailit/emailclient.h | 11 | ||||
-rw-r--r-- | noncore/unsupported/mailit/emailhandler.cpp | 4 | ||||
-rw-r--r-- | noncore/unsupported/mailit/emailhandler.h | 1 | ||||
-rw-r--r-- | noncore/unsupported/mailit/mailitwindow.cpp | 3 | ||||
-rw-r--r-- | noncore/unsupported/mailit/popclient.cpp | 4 | ||||
-rw-r--r-- | noncore/unsupported/mailit/readmail.cpp | 62 | ||||
-rw-r--r-- | noncore/unsupported/mailit/readmail.h | 8 | ||||
-rw-r--r-- | noncore/unsupported/mailit/writemail.cpp | 31 |
9 files changed, 193 insertions, 61 deletions
diff --git a/noncore/unsupported/mailit/emailclient.cpp b/noncore/unsupported/mailit/emailclient.cpp index dff1888..2cedc51 100644 --- a/noncore/unsupported/mailit/emailclient.cpp +++ b/noncore/unsupported/mailit/emailclient.cpp @@ -21,2 +21,3 @@ #include <qmessagebox.h> +#include <qvbox.h> #include <qfile.h> @@ -28,2 +29,3 @@ #include "emailclient.h" +#include "writemail.h" @@ -55,2 +57,4 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) + + connect(emailHandler, SIGNAL(mailSent()), this, SLOT(mailSent()) ); @@ -68,3 +72,2 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) - connect(emailHandler, SIGNAL(mailArrived(const Email &, bool)), this, @@ -86,2 +89,7 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) mailboxView->setCurrentTab(0); //ensure that inbox has focus + + /*channel = new QCopChannel( "QPE/Application/mailit", this ); + connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), + this, SLOT(receive(const QCString&, const QByteArray&)) );*/ + } @@ -106,24 +114,3 @@ void EmailClient::init() { - statusBar = new QStatusBar(this); - statusBar->setSizeGripEnabled(FALSE); - - status1Label = new QLabel( tr("Idle"), statusBar); - status2Label = new QLabel("", statusBar); - connect(emailHandler, SIGNAL(updatePopStatus(const QString &)), - status2Label, SLOT(setText(const QString &)) ); - connect(emailHandler, SIGNAL(updateSmtpStatus(const QString &)), - status2Label, SLOT(setText(const QString &)) ); - - progressBar = new QProgressBar(statusBar); - - connect(emailHandler, SIGNAL(mailboxSize(int)), - this, SLOT(setTotalSize(int)) ); - connect(emailHandler, SIGNAL(currentMailSize(int)), - this, SLOT(setMailSize(int)) ); - connect(emailHandler, SIGNAL(downloadedSize(int)), - this, SLOT(setDownloadedSize(int)) ); - - statusBar->addWidget(status1Label); - statusBar->addWidget(progressBar); - statusBar->addWidget(status2Label); + initStatusBar(this); @@ -196,4 +183,7 @@ void EmailClient::init() inboxView->setAllColumnsShowFocus(TRUE); - 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" - " A blue attachment icon shows whether this mail has attachments.")); + QWhatsThis::add(inboxView,QWidget::tr("This is the inbox view.\n" + "It keeps the fetched mail which can be \n" + "viewed by double clicking the entry.\n" + "blue attachment icon shows whether this \n" + "mailhas attachments.\n")); @@ -212,3 +202,5 @@ void EmailClient::init() - 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.")); + QWhatsThis::add(outboxView,QWidget::tr("This is the outbox view.\n" + "It keeps the queued mails to send which can be \n" + "reviewed by double clicking the entry.")); grid_3->addWidget( outboxView, 0, 0 ); @@ -220,2 +212,29 @@ void EmailClient::init() +void EmailClient::initStatusBar(QWidget* parent) +{ + statusBar = new QStatusBar(parent); + statusBar->setSizeGripEnabled(FALSE); + + status1Label = new QLabel( tr("Idle"), statusBar); + status2Label = new QLabel("", statusBar); + connect(emailHandler, SIGNAL(updatePopStatus(const QString &)), + status2Label, SLOT(setText(const QString &)) ); + connect(emailHandler, SIGNAL(updateSmtpStatus(const QString &)), + status2Label, SLOT(setText(const QString &)) ); + + progressBar = new QProgressBar(statusBar); + + connect(emailHandler, SIGNAL(mailboxSize(int)), + this, SLOT(setTotalSize(int)) ); + connect(emailHandler, SIGNAL(currentMailSize(int)), + this, SLOT(setMailSize(int)) ); + connect(emailHandler, SIGNAL(downloadedSize(int)), + this, SLOT(setDownloadedSize(int)) ); + + statusBar->addWidget(status1Label); + statusBar->addWidget(progressBar); + statusBar->addWidget(status2Label); + +} + void EmailClient::compose() @@ -321,3 +340,3 @@ void EmailClient::getNewMail() { //get any previous mails not downloaded and add to queue - mailDownloadList.clear(); + /*mailDownloadList.clear(); Email *mailPtr; @@ -330,3 +349,3 @@ void EmailClient::getNewMail() { item = (EmailListItem *) item->nextSibling(); - } + }*/ @@ -353,2 +372,3 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) { + newMail.downloaded = mailconf->readBoolEntry("downloaded"); @@ -360,2 +380,3 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) { //mail arrived from server + newMail.serverId = mail.serverId; @@ -920,3 +941,3 @@ void EmailClient::inboxItemReleased() -void EmailClient::timerEvent(QTimerEvent *e) +/*void EmailClient::timerEvent(QTimerEvent *e) { @@ -937,4 +958,4 @@ void EmailClient::timerEvent(QTimerEvent *e) if (action) delete action; - */ -} + +}*/ @@ -955,4 +976,2 @@ void EmailClient::download(Email* mail) tempMailDownloadList.sizeInsert(mail->serverId, mail->size); - if (accountList.count()>0) - qDebug("Accounts present"); @@ -968 +987,46 @@ void EmailClient::download(Email* mail) } + +void EmailClient::receive(const QCString& msg, const QByteArray& data) +{ + /*if (msg=="getMail()") + { + /*QDialog qd(qApp->activeWindow(),"Getting mail",true); + QVBoxLayout *vbProg = new QVBoxLayout( &qd ); + + initStatusBar(&qd); + + if (statusBar==0) + { + qDebug("No Bar ..."); + //statusBar=new ProgressBar(&qd); + } + statusBar->show(); + vbProg->addWidget(statusBar); + qd.showMaximized(); + qd.show(); + emit getAllNewMail(); + //qd.exec(); + } + else if (msg=="compose()") + { + QDialog qd(qApp->activeWindow(),"Getting mail",true); + + WriteMail wm(&qd,"write new mail"); + QVBoxLayout vbProg( &qd ); + + wm.showMaximized(); + vbProg.addWidget(&wm); + + qd.showMaximized(); + + emit composeRequested(); + qd.exec(); + + QMessageBox::warning(qApp->activeWindow(),tr("Info"), tr("Info"), "OK\n"); + } + + else if (msg=="dialog()") + { + QMessageBox::warning(qApp->activeWindow(),tr("Info"), tr("Info"), "OK\n"); + }*/ +} diff --git a/noncore/unsupported/mailit/emailclient.h b/noncore/unsupported/mailit/emailclient.h index 549683b..994fec5 100644 --- a/noncore/unsupported/mailit/emailclient.h +++ b/noncore/unsupported/mailit/emailclient.h @@ -43,2 +43,3 @@ #include <opie/otabwidget.h> +#include <qpe/qcopenvelope_qws.h> #include <qtimer.h> @@ -72,6 +73,5 @@ public: AddressList* getAdrListRef(); - void download(Email*); protected: - void timerEvent(QTimerEvent*); + //void timerEvent(QTimerEvent*); @@ -118,2 +118,3 @@ public slots: void moveMailFront(Email *mailPtr); + void download(Email*); /* void reply(); @@ -123,4 +124,8 @@ public slots: +private slots: + void receive(const QCString&, const QByteArray&); + private: void init(); + void initStatusBar(QWidget*); void readMail(); @@ -148,2 +153,4 @@ private: + QCopChannel* channel; + QToolBar *bar; diff --git a/noncore/unsupported/mailit/emailhandler.cpp b/noncore/unsupported/mailit/emailhandler.cpp index fbbada7..c7b27a0 100644 --- a/noncore/unsupported/mailit/emailhandler.cpp +++ b/noncore/unsupported/mailit/emailhandler.cpp @@ -41,2 +41,4 @@ EmailHandler::EmailHandler() { + qDebug("EMailHandler::EmailHandler"); + smtpClient = new SmtpClient(); @@ -117,2 +119,3 @@ void EmailHandler::getMailHeaders() popClient->headersOnly(headers, mailAccount.syncLimit); //less than requested syncLimit, download all + qDebug("Initiating connection"); popClient->newConnection(mailAccount.popServer, 110); @@ -628 +631,2 @@ void EmailHandler::cancel() } + diff --git a/noncore/unsupported/mailit/emailhandler.h b/noncore/unsupported/mailit/emailhandler.h index b645868..5b59f65 100644 --- a/noncore/unsupported/mailit/emailhandler.h +++ b/noncore/unsupported/mailit/emailhandler.h @@ -30,2 +30,3 @@ #include <qcollection.h> +#include <qpe/qcopenvelope_qws.h> diff --git a/noncore/unsupported/mailit/mailitwindow.cpp b/noncore/unsupported/mailit/mailitwindow.cpp index ffee67e..a111241 100644 --- a/noncore/unsupported/mailit/mailitwindow.cpp +++ b/noncore/unsupported/mailit/mailitwindow.cpp @@ -63,2 +63,5 @@ MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl) this, SLOT(updateCaption(const QString &)) ); + + connect(readMail, SIGNAL(download(Email *)), emailClient, SLOT(download(Email*)) ); + viewingMail = FALSE; diff --git a/noncore/unsupported/mailit/popclient.cpp b/noncore/unsupported/mailit/popclient.cpp index 6105d09..fedc4e2 100644 --- a/noncore/unsupported/mailit/popclient.cpp +++ b/noncore/unsupported/mailit/popclient.cpp @@ -31,2 +31,3 @@ PopClient::PopClient() { + socket = new QSocket(this, "popClient"); @@ -120,2 +121,3 @@ void PopClient::incomingData() + response = socket->readLine(); @@ -159,2 +161,3 @@ void PopClient::incomingData() status = Stat; + break; @@ -275,3 +278,2 @@ void PopClient::incomingData() } else { //message reach entire size - if ( (selected)||(mailSize <= headerLimit)) //mail size limit is not used if late download is active diff --git a/noncore/unsupported/mailit/readmail.cpp b/noncore/unsupported/mailit/readmail.cpp index 4eae7f6..1682675 100644 --- a/noncore/unsupported/mailit/readmail.cpp +++ b/noncore/unsupported/mailit/readmail.cpp @@ -21,4 +21,6 @@ #include <qimage.h> +#include <qwhatsthis.h> #include <qmime.h> #include <qaction.h> +#include <qpopupmenu.h> #include <qpe/resource.h> @@ -44,2 +46,4 @@ void ReadMail::init() + QPopupMenu* mailaction=new QPopupMenu(this); + bar = new QToolBar(this); @@ -57,12 +61,6 @@ void ReadMail::init() - //reply dependant on viewing inbox - replyButton = new QAction( tr( "Reply" ), Resource::loadPixmap( "mailit/reply" ), - QString::null, 0, this, 0 ); - connect(replyButton, SIGNAL(activated()), this, SLOT(reply()) ); - replyButton->setWhatsThis(tr("Click here to reply to the selected mail")); + downloadButton = new QAction( tr( "Download" ), Resource::loadPixmap( "mailit/download" ),QString::null, 0, this, 0 ); + connect(downloadButton, SIGNAL(activated()), this, SLOT(download()) ); + downloadButton->setWhatsThis(tr("Click here to download the selected mail")); - forwardButton = new QAction( tr( "Forward" ), Resource::loadPixmap( "mailit/forward" ), - QString::null, 0, this, 0 ); - connect(forwardButton, SIGNAL(activated()), this, SLOT(forward()) ); - forwardButton->setWhatsThis(tr("Click here to forward the selected mail")); @@ -96,2 +94,19 @@ void ReadMail::init() + //reply dependant on viewing inbox + replyButton = new QToolButton(Resource::loadPixmap("mailit/reply"),tr("reply"),tr("reply to mail"), this,SLOT(reply()),bar); + QWhatsThis::add(replyButton,tr("Click here to reply to the selected mail\nPress and hold for more options.")); + replyButton->setPopup(mailaction); + + replyAllButton = new QAction( tr( "Reply all" ), Resource::loadPixmap( "mailit/reply" ),QString::null, 0, this, 0 ); + connect(replyAllButton, SIGNAL(activated()), this, SLOT(replyAll())); + replyAllButton->setWhatsThis(tr("Click here to reply to the selected mail to CC: addresses also")); + replyAllButton->addTo(mailaction); + + forwardButton = new QAction( tr( "Forward" ), Resource::loadPixmap( "mailit/forward" ), + QString::null, 0, this, 0 ); + connect(forwardButton, SIGNAL(activated()), this, SLOT(forward())); + forwardButton->setWhatsThis(tr("Click here to forward the selected mail")); + forwardButton->addTo(mailaction); + + deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); @@ -121,12 +136,16 @@ void ReadMail::updateView() - replyButton->removeFrom(mailMenu); - replyButton->removeFrom(bar); + replyButton->setEnabled(false); + /*replyButton->removeFrom(bar); forwardButton->removeFrom(mailMenu); - forwardButton->removeFrom(bar); + forwardButton->removeFrom(bar);*/ + downloadButton->removeFrom(bar); + + //downloadButton->setEnabled(!mail->downloaded); + if (inbox == TRUE) { - replyButton->addTo(bar); - replyButton->addTo(mailMenu); + replyButton->setEnabled(true); + /*replyButton->addTo(mailMenu); forwardButton->addTo(bar); - forwardButton->addTo(mailMenu); + forwardButton->addTo(mailMenu);*/ @@ -134,2 +153,5 @@ void ReadMail::updateView() if (!mail->downloaded) { + + downloadButton->addTo(bar); + //report currently viewed mail so that it will be @@ -359,2 +381,7 @@ void ReadMail::reply() { + emit replyRequested(*mail, (bool&)FALSE); +} + +void ReadMail::replyAll() +{ emit replyRequested(*mail, (bool&)TRUE); @@ -367 +394,6 @@ void ReadMail::forward() +void ReadMail::download() +{ + emit download(mail); +} + diff --git a/noncore/unsupported/mailit/readmail.h b/noncore/unsupported/mailit/readmail.h index df32c34..6700595 100644 --- a/noncore/unsupported/mailit/readmail.h +++ b/noncore/unsupported/mailit/readmail.h @@ -30,2 +30,3 @@ #include <qtextview.h> +#include <qtoolbutton.h> @@ -52,2 +53,3 @@ signals: void viewingMail(Email *); + void download (Email*); @@ -61,3 +63,5 @@ public slots: void reply(); + void replyAll(); void forward(); + void download(); @@ -84,4 +88,6 @@ private: QAction *previousButton; - QAction *replyButton; + QToolButton *replyButton; QAction *forwardButton; + QAction *replyAllButton; + QAction *downloadButton; }; diff --git a/noncore/unsupported/mailit/writemail.cpp b/noncore/unsupported/mailit/writemail.cpp index dcf0c6e..c75494e 100644 --- a/noncore/unsupported/mailit/writemail.cpp +++ b/noncore/unsupported/mailit/writemail.cpp @@ -24,4 +24,3 @@ -WriteMail::WriteMail( QWidget* parent, const char* name, WFlags fl ) - : QMainWindow( parent, name, fl ) +WriteMail::WriteMail( QWidget* parent, const char* name, WFlags fl ):QMainWindow( parent, name, fl ) { @@ -270,4 +269,3 @@ void WriteMail::reply(Email replyMail, bool replyAll) } - - addRecipients(replyAll); + else ccInput->clear(); @@ -275,2 +273,9 @@ void WriteMail::reply(Email replyMail, bool replyAll) + QString citation=mail.fromMail; + citation.append(tr(" wrote on ")); + citation.append(mail.date); + citation.append(":\n"); + + + //mail.body.insert(0,tr("On")); pos = 0; @@ -282,3 +287,3 @@ void WriteMail::reply(Email replyMail, bool replyAll) } - + mail.body.insert(0,citation); emailInput->setText(mail.body); @@ -310,5 +315,12 @@ bool WriteMail::getRecipients(bool ccField) + if (ccField) + { + mail.carbonCopies.clear(); + temp = ccInput->text(); + } + else + { mail.recipients.clear(); - - ccField ? temp = ccInput->text() : temp=toInput->text() ; + temp=toInput->text() ; + } @@ -320,3 +332,3 @@ bool WriteMail::getRecipients(bool ccField) ccField ? mail.carbonCopies.append(str) : mail.recipients.append(str); - addressList->addContact(str, ""); + //addressList->addContact(str, ""); } @@ -326,3 +338,3 @@ bool WriteMail::getRecipients(bool ccField) ccField ? mail.carbonCopies.append(temp) : mail.recipients.append(temp); - addressList->addContact(temp, ""); + //addressList->addContact(temp, ""); @@ -385,2 +397,3 @@ void WriteMail::newMail() toInput->clear(); + ccInput->clear(); subjectInput->clear(); |