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.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
@@ -25,53 +25,55 @@
#include "klocale.h"
#include <qmessagebox.h>
#include <qtimer.h>
#include <qcursor.h>
#include <qtextbrowser.h>
#include <qregexp.h>
#include <qpe/global.h>
#ifdef DESKTOP_VERSION
#include <qapplication.h>
#else
#include <qpe/qpeapplication.h>
#endif
#include <libmailwrapper/smtpwrapper.h>
#include <libmailwrapper/mailtypes.h>
#include <libmailwrapper/abstractmail.h>
#include "koprefs.h"
//using namespace Opie::Core;
OpieMail::OpieMail( QWidget *parent, const char *name )
: MainWindow( parent, name) //, WStyle_ContextHelp )
{
+ mCurrentComposer = 0;
settings = new Settings();
tb = 0;
setIcon(SmallIcon( "kmicromail" ) );
folderView->populate( settings->getAccounts() );
-
+ connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)),
+ this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&)));
}
OpieMail::~OpieMail()
{
if (settings) delete settings;
if ( tb )
delete tb;
}
void OpieMail::appMessage(const QCString &msg, const QByteArray &data)
{
}
#include <stdlib.h>
void OpieMail::message(const QCString &msg, const QByteArray &data)
{
// copied from old mail2
static int ii = 0;
//qDebug("QCOP CALL ############################# %d ", ii);
//QString mess ( msg );
//qDebug("Message = %s ",mess.latin1());
++ii;
//qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this);
@@ -117,72 +119,77 @@ void OpieMail::slotExtAppHandler()
void OpieMail::slotwriteMail2(const QString& namemail )
{
//qDebug("OpieMail::slotwriteMail2 ");
//qApp->processEvents();
ComposeMail compose( settings, this, 0, true );
if ( !namemail.isEmpty() ) {
QString to = namemail;
if ( namemail.find( " <") > 1 ) {
to = "\"" +to.replace( QRegExp( " <"), "\" <") ;
} else
if ( namemail.find( "<") > 1 ) {
to = "\"" +to.replace( QRegExp( "<"), "\" <") ;
}
int sub = to.find( ">:");
if ( sub > 0 ) {
compose.setTo( to.left(sub+1) );
compose.setSubject( to.mid(sub+2) );
} else
compose.setTo( to );
}
compose.slotAdjustColumns();
#ifndef DESKTOP_VERSION
compose.showMaximized();
#endif
+ mCurrentComposer = &compose;
compose.exec();
+ mCurrentComposer = 0;
raise();
//qDebug("retttich ");
}
void OpieMail::slotwriteMail(const QString&name,const QString&email)
{
// qDebug("OpieMail::slotwriteMail ");
ComposeMail compose( settings, this, 0, true );
if (!email.isEmpty())
{
if (!name.isEmpty())
{
compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">");
}
else
{
compose.setTo(email);
}
}
compose.slotAdjustColumns();
#ifndef DESKTOP_VERSION
compose.showMaximized();
#endif
+
+ mCurrentComposer = &compose;
compose.exec();
+ mCurrentComposer = 0;
raise();
}
void OpieMail::slotComposeMail()
{
if ( mPendingEmail == QString::null && mPendingName == QString::null)
slotwriteMail2( QString () );
else {
if ( mPendingEmail == QString::null )
slotwriteMail2( mPendingName );
else
slotwriteMail( mPendingName, mPendingEmail );
}
//slotwriteMail(0l,0l);
}
void OpieMail::slotSendQueued()
{
SMTPaccount *smtp = 0;
QList<Account> list = settings->getAccounts();
QList<SMTPaccount> smtpList;
smtpList.setAutoDelete(false);
Account *it;
@@ -279,52 +286,55 @@ void OpieMail::replyMail()
QString text = body->Bodytext();
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( mail->getFrom());
} else {
composer.setTo( mail->Replyto());
}
composer.setSubject( prefix + mail->getSubject());
composer.setMessage( rtext );
composer.setInReplyTo( mail->Msgid());
composer.setCharset( body->getCharset() );
+
+ mCurrentComposer = &composer;
if ( QDialog::Accepted == KApplication::execDialog( &composer ) )
{
mail->Wrapper()->answeredMail(mail);
}
+ mCurrentComposer = 0;
delete settings;
}
void OpieMail::closeViewMail(ViewMail * vm)
{
vm->hide();
}
void OpieMail::slotDownloadMail( )
{
QListViewItem*item = mailView->currentItem();
if (!item ) {
Global::statusMessage("Error: No item slected!");
return;
}
RecMailP mail = ((MailListViewItem*)item)->data();
Account * acc = mail->Wrapper()->getAccount();
if ( !acc ) {
Global::statusMessage("Mail is already stored locally!");
return;
}
QString lfName = acc->getLocalFolder();
//qDebug("local folder " + lfName );
if ( lfName.isEmpty() )
@@ -616,26 +626,47 @@ void OpieMail::slotMoveCopyAllMail()
{
QMessageBox::critical(0,i18n("Error creating new Folder"),
i18n("<center>Error while creating<br>new folder - breaking.</center>"));
return;
}
sels.hide();
qApp->processEvents();
//qDebug("hiding sels ");
mail->Wrapper()->mvcpMailList(t,targetFolder,targetMail,sels.moveMails());
folderView->refreshCurrent();
}
void OpieMail::reEditMail()
{
if (!mailView->currentItem()) return;
ComposeMail compose( settings, this, 0, true );
compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data());
compose.slotAdjustColumns();
#ifndef DESKTOP_VERSION
compose.showMaximized();
#else
compose.resize(640,480);
#endif
+ mCurrentComposer = &compose;
compose.exec();
+ mCurrentComposer = 0;
+}
+
+void OpieMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList)
+{
+
+ if ( mCurrentComposer ) {
+ mCurrentComposer->insertAttendees(uid,nameList,emailList,uidList);
+ } else {
+ ComposeMail compose( settings, this, 0, true );
+ compose.slotAdjustColumns();
+#ifndef DESKTOP_VERSION
+ compose.showMaximized();
+#endif
+ mCurrentComposer = &compose;
+ mCurrentComposer->insertAttendees(uid,nameList,emailList,uidList);
+ compose.exec();
+ mCurrentComposer = 0;
+ raise();
+ }
}