summaryrefslogtreecommitdiffabout
path: root/kmicromail/opiemail.cpp
Unidiff
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
@@ -41,4 +41,5 @@ OpieMail::OpieMail( QWidget *parent, const char *name )
41 settings = new Settings(); 41 settings = new Settings();
42 42
43 setIcon(SmallIcon( "kmicromail" ) );
43 folderView->populate( settings->getAccounts() ); 44 folderView->populate( settings->getAccounts() );
44 45
@@ -241,5 +242,48 @@ void OpieMail::slotEditAccounts()
241 folderView->populate( settings->getAccounts() ); 242 folderView->populate( settings->getAccounts() );
242} 243}
244void OpieMail::replyMail()
245{
246
247 QListViewItem*item = mailView->currentItem();
248 if (!item) return;
249 RecMailP mail = ((MailListViewItem*)item)->data();
250 RecBodyP body = folderView->fetchBody(mail);
251
252 QString rtext;
253 rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose
254 .arg( QString::fromUtf8( mail->getFrom().latin1()))
255 .arg( QString::fromUtf8( mail->getDate().latin1() ));
256
257 QString text = QString::fromUtf8( body->Bodytext().latin1() );
258 QStringList lines = QStringList::split(QRegExp("\\n"), text);
259 QStringList::Iterator it;
260 for (it = lines.begin(); it != lines.end(); it++)
261 {
262 rtext += "> " + *it + "\n";
263 }
264 rtext += "\n";
243 265
266 QString prefix;
267 if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = "";
268 else prefix = "Re: "; // no i18n on purpose
269
270 Settings *settings = new Settings();
271 ComposeMail composer( settings ,this, 0, true);
272 if (mail->Replyto().isEmpty()) {
273 composer.setTo( QString::fromUtf8( mail->getFrom().latin1()));
274 } else {
275 composer.setTo( QString::fromUtf8(mail->Replyto().latin1()));
276 }
277 composer.setSubject( prefix + QString::fromUtf8( mail->getSubject().latin1() ) );
278 composer.setMessage( rtext );
279 composer.setInReplyTo( QString::fromUtf8(mail->Msgid().latin1()));
280
281 if ( QDialog::Accepted == KApplication::execDialog( &composer ) )
282 {
283 mail->Wrapper()->answeredMail(mail);
284 }
285 delete settings;
286
287}
244void OpieMail::displayMail() 288void OpieMail::displayMail()
245{ 289{
@@ -341,4 +385,6 @@ void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int )
341 m->insertItem(i18n("Edit this mail"),this,SLOT(reEditMail())); 385 m->insertItem(i18n("Edit this mail"),this,SLOT(reEditMail()));
342 } 386 }
387 m->insertItem(i18n("Reply to this mail"),this,SLOT(replyMail()));
388 m->insertSeparator();
343 m->insertItem(i18n("Read this mail"),this,SLOT(displayMail())); 389 m->insertItem(i18n("Read this mail"),this,SLOT(displayMail()));
344 m->insertItem(i18n("Move/Copy this mail"),this,SLOT(slotMoveCopyMail())); 390 m->insertItem(i18n("Move/Copy this mail"),this,SLOT(slotMoveCopyMail()));