summaryrefslogtreecommitdiffabout
path: root/kmicromail/opiemail.cpp
Unidiff
Diffstat (limited to 'kmicromail/opiemail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/opiemail.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index af5376f..18a5600 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -20,32 +20,33 @@
20#include "klocale.h" 20#include "klocale.h"
21 21
22#include <qmessagebox.h> 22#include <qmessagebox.h>
23#include <qtimer.h> 23#include <qtimer.h>
24#include <qcursor.h> 24#include <qcursor.h>
25#include <qregexp.h> 25#include <qregexp.h>
26#include <qpe/global.h> 26#include <qpe/global.h>
27 27
28#ifdef DESKTOP_VERSION 28#ifdef DESKTOP_VERSION
29#include <qapplication.h> 29#include <qapplication.h>
30#else 30#else
31#include <qpe/qpeapplication.h> 31#include <qpe/qpeapplication.h>
32#endif 32#endif
33#include <libmailwrapper/smtpwrapper.h> 33#include <libmailwrapper/smtpwrapper.h>
34#include <libmailwrapper/mailtypes.h> 34#include <libmailwrapper/mailtypes.h>
35#include <libmailwrapper/abstractmail.h> 35#include <libmailwrapper/abstractmail.h>
36#include "koprefs.h"
36 37
37//using namespace Opie::Core; 38//using namespace Opie::Core;
38 39
39OpieMail::OpieMail( QWidget *parent, const char *name ) 40OpieMail::OpieMail( QWidget *parent, const char *name )
40 : MainWindow( parent, name) //, WStyle_ContextHelp ) 41 : MainWindow( parent, name) //, WStyle_ContextHelp )
41{ 42{
42 settings = new Settings(); 43 settings = new Settings();
43 44
44 setIcon(SmallIcon( "kmicromail" ) ); 45 setIcon(SmallIcon( "kmicromail" ) );
45 folderView->populate( settings->getAccounts() ); 46 folderView->populate( settings->getAccounts() );
46 47
47} 48}
48 49
49OpieMail::~OpieMail() 50OpieMail::~OpieMail()
50{ 51{
51 if (settings) delete settings; 52 if (settings) delete settings;
@@ -224,84 +225,85 @@ void OpieMail::slotSendQueued()
224} 225}
225 226
226void OpieMail::slotSearchMails() 227void OpieMail::slotSearchMails()
227{ 228{
228 qDebug("OpieMail::slotSearchMails():not implemented "); 229 qDebug("OpieMail::slotSearchMails():not implemented ");
229} 230}
230 231
231void OpieMail::slotEditSettings() 232void OpieMail::slotEditSettings()
232{ 233{
233 234
234 KOPrefsDialog settingsDialog( this, "koprefs", true ); 235 KOPrefsDialog settingsDialog( this, "koprefs", true );
235#ifndef DESKTOP_VERSION 236#ifndef DESKTOP_VERSION
236 settingsDialog.showMaximized(); 237 settingsDialog.showMaximized();
237#endif 238#endif
238 settingsDialog.exec(); 239 settingsDialog.exec();
239 240
241 slotSetCodec( KOPrefs::instance()->mCurrentCodec );
240 // KApplication::execDialog(settingsDialog); 242 // KApplication::execDialog(settingsDialog);
241} 243}
242 244
243void OpieMail::slotEditAccounts() 245void OpieMail::slotEditAccounts()
244{ 246{
245 EditAccounts eaDialog( settings, this, 0, true ); 247 EditAccounts eaDialog( settings, this, 0, true );
246 eaDialog.slotAdjustColumns(); 248 eaDialog.slotAdjustColumns();
247#ifndef DESKTOP_VERSION 249#ifndef DESKTOP_VERSION
248 eaDialog.showMaximized(); 250 eaDialog.showMaximized();
249#endif 251#endif
250 eaDialog.exec(); 252 eaDialog.exec();
251 if ( settings ) delete settings; 253 if ( settings ) delete settings;
252 settings = new Settings(); 254 settings = new Settings();
253 255
254 folderView->populate( settings->getAccounts() ); 256 folderView->populate( settings->getAccounts() );
255} 257}
256void OpieMail::replyMail() 258void OpieMail::replyMail()
257{ 259{
258 260
259 QListViewItem*item = mailView->currentItem(); 261 QListViewItem*item = mailView->currentItem();
260 if (!item) return; 262 if (!item) return;
261 RecMailP mail = ((MailListViewItem*)item)->data(); 263 RecMailP mail = ((MailListViewItem*)item)->data();
262 RecBodyP body = folderView->fetchBody(mail); 264 RecBodyP body = folderView->fetchBody(mail);
263 265
264 QString rtext; 266 QString rtext;
265 rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose 267 rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose
266 .arg( QString::fromUtf8( mail->getFrom().latin1())) 268 .arg( mail->getFrom())
267 .arg( QString::fromUtf8( mail->getDate().latin1() )); 269 .arg( mail->getDate());
268 270
269 QString text = QString::fromUtf8( body->Bodytext().latin1() ); 271 QString text = body->Bodytext();
270 QStringList lines = QStringList::split(QRegExp("\\n"), text); 272 QStringList lines = QStringList::split(QRegExp("\\n"), text);
271 QStringList::Iterator it; 273 QStringList::Iterator it;
272 for (it = lines.begin(); it != lines.end(); it++) 274 for (it = lines.begin(); it != lines.end(); it++)
273 { 275 {
274 rtext += "> " + *it + "\n"; 276 rtext += "> " + *it + "\n";
275 } 277 }
276 rtext += "\n"; 278 rtext += "\n";
277 279
278 QString prefix; 280 QString prefix;
279 if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = ""; 281 if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = "";
280 else prefix = "Re: "; // no i18n on purpose 282 else prefix = "Re: "; // no i18n on purpose
281 283
282 Settings *settings = new Settings(); 284 Settings *settings = new Settings();
283 ComposeMail composer( settings ,this, 0, true); 285 ComposeMail composer( settings ,this, 0, true);
284 if (mail->Replyto().isEmpty()) { 286 if (mail->Replyto().isEmpty()) {
285 composer.setTo( QString::fromUtf8( mail->getFrom().latin1())); 287 composer.setTo( mail->getFrom());
286 } else { 288 } else {
287 composer.setTo( QString::fromUtf8(mail->Replyto().latin1())); 289 composer.setTo( mail->Replyto());
288 } 290 }
289 composer.setSubject( prefix + QString::fromUtf8( mail->getSubject().latin1() ) ); 291 composer.setSubject( prefix + mail->getSubject());
290 composer.setMessage( rtext ); 292 composer.setMessage( rtext );
291 composer.setInReplyTo( QString::fromUtf8(mail->Msgid().latin1())); 293 composer.setInReplyTo( mail->Msgid());
292 294
293 if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) 295 if ( QDialog::Accepted == KApplication::execDialog( &composer ) )
294 { 296 {
295 mail->Wrapper()->answeredMail(mail); 297 mail->Wrapper()->answeredMail(mail);
296 } 298 }
297 delete settings; 299 delete settings;
298 300
299} 301}
300void OpieMail::displayMail() 302void OpieMail::displayMail()
301{ 303{
302 QListViewItem*item = mailView->currentItem(); 304 QListViewItem*item = mailView->currentItem();
303 if (!item) return; 305 if (!item) return;
304 RecMailP mail = ((MailListViewItem*)item)->data(); 306 RecMailP mail = ((MailListViewItem*)item)->data();
305 RecBodyP body = folderView->fetchBody(mail); 307 RecBodyP body = folderView->fetchBody(mail);
306 ViewMail readMail( this,"", Qt::WType_Modal ); 308 ViewMail readMail( this,"", Qt::WType_Modal );
307 readMail.setBody( body ); 309 readMail.setBody( body );