summaryrefslogtreecommitdiffabout
path: root/kmicromail/opiemail.cpp
Side-by-side diff
Diffstat (limited to 'kmicromail/opiemail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/opiemail.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index ca3faaf..fe9df87 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -42,2 +42,3 @@ OpieMail::OpieMail( QWidget *parent, const char *name )
+ setIcon(SmallIcon( "kmicromail" ) );
folderView->populate( settings->getAccounts() );
@@ -242,3 +243,46 @@ void OpieMail::slotEditAccounts()
}
+void OpieMail::replyMail()
+{
+
+ QListViewItem*item = mailView->currentItem();
+ if (!item) return;
+ RecMailP mail = ((MailListViewItem*)item)->data();
+ RecBodyP body = folderView->fetchBody(mail);
+
+ QString rtext;
+ rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose
+ .arg( QString::fromUtf8( mail->getFrom().latin1()))
+ .arg( QString::fromUtf8( mail->getDate().latin1() ));
+
+ QString text = QString::fromUtf8( body->Bodytext().latin1() );
+ QStringList lines = QStringList::split(QRegExp("\\n"), text);
+ QStringList::Iterator it;
+ for (it = lines.begin(); it != lines.end(); it++)
+ {
+ rtext += "> " + *it + "\n";
+ }
+ rtext += "\n";
+ QString prefix;
+ if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = "";
+ else prefix = "Re: "; // no i18n on purpose
+
+ Settings *settings = new Settings();
+ ComposeMail composer( settings ,this, 0, true);
+ if (mail->Replyto().isEmpty()) {
+ composer.setTo( QString::fromUtf8( mail->getFrom().latin1()));
+ } else {
+ composer.setTo( QString::fromUtf8(mail->Replyto().latin1()));
+ }
+ composer.setSubject( prefix + QString::fromUtf8( mail->getSubject().latin1() ) );
+ composer.setMessage( rtext );
+ composer.setInReplyTo( QString::fromUtf8(mail->Msgid().latin1()));
+
+ if ( QDialog::Accepted == KApplication::execDialog( &composer ) )
+ {
+ mail->Wrapper()->answeredMail(mail);
+ }
+ delete settings;
+
+}
void OpieMail::displayMail()
@@ -342,2 +386,4 @@ void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int )
}
+ m->insertItem(i18n("Reply to this mail"),this,SLOT(replyMail()));
+ m->insertSeparator();
m->insertItem(i18n("Read this mail"),this,SLOT(displayMail()));