2
Copyright (C) 2010 Klarälvdalens Datakonsult AB,
3
a KDAB Group company, info@kdab.net,
4
author Tobias Koenig <tokoe@kdab.com>
6
This library is free software; you can redistribute it and/or modify it
7
under the terms of the GNU Library General Public License as published by
8
the Free Software Foundation; either version 2 of the License, or (at your
9
option) any later version.
11
This library is distributed in the hope that it will be useful, but WITHOUT
12
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
14
License for more details.
16
You should have received a copy of the GNU Library General Public License
17
along with this library; see the file COPYING.LIB. If not, write to the
18
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
2
Copyright (C) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.net,
3
Author Tobias Koenig <tokoe@kdab.com>
5
This library is free software; you can redistribute it and/or modify it
6
under the terms of the GNU Library General Public License as published by
7
the Free Software Foundation; either version 2 of the License, or (at your
8
option) any later version.
10
This library is distributed in the hope that it will be useful, but WITHOUT
11
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13
License for more details.
15
You should have received a copy of the GNU Library General Public License
16
along with this library; see the file COPYING.LIB. If not, write to the
17
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22
21
#include "sendmdnhandler.h"
26
25
#include "mailutil.h"
27
26
#include "mdnadvicedialog.h"
29
#include <akonadi/collection.h>
30
#include <akonadi/item.h>
31
#include <akonadi/kmime/messageflags.h>
32
28
#include <messagecomposer/messagefactory.h>
33
29
#include <messagecomposer/messagesender.h>
34
30
#include <messagecore/messagehelpers.h>
35
31
#include <messageviewer/globalsettings.h>
37
#include <QtCore/QQueue>
38
#include <QtCore/QTimer>
33
#include <Akonadi/Collection>
34
#include <Akonadi/Item>
35
#include <Akonadi/KMime/MessageFlags>
40
40
using namespace MailCommon;
64
64
// should we send an MDN?
65
65
if ( MessageViewer::GlobalSettings::notSendWhenEncrypted() &&
66
66
message()->encryptionState() != KMMsgNotEncrypted &&
67
message()->encryptionState() != KMMsgEncryptionStateUnknown )
67
message()->encryptionState() != KMMsgEncryptionStateUnknown ) {
70
71
kDebug() << "AKONADI PORT: Disabled code in " << Q_FUNC_INFO;
73
74
const Akonadi::Collection collection = item.parentCollection();
74
75
if ( collection.isValid() &&
75
(CommonKernel->folderIsSentMailFolder( collection ) ||
76
CommonKernel->folderIsTrash( collection ) ||
77
CommonKernel->folderIsDraftOrOutbox( collection ) ||
78
CommonKernel->folderIsTemplates( collection )) )
76
( CommonKernel->folderIsSentMailFolder( collection ) ||
77
CommonKernel->folderIsTrash( collection ) ||
78
CommonKernel->folderIsDraftOrOutbox( collection ) ||
79
CommonKernel->folderIsTemplates( collection ) ) ) {
81
83
const KMime::Message::Ptr message = MessageCore::Util::message( item );
85
const QPair<bool, KMime::MDN::SendingMode> mdnSend = MDNAdviceHelper::instance()->checkAndSetMDNInfo( item, KMime::MDN::Displayed );
88
const QPair<bool, KMime::MDN::SendingMode> mdnSend =
89
MDNAdviceHelper::instance()->checkAndSetMDNInfo( item, KMime::MDN::Displayed );
86
90
if ( mdnSend.first ) {
87
91
const int quote = MessageViewer::GlobalSettings::self()->quoteMessage();
90
94
factory.setIdentityManager( mKernel->identityManager() );
91
95
factory.setFolderIdentity( MailCommon::Util::folderIdentity( item ) );
93
const KMime::Message::Ptr mdn = factory.createMDN( KMime::MDN::ManualAction, KMime::MDN::Displayed, mdnSend.second, quote );
97
const KMime::Message::Ptr mdn =
98
factory.createMDN( KMime::MDN::ManualAction, KMime::MDN::Displayed, mdnSend.second, quote );
95
100
if( !mKernel->msgSender()->send( mdn ) ) {
96
101
kDebug() << "Sending failed.";