summaryrefslogtreecommitdiffabout
path: root/kmicromail/opiemail.cpp
Unidiff
Diffstat (limited to 'kmicromail/opiemail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/opiemail.cpp33
1 files changed, 32 insertions, 1 deletions
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index f56711d..e159b73 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -37,29 +37,31 @@
37#include <qpe/qpeapplication.h> 37#include <qpe/qpeapplication.h>
38#endif 38#endif
39#include <libmailwrapper/smtpwrapper.h> 39#include <libmailwrapper/smtpwrapper.h>
40#include <libmailwrapper/mailtypes.h> 40#include <libmailwrapper/mailtypes.h>
41#include <libmailwrapper/abstractmail.h> 41#include <libmailwrapper/abstractmail.h>
42#include "koprefs.h" 42#include "koprefs.h"
43 43
44//using namespace Opie::Core; 44//using namespace Opie::Core;
45 45
46OpieMail::OpieMail( QWidget *parent, const char *name ) 46OpieMail::OpieMail( QWidget *parent, const char *name )
47 : MainWindow( parent, name) //, WStyle_ContextHelp ) 47 : MainWindow( parent, name) //, WStyle_ContextHelp )
48{ 48{
49 mCurrentComposer = 0;
49 settings = new Settings(); 50 settings = new Settings();
50 tb = 0; 51 tb = 0;
51 setIcon(SmallIcon( "kmicromail" ) ); 52 setIcon(SmallIcon( "kmicromail" ) );
52 folderView->populate( settings->getAccounts() ); 53 folderView->populate( settings->getAccounts() );
53 54 connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)),
55 this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&)));
54} 56}
55 57
56OpieMail::~OpieMail() 58OpieMail::~OpieMail()
57{ 59{
58 if (settings) delete settings; 60 if (settings) delete settings;
59 if ( tb ) 61 if ( tb )
60 delete tb; 62 delete tb;
61} 63}
62 64
63void OpieMail::appMessage(const QCString &msg, const QByteArray &data) 65void OpieMail::appMessage(const QCString &msg, const QByteArray &data)
64{ 66{
65 67
@@ -129,48 +131,53 @@ void OpieMail::slotwriteMail2(const QString& namemail )
129 } 131 }
130 int sub = to.find( ">:"); 132 int sub = to.find( ">:");
131 if ( sub > 0 ) { 133 if ( sub > 0 ) {
132 compose.setTo( to.left(sub+1) ); 134 compose.setTo( to.left(sub+1) );
133 compose.setSubject( to.mid(sub+2) ); 135 compose.setSubject( to.mid(sub+2) );
134 } else 136 } else
135 compose.setTo( to ); 137 compose.setTo( to );
136 } 138 }
137 compose.slotAdjustColumns(); 139 compose.slotAdjustColumns();
138#ifndef DESKTOP_VERSION 140#ifndef DESKTOP_VERSION
139 compose.showMaximized(); 141 compose.showMaximized();
140#endif 142#endif
143 mCurrentComposer = &compose;
141 compose.exec(); 144 compose.exec();
145 mCurrentComposer = 0;
142 raise(); 146 raise();
143 //qDebug("retttich "); 147 //qDebug("retttich ");
144} 148}
145void OpieMail::slotwriteMail(const QString&name,const QString&email) 149void OpieMail::slotwriteMail(const QString&name,const QString&email)
146{ 150{
147 // qDebug("OpieMail::slotwriteMail "); 151 // qDebug("OpieMail::slotwriteMail ");
148 ComposeMail compose( settings, this, 0, true ); 152 ComposeMail compose( settings, this, 0, true );
149 if (!email.isEmpty()) 153 if (!email.isEmpty())
150 { 154 {
151 if (!name.isEmpty()) 155 if (!name.isEmpty())
152 { 156 {
153 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); 157 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">");
154 } 158 }
155 else 159 else
156 { 160 {
157 compose.setTo(email); 161 compose.setTo(email);
158 } 162 }
159 } 163 }
160 compose.slotAdjustColumns(); 164 compose.slotAdjustColumns();
161#ifndef DESKTOP_VERSION 165#ifndef DESKTOP_VERSION
162 compose.showMaximized(); 166 compose.showMaximized();
163#endif 167#endif
168
169 mCurrentComposer = &compose;
164 compose.exec(); 170 compose.exec();
171 mCurrentComposer = 0;
165 raise(); 172 raise();
166} 173}
167 174
168void OpieMail::slotComposeMail() 175void OpieMail::slotComposeMail()
169{ 176{
170 if ( mPendingEmail == QString::null && mPendingName == QString::null) 177 if ( mPendingEmail == QString::null && mPendingName == QString::null)
171 slotwriteMail2( QString () ); 178 slotwriteMail2( QString () );
172 else { 179 else {
173 if ( mPendingEmail == QString::null ) 180 if ( mPendingEmail == QString::null )
174 slotwriteMail2( mPendingName ); 181 slotwriteMail2( mPendingName );
175 else 182 else
176 slotwriteMail( mPendingName, mPendingEmail ); 183 slotwriteMail( mPendingName, mPendingEmail );
@@ -291,28 +298,31 @@ void OpieMail::replyMail()
291 298
292 Settings *settings = new Settings(); 299 Settings *settings = new Settings();
293 ComposeMail composer( settings ,this, 0, true); 300 ComposeMail composer( settings ,this, 0, true);
294 if (mail->Replyto().isEmpty()) { 301 if (mail->Replyto().isEmpty()) {
295 composer.setTo( mail->getFrom()); 302 composer.setTo( mail->getFrom());
296 } else { 303 } else {
297 composer.setTo( mail->Replyto()); 304 composer.setTo( mail->Replyto());
298 } 305 }
299 composer.setSubject( prefix + mail->getSubject()); 306 composer.setSubject( prefix + mail->getSubject());
300 composer.setMessage( rtext ); 307 composer.setMessage( rtext );
301 composer.setInReplyTo( mail->Msgid()); 308 composer.setInReplyTo( mail->Msgid());
302 composer.setCharset( body->getCharset() ); 309 composer.setCharset( body->getCharset() );
310
311 mCurrentComposer = &composer;
303 if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) 312 if ( QDialog::Accepted == KApplication::execDialog( &composer ) )
304 { 313 {
305 mail->Wrapper()->answeredMail(mail); 314 mail->Wrapper()->answeredMail(mail);
306 } 315 }
316 mCurrentComposer = 0;
307 delete settings; 317 delete settings;
308 318
309} 319}
310void OpieMail::closeViewMail(ViewMail * vm) 320void OpieMail::closeViewMail(ViewMail * vm)
311{ 321{
312 vm->hide(); 322 vm->hide();
313} 323}
314 324
315void OpieMail::slotDownloadMail( ) 325void OpieMail::slotDownloadMail( )
316{ 326{
317 QListViewItem*item = mailView->currentItem(); 327 QListViewItem*item = mailView->currentItem();
318 if (!item ) { 328 if (!item ) {
@@ -628,14 +638,35 @@ void OpieMail::slotMoveCopyAllMail()
628void OpieMail::reEditMail() 638void OpieMail::reEditMail()
629{ 639{
630 if (!mailView->currentItem()) return; 640 if (!mailView->currentItem()) return;
631 641
632 ComposeMail compose( settings, this, 0, true ); 642 ComposeMail compose( settings, this, 0, true );
633 compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data()); 643 compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data());
634 compose.slotAdjustColumns(); 644 compose.slotAdjustColumns();
635#ifndef DESKTOP_VERSION 645#ifndef DESKTOP_VERSION
636 compose.showMaximized(); 646 compose.showMaximized();
637#else 647#else
638 compose.resize(640,480); 648 compose.resize(640,480);
639#endif 649#endif
650 mCurrentComposer = &compose;
640 compose.exec(); 651 compose.exec();
652 mCurrentComposer = 0;
653}
654
655void OpieMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList)
656{
657
658 if ( mCurrentComposer ) {
659 mCurrentComposer->insertAttendees(uid,nameList,emailList,uidList);
660 } else {
661 ComposeMail compose( settings, this, 0, true );
662 compose.slotAdjustColumns();
663#ifndef DESKTOP_VERSION
664 compose.showMaximized();
665#endif
666 mCurrentComposer = &compose;
667 mCurrentComposer->insertAttendees(uid,nameList,emailList,uidList);
668 compose.exec();
669 mCurrentComposer = 0;
670 raise();
671 }
641} 672}