author | alwin <alwin> | 2004-03-08 03:05:23 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-03-08 03:05:23 (UTC) |
commit | a3836842bfabc973f27f2686320f7a207c59b10a (patch) (side-by-side diff) | |
tree | 49c389706af22752a7f9d6c255cd3cb0ce80f211 | |
parent | 25d95c1b4e61445c695177c79049ccf7741e83f7 (diff) | |
download | opie-a3836842bfabc973f27f2686320f7a207c59b10a.zip opie-a3836842bfabc973f27f2686320f7a207c59b10a.tar.gz opie-a3836842bfabc973f27f2686320f7a207c59b10a.tar.bz2 |
different context menus for mail and nntp messages
-rw-r--r-- | noncore/net/mail/opiemail.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp index d8b58b6..61e7dc4 100644 --- a/noncore/net/mail/opiemail.cpp +++ b/noncore/net/mail/opiemail.cpp @@ -51,204 +51,211 @@ void OpieMail::slotwriteMail(const QString&name,const QString&email) { ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); if (!email.isEmpty()) { if (!name.isEmpty()) { compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); } else { compose.setTo(email); } } compose.slotAdjustColumns(); QPEApplication::execDialog( &compose ); } void OpieMail::slotComposeMail() { qDebug( "Compose Mail" ); slotwriteMail(0l,0l); } void OpieMail::slotSendQueued() { qDebug( "Send Queued" ); SMTPaccount *smtp = 0; QList<Account> list = settings->getAccounts(); QList<SMTPaccount> smtpList; smtpList.setAutoDelete(false); Account *it; for ( it = list.first(); it; it = list.next() ) { if ( it->getType() == MAILLIB::A_SMTP ) { smtp = static_cast<SMTPaccount *>(it); smtpList.append(smtp); } } if (smtpList.count()==0) { QMessageBox::information(0,tr("Info"),tr("Define a smtp account first")); return; } if (smtpList.count()==1) { smtp = smtpList.at(0); } else { smtp = 0; selectsmtp selsmtp; selsmtp.setSelectionlist(&smtpList); if ( QPEApplication::execDialog( &selsmtp ) == QDialog::Accepted ) { smtp = selsmtp.selected_smtp(); } } if (smtp) { SMTPwrapper * wrap = new SMTPwrapper(smtp); if ( wrap->flushOutbox() ) { QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); } delete wrap; } } void OpieMail::slotSearchMails() { qDebug( "Search Mails" ); } void OpieMail::slotEditSettings() { SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); QPEApplication::execDialog( &settingsDialog ); } void OpieMail::slotEditAccounts() { qDebug( "Edit Accounts" ); EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp ); eaDialog.slotAdjustColumns(); QPEApplication::execDialog( &eaDialog ); if ( settings ) delete settings; settings = new Settings(); folderView->populate( settings->getAccounts() ); } void OpieMail::displayMail() { QListViewItem*item = mailView->currentItem(); if (!item) return; RecMail mail = ((MailListViewItem*)item)->data(); RecBody body = folderView->fetchBody(mail); ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp ); readMail.setBody( body ); readMail.setMail( mail ); readMail.showMaximized(); readMail.exec(); if ( readMail.deleted ) { folderView->refreshCurrent(); } else { ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "" ) ); } } void OpieMail::slotDeleteMail() { if (!mailView->currentItem()) return; RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data(); if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail.getFrom() + " - " + mail.getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) { mail.Wrapper()->deleteMail( mail ); folderView->refreshCurrent(); } } void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) { + if (!mailView->currentItem()) return; + RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data(); /* just the RIGHT button - or hold on pda */ if (button!=2) {return;} qDebug("Event right/hold"); if (!item) return; QPopupMenu *m = new QPopupMenu(0); if (m) { - m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); - m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); - m->insertItem(tr("Copy/Move this mail"),this,SLOT(slotMoveCopyMail())); + if (mail.Wrapper()->getType()==MAILLIB::A_NNTP) { + m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); +// m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); + } else { + m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); + m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); + m->insertItem(tr("Copy/Move this mail"),this,SLOT(slotMoveCopyMail())); + } m->setFocus(); m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); delete m; } } void OpieMail::slotShowFolders( bool show ) { qDebug( "Show Folders" ); if ( show && folderView->isHidden() ) { qDebug( "-> showing" ); folderView->show(); } else if ( !show && !folderView->isHidden() ) { qDebug( "-> hiding" ); folderView->hide(); } } void OpieMail::refreshMailView(QList<RecMail>*list) { MailListViewItem*item = 0; mailView->clear(); for (unsigned int i = 0; i < list->count();++i) { item = new MailListViewItem(mailView,item); item->storeData(*(list->at(i))); item->showEntry(); } } void OpieMail::mailLeftClicked(int button, QListViewItem *item,const QPoint&,int ) { /* just LEFT button - or tap with stylus on pda */ if (button!=1) return; if (!item) return; displayMail(); } void OpieMail::slotMoveCopyMail() { if (!mailView->currentItem()) return; RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data(); AbstractMail*targetMail = 0; QString targetFolder = ""; Selectstore sels; folderView->setupFolderselect(&sels); if (!sels.exec()) return; targetMail = sels.currentMail(); targetFolder = sels.currentFolder(); if ( (mail.Wrapper()==targetMail && mail.getMbox()==targetFolder) || targetFolder.isEmpty()) { return; } if (sels.newFolder() && !targetMail->createMbox(targetFolder)) { QMessageBox::critical(0,tr("Error creating new Folder"), tr("<center>Error while creating<br>new folder - breaking.</center>")); return; } mail.Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); folderView->refreshCurrent(); } |