Branch 'kolab/integration/4.13.0' - 6 commits - incidenceeditor-ng/CMakeLists.txt incidenceeditor-ng/individualmailcomponentfactory.cpp incidenceeditor-ng/individualmaildialog.cpp incidenceeditor-ng/individualmaildialog.h incidenceeditor-ng/tests kmail/kmkernel.cpp kmail/kmkernel.h
Sandro Knauß
knauss at kolabsys.com
Sat Aug 16 17:53:18 CEST 2014
incidenceeditor-ng/CMakeLists.txt | 10 +++----
incidenceeditor-ng/individualmailcomponentfactory.cpp | 2 -
incidenceeditor-ng/individualmaildialog.cpp | 1
incidenceeditor-ng/individualmaildialog.h | 2 -
incidenceeditor-ng/tests/CMakeLists.txt | 6 ++--
incidenceeditor-ng/tests/testindividualmaildialog.cpp | 25 +++++++++++++++---
kmail/kmkernel.cpp | 1
kmail/kmkernel.h | 2 -
8 files changed, 34 insertions(+), 15 deletions(-)
New commits:
commit 28156f8f6a330af4f945056b42ce1970ad9afb9d
Author: Sandro Knauà <knauss at kolabsys.com>
Date: Sat Aug 16 17:10:54 2014 +0200
Backport patch "individual mail dialog for incidenceeditor."
diff --git a/incidenceeditor-ng/individualmailcomponentfactory.h b/incidenceeditor-ng/individualmailcomponentfactory.h
index 4cab94c..9dc3657 100644
--- a/incidenceeditor-ng/individualmailcomponentfactory.h
+++ b/incidenceeditor-ng/individualmailcomponentfactory.h
@@ -20,11 +20,11 @@
#ifndef INCIDENCEEDITOR_INDUVIDUALMAILJOBFACTORY_H
#define INCIDENCEEDITOR_INDUVIDUALMAILJOBFACTORY_H
-#include "incidenceeditors_ng_export.h"
+#include "incidenceeditors-ng_export.h"
#include "opencomposerjob.h"
-#include <MailTransport/MessageQueueJob>
+#include <mailtransport/messagequeuejob.h>
#include <Akonadi/Calendar/IncidenceChanger>
#include <KPIMIdentities/Identity>
commit 692af174a66f32b43b610f2a2199443683859958
Author: Sandro Knauà <knauss at kolabsys.com>
Date: Sat Aug 16 16:21:12 2014 +0200
Upstream has moved tests to autotests dir
diff --git a/incidenceeditor-ng/autotests/testindividualmaildialog.cpp b/incidenceeditor-ng/autotests/testindividualmaildialog.cpp
deleted file mode 100644
index 302618b..0000000
--- a/incidenceeditor-ng/autotests/testindividualmaildialog.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
-Copyright (c) 2014 Sandro Knauà <knauss at kolabsys.com>
-
-This library is free software; you can redistribute it and/or modify it
-under the terms of the GNU Library General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at your
-option) any later version.
-
-This library is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
-License for more details.
-
-You should have received a copy of the GNU Library General Public License
-along with this library; see the file COPYING.LIB. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301, USA.
- */
-
-#include "individualmaildialog.h"
-
-#include <QObject>
-#include <qtest.h>
-
-using namespace IncidenceEditorNG;
-
-class TestIndividualMailDialog : public QObject
-{
- Q_OBJECT
-private slots:
- void testDialog() {
- KCalCore::Attendee::List attendees;
- KGuiItem buttonYes = KGuiItem(QLatin1String("Send Email"));
- KGuiItem buttonNo = KGuiItem(QLatin1String("Do not send"));
-
- KCalCore::Attendee::Ptr attendee1(new KCalCore::Attendee(QLatin1String("test1"), QLatin1String("test1 at example.com")));
- KCalCore::Attendee::Ptr attendee2(new KCalCore::Attendee(QLatin1String("test2"), QLatin1String("test2 at example.com")));
- KCalCore::Attendee::Ptr attendee3(new KCalCore::Attendee(QLatin1String("test3"), QLatin1String("test3 at example.com")));
-
- attendees << attendee1 << attendee2 << attendee3;
-
- IndividualMailDialog dialog(QLatin1String("title"), attendees, buttonYes, buttonNo, 0);
-
- QCOMPARE(dialog.editAttendees().count(), 0);
- QCOMPARE(dialog.updateAttendees().count(), 3);
-
- // Just make sure, that the QCombobox is sorted like we think
- QComboBox *first = dialog.mAttendeeDecision[attendees[0]];
- QCOMPARE((IndividualMailDialog::Decisions)first->itemData(0, Qt::UserRole).toInt(), IndividualMailDialog::Update);
- QCOMPARE((IndividualMailDialog::Decisions)first->itemData(1, Qt::UserRole).toInt(), IndividualMailDialog::NoUpdate);
- QCOMPARE((IndividualMailDialog::Decisions)first->itemData(2, Qt::UserRole).toInt(), IndividualMailDialog::Edit);
-
- // No update for first attendee, other default
- first->setCurrentIndex(1);
- QCOMPARE(dialog.editAttendees().count(), 0);
- QCOMPARE(dialog.updateAttendees().count(), 2);
- QVERIFY(dialog.updateAttendees().contains(attendee2));
- QVERIFY(dialog.updateAttendees().contains(attendee3));
-
- // edit for frist attende, other default
- first->setCurrentIndex(2);
- QCOMPARE(dialog.editAttendees().count(), 1);
- QCOMPARE(dialog.updateAttendees().count(), 2);
- QCOMPARE(dialog.editAttendees()[0], attendee1);
- }
- };
-
-QTEST_MAIN( TestIndividualMailDialog )
-
-#include "testindividualmaildialog.moc"
diff --git a/incidenceeditor-ng/tests/testindividualmaildialog.cpp b/incidenceeditor-ng/tests/testindividualmaildialog.cpp
new file mode 100644
index 0000000..302618b
--- /dev/null
+++ b/incidenceeditor-ng/tests/testindividualmaildialog.cpp
@@ -0,0 +1,70 @@
+/*
+Copyright (c) 2014 Sandro Knauà <knauss at kolabsys.com>
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Library General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at your
+option) any later version.
+
+This library is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
+License for more details.
+
+You should have received a copy of the GNU Library General Public License
+along with this library; see the file COPYING.LIB. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301, USA.
+ */
+
+#include "individualmaildialog.h"
+
+#include <QObject>
+#include <qtest.h>
+
+using namespace IncidenceEditorNG;
+
+class TestIndividualMailDialog : public QObject
+{
+ Q_OBJECT
+private slots:
+ void testDialog() {
+ KCalCore::Attendee::List attendees;
+ KGuiItem buttonYes = KGuiItem(QLatin1String("Send Email"));
+ KGuiItem buttonNo = KGuiItem(QLatin1String("Do not send"));
+
+ KCalCore::Attendee::Ptr attendee1(new KCalCore::Attendee(QLatin1String("test1"), QLatin1String("test1 at example.com")));
+ KCalCore::Attendee::Ptr attendee2(new KCalCore::Attendee(QLatin1String("test2"), QLatin1String("test2 at example.com")));
+ KCalCore::Attendee::Ptr attendee3(new KCalCore::Attendee(QLatin1String("test3"), QLatin1String("test3 at example.com")));
+
+ attendees << attendee1 << attendee2 << attendee3;
+
+ IndividualMailDialog dialog(QLatin1String("title"), attendees, buttonYes, buttonNo, 0);
+
+ QCOMPARE(dialog.editAttendees().count(), 0);
+ QCOMPARE(dialog.updateAttendees().count(), 3);
+
+ // Just make sure, that the QCombobox is sorted like we think
+ QComboBox *first = dialog.mAttendeeDecision[attendees[0]];
+ QCOMPARE((IndividualMailDialog::Decisions)first->itemData(0, Qt::UserRole).toInt(), IndividualMailDialog::Update);
+ QCOMPARE((IndividualMailDialog::Decisions)first->itemData(1, Qt::UserRole).toInt(), IndividualMailDialog::NoUpdate);
+ QCOMPARE((IndividualMailDialog::Decisions)first->itemData(2, Qt::UserRole).toInt(), IndividualMailDialog::Edit);
+
+ // No update for first attendee, other default
+ first->setCurrentIndex(1);
+ QCOMPARE(dialog.editAttendees().count(), 0);
+ QCOMPARE(dialog.updateAttendees().count(), 2);
+ QVERIFY(dialog.updateAttendees().contains(attendee2));
+ QVERIFY(dialog.updateAttendees().contains(attendee3));
+
+ // edit for frist attende, other default
+ first->setCurrentIndex(2);
+ QCOMPARE(dialog.editAttendees().count(), 1);
+ QCOMPARE(dialog.updateAttendees().count(), 2);
+ QCOMPARE(dialog.editAttendees()[0], attendee1);
+ }
+ };
+
+QTEST_MAIN( TestIndividualMailDialog )
+
+#include "testindividualmaildialog.moc"
commit 1ecf3e0e1737967a34c0b68d47ee6212e1ece90e
Author: Sandro Knauà <knauss at kolabsys.com>
Date: Sun Jul 27 11:04:15 2014 +0200
individual mail dialog for incidenceeditor.
REVIEW: 119462
Conflicts:
incidenceeditor-ng/CMakeLists.txt
incidenceeditor-ng/autotests/CMakeLists.txt
diff --git a/incidenceeditor-ng/CMakeLists.txt b/incidenceeditor-ng/CMakeLists.txt
index ac293dc..fcfa555 100644
--- a/incidenceeditor-ng/CMakeLists.txt
+++ b/incidenceeditor-ng/CMakeLists.txt
@@ -68,6 +68,11 @@ set(incidenceeditors_ng_shared_LIB_SRCS
ldaputils.cpp
attendeetablemodel.cpp
attendeecomboboxdelegate.cpp
+
+ # Individual mail
+ individualmailcomponentfactory.cpp
+ individualmaildialog.cpp
+ opencomposerjob.cpp
)
kde4_add_kcfg_files(incidenceeditors_ng_shared_LIB_SRCS globalsettings_base.kcfgc)
@@ -98,12 +103,14 @@ kde4_add_library(incidenceeditorsng ${LIBRARY_TYPE} ${incidenceeditors_ng_deskto
target_link_libraries(incidenceeditorsng
akonadi-calendar
+ akonadi-kmime
${QT_QTCORE_LIBRARY}
${QT_QTGUI_LIBRARY}
${QJSON_LIBRARIES}
${KDE4_KDEUI_LIBS}
${KDEPIMLIBS_KCALCORE_LIBS}
${KDEPIMLIBS_KCALUTILS_LIBS}
+ ${KDEPIMLIBS_MAILTRANSPORT_LIBS}
kdepim
kdepimdbusinterfaces # For UriHandler
calendarsupport # For KCalPrefs
@@ -142,6 +149,7 @@ install(TARGETS incidenceeditorsng ${INSTALL_TARGETS_DEFAULT_ARGS})
target_link_libraries(incidenceeditorsngmobile
akonadi-calendar
+ akonadi-kmime
${QT_QTCORE_LIBRARY}
${QT_QTGUI_LIBRARY}
${KDE4_KDEUI_LIBS}
@@ -151,6 +159,7 @@ install(TARGETS incidenceeditorsng ${INSTALL_TARGETS_DEFAULT_ARGS})
kdgantt2
${KDEPIMLIBS_KCALUTILS_LIBS}
${KDEPIMLIBS_KCALCORE_LIBS}
+ ${KDEPIMLIBS_MAILTRANSPORT_LIBS}
${QJSON_LIBRARIES}
)
diff --git a/incidenceeditor-ng/Messages.sh b/incidenceeditor-ng/Messages.sh
index b20d68d..b2fad21 100644
--- a/incidenceeditor-ng/Messages.sh
+++ b/incidenceeditor-ng/Messages.sh
@@ -1,4 +1,4 @@
#! /bin/sh
$EXTRACTRC `find . -name \*.ui -o -name \*.kcfg` >> rc.cpp
-$XGETTEXT `find . -name "*.cpp"` -o $podir/libincidenceeditors.pot
+$XGETTEXT `find . -name "*.cpp" -name "*.h"` -o $podir/libincidenceeditors.pot
rm -f rc.cpp
diff --git a/incidenceeditor-ng/autotests/testindividualmaildialog.cpp b/incidenceeditor-ng/autotests/testindividualmaildialog.cpp
new file mode 100644
index 0000000..302618b
--- /dev/null
+++ b/incidenceeditor-ng/autotests/testindividualmaildialog.cpp
@@ -0,0 +1,70 @@
+/*
+Copyright (c) 2014 Sandro Knauà <knauss at kolabsys.com>
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Library General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at your
+option) any later version.
+
+This library is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
+License for more details.
+
+You should have received a copy of the GNU Library General Public License
+along with this library; see the file COPYING.LIB. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301, USA.
+ */
+
+#include "individualmaildialog.h"
+
+#include <QObject>
+#include <qtest.h>
+
+using namespace IncidenceEditorNG;
+
+class TestIndividualMailDialog : public QObject
+{
+ Q_OBJECT
+private slots:
+ void testDialog() {
+ KCalCore::Attendee::List attendees;
+ KGuiItem buttonYes = KGuiItem(QLatin1String("Send Email"));
+ KGuiItem buttonNo = KGuiItem(QLatin1String("Do not send"));
+
+ KCalCore::Attendee::Ptr attendee1(new KCalCore::Attendee(QLatin1String("test1"), QLatin1String("test1 at example.com")));
+ KCalCore::Attendee::Ptr attendee2(new KCalCore::Attendee(QLatin1String("test2"), QLatin1String("test2 at example.com")));
+ KCalCore::Attendee::Ptr attendee3(new KCalCore::Attendee(QLatin1String("test3"), QLatin1String("test3 at example.com")));
+
+ attendees << attendee1 << attendee2 << attendee3;
+
+ IndividualMailDialog dialog(QLatin1String("title"), attendees, buttonYes, buttonNo, 0);
+
+ QCOMPARE(dialog.editAttendees().count(), 0);
+ QCOMPARE(dialog.updateAttendees().count(), 3);
+
+ // Just make sure, that the QCombobox is sorted like we think
+ QComboBox *first = dialog.mAttendeeDecision[attendees[0]];
+ QCOMPARE((IndividualMailDialog::Decisions)first->itemData(0, Qt::UserRole).toInt(), IndividualMailDialog::Update);
+ QCOMPARE((IndividualMailDialog::Decisions)first->itemData(1, Qt::UserRole).toInt(), IndividualMailDialog::NoUpdate);
+ QCOMPARE((IndividualMailDialog::Decisions)first->itemData(2, Qt::UserRole).toInt(), IndividualMailDialog::Edit);
+
+ // No update for first attendee, other default
+ first->setCurrentIndex(1);
+ QCOMPARE(dialog.editAttendees().count(), 0);
+ QCOMPARE(dialog.updateAttendees().count(), 2);
+ QVERIFY(dialog.updateAttendees().contains(attendee2));
+ QVERIFY(dialog.updateAttendees().contains(attendee3));
+
+ // edit for frist attende, other default
+ first->setCurrentIndex(2);
+ QCOMPARE(dialog.editAttendees().count(), 1);
+ QCOMPARE(dialog.updateAttendees().count(), 2);
+ QCOMPARE(dialog.editAttendees()[0], attendee1);
+ }
+ };
+
+QTEST_MAIN( TestIndividualMailDialog )
+
+#include "testindividualmaildialog.moc"
diff --git a/incidenceeditor-ng/editoritemmanager.cpp b/incidenceeditor-ng/editoritemmanager.cpp
index 7cc3614..0d57318 100644
--- a/incidenceeditor-ng/editoritemmanager.cpp
+++ b/incidenceeditor-ng/editoritemmanager.cpp
@@ -19,6 +19,7 @@
*/
#include "editoritemmanager.h"
+#include "individualmailcomponentfactory.h"
#include <calendarsupport/utils.h>
#include <calendarsupport/kcalprefs.h>
@@ -80,7 +81,7 @@ ItemEditorPrivate::ItemEditorPrivate( Akonadi::IncidenceChanger *changer, Editor
mFetchScope.fetchFullPayload();
mFetchScope.setAncestorRetrieval( Akonadi::ItemFetchScope::Parent );
- mChanger = changer ? changer : new Akonadi::IncidenceChanger( qq );
+ mChanger = changer ? changer : new Akonadi::IncidenceChanger( new IndividualMailComponentFactory(qq), qq );
qq->connect( mChanger,
SIGNAL(modifyFinished(int,Akonadi::Item,Akonadi::IncidenceChanger::ResultCode,QString)),
diff --git a/incidenceeditor-ng/individualmailcomponentfactory.cpp b/incidenceeditor-ng/individualmailcomponentfactory.cpp
new file mode 100644
index 0000000..343ff9f
--- /dev/null
+++ b/incidenceeditor-ng/individualmailcomponentfactory.cpp
@@ -0,0 +1,254 @@
+/*
+ Copyright (c) 2014 Sandro Knauà <knauss at kolabsys.com>
+
+ This library is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Library General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or (at your
+ option) any later version.
+
+ This library is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
+ License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+*/
+
+#include "individualmailcomponentfactory.h"
+#include "individualmaildialog.h"
+
+#include <KPIMUtils/Email>
+
+#include <KMessageBox>
+
+#include <QDBusConnection>
+#include <QDBusConnectionInterface>
+#include <QDBusInterface>
+#include <QDBusReply>
+
+using namespace IncidenceEditorNG;
+
+// IndividualMessageQueueJob
+
+IndividualMessageQueueJob::IndividualMessageQueueJob(const KPIMIdentities::Identity &identity,
+ const KCalCore::Attendee::List &update, const KCalCore::Attendee::List &edit,
+ QObject *parent)
+ : MailTransport::MessageQueueJob(parent)
+ , mUpdate(update)
+ , mEdit(edit)
+ , mIdentity(identity)
+ , mQueueJob(0)
+ , mComposerJob(0)
+{
+}
+
+void IndividualMessageQueueJob::start()
+{
+ QSet<QString> attendeesTo(QSet<QString>::fromList(addressAttribute().to()));
+ QSet<QString> attendeesCc(QSet<QString>::fromList(addressAttribute().cc()));
+
+ QStringList attendeesAutoTo, attendeesAutoCc;
+ foreach (const KCalCore::Attendee::Ptr & attendee, mUpdate) {
+ if (attendeesTo.contains(attendee->email())) {
+ attendeesAutoTo.append(attendee->fullName());
+ }
+ if (attendeesCc.contains(attendee->email())) {
+ attendeesAutoCc.append(attendee->fullName());
+ }
+ }
+ if (!attendeesAutoTo.isEmpty() || !attendeesAutoCc.isEmpty() || !addressAttribute().bcc().isEmpty()) {
+ startQueueJob(attendeesAutoTo, attendeesAutoCc);
+ }
+
+ QStringList attendeesComposerTo, attendeesComposerCc;
+ foreach (const KCalCore::Attendee::Ptr & attendee, mEdit) {
+ if (attendeesTo.contains(attendee->email())) {
+ attendeesComposerTo.append(attendee->fullName());
+ }
+ if (attendeesCc.contains(attendee->email())) {
+ attendeesComposerCc.append(attendee->fullName());
+ }
+ }
+ if (!attendeesComposerTo.isEmpty() || !attendeesComposerCc.isEmpty()) {
+ startComposerJob(attendeesComposerTo, attendeesComposerCc);
+ }
+
+ // No subjob has been started
+ if (!mQueueJob && !mComposerJob) {
+ emitResult();
+ }
+}
+
+void IndividualMessageQueueJob::startQueueJob(const QStringList &to, const QStringList &cc)
+{
+ KMime::Message::Ptr msg(message());
+ msg->to()->fromUnicodeString(to.join(QLatin1String(", ")), "utf-8");
+ msg->cc()->fromUnicodeString(cc.join(QLatin1String(", ")), "utf-8");
+ msg->assemble();
+
+ mQueueJob->setMessage(msg);
+ mQueueJob->transportAttribute().setTransportId(transportAttribute().transportId());
+ mQueueJob->sentBehaviourAttribute().setSentBehaviour(sentBehaviourAttribute().sentBehaviour());
+ mQueueJob->addressAttribute().setFrom(addressAttribute().from());
+ mQueueJob->addressAttribute().setTo(to);
+ mQueueJob->addressAttribute().setCc(cc);
+ mQueueJob->addressAttribute().setBcc(addressAttribute().bcc());
+
+ mQueueJob = new MailTransport::MessageQueueJob(this);
+ connect(mQueueJob, SIGNAL(finished(KJob*)), SLOT(handleJobFinished(KJob*)));
+ mQueueJob->start();
+}
+
+void IndividualMessageQueueJob::startComposerJob(const QStringList &to, const QStringList &cc)
+{
+ mComposerJob = new OpenComposerJob(this, to.join(QLatin1String(", ")), cc.join(QLatin1String(", ")), QString(), message(), mIdentity);
+ connect(mComposerJob, SIGNAL(finished(KJob*)), SLOT(handleJobFinished(KJob*)));
+ mComposerJob->start();
+}
+
+void IndividualMessageQueueJob::handleJobFinished(KJob *job)
+{
+ if (job->error()) {
+ if (job == mQueueJob && mComposerJob) {
+ mComposerJob->kill();
+ mComposerJob = 0;
+ } else if (mComposerJob) {
+ mQueueJob->kill();
+ mQueueJob = 0;
+ }
+ setError(job->error());
+ setErrorText(job->errorString());
+ emitResult();
+ return;
+ }
+ if (job == mQueueJob) {
+ if (!mComposerJob) {
+ emitResult();
+ }
+ mQueueJob = 0;
+ } else {
+ if (!mQueueJob) {
+ emitResult();
+ }
+ mComposerJob = 0;
+ }
+
+}
+
+// IndividualMailAskDelegator
+
+IndividualMailITIPHandlerDialogDelegate::IndividualMailITIPHandlerDialogDelegate(const KCalCore::Incidence::Ptr &incidence,
+ KCalCore::iTIPMethod method, QWidget *parent)
+ : Akonadi::ITIPHandlerDialogDelegate(incidence, method, parent)
+{
+}
+
+void IndividualMailITIPHandlerDialogDelegate::openDialog(const QString &question, const KCalCore::Attendee::List &attendees,
+ Action action,
+ const KGuiItem &buttonYes, const KGuiItem &buttonNo)
+{
+ switch (action) {
+ case ActionSendMessage:
+ emit setUpdate(mIncidence, attendees);
+ emit dialogClosed(KMessageBox::Yes, mMethod, mIncidence);
+ break;
+ case ActionDontSendMessage:
+ emit dialogClosed(KMessageBox::No, mMethod, mIncidence);
+ break;
+ default:
+ mDialog = new IndividualMailDialog(question, attendees, buttonYes, buttonNo, mParent);
+ connect(mDialog, SIGNAL(finished(int)), SLOT(onDialogClosed(int)));
+ mDialog->show();
+ break;
+ }
+}
+
+void IndividualMailITIPHandlerDialogDelegate::openDialogIncidenceCreated(Recipient recipient,
+ const QString &question,
+ Action action,
+ const KGuiItem &buttonYes, const KGuiItem &buttonNo)
+{
+ if (recipient == Attendees) {
+ openDialog(question, mIncidence->attendees(), action, buttonYes, buttonNo);
+ } else {
+ KCalCore::Attendee::Ptr organizer(new KCalCore::Attendee(mIncidence->organizer()->name(), mIncidence->organizer()->email()));
+ openDialog(question, KCalCore::Attendee::List() << organizer, action, buttonYes, buttonNo);
+ }
+}
+
+void IndividualMailITIPHandlerDialogDelegate::openDialogIncidenceModified(bool attendeeStatusChanged,
+ Recipient recipient,
+ const QString &question,
+ Action action,
+ const KGuiItem &buttonYes, const KGuiItem &buttonNo)
+{
+ Q_UNUSED(attendeeStatusChanged);
+ if (recipient == Attendees) {
+ openDialog(question, mIncidence->attendees(), action, buttonYes, buttonNo);
+ } else {
+ KCalCore::Attendee::Ptr organizer(new KCalCore::Attendee(mIncidence->organizer()->name(), mIncidence->organizer()->email()));
+ openDialog(question, KCalCore::Attendee::List() << organizer, action, buttonYes, buttonNo);
+ }
+}
+
+void IndividualMailITIPHandlerDialogDelegate::openDialogIncidenceDeleted(Recipient recipient,
+ const QString &question,
+ Action action,
+ const KGuiItem &buttonYes, const KGuiItem &buttonNo)
+{
+ if (recipient == Attendees) {
+ openDialog(question, mIncidence->attendees(), action, buttonYes, buttonNo);
+ } else {
+ KCalCore::Attendee::Ptr organizer(new KCalCore::Attendee(mIncidence->organizer()->name(), mIncidence->organizer()->email()));
+ openDialog(question, KCalCore::Attendee::List() << organizer, action, buttonYes, buttonNo);
+ }
+}
+
+void IndividualMailITIPHandlerDialogDelegate::onDialogClosed(int result)
+{
+ if (result == KDialog::Yes) {
+ emit setEdit(mIncidence, mDialog->editAttendees());
+ emit setUpdate(mIncidence, mDialog->updateAttendees());
+ emit dialogClosed(KMessageBox::Yes, mMethod, mIncidence);
+ } else {
+ emit dialogClosed(KMessageBox::No, mMethod, mIncidence);
+ }
+}
+
+// IndividualMailJobFactory
+IndividualMailComponentFactory::IndividualMailComponentFactory(QObject *parent)
+ : Akonadi::ITIPHandlerComponentFactory(parent)
+{
+
+}
+
+MailTransport::MessageQueueJob *IndividualMailComponentFactory::createMessageQueueJob(const KCalCore::IncidenceBase::Ptr &incidence,
+ const KPIMIdentities::Identity &identity, QObject *parent)
+{
+ return new IndividualMessageQueueJob(identity, mUpdate.take(incidence->uid()), mEdit.take(incidence->uid()), parent);
+}
+
+Akonadi::ITIPHandlerDialogDelegate *IndividualMailComponentFactory::createITIPHanderDialogDelegate(const KCalCore::Incidence::Ptr &incidence,
+ KCalCore::iTIPMethod method, QWidget *parent)
+{
+ IndividualMailITIPHandlerDialogDelegate *askDelegator = new IndividualMailITIPHandlerDialogDelegate(incidence, method, parent);
+ connect(askDelegator, SIGNAL(setEdit(KCalCore::Incidence::Ptr,KCalCore::Attendee::List)),
+ SLOT(onSetEdit(KCalCore::Incidence::Ptr,KCalCore::Attendee::List)));
+ connect(askDelegator, SIGNAL(setUpdate(KCalCore::Incidence::Ptr,KCalCore::Attendee::List)),
+ SLOT(onSetUpdate(KCalCore::Incidence::Ptr,KCalCore::Attendee::List)));
+
+ return askDelegator;
+}
+
+void IndividualMailComponentFactory::onSetEdit(const KCalCore::Incidence::Ptr &incidence, const KCalCore::Attendee::List &edit)
+{
+ mEdit[incidence->uid()] = edit;
+}
+
+void IndividualMailComponentFactory::onSetUpdate(const KCalCore::Incidence::Ptr &incidence, const KCalCore::Attendee::List &update)
+{
+ mUpdate[incidence->uid()] = update;
+}
diff --git a/incidenceeditor-ng/individualmailcomponentfactory.h b/incidenceeditor-ng/individualmailcomponentfactory.h
new file mode 100644
index 0000000..4cab94c
--- /dev/null
+++ b/incidenceeditor-ng/individualmailcomponentfactory.h
@@ -0,0 +1,117 @@
+/*
+ Copyright (c) 2014 Sandro Knauà <knauss at kolabsys.com>
+
+ This library is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Library General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or (at your
+ option) any later version.
+
+ This library is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
+ License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+*/
+
+#ifndef INCIDENCEEDITOR_INDUVIDUALMAILJOBFACTORY_H
+#define INCIDENCEEDITOR_INDUVIDUALMAILJOBFACTORY_H
+
+#include "incidenceeditors_ng_export.h"
+
+#include "opencomposerjob.h"
+
+#include <MailTransport/MessageQueueJob>
+#include <Akonadi/Calendar/IncidenceChanger>
+#include <KPIMIdentities/Identity>
+
+namespace IncidenceEditorNG {
+
+class IndividualMailDialog;
+
+class IndividualMessageQueueJob : public MailTransport::MessageQueueJob
+{
+ Q_OBJECT
+public:
+ explicit IndividualMessageQueueJob(const KPIMIdentities::Identity &identity, const KCalCore::Attendee::List &update, const KCalCore::Attendee::List &edit, QObject *parent);
+
+ virtual void start();
+private slots:
+ void startQueueJob(const QStringList &to, const QStringList &cc);
+ void startComposerJob(const QStringList &to, const QStringList &cc);
+ void handleJobFinished(KJob *job);
+
+private:
+ KCalCore::Attendee::List mUpdate;
+ KCalCore::Attendee::List mEdit;
+ KPIMIdentities::Identity mIdentity;
+ MailTransport::MessageQueueJob *mQueueJob;
+ OpenComposerJob *mComposerJob;
+};
+
+class IndividualMailITIPHandlerDialogDelegate : public Akonadi::ITIPHandlerDialogDelegate
+{
+ Q_OBJECT
+public:
+
+ explicit IndividualMailITIPHandlerDialogDelegate(const KCalCore::Incidence::Ptr &incidence, KCalCore::iTIPMethod method, QWidget *parent);
+
+ virtual void openDialogIncidenceCreated(Recipient recipient,
+ const QString &question,
+ Action action = ActionAsk,
+ const KGuiItem &buttonYes = KGuiItem(i18nc("@action:button dialog positive answer", "Send Email")),
+ const KGuiItem &buttonNo = KGuiItem(i18nc("@action:button dialog negative answer", "Do Not Send")));
+
+ virtual void openDialogIncidenceModified(bool attendeeStatusChanged,
+ Recipient recipient,
+ const QString &question,
+ Action action = ActionAsk,
+ const KGuiItem &buttonYes = KGuiItem(i18nc("@action:button dialog positive answer", "Send Email")),
+ const KGuiItem &buttonNo = KGuiItem(i18nc("@action:button dialog negative answer", "Do Not Send")));
+
+ virtual void openDialogIncidenceDeleted(Recipient recipient,
+ const QString &question,
+ Action action = ActionAsk,
+ const KGuiItem &buttonYes = KGuiItem(i18nc("@action:button dialog positive answer", "Send Email")),
+ const KGuiItem &buttonNo = KGuiItem(i18nc("@action:button dialog negative answer", "Do Not Send")));
+
+signals:
+ void setEdit(const KCalCore::Incidence::Ptr &incidence, const KCalCore::Attendee::List &edit);
+ void setUpdate(const KCalCore::Incidence::Ptr &incidence, const KCalCore::Attendee::List &update);
+
+protected:
+ void openDialog(const QString &question, const KCalCore::Attendee::List &attendees,
+ Action action,
+ const KGuiItem &buttonYes, const KGuiItem &buttonNo);
+
+private slots:
+ void onDialogClosed(int result);
+private:
+ IndividualMailDialog *mDialog;
+};
+
+class INCIDENCEEDITORS_NG_EXPORT IndividualMailComponentFactory : public Akonadi::ITIPHandlerComponentFactory
+{
+ Q_OBJECT
+public:
+ explicit IndividualMailComponentFactory(QObject *parent = 0);
+ virtual MailTransport::MessageQueueJob *createMessageQueueJob(const KCalCore::IncidenceBase::Ptr &incidence,
+ const KPIMIdentities::Identity &identity, QObject *parent);
+
+ virtual Akonadi::ITIPHandlerDialogDelegate *createITIPHanderDialogDelegate(const KCalCore::Incidence::Ptr &incidence,
+ KCalCore::iTIPMethod method, QWidget *parent);
+
+public slots:
+ void onSetEdit(const KCalCore::Incidence::Ptr &incidence, const KCalCore::Attendee::List &edit);
+ void onSetUpdate(const KCalCore::Incidence::Ptr &incidence, const KCalCore::Attendee::List &update);
+
+private:
+ QHash<QString, KCalCore::Attendee::List> mEdit;
+ QHash<QString, KCalCore::Attendee::List> mUpdate;
+};
+
+}
+#endif
diff --git a/incidenceeditor-ng/individualmaildialog.cpp b/incidenceeditor-ng/individualmaildialog.cpp
new file mode 100644
index 0000000..4db5055
--- /dev/null
+++ b/incidenceeditor-ng/individualmaildialog.cpp
@@ -0,0 +1,92 @@
+/*
+ Copyright (c) 2014 Sandro Knauà <knauss at kolabsys.com>
+
+ This library is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Library General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or (at your
+ option) any later version.
+
+ This library is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
+ License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+*/
+
+#include "individualmaildialog.h"
+
+#include <KLocalizedString>
+
+#include <QGridLayout>
+#include <QComboBox>
+#include <QLabel>
+
+using namespace IncidenceEditorNG;
+
+IndividualMailDialog::IndividualMailDialog(const QString &question, const KCalCore::Attendee::List &attendees,
+ const KGuiItem &buttonYes, const KGuiItem &buttonNo, QWidget *parent)
+ : KDialog(parent)
+{
+ setCaption(i18nc("@title:window", "Group Scheduling Email"));
+ setButtons(KDialog::Yes | KDialog::No | KDialog::Details);
+ setButtonText(KDialog::Details, i18nc("@action:button show list of attendees", "Individual mailsettings"));
+ setButtonGuiItem(KDialog::Yes, buttonYes);
+ setButtonGuiItem(KDialog::No, buttonNo);
+
+ QWidget *widget = new QWidget();
+ QGridLayout *layout = new QGridLayout(widget);
+ int row = 0;
+ foreach (const KCalCore::Attendee::Ptr & attendee, attendees) {
+ QComboBox *options = new QComboBox();
+ options->addItem(i18nc("@item:inlistbox ITIP Messages for one attendee", "Send update"), QVariant(Update));
+ options->addItem(i18nc("@item:inlistbox ITIP Messages for one attendee", "Send no update"), QVariant(NoUpdate));
+ options->addItem(i18nc("@item:inlistbox ITIP Messages for one attendee", "Edit mail"), QVariant(Edit));
+ mAttendeeDecision[attendee] = options;
+
+ layout->addWidget(new QLabel(attendee->fullName()), row, 0);
+ layout->addWidget(options, row, 1);
+ ++row;
+ }
+ widget->sizePolicy().setHorizontalStretch(1);
+ widget->sizePolicy().setVerticalStretch(1);
+
+ QWidget *mW = new QLabel(question);
+
+ setMainWidget(mW);
+ setDetailsWidget(widget);
+}
+
+IndividualMailDialog::~IndividualMailDialog()
+{
+
+}
+
+KCalCore::Attendee::List IndividualMailDialog::editAttendees() const
+{
+ KCalCore::Attendee::List edit;
+ QList<KCalCore::Attendee::Ptr> attendees = mAttendeeDecision.keys();
+ foreach (const KCalCore::Attendee::Ptr & attendee, attendees) {
+ int index = mAttendeeDecision[attendee]->currentIndex();
+ if (mAttendeeDecision[attendee]->itemData(index, Qt::UserRole) == Edit) {
+ edit.append(attendee);
+ }
+ }
+ return edit;
+}
+
+KCalCore::Attendee::List IndividualMailDialog::updateAttendees() const
+{
+ KCalCore::Attendee::List update;
+ QList<KCalCore::Attendee::Ptr> attendees = mAttendeeDecision.keys();
+ foreach (const KCalCore::Attendee::Ptr & attendee, attendees) {
+ int index = mAttendeeDecision[attendee]->currentIndex();
+ if (mAttendeeDecision[attendee]->itemData(index, Qt::UserRole) == Update) {
+ update.append(attendee);
+ }
+ }
+ return update;
+}
diff --git a/incidenceeditor-ng/individualmaildialog.h b/incidenceeditor-ng/individualmaildialog.h
new file mode 100644
index 0000000..55eb2d9
--- /dev/null
+++ b/incidenceeditor-ng/individualmaildialog.h
@@ -0,0 +1,57 @@
+/*
+ Copyright (c) 2014 Sandro Knauà <knauss at kolabsys.com>
+
+ This library is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Library General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or (at your
+ option) any later version.
+
+ This library is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
+ License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+*/
+
+#ifndef INCIDENCEEDITOR_INDIVIDUALMAILDIALOG_H
+#define INCIDENCEEDITOR_INDIVIDUALMAILDIALOG_H
+
+#include <KCalCore/Attendee>
+#include <KDialog>
+
+#include <QComboBox>
+
+class TestIndividualMailDialog;
+
+namespace IncidenceEditorNG {
+
+// Shows a dialog with a question and the option to select which attendee should get the mail or to open a composer for him.
+// Used to get individual mails for attendees of an event.
+class IndividualMailDialog : public KDialog
+{
+ Q_OBJECT
+ friend TestIndividualMailDialog;
+public:
+ enum Decisions {
+ Update, /**< send automatic mail to attendee */
+ NoUpdate, /**< do not send mail to attendee */
+ Edit /**< open composer for attendee */
+ };
+ explicit IndividualMailDialog(const QString &question, const KCalCore::Attendee::List &attendees,
+ const KGuiItem &buttonYes, const KGuiItem &buttonNo, QWidget *parent = 0);
+ virtual ~IndividualMailDialog();
+
+ KCalCore::Attendee::List editAttendees() const;
+ KCalCore::Attendee::List updateAttendees() const;
+
+private:
+ QHash<KCalCore::Attendee::Ptr, QComboBox *> mAttendeeDecision;
+};
+
+}
+
+#endif
diff --git a/incidenceeditor-ng/opencomposerjob.cpp b/incidenceeditor-ng/opencomposerjob.cpp
new file mode 100644
index 0000000..052449a
--- /dev/null
+++ b/incidenceeditor-ng/opencomposerjob.cpp
@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 2014 Sandro Knauà <knauss at kolabsys.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Library General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#include "opencomposerjob.h"
+
+#include <QtCore/QObject>
+#include <QtDBus/QtDBus>
+#include <QtCore/QProcess>
+
+#include <klocalizedstring.h>
+#include <kdbusservicestarter.h>
+
+using namespace IncidenceEditorNG;
+
+OpenComposerJob::OpenComposerJob(QObject *parent,
+ const QString &to, const QString &cc, const QString &bcc,
+ const KMime::Message::Ptr &message, const KPIMIdentities::Identity &identity)
+ : KJob(parent)
+ , mTo(to)
+ , mCc(cc)
+ , mBcc(bcc)
+ , mMessage(message)
+ , mIdentity(identity)
+ , mSuccess(false)
+{
+ connect(QDBusConnection::sessionBus().interface(), SIGNAL(serviceOwnerChanged(QString,QString,QString)),
+ SLOT(slotServiceOwnerChanged(QString,QString,QString)));
+}
+
+OpenComposerJob::~OpenComposerJob()
+{
+
+}
+
+void OpenComposerJob::start()
+{
+ mSuccess = false;
+ if (QDBusConnection::sessionBus().interface()->isServiceRegistered(QLatin1String("org.kde.kmail"))) {
+ processMail();
+ }
+ //Check if Kontact is already running and if not ...
+ int result = KDBusServiceStarter::self()->findServiceFor(QLatin1String("DBUS/Mailer"), QString(),
+ &mError, &mDBusService);
+ if (result != 0) {
+ // ... start Kontact
+ result = KDBusServiceStarter::self()->startServiceFor(QLatin1String("DBUS/Mailer"), QString(),
+ &mError, &mDBusService);
+ if (result != 0) {
+ const bool ok = QProcess::startDetached(QLatin1String("kontact"));
+ if (!ok) {
+ setError(KJob::UserDefinedError);
+ setErrorText(i18nc("errormessage: can't get connection via dbus", "Don't get kmail started"));
+ emitResult();
+ return;
+ }
+ } else {
+ setError(KJob::UserDefinedError);
+ setErrorText(i18nc("errormessage: can't get connection via dbus", "Don't get kmail started"));
+ emitResult();
+ return;
+ }
+ }
+
+ QTimer::singleShot(10000, this, SLOT(timeout()));
+}
+
+void OpenComposerJob::timeout()
+{
+ if (!mSuccess) {
+ setError(KJob::UserDefinedError);
+ setErrorText(i18nc("errormessage: can't get connection via dbus", "Don't get kmail started"));
+ emitResult();
+ }
+}
+
+void OpenComposerJob::slotServiceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner)
+{
+ Q_UNUSED(oldOwner);
+ if (name == QLatin1String("org.kde.kmail") && !newOwner.isEmpty()) {
+ processMail();
+ }
+}
+
+void OpenComposerJob::processMail()
+{
+ Q_ASSERT(mMessage);
+ mSuccess = true;
+
+ bool hidden = false;
+ unsigned int identity = mIdentity.uoid();
+
+ QString subject = mMessage->subject()->asUnicodeString();
+ QString body = QString::fromUtf8(mMessage->contents()[0]->body());
+
+ QList<QVariant> messages;
+
+ if (mMessage->contents().count() == 1) {
+ const QString messageFile;
+ const QStringList attachmentPaths;
+ const QStringList customHeaders;
+ const QString replyTo;
+ const QString inReplyTo;
+
+ messages << mTo << mCc << mBcc << subject << body << hidden
+ << messageFile << attachmentPaths << customHeaders << replyTo << inReplyTo;
+ } else {
+ KMime::Content *attachment(mMessage->contents().at(1));
+ QString attachName = attachment->contentType()->name();
+ QByteArray attachCte = attachment->contentTransferEncoding()->as7BitString(false);
+ QByteArray attachType = attachment->contentType()->mediaType();
+ QByteArray attachSubType = attachment->contentType()->subType();
+ QByteArray attachContDisp = attachment->contentDisposition()->as7BitString(false);
+ QByteArray attachCharset = attachment->contentType()->charset();
+
+ QByteArray attachParamAttr = "method";
+ QString attachParamValue = attachment->contentType()->parameter(QLatin1String("method"));
+ QByteArray attachData = attachment->encodedBody();
+
+ messages << mTo << mCc << mBcc << subject << body << hidden
+ << attachName << attachCte << attachData << attachType << attachSubType
+ << attachParamAttr << attachParamValue << attachContDisp << attachCharset
+ << identity << false;
+ }
+ QDBusInterface kmailObj(QLatin1String("org.kde.kmail"), QLatin1String("/KMail"), QLatin1String("org.kde.kmail.kmail"));
+
+ QDBusReply<int> composerDbusPath = kmailObj.callWithArgumentList(QDBus::AutoDetect, QLatin1String("openComposer"), messages);
+
+ if (!composerDbusPath.isValid()) {
+ setError(KJob::UserDefinedError);
+ setErrorText(i18nc( "errormessage: dbus is running but still no connection kmail", "Cannot connect to email service"));
+ }
+ emitResult();
+
+}
diff --git a/incidenceeditor-ng/opencomposerjob.h b/incidenceeditor-ng/opencomposerjob.h
new file mode 100644
index 0000000..acb43cc
--- /dev/null
+++ b/incidenceeditor-ng/opencomposerjob.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2014 Sandro Knauà <knauss at kolabsys.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Library General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#ifndef INCIDENCEEDITOR_OPENCOMPOSERJOB_H
+#define INCIDENCEEDITOR_OPENCOMPOSERJOB_H
+
+#include <KPIMIdentities/Identity>
+#include <kmime/kmime_message.h>
+
+#include <KJob>
+namespace IncidenceEditorNG {
+
+// Opens a Composer with a mail with one attachment (costructed my ITIPHandler)
+class OpenComposerJob : public KJob
+{
+ Q_OBJECT
+
+public:
+ explicit OpenComposerJob(QObject *parent,
+ const QString &to, const QString &cc, const QString &bcc,
+ const KMime::Message::Ptr &message, const KPIMIdentities::Identity &identity);
+ virtual ~OpenComposerJob();
+
+ virtual void start();
+
+private slots:
+ void slotServiceOwnerChanged(const QString &, const QString &, const QString &);
+ void timeout();
+ void processMail();
+
+private:
+ QString mDBusService;
+ QString mError;
+ QString mTo, mCc, mBcc;
+ KMime::Message::Ptr mMessage;
+ KPIMIdentities::Identity mIdentity;
+ bool mSuccess;
+};
+
+}
+#endif
diff --git a/incidenceeditor-ng/tests/CMakeLists.txt b/incidenceeditor-ng/tests/CMakeLists.txt
index 73522a6..5403c0f 100644
--- a/incidenceeditor-ng/tests/CMakeLists.txt
+++ b/incidenceeditor-ng/tests/CMakeLists.txt
@@ -40,6 +40,16 @@ target_link_libraries(
incidenceeditorsng
)
+kde4_add_executable(testindividualmaildialog NOGUI TEST testindividualmaildialog.cpp ../individualmaildialog.cpp)
+target_link_libraries(testindividualmaildialog
+ ${QT_QTCORE_LIBRARY}
+ ${QT_QTGUI_LIBRARY}
+ ${QT_QTTEST_LIBRARY}
+ ${KDE4_KDECORE_LIBS}
+ ${KDE4_KDEUI_LIBS}
+ ${KDEPIMLIBS_KCALCORE_LIBS}
+)
+
set(resourcemanagement_gui_SRCS resourcemanagment_gui.cpp)
kde4_add_executable(resourcemanagement_gui TEST ${resourcemanagement_gui_SRCS})
target_link_libraries(resourcemanagement_gui
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index ba838f1..5d620f5 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -64,6 +64,7 @@
#include <incidenceeditor-ng/incidencedefaults.h>
#include <incidenceeditor-ng/incidencedialog.h>
#include <incidenceeditor-ng/incidencedialogfactory.h>
+#include <incidenceeditor-ng/individualmailcomponentfactory.h>
#include <libkdepim/widgets/pimmessagebox.h>
#include <akonadi/calendar/freebusymanager.h>
@@ -106,7 +107,7 @@ CalendarView::CalendarView( QWidget *parent ) : CalendarViewBase( parent ),
mETMCollectionView( 0 )
{
Akonadi::Control::widgetNeedsAkonadi( this );
- mChanger = new Akonadi::IncidenceChanger( this );
+ mChanger = new Akonadi::IncidenceChanger( new IncidenceEditorNG::IndividualMailComponentFactory( this ), this );
mChanger->setDefaultCollection( Akonadi::Collection( CalendarSupport::KCalPrefs::instance()->defaultCalendarId() ) );
mChanger->setDestinationPolicy( static_cast<Akonadi::IncidenceChanger::DestinationPolicy>( KOPrefs::instance()->destination() ) );
commit ead610c5be18357d879f80fec3a8ec2975e927de
Author: Sandro Knauà <knauss at kolabsys.com>
Date: Sat Aug 16 16:11:15 2014 +0200
Revert "individual mail dialog for incidenceeditor."
This reverts commit f5849c29a314deeff7b0a4c469bd2cf2d82e5818.
(Replace with commited version to master)
Conflicts:
incidenceeditor-ng/CMakeLists.txt
incidenceeditor-ng/tests/CMakeLists.txt
diff --git a/incidenceeditor-ng/CMakeLists.txt b/incidenceeditor-ng/CMakeLists.txt
index 4b33d45..ac293dc 100644
--- a/incidenceeditor-ng/CMakeLists.txt
+++ b/incidenceeditor-ng/CMakeLists.txt
@@ -62,11 +62,6 @@ set(incidenceeditors_ng_shared_LIB_SRCS
categoryeditdialog.cpp
categoryselectdialog.cpp
categorydialog.cpp
-
- # Individual mail
- individualmailcomponentfactory.cpp
- individualmaildialog.cpp
- opencomposerjob.cpp
resourcemanagement.cpp
resourceitem.cpp
resourcemodel.cpp
@@ -103,14 +98,12 @@ kde4_add_library(incidenceeditorsng ${LIBRARY_TYPE} ${incidenceeditors_ng_deskto
target_link_libraries(incidenceeditorsng
akonadi-calendar
- akonadi-kmime
${QT_QTCORE_LIBRARY}
${QT_QTGUI_LIBRARY}
${QJSON_LIBRARIES}
${KDE4_KDEUI_LIBS}
${KDEPIMLIBS_KCALCORE_LIBS}
${KDEPIMLIBS_KCALUTILS_LIBS}
- ${KDEPIMLIBS_MAILTRANSPORT_LIBS}
kdepim
kdepimdbusinterfaces # For UriHandler
calendarsupport # For KCalPrefs
@@ -149,7 +142,6 @@ install(TARGETS incidenceeditorsng ${INSTALL_TARGETS_DEFAULT_ARGS})
target_link_libraries(incidenceeditorsngmobile
akonadi-calendar
- akonadi-kmime
${QT_QTCORE_LIBRARY}
${QT_QTGUI_LIBRARY}
${KDE4_KDEUI_LIBS}
@@ -159,7 +151,6 @@ install(TARGETS incidenceeditorsng ${INSTALL_TARGETS_DEFAULT_ARGS})
kdgantt2
${KDEPIMLIBS_KCALUTILS_LIBS}
${KDEPIMLIBS_KCALCORE_LIBS}
- ${KDEPIMLIBS_MAILTRANSPORT_LIBS}
${QJSON_LIBRARIES}
)
diff --git a/incidenceeditor-ng/Messages.sh b/incidenceeditor-ng/Messages.sh
index b2fad21..b20d68d 100644
--- a/incidenceeditor-ng/Messages.sh
+++ b/incidenceeditor-ng/Messages.sh
@@ -1,4 +1,4 @@
#! /bin/sh
$EXTRACTRC `find . -name \*.ui -o -name \*.kcfg` >> rc.cpp
-$XGETTEXT `find . -name "*.cpp" -name "*.h"` -o $podir/libincidenceeditors.pot
+$XGETTEXT `find . -name "*.cpp"` -o $podir/libincidenceeditors.pot
rm -f rc.cpp
diff --git a/incidenceeditor-ng/editoritemmanager.cpp b/incidenceeditor-ng/editoritemmanager.cpp
index 0d57318..7cc3614 100644
--- a/incidenceeditor-ng/editoritemmanager.cpp
+++ b/incidenceeditor-ng/editoritemmanager.cpp
@@ -19,7 +19,6 @@
*/
#include "editoritemmanager.h"
-#include "individualmailcomponentfactory.h"
#include <calendarsupport/utils.h>
#include <calendarsupport/kcalprefs.h>
@@ -81,7 +80,7 @@ ItemEditorPrivate::ItemEditorPrivate( Akonadi::IncidenceChanger *changer, Editor
mFetchScope.fetchFullPayload();
mFetchScope.setAncestorRetrieval( Akonadi::ItemFetchScope::Parent );
- mChanger = changer ? changer : new Akonadi::IncidenceChanger( new IndividualMailComponentFactory(qq), qq );
+ mChanger = changer ? changer : new Akonadi::IncidenceChanger( qq );
qq->connect( mChanger,
SIGNAL(modifyFinished(int,Akonadi::Item,Akonadi::IncidenceChanger::ResultCode,QString)),
diff --git a/incidenceeditor-ng/individualmailcomponentfactory.cpp b/incidenceeditor-ng/individualmailcomponentfactory.cpp
deleted file mode 100644
index 06c86e6..0000000
--- a/incidenceeditor-ng/individualmailcomponentfactory.cpp
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
- Copyright (c) 2014 Sandro Knauà <knauss at kolabsys.com>
-
- This library is free software; you can redistribute it and/or modify it
- under the terms of the GNU Library General Public License as published by
- the Free Software Foundation; either version 2 of the License, or (at your
- option) any later version.
-
- This library is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
- License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to the
- Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301, USA.
-*/
-
-#include "individualmailcomponentfactory.h"
-#include "individualmaildialog.h"
-
-#include <kpimutils/email.h>
-
-#include <KMessageBox>
-
-#include <QDBusConnection>
-#include <QDBusConnectionInterface>
-#include <QDBusInterface>
-#include <QDBusReply>
-
-using namespace IncidenceEditorNG;
-
-// IndividualMessageQueueJob
-
-IndividualMessageQueueJob::IndividualMessageQueueJob(const KPIMIdentities::Identity &identity,
- const KCalCore::Attendee::List &update, const KCalCore::Attendee::List &edit,
- QObject *parent)
- : MailTransport::MessageQueueJob(parent)
- , mUpdate(update)
- , mEdit(edit)
- , mIdentity(identity)
- , mQueueJob(0)
- , mComposerJob(0)
-{
-}
-
-void IndividualMessageQueueJob::start()
-{
- QSet<QString> attendeesTo(QSet<QString>::fromList(addressAttribute().to()));
- QSet<QString> attendeesCc(QSet<QString>::fromList(addressAttribute().cc()));
-
- QStringList attendeesAutoTo, attendeesAutoCc;
- foreach (const KCalCore::Attendee::Ptr & attendee, mUpdate) {
- if (attendeesTo.contains(attendee->email())) {
- attendeesAutoTo.append(attendee->fullName());
- }
- if (attendeesCc.contains(attendee->email())) {
- attendeesAutoCc.append(attendee->fullName());
- }
- }
- if (!attendeesAutoTo.isEmpty() || !attendeesAutoCc.isEmpty() || !addressAttribute().bcc().isEmpty()) {
- startQueueJob(attendeesAutoTo, attendeesAutoCc);
- }
-
- QStringList attendeesComposerTo, attendeesComposerCc;
- foreach (const KCalCore::Attendee::Ptr & attendee, mEdit) {
- if (attendeesTo.contains(attendee->email())) {
- attendeesComposerTo.append(attendee->fullName());
- }
- if (attendeesCc.contains(attendee->email())) {
- attendeesComposerCc.append(attendee->fullName());
- }
- }
- if (!attendeesComposerTo.isEmpty() || !attendeesComposerCc.isEmpty()) {
- startComposerJob(attendeesComposerTo, attendeesComposerCc);
- }
-
- // No subjob has been started
- if (!mQueueJob && !mComposerJob) {
- emitResult();
- }
-}
-
-void IndividualMessageQueueJob::startQueueJob(const QStringList &to, const QStringList &cc)
-{
- KMime::Message::Ptr msg(message());
- msg->to()->fromUnicodeString(to.join(QLatin1String(", ")), "utf-8");
- msg->cc()->fromUnicodeString(cc.join(QLatin1String(", ")), "utf-8");
- msg->assemble();
-
- mQueueJob->setMessage(msg);
- mQueueJob->transportAttribute().setTransportId(transportAttribute().transportId());
- mQueueJob->sentBehaviourAttribute().setSentBehaviour(sentBehaviourAttribute().sentBehaviour());
- mQueueJob->addressAttribute().setFrom(addressAttribute().from());
- mQueueJob->addressAttribute().setTo(to);
- mQueueJob->addressAttribute().setCc(cc);
- mQueueJob->addressAttribute().setBcc(addressAttribute().bcc());
-
- mQueueJob = new MailTransport::MessageQueueJob(this);
- connect(mQueueJob, SIGNAL(finished(KJob*)), SLOT(handleJobFinished(KJob*)));
- mQueueJob->start();
-}
-
-void IndividualMessageQueueJob::startComposerJob(const QStringList &to, const QStringList &cc)
-{
- mComposerJob = new OpenComposerJob(this, to.join(QLatin1String(", ")), cc.join(QLatin1String(", ")), QString(), message(), mIdentity);
- connect(mComposerJob, SIGNAL(finished(KJob*)), SLOT(handleJobFinished(KJob*)));
- mComposerJob->start();
-}
-
-void IndividualMessageQueueJob::handleJobFinished(KJob *job)
-{
- if (job->error()) {
- if (job == mQueueJob && mComposerJob) {
- mComposerJob->kill();
- mComposerJob = 0;
- } else if (mComposerJob) {
- mQueueJob->kill();
- mQueueJob = 0;
- }
- setError(job->error());
- setErrorText(job->errorString());
- emitResult();
- return;
- }
- if (job == mQueueJob) {
- if (!mComposerJob) {
- emitResult();
- }
- mQueueJob = 0;
- } else {
- if (!mQueueJob) {
- emitResult();
- }
- mComposerJob = 0;
- }
-
-}
-
-// IndividualMailAskDelegator
-
-IndividualMailITIPHandlerDialogDelegate::IndividualMailITIPHandlerDialogDelegate(const KCalCore::Incidence::Ptr &incidence,
- KCalCore::iTIPMethod method, QWidget *parent)
- : Akonadi::ITIPHandlerDialogDelegate(incidence, method, parent)
-{
-}
-
-void IndividualMailITIPHandlerDialogDelegate::openDialog(const QString &question, const KCalCore::Attendee::List &attendees,
- Action action,
- const KGuiItem &buttonYes, const KGuiItem &buttonNo)
-{
- switch (action) {
- case ActionSendMessage:
- emit setUpdate(mIncidence, attendees);
- emit dialogClosed(KMessageBox::Yes, mMethod, mIncidence);
- break;
- case ActionDontSendMessage:
- emit dialogClosed(KMessageBox::No, mMethod, mIncidence);
- break;
- default:
- mDialog = new IndividualMailDialog(question, attendees, buttonYes, buttonNo, mParent);
- connect(mDialog, SIGNAL(finished(int)), SLOT(onDialogClosed(int)));
- mDialog->show();
- break;
- }
-}
-
-void IndividualMailITIPHandlerDialogDelegate::openDialogIncidenceCreated(Recipient recipient,
- const QString &question,
- Action action,
- const KGuiItem &buttonYes, const KGuiItem &buttonNo)
-{
- if (recipient == Attendees) {
- openDialog(question, mIncidence->attendees(), action, buttonYes, buttonNo);
- } else {
- KCalCore::Attendee::Ptr organizer(new KCalCore::Attendee(mIncidence->organizer()->name(), mIncidence->organizer()->email()));
- openDialog(question, KCalCore::Attendee::List() << organizer, action, buttonYes, buttonNo);
- }
-}
-
-void IndividualMailITIPHandlerDialogDelegate::openDialogIncidenceModified(bool attendeeStatusChanged,
- Recipient recipient,
- const QString &question,
- Action action,
- const KGuiItem &buttonYes, const KGuiItem &buttonNo)
-{
- Q_UNUSED(attendeeStatusChanged);
- if (recipient == Attendees) {
- openDialog(question, mIncidence->attendees(), action, buttonYes, buttonNo);
- } else {
- KCalCore::Attendee::Ptr organizer(new KCalCore::Attendee(mIncidence->organizer()->name(), mIncidence->organizer()->email()));
- openDialog(question, KCalCore::Attendee::List() << organizer, action, buttonYes, buttonNo);
- }
-}
-
-void IndividualMailITIPHandlerDialogDelegate::openDialogIncidenceDeleted(Recipient recipient,
- const QString &question,
- Action action,
- const KGuiItem &buttonYes, const KGuiItem &buttonNo)
-{
- if (recipient == Attendees) {
- openDialog(question, mIncidence->attendees(), action, buttonYes, buttonNo);
- } else {
- KCalCore::Attendee::Ptr organizer(new KCalCore::Attendee(mIncidence->organizer()->name(), mIncidence->organizer()->email()));
- openDialog(question, KCalCore::Attendee::List() << organizer, action, buttonYes, buttonNo);
- }
-}
-
-void IndividualMailITIPHandlerDialogDelegate::onDialogClosed(int result)
-{
- if (result == KDialog::Yes) {
- emit setEdit(mIncidence, mDialog->editAttendees());
- emit setUpdate(mIncidence, mDialog->updateAttendees());
- emit dialogClosed(KMessageBox::Yes, mMethod, mIncidence);
- } else {
- emit dialogClosed(KMessageBox::No, mMethod, mIncidence);
- }
-}
-
-// IndividualMailJobFactory
-IndividualMailComponentFactory::IndividualMailComponentFactory(QObject *parent)
- : Akonadi::ITIPHandlerComponentFactory(parent)
-{
-
-}
-
-MailTransport::MessageQueueJob *IndividualMailComponentFactory::createMessageQueueJob(const KCalCore::IncidenceBase::Ptr &incidence,
- const KPIMIdentities::Identity &identity, QObject *parent)
-{
- return new IndividualMessageQueueJob(identity, mUpdate.take(incidence->uid()), mEdit.take(incidence->uid()), parent);
-}
-
-Akonadi::ITIPHandlerDialogDelegate *IndividualMailComponentFactory::createITIPHanderDialogDelegate(const KCalCore::Incidence::Ptr &incidence,
- KCalCore::iTIPMethod method, QWidget *parent)
-{
- IndividualMailITIPHandlerDialogDelegate *askDelegator = new IndividualMailITIPHandlerDialogDelegate(incidence, method, parent);
- connect(askDelegator, SIGNAL(setEdit(KCalCore::Incidence::Ptr,KCalCore::Attendee::List)),
- SLOT(onSetEdit(KCalCore::Incidence::Ptr,KCalCore::Attendee::List)));
- connect(askDelegator, SIGNAL(setUpdate(KCalCore::Incidence::Ptr,KCalCore::Attendee::List)),
- SLOT(onSetUpdate(KCalCore::Incidence::Ptr,KCalCore::Attendee::List)));
-
- return askDelegator;
-}
-
-void IndividualMailComponentFactory::onSetEdit(const KCalCore::Incidence::Ptr &incidence, const KCalCore::Attendee::List &edit)
-{
- mEdit[incidence->uid()] = edit;
-}
-
-void IndividualMailComponentFactory::onSetUpdate(const KCalCore::Incidence::Ptr &incidence, const KCalCore::Attendee::List &update)
-{
- mUpdate[incidence->uid()] = update;
-}
diff --git a/incidenceeditor-ng/individualmailcomponentfactory.h b/incidenceeditor-ng/individualmailcomponentfactory.h
deleted file mode 100644
index 9dc3657..0000000
--- a/incidenceeditor-ng/individualmailcomponentfactory.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- Copyright (c) 2014 Sandro Knauà <knauss at kolabsys.com>
-
- This library is free software; you can redistribute it and/or modify it
- under the terms of the GNU Library General Public License as published by
- the Free Software Foundation; either version 2 of the License, or (at your
- option) any later version.
-
- This library is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
- License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to the
- Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301, USA.
-*/
-
-#ifndef INCIDENCEEDITOR_INDUVIDUALMAILJOBFACTORY_H
-#define INCIDENCEEDITOR_INDUVIDUALMAILJOBFACTORY_H
-
-#include "incidenceeditors-ng_export.h"
-
-#include "opencomposerjob.h"
-
-#include <mailtransport/messagequeuejob.h>
-#include <Akonadi/Calendar/IncidenceChanger>
-#include <KPIMIdentities/Identity>
-
-namespace IncidenceEditorNG {
-
-class IndividualMailDialog;
-
-class IndividualMessageQueueJob : public MailTransport::MessageQueueJob
-{
- Q_OBJECT
-public:
- explicit IndividualMessageQueueJob(const KPIMIdentities::Identity &identity, const KCalCore::Attendee::List &update, const KCalCore::Attendee::List &edit, QObject *parent);
-
- virtual void start();
-private slots:
- void startQueueJob(const QStringList &to, const QStringList &cc);
- void startComposerJob(const QStringList &to, const QStringList &cc);
- void handleJobFinished(KJob *job);
-
-private:
- KCalCore::Attendee::List mUpdate;
- KCalCore::Attendee::List mEdit;
- KPIMIdentities::Identity mIdentity;
- MailTransport::MessageQueueJob *mQueueJob;
- OpenComposerJob *mComposerJob;
-};
-
-class IndividualMailITIPHandlerDialogDelegate : public Akonadi::ITIPHandlerDialogDelegate
-{
- Q_OBJECT
-public:
-
- explicit IndividualMailITIPHandlerDialogDelegate(const KCalCore::Incidence::Ptr &incidence, KCalCore::iTIPMethod method, QWidget *parent);
-
- virtual void openDialogIncidenceCreated(Recipient recipient,
- const QString &question,
- Action action = ActionAsk,
- const KGuiItem &buttonYes = KGuiItem(i18nc("@action:button dialog positive answer", "Send Email")),
- const KGuiItem &buttonNo = KGuiItem(i18nc("@action:button dialog negative answer", "Do Not Send")));
-
- virtual void openDialogIncidenceModified(bool attendeeStatusChanged,
- Recipient recipient,
- const QString &question,
- Action action = ActionAsk,
- const KGuiItem &buttonYes = KGuiItem(i18nc("@action:button dialog positive answer", "Send Email")),
- const KGuiItem &buttonNo = KGuiItem(i18nc("@action:button dialog negative answer", "Do Not Send")));
-
- virtual void openDialogIncidenceDeleted(Recipient recipient,
- const QString &question,
- Action action = ActionAsk,
- const KGuiItem &buttonYes = KGuiItem(i18nc("@action:button dialog positive answer", "Send Email")),
- const KGuiItem &buttonNo = KGuiItem(i18nc("@action:button dialog negative answer", "Do Not Send")));
-
-signals:
- void setEdit(const KCalCore::Incidence::Ptr &incidence, const KCalCore::Attendee::List &edit);
- void setUpdate(const KCalCore::Incidence::Ptr &incidence, const KCalCore::Attendee::List &update);
-
-protected:
- void openDialog(const QString &question, const KCalCore::Attendee::List &attendees,
- Action action,
- const KGuiItem &buttonYes, const KGuiItem &buttonNo);
-
-private slots:
- void onDialogClosed(int result);
-private:
- IndividualMailDialog *mDialog;
-};
-
-class INCIDENCEEDITORS_NG_EXPORT IndividualMailComponentFactory : public Akonadi::ITIPHandlerComponentFactory
-{
- Q_OBJECT
-public:
- explicit IndividualMailComponentFactory(QObject *parent = 0);
- virtual MailTransport::MessageQueueJob *createMessageQueueJob(const KCalCore::IncidenceBase::Ptr &incidence,
- const KPIMIdentities::Identity &identity, QObject *parent);
-
- virtual Akonadi::ITIPHandlerDialogDelegate *createITIPHanderDialogDelegate(const KCalCore::Incidence::Ptr &incidence,
- KCalCore::iTIPMethod method, QWidget *parent);
-
-public slots:
- void onSetEdit(const KCalCore::Incidence::Ptr &incidence, const KCalCore::Attendee::List &edit);
- void onSetUpdate(const KCalCore::Incidence::Ptr &incidence, const KCalCore::Attendee::List &update);
-
-private:
- QHash<QString, KCalCore::Attendee::List> mEdit;
- QHash<QString, KCalCore::Attendee::List> mUpdate;
-};
-
-}
-#endif
diff --git a/incidenceeditor-ng/individualmaildialog.cpp b/incidenceeditor-ng/individualmaildialog.cpp
deleted file mode 100644
index 322d95c..0000000
--- a/incidenceeditor-ng/individualmaildialog.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- Copyright (c) 2014 Sandro Knauà <knauss at kolabsys.com>
-
- This library is free software; you can redistribute it and/or modify it
- under the terms of the GNU Library General Public License as published by
- the Free Software Foundation; either version 2 of the License, or (at your
- option) any later version.
-
- This library is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
- License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to the
- Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301, USA.
-*/
-
-#include "individualmaildialog.h"
-
-#include <KLocalizedString>
-#include <KDebug>
-
-#include <QGridLayout>
-#include <QComboBox>
-#include <QLabel>
-
-using namespace IncidenceEditorNG;
-
-IndividualMailDialog::IndividualMailDialog(const QString &question, const KCalCore::Attendee::List &attendees,
- const KGuiItem &buttonYes, const KGuiItem &buttonNo, QWidget *parent)
- : KDialog(parent)
-{
- setCaption(i18nc("@title:window", "Group Scheduling Email"));
- setButtons(KDialog::Yes | KDialog::No | KDialog::Details);
- setButtonText(KDialog::Details, i18nc("@action:button show list of attendees", "Individual mailsettings"));
- setButtonGuiItem(KDialog::Yes, buttonYes);
- setButtonGuiItem(KDialog::No, buttonNo);
-
- QWidget *widget = new QWidget();
- QGridLayout *layout = new QGridLayout(widget);
- int row = 0;
- foreach (const KCalCore::Attendee::Ptr & attendee, attendees) {
- QComboBox *options = new QComboBox();
- options->addItem(i18nc("@item:inlistbox ITIP Messages for one attendee", "Send update"), QVariant(Update));
- options->addItem(i18nc("@item:inlistbox ITIP Messages for one attendee", "Send no update"), QVariant(NoUpdate));
- options->addItem(i18nc("@item:inlistbox ITIP Messages for one attendee", "Edit mail"), QVariant(Edit));
- mAttendeeDecision[attendee] = options;
-
- layout->addWidget(new QLabel(attendee->fullName()), row, 0);
- layout->addWidget(options, row, 1);
- ++row;
- }
- widget->sizePolicy().setHorizontalStretch(1);
- widget->sizePolicy().setVerticalStretch(1);
-
- QWidget *mW = new QLabel(question);
-
- setMainWidget(mW);
- setDetailsWidget(widget);
-}
-
-IndividualMailDialog::~IndividualMailDialog()
-{
-
-}
-
-KCalCore::Attendee::List IndividualMailDialog::editAttendees() const
-{
- KCalCore::Attendee::List edit;
- QList<KCalCore::Attendee::Ptr> attendees = mAttendeeDecision.keys();
- foreach (const KCalCore::Attendee::Ptr & attendee, attendees) {
- int index = mAttendeeDecision[attendee]->currentIndex();
- if (mAttendeeDecision[attendee]->itemData(index, Qt::UserRole) == Edit) {
- edit.append(attendee);
- }
- }
- return edit;
-}
-
-KCalCore::Attendee::List IndividualMailDialog::updateAttendees() const
-{
- KCalCore::Attendee::List update;
- QList<KCalCore::Attendee::Ptr> attendees = mAttendeeDecision.keys();
- foreach (const KCalCore::Attendee::Ptr & attendee, attendees) {
- int index = mAttendeeDecision[attendee]->currentIndex();
- if (mAttendeeDecision[attendee]->itemData(index, Qt::UserRole) == Update) {
- update.append(attendee);
- }
- }
- return update;
-}
diff --git a/incidenceeditor-ng/individualmaildialog.h b/incidenceeditor-ng/individualmaildialog.h
deleted file mode 100644
index 3c3331b..0000000
--- a/incidenceeditor-ng/individualmaildialog.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- Copyright (c) 2014 Sandro Knauà <knauss at kolabsys.com>
-
- This library is free software; you can redistribute it and/or modify it
- under the terms of the GNU Library General Public License as published by
- the Free Software Foundation; either version 2 of the License, or (at your
- option) any later version.
-
- This library is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
- License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to the
- Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301, USA.
-*/
-
-#ifndef INCIDENCEEDITOR_INDIVIDUALMAILDIALOG_H
-#define INCIDENCEEDITOR_INDIVIDUALMAILDIALOG_H
-
-#include <kcalcore/attendee.h>
-#include <KDialog>
-
-#include <QComboBox>
-
-class TestIndividualMailDialog;
-
-namespace IncidenceEditorNG {
-
-// Shows a dialog with a question and the option to select which attendee should get the mail or to open a composer for him.
-// Used to get individual mails for attendees of an event.
-class IndividualMailDialog : public KDialog
-{
- Q_OBJECT
- friend TestIndividualMailDialog;
-public:
- enum Decisions {
- Update, /**< send automatic mail to attendee */
- NoUpdate, /**< do not send mail to attendee */
- Edit /**< open composer for attendee */
- };
- explicit IndividualMailDialog(const QString &question, const KCalCore::Attendee::List &attendees,
- const KGuiItem &buttonYes, const KGuiItem &buttonNo, QWidget *parent = 0);
- virtual ~IndividualMailDialog();
-
- KCalCore::Attendee::List editAttendees() const;
- KCalCore::Attendee::List updateAttendees() const;
-
-private:
- QHash<KCalCore::Attendee::Ptr, QComboBox *> mAttendeeDecision;
-};
-
-}
-
-#endif
diff --git a/incidenceeditor-ng/opencomposerjob.cpp b/incidenceeditor-ng/opencomposerjob.cpp
deleted file mode 100644
index 052449a..0000000
--- a/incidenceeditor-ng/opencomposerjob.cpp
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Copyright (c) 2014 Sandro Knauà <knauss at kolabsys.com>
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-#include "opencomposerjob.h"
-
-#include <QtCore/QObject>
-#include <QtDBus/QtDBus>
-#include <QtCore/QProcess>
-
-#include <klocalizedstring.h>
-#include <kdbusservicestarter.h>
-
-using namespace IncidenceEditorNG;
-
-OpenComposerJob::OpenComposerJob(QObject *parent,
- const QString &to, const QString &cc, const QString &bcc,
- const KMime::Message::Ptr &message, const KPIMIdentities::Identity &identity)
- : KJob(parent)
- , mTo(to)
- , mCc(cc)
- , mBcc(bcc)
- , mMessage(message)
- , mIdentity(identity)
- , mSuccess(false)
-{
- connect(QDBusConnection::sessionBus().interface(), SIGNAL(serviceOwnerChanged(QString,QString,QString)),
- SLOT(slotServiceOwnerChanged(QString,QString,QString)));
-}
-
-OpenComposerJob::~OpenComposerJob()
-{
-
-}
-
-void OpenComposerJob::start()
-{
- mSuccess = false;
- if (QDBusConnection::sessionBus().interface()->isServiceRegistered(QLatin1String("org.kde.kmail"))) {
- processMail();
- }
- //Check if Kontact is already running and if not ...
- int result = KDBusServiceStarter::self()->findServiceFor(QLatin1String("DBUS/Mailer"), QString(),
- &mError, &mDBusService);
- if (result != 0) {
- // ... start Kontact
- result = KDBusServiceStarter::self()->startServiceFor(QLatin1String("DBUS/Mailer"), QString(),
- &mError, &mDBusService);
- if (result != 0) {
- const bool ok = QProcess::startDetached(QLatin1String("kontact"));
- if (!ok) {
- setError(KJob::UserDefinedError);
- setErrorText(i18nc("errormessage: can't get connection via dbus", "Don't get kmail started"));
- emitResult();
- return;
- }
- } else {
- setError(KJob::UserDefinedError);
- setErrorText(i18nc("errormessage: can't get connection via dbus", "Don't get kmail started"));
- emitResult();
- return;
- }
- }
-
- QTimer::singleShot(10000, this, SLOT(timeout()));
-}
-
-void OpenComposerJob::timeout()
-{
- if (!mSuccess) {
- setError(KJob::UserDefinedError);
- setErrorText(i18nc("errormessage: can't get connection via dbus", "Don't get kmail started"));
- emitResult();
- }
-}
-
-void OpenComposerJob::slotServiceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner)
-{
- Q_UNUSED(oldOwner);
- if (name == QLatin1String("org.kde.kmail") && !newOwner.isEmpty()) {
- processMail();
- }
-}
-
-void OpenComposerJob::processMail()
-{
- Q_ASSERT(mMessage);
- mSuccess = true;
-
- bool hidden = false;
- unsigned int identity = mIdentity.uoid();
-
- QString subject = mMessage->subject()->asUnicodeString();
- QString body = QString::fromUtf8(mMessage->contents()[0]->body());
-
- QList<QVariant> messages;
-
- if (mMessage->contents().count() == 1) {
- const QString messageFile;
- const QStringList attachmentPaths;
- const QStringList customHeaders;
- const QString replyTo;
- const QString inReplyTo;
-
- messages << mTo << mCc << mBcc << subject << body << hidden
- << messageFile << attachmentPaths << customHeaders << replyTo << inReplyTo;
- } else {
- KMime::Content *attachment(mMessage->contents().at(1));
- QString attachName = attachment->contentType()->name();
- QByteArray attachCte = attachment->contentTransferEncoding()->as7BitString(false);
- QByteArray attachType = attachment->contentType()->mediaType();
- QByteArray attachSubType = attachment->contentType()->subType();
- QByteArray attachContDisp = attachment->contentDisposition()->as7BitString(false);
- QByteArray attachCharset = attachment->contentType()->charset();
-
- QByteArray attachParamAttr = "method";
- QString attachParamValue = attachment->contentType()->parameter(QLatin1String("method"));
- QByteArray attachData = attachment->encodedBody();
-
- messages << mTo << mCc << mBcc << subject << body << hidden
- << attachName << attachCte << attachData << attachType << attachSubType
- << attachParamAttr << attachParamValue << attachContDisp << attachCharset
- << identity << false;
- }
- QDBusInterface kmailObj(QLatin1String("org.kde.kmail"), QLatin1String("/KMail"), QLatin1String("org.kde.kmail.kmail"));
-
- QDBusReply<int> composerDbusPath = kmailObj.callWithArgumentList(QDBus::AutoDetect, QLatin1String("openComposer"), messages);
-
- if (!composerDbusPath.isValid()) {
- setError(KJob::UserDefinedError);
- setErrorText(i18nc( "errormessage: dbus is running but still no connection kmail", "Cannot connect to email service"));
- }
- emitResult();
-
-}
diff --git a/incidenceeditor-ng/opencomposerjob.h b/incidenceeditor-ng/opencomposerjob.h
deleted file mode 100644
index acb43cc..0000000
--- a/incidenceeditor-ng/opencomposerjob.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2014 Sandro Knauà <knauss at kolabsys.com>
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-#ifndef INCIDENCEEDITOR_OPENCOMPOSERJOB_H
-#define INCIDENCEEDITOR_OPENCOMPOSERJOB_H
-
-#include <KPIMIdentities/Identity>
-#include <kmime/kmime_message.h>
-
-#include <KJob>
-namespace IncidenceEditorNG {
-
-// Opens a Composer with a mail with one attachment (costructed my ITIPHandler)
-class OpenComposerJob : public KJob
-{
- Q_OBJECT
-
-public:
- explicit OpenComposerJob(QObject *parent,
- const QString &to, const QString &cc, const QString &bcc,
- const KMime::Message::Ptr &message, const KPIMIdentities::Identity &identity);
- virtual ~OpenComposerJob();
-
- virtual void start();
-
-private slots:
- void slotServiceOwnerChanged(const QString &, const QString &, const QString &);
- void timeout();
- void processMail();
-
-private:
- QString mDBusService;
- QString mError;
- QString mTo, mCc, mBcc;
- KMime::Message::Ptr mMessage;
- KPIMIdentities::Identity mIdentity;
- bool mSuccess;
-};
-
-}
-#endif
diff --git a/incidenceeditor-ng/tests/CMakeLists.txt b/incidenceeditor-ng/tests/CMakeLists.txt
index e248660..73522a6 100644
--- a/incidenceeditor-ng/tests/CMakeLists.txt
+++ b/incidenceeditor-ng/tests/CMakeLists.txt
@@ -40,16 +40,6 @@ target_link_libraries(
incidenceeditorsng
)
-kde4_add_executable(testindividualmaildialog NOGUI TEST testindividualmaildialog.cpp ../individualmaildialog.cpp)
-target_link_libraries(testindividualmaildialog
- ${KDEPIMLIBS_KCALCORE_LIBS}
- ${QT_QTTEST_LIBRARY}
- ${QT_QTCORE_LIBRARY}
- ${QT_QTGUI_LIBRARY}
- ${KDE4_KDECORE_LIBS}
- ${KDE4_KDEUI_LIBS}
- )
-
set(resourcemanagement_gui_SRCS resourcemanagment_gui.cpp)
kde4_add_executable(resourcemanagement_gui TEST ${resourcemanagement_gui_SRCS})
target_link_libraries(resourcemanagement_gui
diff --git a/incidenceeditor-ng/tests/testindividualmaildialog.cpp b/incidenceeditor-ng/tests/testindividualmaildialog.cpp
deleted file mode 100644
index 2831cb0..0000000
--- a/incidenceeditor-ng/tests/testindividualmaildialog.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-#include <QObject>
-#include <qtest_kde.h>
-
-#include "individualmaildialog.h"
-
-using namespace IncidenceEditorNG;
-
-class TestIndividualMailDialog : public QObject
-{
- Q_OBJECT
-private slots:
- void testDialog() {
- KCalCore::Attendee::List attendees;
- KGuiItem buttonYes = KGuiItem(QLatin1String("Send Email"));
- KGuiItem buttonNo = KGuiItem(QLatin1String("Do not send"));
-
- KCalCore::Attendee::Ptr attendee1(new KCalCore::Attendee(QLatin1String("test1"), QLatin1String("test1 at example.com")));
- KCalCore::Attendee::Ptr attendee2(new KCalCore::Attendee(QLatin1String("test2"), QLatin1String("test2 at example.com")));
- KCalCore::Attendee::Ptr attendee3(new KCalCore::Attendee(QLatin1String("test3"), QLatin1String("test3 at example.com")));
-
- attendees << attendee1 << attendee2 << attendee3;
-
- IndividualMailDialog dialog(QLatin1String("title"), attendees, buttonYes, buttonNo, 0);
-
- QCOMPARE(dialog.editAttendees().count(), 0);
- QCOMPARE(dialog.updateAttendees().count(), 3);
-
- // Just make sure, that the QCombobox is sorted like we think
- QComboBox *first = dialog.mAttendeeDecision[attendees[0]];
- QCOMPARE((IndividualMailDialog::Decisions)first->itemData(0, Qt::UserRole).toInt(), IndividualMailDialog::Update);
- QCOMPARE((IndividualMailDialog::Decisions)first->itemData(1, Qt::UserRole).toInt(), IndividualMailDialog::NoUpdate);
- QCOMPARE((IndividualMailDialog::Decisions)first->itemData(2, Qt::UserRole).toInt(), IndividualMailDialog::Edit);
-
- // No update for first attendee, other default
- first->setCurrentIndex(1);
- QCOMPARE(dialog.editAttendees().count(), 0);
- QCOMPARE(dialog.updateAttendees().count(), 2);
- QVERIFY(dialog.updateAttendees().contains(attendee2));
- QVERIFY(dialog.updateAttendees().contains(attendee3));
-
- // edit for frist attende, other default
- first->setCurrentIndex(2);
- QCOMPARE(dialog.editAttendees().count(), 1);
- QCOMPARE(dialog.updateAttendees().count(), 2);
- QCOMPARE(dialog.editAttendees()[0], attendee1);
- }
- };
-
-QTEST_KDEMAIN( TestIndividualMailDialog, GUI )
-
-#include "testindividualmaildialog.moc"
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 5d620f5..ba838f1 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -64,7 +64,6 @@
#include <incidenceeditor-ng/incidencedefaults.h>
#include <incidenceeditor-ng/incidencedialog.h>
#include <incidenceeditor-ng/incidencedialogfactory.h>
-#include <incidenceeditor-ng/individualmailcomponentfactory.h>
#include <libkdepim/widgets/pimmessagebox.h>
#include <akonadi/calendar/freebusymanager.h>
@@ -107,7 +106,7 @@ CalendarView::CalendarView( QWidget *parent ) : CalendarViewBase( parent ),
mETMCollectionView( 0 )
{
Akonadi::Control::widgetNeedsAkonadi( this );
- mChanger = new Akonadi::IncidenceChanger( new IncidenceEditorNG::IndividualMailComponentFactory( this ), this );
+ mChanger = new Akonadi::IncidenceChanger( this );
mChanger->setDefaultCollection( Akonadi::Collection( CalendarSupport::KCalPrefs::instance()->defaultCalendarId() ) );
mChanger->setDestinationPolicy( static_cast<Akonadi::IncidenceChanger::DestinationPolicy>( KOPrefs::instance()->destination() ) );
commit 7e19a27223226dc8c53e343b673bd6b899e74dac
Author: Sandro Knauà <knauss at kolabsys.com>
Date: Tue Jul 22 17:30:48 2014 +0200
Add paramenter to ensure the composer to open
REVIEW: 119461
diff --git a/kmail/kmkernel.cpp b/kmail/kmkernel.cpp
index 5e2ffaf..b4d7dc5 100644
--- a/kmail/kmkernel.cpp
+++ b/kmail/kmkernel.cpp
@@ -643,6 +643,28 @@ int KMKernel::openComposer(const QString &to, const QString &cc,
return 1;
}
+int KMKernel::openComposer(const QString &to, const QString &cc,
+ const QString &bcc, const QString &subject,
+ const QString &body, bool hidden,
+ const QString &attachName,
+ const QByteArray &attachCte,
+ const QByteArray &attachData,
+ const QByteArray &attachType,
+ const QByteArray &attachSubType,
+ const QByteArray &attachParamAttr,
+ const QString &attachParamValue,
+ const QByteArray &attachContDisp,
+ const QByteArray &attachCharset,
+ unsigned int identity)
+{
+ return openComposer(to, cc, bcc,
+ subject, body, hidden,
+ attachName, attachCte, attachData,
+ attachType, attachSubType, attachParamAttr, attachParamValue,
+ attachContDisp, attachCharset, identity, true);
+}
+
+
int KMKernel::openComposer (const QString &to, const QString &cc,
const QString &bcc, const QString &subject,
const QString &body, bool hidden,
@@ -655,7 +677,8 @@ int KMKernel::openComposer (const QString &to, const QString &cc,
const QString &attachParamValue,
const QByteArray &attachContDisp,
const QByteArray &attachCharset,
- unsigned int identity )
+ unsigned int identity,
+ bool allowDefaultSend)
{
kDebug();
KMail::Composer::TemplateContext context = KMail::Composer::New;
@@ -740,7 +763,7 @@ int KMKernel::openComposer (const QString &to, const QString &cc,
cWin->disableForgottenAttachmentsCheck();
}
- if ( !hidden && !iCalAutoSend ) {
+ if ( !hidden && !(allowDefaultSend && iCalAutoSend) ) {
cWin->show();
// Activate window - doing this instead of KWin::activateWindow(cWin->winId());
// so that it also works when called from KMailApplication::newInstance()
diff --git a/kmail/kmkernel.h b/kmail/kmkernel.h
index a9b39fd..bf3f549 100644
--- a/kmail/kmkernel.h
+++ b/kmail/kmkernel.h
@@ -236,6 +236,51 @@ public Q_SLOTS:
/**
* Opens a composer window and prefills it with different
* message parts.
+ * @since 5.0
+ *
+ * @returns The id of composer if more are opened.
+ *
+ * @param to A comma separated list of To addresses.
+ * @param cc A comma separated list of CC addresses.
+ * @param bcc A comma separated list of BCC addresses.
+ * @param subject The message subject.
+ * @param body The message body.
+ * @param hidden Whether the composer window shall initially be hidden.
+ * @param attachName The name of the attachment.
+ * @param attachCte The content transfer encoding of the attachment.
+ * @param attachData The raw data of the attachment.
+ * @param attachType The mime type of the attachment.
+ * @param attachSubType The sub mime type of the attachment.
+ * @param attachParamAttr The parameter attribute of the attachment.
+ * @param attachParamValue The parameter value of the attachment.
+ * @param attachContDisp The content display type of the attachment.
+ * @param attachCharset The charset of the attachment.
+ * @param identity The identity identifier which will be used as sender identity.
+ * @param allowDefaultSend Overwrite automatic sending feature,
+ * to make sure a composer is opend
+ */
+ Q_SCRIPTABLE int openComposer( const QString & to,
+ const QString & cc,
+ const QString & bcc,
+ const QString & subject,
+ const QString & body,
+ bool hidden,
+ const QString & attachName,
+ const QByteArray & attachCte,
+ const QByteArray &attachData,
+ const QByteArray & attachType,
+ const QByteArray & attachSubType,
+ const QByteArray & attachParamAttr,
+ const QString & attachParamValue,
+ const QByteArray & attachContDisp,
+ const QByteArray & attachCharset,
+ unsigned int identity,
+ bool allowDefaultSend );
+
+
+ /**
+ * Opens a composer window and prefills it with different
+ * message parts.
*
* @returns The DBus object path for the composer.
*
commit 4395738ee3c9a680dc4a177ed0b5dd0c90c1d09f
Author: Sandro Knauà <knauss at kolabsys.com>
Date: Sat Aug 16 16:08:00 2014 +0200
Revert "Add paramenter to ensure the composer to open"
This reverts commit 09cc03e9adfccbac2b42706a9f8ab6bd59eac954.
diff --git a/kmail/kmkernel.cpp b/kmail/kmkernel.cpp
index 91fa37b..5e2ffaf 100644
--- a/kmail/kmkernel.cpp
+++ b/kmail/kmkernel.cpp
@@ -643,28 +643,6 @@ int KMKernel::openComposer(const QString &to, const QString &cc,
return 1;
}
-int KMKernel::openComposer(const QString &to, const QString &cc,
- const QString &bcc, const QString &subject,
- const QString &body, bool hidden,
- const QString &attachName,
- const QByteArray &attachCte,
- const QByteArray &attachData,
- const QByteArray &attachType,
- const QByteArray &attachSubType,
- const QByteArray &attachParamAttr,
- const QString &attachParamValue,
- const QByteArray &attachContDisp,
- const QByteArray &attachCharset,
- unsigned int identity)
-{
- return openComposer(to, cc, bcc,
- subject, body, hidden,
- attachName, attachCte, attachData,
- attachType, attachSubType, attachParamAttr, attachParamValue,
- attachContDisp, attachCharset, identity, true);
-}
-
-
int KMKernel::openComposer (const QString &to, const QString &cc,
const QString &bcc, const QString &subject,
const QString &body, bool hidden,
@@ -677,9 +655,9 @@ int KMKernel::openComposer (const QString &to, const QString &cc,
const QString &attachParamValue,
const QByteArray &attachContDisp,
const QByteArray &attachCharset,
- unsigned int identity,
- bool allowDefaultSend)
+ unsigned int identity )
{
+ kDebug();
KMail::Composer::TemplateContext context = KMail::Composer::New;
KMime::Message::Ptr msg( new KMime::Message );
KMime::Content *msgPart = 0;
@@ -762,7 +740,7 @@ int KMKernel::openComposer (const QString &to, const QString &cc,
cWin->disableForgottenAttachmentsCheck();
}
- if ( !hidden && !(allowDefaultSend && iCalAutoSend) ) {
+ if ( !hidden && !iCalAutoSend ) {
cWin->show();
// Activate window - doing this instead of KWin::activateWindow(cWin->winId());
// so that it also works when called from KMailApplication::newInstance()
diff --git a/kmail/kmkernel.h b/kmail/kmkernel.h
index ecbf0ee..a9b39fd 100644
--- a/kmail/kmkernel.h
+++ b/kmail/kmkernel.h
@@ -236,51 +236,6 @@ public Q_SLOTS:
/**
* Opens a composer window and prefills it with different
* message parts.
- * @since 4.70.0
- *
- * @returns The id of composer if more are opened.
- *
- * @param to A comma separated list of To addresses.
- * @param cc A comma separated list of CC addresses.
- * @param bcc A comma separated list of BCC addresses.
- * @param subject The message subject.
- * @param body The message body.
- * @param hidden Whether the composer window shall initially be hidden.
- * @param attachName The name of the attachment.
- * @param attachCte The content transfer encoding of the attachment.
- * @param attachData The raw data of the attachment.
- * @param attachType The mime type of the attachment.
- * @param attachSubType The sub mime type of the attachment.
- * @param attachParamAttr The parameter attribute of the attachment.
- * @param attachParamValue The parameter value of the attachment.
- * @param attachContDisp The content display type of the attachment.
- * @param attachCharset The charset of the attachment.
- * @param identity The identity identifier which will be used as sender identity.
- * @param allowDefaultSend Overwrite automatic sending feature,
- * to make sure a composer is opend
- */
- Q_SCRIPTABLE int openComposer( const QString & to,
- const QString & cc,
- const QString & bcc,
- const QString & subject,
- const QString & body,
- bool hidden,
- const QString & attachName,
- const QByteArray & attachCte,
- const QByteArray &attachData,
- const QByteArray & attachType,
- const QByteArray & attachSubType,
- const QByteArray & attachParamAttr,
- const QString & attachParamValue,
- const QByteArray & attachContDisp,
- const QByteArray & attachCharset,
- unsigned int identity,
- bool allowDefaultSend );
-
-
- /**
- * Opens a composer window and prefills it with different
- * message parts.
*
* @returns The DBus object path for the composer.
*
More information about the commits
mailing list