author | groucho <groucho> | 2003-04-20 07:59:48 (UTC) |
---|---|---|
committer | groucho <groucho> | 2003-04-20 07:59:48 (UTC) |
commit | 8b85cba50912127ff6a2d048021baf68306481c6 (patch) (side-by-side diff) | |
tree | bfd1b377911d05db8e1c816f72fe070d5a5b2ff3 /noncore/net/mailit/emailclient.cpp | |
parent | 6b381e438fdeb1757b3278c683349dee9c4ab230 (diff) | |
download | opie-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 (limited to 'noncore/net/mailit/emailclient.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/mailit/emailclient.cpp | 152 |
1 files changed, 142 insertions, 10 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 @@ -59,8 +59,12 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) connect(emailHandler, SIGNAL(popError(int)), this, 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, SLOT(mailArrived(const Email &, bool)) ); @@ -143,10 +147,26 @@ 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); connect(sendMailButton, SIGNAL(activated()), this, SLOT(sendQuedMail()) ); @@ -164,6 +184,10 @@ void EmailClient::init() cancelButton->addTo(bar); 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" ); QWidget* widget = new QWidget( mailboxView, "widget" ); @@ -195,6 +219,8 @@ void EmailClient::init() mailboxView->addTab( widget_2,"mailit/outbox", tr( "Outbox" ) ); setCentralWidget(mailboxView); + + mailboxView->setCurrentTab(0); } void EmailClient::compose() @@ -232,6 +258,8 @@ void EmailClient::enqueMail(const Email &mail) addMail.rawMail.prepend("From: " + addMail.from + "<" + addMail.fromMail + ">\n"); item = new EmailListItem(outboxView, addMail, false); + mailboxView->setCurrentTab(1); + } void EmailClient::sendQuedMail() @@ -296,7 +324,7 @@ void EmailClient::getNewMail() { progressBar->reset(); //get any previous mails not downloaded and add to queue - mailDownloadList.clear(); +/* mailDownloadList.clear(); Email *mailPtr; item = (EmailListItem *) inboxView->firstChild(); while (item != NULL) { @@ -305,7 +333,7 @@ void EmailClient::getNewMail() { mailDownloadList.sizeInsert(mailPtr->serverId, mailPtr->size); } item = (EmailListItem *) item->nextSibling(); - } + }*/ emailHandler->getMailHeaders(); } @@ -415,6 +443,8 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) mailDownloadList.sizeInsert(newMail.serverId, newMail.size); } + mailboxView->setCurrentTab(0); + } void EmailClient::allMailArrived(int count) @@ -444,6 +474,8 @@ void EmailClient::allMailArrived(int count) progressBar->reset(); emailHandler->getMailByList(&mailDownloadList); + + mailboxView->setCurrentTab(0); } void EmailClient::moveMailFront(Email *mailPtr) @@ -509,6 +541,8 @@ void EmailClient::popError(int code) void EmailClient::inboxItemSelected() { + killTimer(timerID); + item = (EmailListItem*) inboxView->selectedItem(); if (item != NULL) { emit viewEmail(inboxView, item->getMail()); @@ -517,6 +551,8 @@ void EmailClient::inboxItemSelected() void EmailClient::outboxItemSelected() { + killTimer(timerID); + item = (EmailListItem*) outboxView->selectedItem(); if (item != NULL) { emit viewEmail(outboxView, item->getMail()); @@ -692,6 +728,7 @@ void EmailClient::readSettings() void EmailClient::saveSettings() { + QString temp; QFile f( getPath(FALSE) + "settings.txt"); MailAccount *accountPtr; @@ -701,7 +738,7 @@ void EmailClient::saveSettings() return; } QTextStream t(&f); - t << "#Settings for QPE Mailit program\n"; + t << "#Settings for OPIE Mailit program\n"; for (accountPtr = accountList.first(); accountPtr != 0; accountPtr = accountList.next()) { @@ -824,7 +861,8 @@ void EmailClient::deleteMail(EmailListItem *mailItem, bool &inbox) Email *mPtr; Enclosure *ePtr; - if (inbox) { + if (inbox) + { mPtr = mailItem->getMail(); //if mail is in queue for download, remove it from @@ -844,7 +882,9 @@ void EmailClient::deleteMail(EmailListItem *mailItem, bool &inbox) } } inboxView->takeItem(mailItem); - } else { + } + else + { outboxView->takeItem(mailItem); } } @@ -870,3 +910,95 @@ void EmailClient::setDownloadedSize(int size) progressBar->setProgress(total); } } + +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 |