summaryrefslogtreecommitdiff
authorgroucho <groucho>2003-04-20 07:59:48 (UTC)
committer groucho <groucho>2003-04-20 07:59:48 (UTC)
commit8b85cba50912127ff6a2d048021baf68306481c6 (patch) (side-by-side diff)
treebfd1b377911d05db8e1c816f72fe070d5a5b2ff3
parent6b381e438fdeb1757b3278c683349dee9c4ab230 (diff)
downloadopie-8b85cba50912127ff6a2d048021baf68306481c6.zip
opie-8b85cba50912127ff6a2d048021baf68306481c6.tar.gz
opie-8b85cba50912127ff6a2d048021baf68306481c6.tar.bz2
- Added CC: support
- Added mail forwarding - Added icon for selective mail download - Removing mails from mail list via icon - Temporarily disabled mail header download queue
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/mailit/emailclient.cpp152
-rw-r--r--noncore/net/mailit/emailclient.h28
-rw-r--r--noncore/net/mailit/emailhandler.cpp15
-rw-r--r--noncore/net/mailit/mailitwindow.cpp40
-rw-r--r--noncore/net/mailit/mailitwindow.h8
-rw-r--r--noncore/net/mailit/readmail.cpp32
-rw-r--r--noncore/net/mailit/readmail.h5
-rw-r--r--noncore/net/mailit/writemail.cpp101
-rw-r--r--noncore/net/mailit/writemail.h9
-rw-r--r--noncore/unsupported/mailit/emailclient.cpp152
-rw-r--r--noncore/unsupported/mailit/emailclient.h28
-rw-r--r--noncore/unsupported/mailit/emailhandler.cpp15
-rw-r--r--noncore/unsupported/mailit/mailitwindow.cpp40
-rw-r--r--noncore/unsupported/mailit/mailitwindow.h8
-rw-r--r--noncore/unsupported/mailit/readmail.cpp32
-rw-r--r--noncore/unsupported/mailit/readmail.h5
-rw-r--r--noncore/unsupported/mailit/writemail.cpp101
-rw-r--r--noncore/unsupported/mailit/writemail.h9
18 files changed, 708 insertions, 72 deletions
diff --git a/noncore/net/mailit/emailclient.cpp b/noncore/net/mailit/emailclient.cpp
index 0d82a9a..ad1e0b4 100644
--- a/noncore/net/mailit/emailclient.cpp
+++ b/noncore/net/mailit/emailclient.cpp
@@ -60,6 +60,10 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl )
SLOT(popError(int)) );
- connect(inboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(inboxItemSelected()) );
- connect(outboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(outboxItemSelected()) );
+ connect(inboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(inboxItemSelected()) );
+ connect(outboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(outboxItemSelected()) );
+
+ connect(inboxView, SIGNAL(pressed(QListViewItem *)), this, SLOT(inboxItemPressed()) );
+ connect(inboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(inboxItemReleased()) );
+
connect(emailHandler, SIGNAL(mailArrived(const Email &, bool)), this,
@@ -144,8 +148,24 @@ void EmailClient::init()
bar = new QToolBar(this);
- getMailButton = new QAction(tr("Get all mail"), Resource::loadPixmap("mailit/getmail"), QString::null, 0, this, 0);
+ getMailButton = new QToolButton(Resource::loadPixmap("mailit/getmail"),tr("getMail"),tr("select account"), this,SLOT(getAllNewMail()),bar);
+ //connect(setAccountlButton, SIGNAL(activated()), this, SLOT(setCurrentAccount()) );
+ // setAccountButton->addTo(bar);
+ //setAccountButton->addTo(mail);
+
+ /*idCount = 0;
+
+ for (MailAccount* accountPtr = accountList.first(); accountPtr != 0;
+ accountPtr = accountList.next()) {
+
+ selectAccountMenu->insertItem(accountPtr->accountName,this, SLOT(selectAccount(int)), 0, idCount);
+ idCount++;
+ }*/
+ getMailButton->setPopup(selectAccountMenu);
+
+
+ /*getMailButton = new QAction(tr("Get all mail"), Resource::loadPixmap("mailit/getmail"), QString::null, 0, this, 0);
connect(getMailButton, SIGNAL(activated()), this, SLOT(getAllNewMail()) );
- getMailButton->addTo(bar);
- getMailButton->addTo(mail);
+ getMailButton->addTo(bar);*/
+ //getMailButton->addTo(mail);
sendMailButton = new QAction(tr("Send mail"), Resource::loadPixmap("mailit/sendqueue"), QString::null, 0, this, 0);
@@ -165,4 +185,8 @@ void EmailClient::init()
cancelButton->setEnabled(FALSE);
+ deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 );
+ connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) );
+ deleteButton->addTo(bar);
+
mailboxView = new OTabWidget( this, "mailboxView" );
@@ -196,4 +220,6 @@ void EmailClient::init()
setCentralWidget(mailboxView);
+
+ mailboxView->setCurrentTab(0);
}
@@ -233,4 +259,6 @@ void EmailClient::enqueMail(const Email &mail)
item = new EmailListItem(outboxView, addMail, false);
+ mailboxView->setCurrentTab(1);
+
}
@@ -297,5 +325,5 @@ void EmailClient::getNewMail() {
//get any previous mails not downloaded and add to queue
- mailDownloadList.clear();
+/* mailDownloadList.clear();
Email *mailPtr;
item = (EmailListItem *) inboxView->firstChild();
@@ -306,5 +334,5 @@ void EmailClient::getNewMail() {
}
item = (EmailListItem *) item->nextSibling();
- }
+ }*/
emailHandler->getMailHeaders();
@@ -416,4 +444,6 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk)
}
+ mailboxView->setCurrentTab(0);
+
}
@@ -445,4 +475,6 @@ void EmailClient::allMailArrived(int count)
emailHandler->getMailByList(&mailDownloadList);
+
+ mailboxView->setCurrentTab(0);
}
@@ -510,4 +542,6 @@ void EmailClient::popError(int code)
void EmailClient::inboxItemSelected()
{
+ killTimer(timerID);
+
item = (EmailListItem*) inboxView->selectedItem();
if (item != NULL) {
@@ -518,4 +552,6 @@ void EmailClient::inboxItemSelected()
void EmailClient::outboxItemSelected()
{
+ killTimer(timerID);
+
item = (EmailListItem*) outboxView->selectedItem();
if (item != NULL) {
@@ -693,4 +729,5 @@ void EmailClient::readSettings()
void EmailClient::saveSettings()
{
+
QString temp;
QFile f( getPath(FALSE) + "settings.txt");
@@ -702,5 +739,5 @@ void EmailClient::saveSettings()
}
QTextStream t(&f);
- t << "#Settings for QPE Mailit program\n";
+ t << "#Settings for OPIE Mailit program\n";
for (accountPtr = accountList.first(); accountPtr != 0;
@@ -825,5 +862,6 @@ void EmailClient::deleteMail(EmailListItem *mailItem, bool &inbox)
Enclosure *ePtr;
- if (inbox) {
+ if (inbox)
+ {
mPtr = mailItem->getMail();
@@ -845,5 +883,7 @@ void EmailClient::deleteMail(EmailListItem *mailItem, bool &inbox)
}
inboxView->takeItem(mailItem);
- } else {
+ }
+ else
+ {
outboxView->takeItem(mailItem);
}
@@ -871,2 +911,94 @@ void EmailClient::setDownloadedSize(int size)
}
}
+
+void EmailClient::deleteItem()
+{
+ bool inbox=mailboxView->currentTab()==0;
+
+ EmailListItem* eli;
+
+ inbox ? eli=(EmailListItem*)inboxView->selectedItem():eli=(EmailListItem*)outboxView->selectedItem();
+
+ if (eli)
+ deleteMail(eli,(bool&)inbox);
+}
+
+void EmailClient::inboxItemPressed()
+{
+// timerID=startTimer(500);
+}
+
+void EmailClient::inboxItemReleased()
+{
+ // killTimer(timerID);
+}
+
+void EmailClient::timerEvent(QTimerEvent *e)
+{
+ /*killTimer(timerID);
+
+
+ QPopupMenu *action = new QPopupMenu(this);
+
+ int reply=0;
+
+ action->insertItem(tr( "Reply To" ),this,SLOT(reply()));
+ action->insertItem( tr( "Reply All" ),this,SLOT(replyAll()));
+ action->insertItem( tr( "Forward" ), this,SLOT(forward()));
+ action->insertItem( tr( "Remove Mail" ), this,SLOT(remove()));
+
+ action->exec(QCursor::pos());
+
+ if (action) delete action;
+ */
+}
+
+Email* EmailClient::getCurrentMail()
+{
+ EmailListItem *eli=(EmailListItem* ) (inboxView->selectedItem());
+ if (eli!=NULL)
+ return eli->getMail();
+ else
+ return NULL;
+}
+
+/*
+void EmailClient::reply()
+{
+ Email* mail=getCurrentMail();
+
+ if (mail!=NULL)
+ {
+ emit reply(*mail);
+ }
+}
+
+void EmailClient::replyAll()
+{
+ Email* mail=getCurrentMail();
+
+ if (mail!=NULL)
+ {
+ emit replyAll(*mail);
+ }
+}
+
+void EmailClient::forward()
+{
+ Email* mail=getCurrentMail();
+
+ if (mail!=NULL)
+ {
+ emit reply(*mail);
+ }
+}
+
+void EmailClient::remove()
+{
+ Email* mail=getCurrentMail();
+
+ if (mail!=NULL)
+ {
+ emit remove(*mail);
+ }
+}*/ \ No newline at end of file
diff --git a/noncore/net/mailit/emailclient.h b/noncore/net/mailit/emailclient.h
index 80457f9..0890dcf 100644
--- a/noncore/net/mailit/emailclient.h
+++ b/noncore/net/mailit/emailclient.h
@@ -33,4 +33,5 @@
#include <qlayout.h>
#include <qtooltip.h>
+#include <qtoolbutton.h>
#include <qimage.h>
#include <qpixmap.h>
@@ -41,4 +42,5 @@
#include <stdlib.h>
#include <opie/otabwidget.h>
+#include <qtimer.h>
#include "emailhandler.h"
@@ -70,4 +72,7 @@ public:
AddressList* getAdrListRef();
+protected:
+ void timerEvent(QTimerEvent*);
+
signals:
void composeRequested();
@@ -75,4 +80,11 @@ signals:
void mailUpdated(Email *);
void newCaption(const QString &);
+ void replyRequested(Email&, bool&);
+ void forwardRequested(Email&);
+ void removeItem(EmailListItem*, bool&);
+ /*void reply(Email&);
+ void replyAll(Email&);
+ void remove(Email&);
+ void forward(Email&);*/
public slots:
@@ -83,4 +95,5 @@ public slots:
void sendQuedMail();
void mailSent();
+ void deleteItem();
void getNewMail();
void getAllNewMail();
@@ -89,4 +102,6 @@ public slots:
void inboxItemSelected();
void outboxItemSelected();
+ void inboxItemPressed();
+ void inboxItemReleased();
void mailArrived(const Email &mail, bool fromDisk);
void allMailArrived(int);
@@ -101,4 +116,8 @@ public slots:
void setDownloadedSize(int);
void moveMailFront(Email *mailPtr);
+/* void reply();
+ void replyAll();
+ void forward();
+ void remove();*/
private:
@@ -108,6 +127,6 @@ private:
void readSettings();
void saveSettings();
-
-private:
+ Email* getCurrentMail();
+ int timerID;
Config *mailconf;
int newAccountId, idCount, mailIdCount;
@@ -129,8 +148,10 @@ private:
QStatusBar *statusBar;
QLabel *status1Label, *status2Label;
- QAction *getMailButton;
+ QToolButton *getMailButton;
QAction *sendMailButton;
QAction *composeButton;
QAction *cancelButton;
+ QAction *deleteButton;
+ //QToolButton *setAccountButton;
QMenuBar *mb;
@@ -138,4 +159,5 @@ private:
QPopupMenu *editAccountMenu;
QPopupMenu *deleteAccountMenu;
+ QPopupMenu *setAccountMenu;
OTabWidget* mailboxView;
diff --git a/noncore/net/mailit/emailhandler.cpp b/noncore/net/mailit/emailhandler.cpp
index 03f8a28..f6c6d60 100644
--- a/noncore/net/mailit/emailhandler.cpp
+++ b/noncore/net/mailit/emailhandler.cpp
@@ -201,5 +201,5 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail)
//@@@ToDo: Rewrite the parser as To: stops at the first occurence- which is Delivered-To:
- if (pos = p.find("TO",':', pos, TRUE) != -1)
+ if ((pos = p.find("TO",':', 0, TRUE)) != -1)
{
pos++;
@@ -207,4 +207,10 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail)
}
+ //@@@ToDo: Rewrite the parser as To: stops at the first occurence- which is Delivered-To:
+ if ((pos = p.find("CC",':', 0, TRUE)) != -1)
+ {
+ pos++;
+ mail->carbonCopies.append (p.getString(&pos, 'z', TRUE) );
+ }
@@ -435,4 +441,11 @@ int EmailHandler::encodeMime(Email *mail)
newBody += *it + " ";
}
+
+ newBody += "\r\nCC: ";
+
+ for (QStringList::Iterator it = mail->carbonCopies.begin(); it != mail->carbonCopies.end(); ++it ) {
+ newBody += *it + " ";
+ }
+
newBody += "\r\nSubject: " + mail->subject + "\r\n";
diff --git a/noncore/net/mailit/mailitwindow.cpp b/noncore/net/mailit/mailitwindow.cpp
index 2bf1dcb..ef5fc09 100644
--- a/noncore/net/mailit/mailitwindow.cpp
+++ b/noncore/net/mailit/mailitwindow.cpp
@@ -48,6 +48,9 @@ MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl)
connect(readMail, SIGNAL(cancelView()), this, SLOT(showEmailClient()) );
- connect(readMail, SIGNAL(replyRequested(Email &)), this,
- SLOT(composeReply(Email &)) );
+ connect(readMail, SIGNAL(replyRequested(Email &, bool&)), this,
+ SLOT(composeReply(Email &, bool&)) );
+ connect(readMail, SIGNAL(forwardRequested(Email &)), this,
+ SLOT(composeForward(Email &)) );
+
connect(readMail, SIGNAL(removeItem(EmailListItem *, bool &)), emailClient,
SLOT(deleteMail(EmailListItem *, bool &)) );
@@ -84,10 +87,17 @@ void MailItWindow::compose()
}
-void MailItWindow::composeReply(Email &mail)
+void MailItWindow::composeReply(Email &mail, bool& replyAll)
+{
+ compose();
+ writeMail->reply(mail,replyAll) ;
+}
+
+void MailItWindow::composeForward(Email &mail)
{
compose();
- writeMail->reply(mail);
+ writeMail->forward(mail) ;
}
+
void MailItWindow::showEmailClient()
{
@@ -132,2 +142,24 @@ void MailItWindow::setDocument(const QString &_address)
}
+/*void MailItWindow::reply(Email& mail)
+{
+ qDebug("####EmailClient: 0 reached");
+ composeReply(mail,(bool&)FALSE);
+}
+
+void MailItWindow::replyAll(Email& mail)
+{
+ qDebug("####EmailClient: 1 reached");
+ composeReply(mail,(bool&)TRUE);
+}
+
+void MailItWindow::forward(Email& mail)
+{
+ qDebug("####EmailClient: 2 reached");
+}
+
+void MailItWindow::remove(Email&)
+{
+ qDebug("####EmailClient: 3 reached");
+ //emit removeItem(eli,(bool&)TRUE);
+} */ \ No newline at end of file
diff --git a/noncore/net/mailit/mailitwindow.h b/noncore/net/mailit/mailitwindow.h
index 667960b..e818d32 100644
--- a/noncore/net/mailit/mailitwindow.h
+++ b/noncore/net/mailit/mailitwindow.h
@@ -37,7 +37,9 @@ public:
~MailItWindow();
+signals:
public slots:
void compose();
- void composeReply(Email &);
+ void composeReply(Email &, bool&);
+ void composeForward(Email &);
void showEmailClient();
void viewMail(QListView *, Email *mail);
@@ -46,4 +48,8 @@ public slots:
void updateCaption(const QString &);
void setDocument(const QString &);
+ /*void reply(Email&);
+ void replyAll(Email&);
+ void forward(Email&);
+ void remove(Email&);*/
private:
diff --git a/noncore/net/mailit/readmail.cpp b/noncore/net/mailit/readmail.cpp
index 7cd3e09..dc98a6f 100644
--- a/noncore/net/mailit/readmail.cpp
+++ b/noncore/net/mailit/readmail.cpp
@@ -61,4 +61,8 @@ void ReadMail::init()
connect(replyButton, SIGNAL(activated()), this, SLOT(reply()) );
+ forwardButton = new QAction( tr( "Forward" ), Resource::loadPixmap( "mailit/forward" ),
+ QString::null, 0, this, 0 );
+ connect(forwardButton, SIGNAL(activated()), this, SLOT(forward()) );
+
previousButton = new QAction( tr( "Previous" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 );
connect( previousButton, SIGNAL( activated() ), this, SLOT( previous() ) );
@@ -108,8 +112,13 @@ void ReadMail::updateView()
replyButton->removeFrom(mailMenu);
replyButton->removeFrom(bar);
+ forwardButton->removeFrom(mailMenu);
+ forwardButton->removeFrom(bar);
if (inbox == TRUE) {
replyButton->addTo(bar);
replyButton->addTo(mailMenu);
+ forwardButton->addTo(bar);
+ forwardButton->addTo(mailMenu);
+
if (!mail->downloaded) {
@@ -146,4 +155,11 @@ void ReadMail::updateView()
text += *it + " ";
}
+
+ text +="<br><b>CC: </b>";
+ for (QStringList::Iterator it = mail->carbonCopies.begin();
+ it != mail->carbonCopies.end(); ++it ) {
+ text += *it + " ";
+ }
+
text += "<br>" + mail->date;
@@ -203,4 +219,12 @@ void ReadMail::updateView()
text += *it + " ";
}
+
+ text += "\nCC: ";
+ for (QStringList::Iterator it = mail->carbonCopies.begin();
+ it != mail->carbonCopies.end(); ++it ) {
+ text += *it + " ";
+ }
+
+
text += "\nDate: " + mail->date + "\n";
if (mail->files.count() > 0) {
@@ -324,4 +348,10 @@ void ReadMail::viewAttatchments()
void ReadMail::reply()
{
- emit replyRequested(*mail);
+ emit replyRequested(*mail, (bool&)TRUE);
}
+
+void ReadMail::forward()
+{
+ emit forwardRequested(*mail);
+}
+
diff --git a/noncore/net/mailit/readmail.h b/noncore/net/mailit/readmail.h
index d0bb067..0fe0646 100644
--- a/noncore/net/mailit/readmail.h
+++ b/noncore/net/mailit/readmail.h
@@ -47,5 +47,6 @@ public:
signals:
void cancelView();
- void replyRequested(Email &);
+ void replyRequested(Email &, bool &);
+ void forwardRequested(Email&);
void removeItem(EmailListItem *, bool &);
void viewingMail(Email *);
@@ -59,4 +60,5 @@ public slots:
void viewAttatchments();
void reply();
+ void forward();
private:
@@ -82,4 +84,5 @@ private:
QAction *previousButton;
QAction *replyButton;
+ QAction *forwardButton;
};
diff --git a/noncore/net/mailit/writemail.cpp b/noncore/net/mailit/writemail.cpp
index 38a2596..a9dcb02 100644
--- a/noncore/net/mailit/writemail.cpp
+++ b/noncore/net/mailit/writemail.cpp
@@ -87,4 +87,6 @@ void WriteMail::init()
recipientsBox->setCurrentItem(0);
grid->addWidget( recipientsBox, 0, 0 );
+ connect(recipientsBox,SIGNAL(activated(int)),this, SLOT(changeRecipients(int)));
+
subjetLabel = new QLabel( widget, "subjetLabel" );
@@ -103,4 +105,9 @@ void WriteMail::init()
grid->addWidget( toInput, 0, 1 );
+ ccInput = new QLineEdit( widget, "ccInput" );
+ ccInput->hide();
+ grid->addWidget( ccInput, 0, 1 );
+
+
addressButton = new QToolButton( widget, "addressButton" );
addressButton->setPixmap( Resource::loadPixmap("AddressBook") );
@@ -140,17 +147,29 @@ void WriteMail::accept()
int idCount = 0;
- if (toInput->text() == "") {
- QMessageBox::warning(this,"No recipient", "Send mail to whom?", "OK\n");
+ if (toInput->text() == "")
+ {
+ QMessageBox::warning(this,tr("No recipient"), tr("Send mail to whom?"), tr("OK\n"));
+ return;
+ }
+
+ if (! getRecipients(false) )
+ {
+ QMessageBox::warning(this,tr("Incorrect recipient separator"),
+ tr("Recipients must be separated by ;\nand be valid emailaddresses"), tr("OK\n"));
return;
}
- if (! getRecipients() ) {
- QMessageBox::warning(this,"Incorrect recipient separator",
- "Recipients must be separated by ;\nand be valid emailaddresses", "OK\n");
+
+ if ((ccInput->text()!="") && (! getRecipients(true) ))
+ {
+ QMessageBox::warning(this,tr("Incorrect carbon copy separator"),
+ tr("CC Recipients must be separated by ;\nand be valid emailaddresses"), tr("OK\n"));
return;
}
+
mail.subject = subjectInput->text();
mail.body = emailInput->text();
mail.sent = false;
mail.received = false;
+
mail.rawMail = "To: ";
@@ -161,5 +180,16 @@ void WriteMail::accept()
mail.rawMail += ",\n";
}
+
mail.rawMail.truncate(mail.rawMail.length()-2);
+
+ mail.rawMail += "\nCC: ";
+
+ for (QStringList::Iterator it = mail.carbonCopies.begin();
+ it != mail.carbonCopies.end(); ++it) {
+
+ mail.rawMail += (*it);
+ mail.rawMail += ",\n";
+ }
+
mail.rawMail += mail.from;
mail.rawMail += "\nSubject: ";
@@ -212,5 +242,5 @@ void WriteMail::attatchFile()
}
-void WriteMail::reply(Email replyMail)
+void WriteMail::reply(Email replyMail, bool replyAll)
{
int pos;
@@ -220,5 +250,9 @@ void WriteMail::reply(Email replyMail)
toInput->setText(mail.fromMail);
- subjectInput->setText("Re: " + mail.subject);
+ //replyAll ? ccInput->setText(mail.c)
+
+ addRecipients(replyAll);
+
+ subjectInput->setText(tr("Re: ") + mail.subject);
pos = 0;
@@ -233,5 +267,24 @@ void WriteMail::reply(Email replyMail)
}
-bool WriteMail::getRecipients()
+void WriteMail::forward(Email forwMail)
+{
+ int pos=0;
+
+ QString fwdBody=tr("======forwarded message from ");
+ fwdBody.append(forwMail.fromMail);
+ fwdBody.append(tr(" starts======\n\n"));
+
+ mail=forwMail;
+ toInput->setText("");
+ ccInput->setText("");
+ subjectInput->setText(tr("FWD: ") + mail.subject);
+
+ fwdBody+=mail.body;
+ fwdBody+=QString(tr("======end of forwarded message======\n\n"));
+
+ emailInput->setText(fwdBody);
+}
+
+bool WriteMail::getRecipients(bool ccField)
{
QString str, temp;
@@ -240,5 +293,6 @@ bool WriteMail::getRecipients()
mail.recipients.clear();
- temp = toInput->text();
+ ccField ? temp = ccInput->text() : temp=toInput->text() ;
+
while ( (pos = temp.find(';')) != -1) {
str = temp.left(pos).stripWhiteSpace();
@@ -246,5 +300,5 @@ bool WriteMail::getRecipients()
if ( str.find('@') == -1)
return false;
- mail.recipients.append(str);
+ ccField ? mail.carbonCopies.append(str) : mail.recipients.append(str);
addressList->addContact(str, "");
}
@@ -252,5 +306,5 @@ bool WriteMail::getRecipients()
if ( temp.find('@') == -1)
return false;
- mail.recipients.append(temp);
+ ccField ? mail.carbonCopies.append(temp) : mail.recipients.append(temp);
addressList->addContact(temp, "");
@@ -258,10 +312,16 @@ bool WriteMail::getRecipients()
}
-
void WriteMail::addRecipients()
{
+
+ addRecipients(false);
+}
+
+void WriteMail::addRecipients(bool ccField)
+{
QString recipients = "";
mail.recipients.clear();
+
QListViewItem *item = addressView->firstChild();
while (item != NULL) {
@@ -275,5 +335,6 @@ void WriteMail::addRecipients()
item = item->nextSibling();
}
- toInput->setText(recipients);
+
+ ccField ? ccInput->setText(recipients):toInput->setText(recipients);
addressView->hide();
@@ -284,4 +345,18 @@ void WriteMail::addRecipients()
}
+void WriteMail::changeRecipients(int selection)
+{
+ if (selection==0)
+ {
+ toInput->show();
+ ccInput->hide();
+ }
+ else if (selection==1)
+ {
+ toInput->hide();
+ ccInput->show();
+ }
+}
+
void WriteMail::setRecipient(const QString &recipient)
{
diff --git a/noncore/net/mailit/writemail.h b/noncore/net/mailit/writemail.h
index dd12063..f193b13 100644
--- a/noncore/net/mailit/writemail.h
+++ b/noncore/net/mailit/writemail.h
@@ -44,7 +44,8 @@ public:
WriteMail( QWidget* parent, const char* name, WFlags fl = 0 );
~WriteMail();
- void reply(Email replyMail);
+ void reply(Email replyMail, bool replyAll);
void setRecipient(const QString &recipient);
void setAddressList(AddressList *list);
+ void forward(Email forwMail);
signals:
@@ -52,4 +53,5 @@ signals:
void cancelMail();
+
public slots:
void getAddress();
@@ -59,8 +61,10 @@ public slots:
void accept();
void reject();
+ void changeRecipients(int);
private:
- bool getRecipients();
+ bool getRecipients(bool);
void init();
+ void addRecipients(bool);
Email mail;
@@ -84,4 +88,5 @@ private:
QLineEdit *subjectInput;
QLineEdit *toInput;
+ QLineEdit *ccInput;
QToolButton* addressButton;
QMultiLineEdit* emailInput;
diff --git a/noncore/unsupported/mailit/emailclient.cpp b/noncore/unsupported/mailit/emailclient.cpp
index 0d82a9a..ad1e0b4 100644
--- a/noncore/unsupported/mailit/emailclient.cpp
+++ b/noncore/unsupported/mailit/emailclient.cpp
@@ -60,6 +60,10 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl )
SLOT(popError(int)) );
- connect(inboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(inboxItemSelected()) );
- connect(outboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(outboxItemSelected()) );
+ connect(inboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(inboxItemSelected()) );
+ connect(outboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(outboxItemSelected()) );
+
+ connect(inboxView, SIGNAL(pressed(QListViewItem *)), this, SLOT(inboxItemPressed()) );
+ connect(inboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(inboxItemReleased()) );
+
connect(emailHandler, SIGNAL(mailArrived(const Email &, bool)), this,
@@ -144,8 +148,24 @@ void EmailClient::init()
bar = new QToolBar(this);
- getMailButton = new QAction(tr("Get all mail"), Resource::loadPixmap("mailit/getmail"), QString::null, 0, this, 0);
+ getMailButton = new QToolButton(Resource::loadPixmap("mailit/getmail"),tr("getMail"),tr("select account"), this,SLOT(getAllNewMail()),bar);
+ //connect(setAccountlButton, SIGNAL(activated()), this, SLOT(setCurrentAccount()) );
+ // setAccountButton->addTo(bar);
+ //setAccountButton->addTo(mail);
+
+ /*idCount = 0;
+
+ for (MailAccount* accountPtr = accountList.first(); accountPtr != 0;
+ accountPtr = accountList.next()) {
+
+ selectAccountMenu->insertItem(accountPtr->accountName,this, SLOT(selectAccount(int)), 0, idCount);
+ idCount++;
+ }*/
+ getMailButton->setPopup(selectAccountMenu);
+
+
+ /*getMailButton = new QAction(tr("Get all mail"), Resource::loadPixmap("mailit/getmail"), QString::null, 0, this, 0);
connect(getMailButton, SIGNAL(activated()), this, SLOT(getAllNewMail()) );
- getMailButton->addTo(bar);
- getMailButton->addTo(mail);
+ getMailButton->addTo(bar);*/
+ //getMailButton->addTo(mail);
sendMailButton = new QAction(tr("Send mail"), Resource::loadPixmap("mailit/sendqueue"), QString::null, 0, this, 0);
@@ -165,4 +185,8 @@ void EmailClient::init()
cancelButton->setEnabled(FALSE);
+ deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 );
+ connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) );
+ deleteButton->addTo(bar);
+
mailboxView = new OTabWidget( this, "mailboxView" );
@@ -196,4 +220,6 @@ void EmailClient::init()
setCentralWidget(mailboxView);
+
+ mailboxView->setCurrentTab(0);
}
@@ -233,4 +259,6 @@ void EmailClient::enqueMail(const Email &mail)
item = new EmailListItem(outboxView, addMail, false);
+ mailboxView->setCurrentTab(1);
+
}
@@ -297,5 +325,5 @@ void EmailClient::getNewMail() {
//get any previous mails not downloaded and add to queue
- mailDownloadList.clear();
+/* mailDownloadList.clear();
Email *mailPtr;
item = (EmailListItem *) inboxView->firstChild();
@@ -306,5 +334,5 @@ void EmailClient::getNewMail() {
}
item = (EmailListItem *) item->nextSibling();
- }
+ }*/
emailHandler->getMailHeaders();
@@ -416,4 +444,6 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk)
}
+ mailboxView->setCurrentTab(0);
+
}
@@ -445,4 +475,6 @@ void EmailClient::allMailArrived(int count)
emailHandler->getMailByList(&mailDownloadList);
+
+ mailboxView->setCurrentTab(0);
}
@@ -510,4 +542,6 @@ void EmailClient::popError(int code)
void EmailClient::inboxItemSelected()
{
+ killTimer(timerID);
+
item = (EmailListItem*) inboxView->selectedItem();
if (item != NULL) {
@@ -518,4 +552,6 @@ void EmailClient::inboxItemSelected()
void EmailClient::outboxItemSelected()
{
+ killTimer(timerID);
+
item = (EmailListItem*) outboxView->selectedItem();
if (item != NULL) {
@@ -693,4 +729,5 @@ void EmailClient::readSettings()
void EmailClient::saveSettings()
{
+
QString temp;
QFile f( getPath(FALSE) + "settings.txt");
@@ -702,5 +739,5 @@ void EmailClient::saveSettings()
}
QTextStream t(&f);
- t << "#Settings for QPE Mailit program\n";
+ t << "#Settings for OPIE Mailit program\n";
for (accountPtr = accountList.first(); accountPtr != 0;
@@ -825,5 +862,6 @@ void EmailClient::deleteMail(EmailListItem *mailItem, bool &inbox)
Enclosure *ePtr;
- if (inbox) {
+ if (inbox)
+ {
mPtr = mailItem->getMail();
@@ -845,5 +883,7 @@ void EmailClient::deleteMail(EmailListItem *mailItem, bool &inbox)
}
inboxView->takeItem(mailItem);
- } else {
+ }
+ else
+ {
outboxView->takeItem(mailItem);
}
@@ -871,2 +911,94 @@ void EmailClient::setDownloadedSize(int size)
}
}
+
+void EmailClient::deleteItem()
+{
+ bool inbox=mailboxView->currentTab()==0;
+
+ EmailListItem* eli;
+
+ inbox ? eli=(EmailListItem*)inboxView->selectedItem():eli=(EmailListItem*)outboxView->selectedItem();
+
+ if (eli)
+ deleteMail(eli,(bool&)inbox);
+}
+
+void EmailClient::inboxItemPressed()
+{
+// timerID=startTimer(500);
+}
+
+void EmailClient::inboxItemReleased()
+{
+ // killTimer(timerID);
+}
+
+void EmailClient::timerEvent(QTimerEvent *e)
+{
+ /*killTimer(timerID);
+
+
+ QPopupMenu *action = new QPopupMenu(this);
+
+ int reply=0;
+
+ action->insertItem(tr( "Reply To" ),this,SLOT(reply()));
+ action->insertItem( tr( "Reply All" ),this,SLOT(replyAll()));
+ action->insertItem( tr( "Forward" ), this,SLOT(forward()));
+ action->insertItem( tr( "Remove Mail" ), this,SLOT(remove()));
+
+ action->exec(QCursor::pos());
+
+ if (action) delete action;
+ */
+}
+
+Email* EmailClient::getCurrentMail()
+{
+ EmailListItem *eli=(EmailListItem* ) (inboxView->selectedItem());
+ if (eli!=NULL)
+ return eli->getMail();
+ else
+ return NULL;
+}
+
+/*
+void EmailClient::reply()
+{
+ Email* mail=getCurrentMail();
+
+ if (mail!=NULL)
+ {
+ emit reply(*mail);
+ }
+}
+
+void EmailClient::replyAll()
+{
+ Email* mail=getCurrentMail();
+
+ if (mail!=NULL)
+ {
+ emit replyAll(*mail);
+ }
+}
+
+void EmailClient::forward()
+{
+ Email* mail=getCurrentMail();
+
+ if (mail!=NULL)
+ {
+ emit reply(*mail);
+ }
+}
+
+void EmailClient::remove()
+{
+ Email* mail=getCurrentMail();
+
+ if (mail!=NULL)
+ {
+ emit remove(*mail);
+ }
+}*/ \ No newline at end of file
diff --git a/noncore/unsupported/mailit/emailclient.h b/noncore/unsupported/mailit/emailclient.h
index 80457f9..0890dcf 100644
--- a/noncore/unsupported/mailit/emailclient.h
+++ b/noncore/unsupported/mailit/emailclient.h
@@ -33,4 +33,5 @@
#include <qlayout.h>
#include <qtooltip.h>
+#include <qtoolbutton.h>
#include <qimage.h>
#include <qpixmap.h>
@@ -41,4 +42,5 @@
#include <stdlib.h>
#include <opie/otabwidget.h>
+#include <qtimer.h>
#include "emailhandler.h"
@@ -70,4 +72,7 @@ public:
AddressList* getAdrListRef();
+protected:
+ void timerEvent(QTimerEvent*);
+
signals:
void composeRequested();
@@ -75,4 +80,11 @@ signals:
void mailUpdated(Email *);
void newCaption(const QString &);
+ void replyRequested(Email&, bool&);
+ void forwardRequested(Email&);
+ void removeItem(EmailListItem*, bool&);
+ /*void reply(Email&);
+ void replyAll(Email&);
+ void remove(Email&);
+ void forward(Email&);*/
public slots:
@@ -83,4 +95,5 @@ public slots:
void sendQuedMail();
void mailSent();
+ void deleteItem();
void getNewMail();
void getAllNewMail();
@@ -89,4 +102,6 @@ public slots:
void inboxItemSelected();
void outboxItemSelected();
+ void inboxItemPressed();
+ void inboxItemReleased();
void mailArrived(const Email &mail, bool fromDisk);
void allMailArrived(int);
@@ -101,4 +116,8 @@ public slots:
void setDownloadedSize(int);
void moveMailFront(Email *mailPtr);
+/* void reply();
+ void replyAll();
+ void forward();
+ void remove();*/
private:
@@ -108,6 +127,6 @@ private:
void readSettings();
void saveSettings();
-
-private:
+ Email* getCurrentMail();
+ int timerID;
Config *mailconf;
int newAccountId, idCount, mailIdCount;
@@ -129,8 +148,10 @@ private:
QStatusBar *statusBar;
QLabel *status1Label, *status2Label;
- QAction *getMailButton;
+ QToolButton *getMailButton;
QAction *sendMailButton;
QAction *composeButton;
QAction *cancelButton;
+ QAction *deleteButton;
+ //QToolButton *setAccountButton;
QMenuBar *mb;
@@ -138,4 +159,5 @@ private:
QPopupMenu *editAccountMenu;
QPopupMenu *deleteAccountMenu;
+ QPopupMenu *setAccountMenu;
OTabWidget* mailboxView;
diff --git a/noncore/unsupported/mailit/emailhandler.cpp b/noncore/unsupported/mailit/emailhandler.cpp
index 03f8a28..f6c6d60 100644
--- a/noncore/unsupported/mailit/emailhandler.cpp
+++ b/noncore/unsupported/mailit/emailhandler.cpp
@@ -201,5 +201,5 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail)
//@@@ToDo: Rewrite the parser as To: stops at the first occurence- which is Delivered-To:
- if (pos = p.find("TO",':', pos, TRUE) != -1)
+ if ((pos = p.find("TO",':', 0, TRUE)) != -1)
{
pos++;
@@ -207,4 +207,10 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail)
}
+ //@@@ToDo: Rewrite the parser as To: stops at the first occurence- which is Delivered-To:
+ if ((pos = p.find("CC",':', 0, TRUE)) != -1)
+ {
+ pos++;
+ mail->carbonCopies.append (p.getString(&pos, 'z', TRUE) );
+ }
@@ -435,4 +441,11 @@ int EmailHandler::encodeMime(Email *mail)
newBody += *it + " ";
}
+
+ newBody += "\r\nCC: ";
+
+ for (QStringList::Iterator it = mail->carbonCopies.begin(); it != mail->carbonCopies.end(); ++it ) {
+ newBody += *it + " ";
+ }
+
newBody += "\r\nSubject: " + mail->subject + "\r\n";
diff --git a/noncore/unsupported/mailit/mailitwindow.cpp b/noncore/unsupported/mailit/mailitwindow.cpp
index 2bf1dcb..ef5fc09 100644
--- a/noncore/unsupported/mailit/mailitwindow.cpp
+++ b/noncore/unsupported/mailit/mailitwindow.cpp
@@ -48,6 +48,9 @@ MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl)
connect(readMail, SIGNAL(cancelView()), this, SLOT(showEmailClient()) );
- connect(readMail, SIGNAL(replyRequested(Email &)), this,
- SLOT(composeReply(Email &)) );
+ connect(readMail, SIGNAL(replyRequested(Email &, bool&)), this,
+ SLOT(composeReply(Email &, bool&)) );
+ connect(readMail, SIGNAL(forwardRequested(Email &)), this,
+ SLOT(composeForward(Email &)) );
+
connect(readMail, SIGNAL(removeItem(EmailListItem *, bool &)), emailClient,
SLOT(deleteMail(EmailListItem *, bool &)) );
@@ -84,10 +87,17 @@ void MailItWindow::compose()
}
-void MailItWindow::composeReply(Email &mail)
+void MailItWindow::composeReply(Email &mail, bool& replyAll)
+{
+ compose();
+ writeMail->reply(mail,replyAll) ;
+}
+
+void MailItWindow::composeForward(Email &mail)
{
compose();
- writeMail->reply(mail);
+ writeMail->forward(mail) ;
}
+
void MailItWindow::showEmailClient()
{
@@ -132,2 +142,24 @@ void MailItWindow::setDocument(const QString &_address)
}
+/*void MailItWindow::reply(Email& mail)
+{
+ qDebug("####EmailClient: 0 reached");
+ composeReply(mail,(bool&)FALSE);
+}
+
+void MailItWindow::replyAll(Email& mail)
+{
+ qDebug("####EmailClient: 1 reached");
+ composeReply(mail,(bool&)TRUE);
+}
+
+void MailItWindow::forward(Email& mail)
+{
+ qDebug("####EmailClient: 2 reached");
+}
+
+void MailItWindow::remove(Email&)
+{
+ qDebug("####EmailClient: 3 reached");
+ //emit removeItem(eli,(bool&)TRUE);
+} */ \ No newline at end of file
diff --git a/noncore/unsupported/mailit/mailitwindow.h b/noncore/unsupported/mailit/mailitwindow.h
index 667960b..e818d32 100644
--- a/noncore/unsupported/mailit/mailitwindow.h
+++ b/noncore/unsupported/mailit/mailitwindow.h
@@ -37,7 +37,9 @@ public:
~MailItWindow();
+signals:
public slots:
void compose();
- void composeReply(Email &);
+ void composeReply(Email &, bool&);
+ void composeForward(Email &);
void showEmailClient();
void viewMail(QListView *, Email *mail);
@@ -46,4 +48,8 @@ public slots:
void updateCaption(const QString &);
void setDocument(const QString &);
+ /*void reply(Email&);
+ void replyAll(Email&);
+ void forward(Email&);
+ void remove(Email&);*/
private:
diff --git a/noncore/unsupported/mailit/readmail.cpp b/noncore/unsupported/mailit/readmail.cpp
index 7cd3e09..dc98a6f 100644
--- a/noncore/unsupported/mailit/readmail.cpp
+++ b/noncore/unsupported/mailit/readmail.cpp
@@ -61,4 +61,8 @@ void ReadMail::init()
connect(replyButton, SIGNAL(activated()), this, SLOT(reply()) );
+ forwardButton = new QAction( tr( "Forward" ), Resource::loadPixmap( "mailit/forward" ),
+ QString::null, 0, this, 0 );
+ connect(forwardButton, SIGNAL(activated()), this, SLOT(forward()) );
+
previousButton = new QAction( tr( "Previous" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 );
connect( previousButton, SIGNAL( activated() ), this, SLOT( previous() ) );
@@ -108,8 +112,13 @@ void ReadMail::updateView()
replyButton->removeFrom(mailMenu);
replyButton->removeFrom(bar);
+ forwardButton->removeFrom(mailMenu);
+ forwardButton->removeFrom(bar);
if (inbox == TRUE) {
replyButton->addTo(bar);
replyButton->addTo(mailMenu);
+ forwardButton->addTo(bar);
+ forwardButton->addTo(mailMenu);
+
if (!mail->downloaded) {
@@ -146,4 +155,11 @@ void ReadMail::updateView()
text += *it + " ";
}
+
+ text +="<br><b>CC: </b>";
+ for (QStringList::Iterator it = mail->carbonCopies.begin();
+ it != mail->carbonCopies.end(); ++it ) {
+ text += *it + " ";
+ }
+
text += "<br>" + mail->date;
@@ -203,4 +219,12 @@ void ReadMail::updateView()
text += *it + " ";
}
+
+ text += "\nCC: ";
+ for (QStringList::Iterator it = mail->carbonCopies.begin();
+ it != mail->carbonCopies.end(); ++it ) {
+ text += *it + " ";
+ }
+
+
text += "\nDate: " + mail->date + "\n";
if (mail->files.count() > 0) {
@@ -324,4 +348,10 @@ void ReadMail::viewAttatchments()
void ReadMail::reply()
{
- emit replyRequested(*mail);
+ emit replyRequested(*mail, (bool&)TRUE);
}
+
+void ReadMail::forward()
+{
+ emit forwardRequested(*mail);
+}
+
diff --git a/noncore/unsupported/mailit/readmail.h b/noncore/unsupported/mailit/readmail.h
index d0bb067..0fe0646 100644
--- a/noncore/unsupported/mailit/readmail.h
+++ b/noncore/unsupported/mailit/readmail.h
@@ -47,5 +47,6 @@ public:
signals:
void cancelView();
- void replyRequested(Email &);
+ void replyRequested(Email &, bool &);
+ void forwardRequested(Email&);
void removeItem(EmailListItem *, bool &);
void viewingMail(Email *);
@@ -59,4 +60,5 @@ public slots:
void viewAttatchments();
void reply();
+ void forward();
private:
@@ -82,4 +84,5 @@ private:
QAction *previousButton;
QAction *replyButton;
+ QAction *forwardButton;
};
diff --git a/noncore/unsupported/mailit/writemail.cpp b/noncore/unsupported/mailit/writemail.cpp
index 38a2596..a9dcb02 100644
--- a/noncore/unsupported/mailit/writemail.cpp
+++ b/noncore/unsupported/mailit/writemail.cpp
@@ -87,4 +87,6 @@ void WriteMail::init()
recipientsBox->setCurrentItem(0);
grid->addWidget( recipientsBox, 0, 0 );
+ connect(recipientsBox,SIGNAL(activated(int)),this, SLOT(changeRecipients(int)));
+
subjetLabel = new QLabel( widget, "subjetLabel" );
@@ -103,4 +105,9 @@ void WriteMail::init()
grid->addWidget( toInput, 0, 1 );
+ ccInput = new QLineEdit( widget, "ccInput" );
+ ccInput->hide();
+ grid->addWidget( ccInput, 0, 1 );
+
+
addressButton = new QToolButton( widget, "addressButton" );
addressButton->setPixmap( Resource::loadPixmap("AddressBook") );
@@ -140,17 +147,29 @@ void WriteMail::accept()
int idCount = 0;
- if (toInput->text() == "") {
- QMessageBox::warning(this,"No recipient", "Send mail to whom?", "OK\n");
+ if (toInput->text() == "")
+ {
+ QMessageBox::warning(this,tr("No recipient"), tr("Send mail to whom?"), tr("OK\n"));
+ return;
+ }
+
+ if (! getRecipients(false) )
+ {
+ QMessageBox::warning(this,tr("Incorrect recipient separator"),
+ tr("Recipients must be separated by ;\nand be valid emailaddresses"), tr("OK\n"));
return;
}
- if (! getRecipients() ) {
- QMessageBox::warning(this,"Incorrect recipient separator",
- "Recipients must be separated by ;\nand be valid emailaddresses", "OK\n");
+
+ if ((ccInput->text()!="") && (! getRecipients(true) ))
+ {
+ QMessageBox::warning(this,tr("Incorrect carbon copy separator"),
+ tr("CC Recipients must be separated by ;\nand be valid emailaddresses"), tr("OK\n"));
return;
}
+
mail.subject = subjectInput->text();
mail.body = emailInput->text();
mail.sent = false;
mail.received = false;
+
mail.rawMail = "To: ";
@@ -161,5 +180,16 @@ void WriteMail::accept()
mail.rawMail += ",\n";
}
+
mail.rawMail.truncate(mail.rawMail.length()-2);
+
+ mail.rawMail += "\nCC: ";
+
+ for (QStringList::Iterator it = mail.carbonCopies.begin();
+ it != mail.carbonCopies.end(); ++it) {
+
+ mail.rawMail += (*it);
+ mail.rawMail += ",\n";
+ }
+
mail.rawMail += mail.from;
mail.rawMail += "\nSubject: ";
@@ -212,5 +242,5 @@ void WriteMail::attatchFile()
}
-void WriteMail::reply(Email replyMail)
+void WriteMail::reply(Email replyMail, bool replyAll)
{
int pos;
@@ -220,5 +250,9 @@ void WriteMail::reply(Email replyMail)
toInput->setText(mail.fromMail);
- subjectInput->setText("Re: " + mail.subject);
+ //replyAll ? ccInput->setText(mail.c)
+
+ addRecipients(replyAll);
+
+ subjectInput->setText(tr("Re: ") + mail.subject);
pos = 0;
@@ -233,5 +267,24 @@ void WriteMail::reply(Email replyMail)
}
-bool WriteMail::getRecipients()
+void WriteMail::forward(Email forwMail)
+{
+ int pos=0;
+
+ QString fwdBody=tr("======forwarded message from ");
+ fwdBody.append(forwMail.fromMail);
+ fwdBody.append(tr(" starts======\n\n"));
+
+ mail=forwMail;
+ toInput->setText("");
+ ccInput->setText("");
+ subjectInput->setText(tr("FWD: ") + mail.subject);
+
+ fwdBody+=mail.body;
+ fwdBody+=QString(tr("======end of forwarded message======\n\n"));
+
+ emailInput->setText(fwdBody);
+}
+
+bool WriteMail::getRecipients(bool ccField)
{
QString str, temp;
@@ -240,5 +293,6 @@ bool WriteMail::getRecipients()
mail.recipients.clear();
- temp = toInput->text();
+ ccField ? temp = ccInput->text() : temp=toInput->text() ;
+
while ( (pos = temp.find(';')) != -1) {
str = temp.left(pos).stripWhiteSpace();
@@ -246,5 +300,5 @@ bool WriteMail::getRecipients()
if ( str.find('@') == -1)
return false;
- mail.recipients.append(str);
+ ccField ? mail.carbonCopies.append(str) : mail.recipients.append(str);
addressList->addContact(str, "");
}
@@ -252,5 +306,5 @@ bool WriteMail::getRecipients()
if ( temp.find('@') == -1)
return false;
- mail.recipients.append(temp);
+ ccField ? mail.carbonCopies.append(temp) : mail.recipients.append(temp);
addressList->addContact(temp, "");
@@ -258,10 +312,16 @@ bool WriteMail::getRecipients()
}
-
void WriteMail::addRecipients()
{
+
+ addRecipients(false);
+}
+
+void WriteMail::addRecipients(bool ccField)
+{
QString recipients = "";
mail.recipients.clear();
+
QListViewItem *item = addressView->firstChild();
while (item != NULL) {
@@ -275,5 +335,6 @@ void WriteMail::addRecipients()
item = item->nextSibling();
}
- toInput->setText(recipients);
+
+ ccField ? ccInput->setText(recipients):toInput->setText(recipients);
addressView->hide();
@@ -284,4 +345,18 @@ void WriteMail::addRecipients()
}
+void WriteMail::changeRecipients(int selection)
+{
+ if (selection==0)
+ {
+ toInput->show();
+ ccInput->hide();
+ }
+ else if (selection==1)
+ {
+ toInput->hide();
+ ccInput->show();
+ }
+}
+
void WriteMail::setRecipient(const QString &recipient)
{
diff --git a/noncore/unsupported/mailit/writemail.h b/noncore/unsupported/mailit/writemail.h
index dd12063..f193b13 100644
--- a/noncore/unsupported/mailit/writemail.h
+++ b/noncore/unsupported/mailit/writemail.h
@@ -44,7 +44,8 @@ public:
WriteMail( QWidget* parent, const char* name, WFlags fl = 0 );
~WriteMail();
- void reply(Email replyMail);
+ void reply(Email replyMail, bool replyAll);
void setRecipient(const QString &recipient);
void setAddressList(AddressList *list);
+ void forward(Email forwMail);
signals:
@@ -52,4 +53,5 @@ signals:
void cancelMail();
+
public slots:
void getAddress();
@@ -59,8 +61,10 @@ public slots:
void accept();
void reject();
+ void changeRecipients(int);
private:
- bool getRecipients();
+ bool getRecipients(bool);
void init();
+ void addRecipients(bool);
Email mail;
@@ -84,4 +88,5 @@ private:
QLineEdit *subjectInput;
QLineEdit *toInput;
+ QLineEdit *ccInput;
QToolButton* addressButton;
QMultiLineEdit* emailInput;