summaryrefslogtreecommitdiffabout
path: root/kmicromail/opiemail.cpp
authorzautrix <zautrix>2004-10-31 12:28:03 (UTC)
committer zautrix <zautrix>2004-10-31 12:28:03 (UTC)
commitbed831cc1a38d38a4c5b9329bf37b1c663142c23 (patch) (unidiff)
treedb12b81ea6cee0cac347c801798d759dfe24acfb /kmicromail/opiemail.cpp
parent553bd9acf9879a77c5fa925155f73afbe8a9af41 (diff)
downloadkdepimpi-bed831cc1a38d38a4c5b9329bf37b1c663142c23.zip
kdepimpi-bed831cc1a38d38a4c5b9329bf37b1c663142c23.tar.gz
kdepimpi-bed831cc1a38d38a4c5b9329bf37b1c663142c23.tar.bz2
ompi utf8 fixes
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
@@ -35,16 +35,17 @@
35 35
36//using namespace Opie::Core; 36//using namespace Opie::Core;
37 37
38OpieMail::OpieMail( QWidget *parent, const char *name ) 38OpieMail::OpieMail( QWidget *parent, const char *name )
39 : MainWindow( parent, name) //, WStyle_ContextHelp ) 39 : MainWindow( parent, name) //, WStyle_ContextHelp )
40{ 40{
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
45} 46}
46 47
47OpieMail::~OpieMail() 48OpieMail::~OpieMail()
48{ 49{
49 if (settings) delete settings; 50 if (settings) delete settings;
50} 51}
@@ -235,17 +236,60 @@ void OpieMail::slotEditAccounts()
235 eaDialog.showMaximized(); 236 eaDialog.showMaximized();
236#endif 237#endif
237 eaDialog.exec(); 238 eaDialog.exec();
238 if ( settings ) delete settings; 239 if ( settings ) delete settings;
239 settings = new Settings(); 240 settings = new Settings();
240 241
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{
246 QListViewItem*item = mailView->currentItem(); 290 QListViewItem*item = mailView->currentItem();
247 if (!item) return; 291 if (!item) return;
248 RecMailP mail = ((MailListViewItem*)item)->data(); 292 RecMailP mail = ((MailListViewItem*)item)->data();
249 RecBodyP body = folderView->fetchBody(mail); 293 RecBodyP body = folderView->fetchBody(mail);
250 ViewMail readMail( this,"", Qt::WType_Modal ); 294 ViewMail readMail( this,"", Qt::WType_Modal );
251 readMail.setBody( body ); 295 readMail.setBody( body );
@@ -335,16 +379,18 @@ void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int )
335 m->insertItem(i18n("Copy this posting"),this,SLOT(slotMoveCopyMail())); 379 m->insertItem(i18n("Copy this posting"),this,SLOT(slotMoveCopyMail()));
336 m->insertSeparator(); 380 m->insertSeparator();
337 m->insertItem(i18n("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail())); 381 m->insertItem(i18n("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail()));
338 m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); 382 m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection()));
339 } else { 383 } else {
340 if (folderView->currentisDraft()) { 384 if (folderView->currentisDraft()) {
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()));
345 m->insertItem(i18n("Delete this mail"),this,SLOT(slotDeleteMail())); 391 m->insertItem(i18n("Delete this mail"),this,SLOT(slotDeleteMail()));
346 m->insertSeparator(); 392 m->insertSeparator();
347 m->insertItem(i18n("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail())); 393 m->insertItem(i18n("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail()));
348 m->insertItem(i18n("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); 394 m->insertItem(i18n("Delete all selected mails"),this,SLOT(slotDeleteAllMail()));
349 m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); 395 m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection()));
350 } 396 }