Build with clang.
[kdepim.git] / mailcommon / mdnadvicedialog.h
blob3187a7ab009de8b55845a5e2d1c99f9001a486f4
1 /*
2 Copyright (c) 2009 Michael Leupold <lemma@confuego.org>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License along
15 with this program; if not, write to the Free Software Foundation, Inc.,
16 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #ifndef MAILCOMMON_MDNADVICEDIALOG_H
20 #define MAILCOMMON_MDNADVICEDIALOG_H
22 #include "mailcommon_export.h"
24 #include <kdialog.h>
25 #include <kmime/kmime_message.h>
26 #include <messagecomposer/messagefactory.h>
28 #include <QtCore/QString>
30 namespace MailCommon {
32 class MAILCOMMON_EXPORT MDNAdviceHelper : public QObject
34 Q_OBJECT
35 public:
36 static MDNAdviceHelper* instance() {
37 if( !s_instance )
38 s_instance = new MDNAdviceHelper;
40 return s_instance;
43 /**
44 * Checks the MDN headers to see if the user needs to be asked for any
45 * confirmations. Will ask the user if action is required.
47 * Returns whether to send an MDN or not, and the sending mode for the MDN to be created.
49 * Will also set the MessageCore::MDNStateAttribute on the given item
50 * to what the user has selected.
52 QPair< bool, KMime::MDN::SendingMode > checkAndSetMDNInfo( const Akonadi::Item &item, KMime::MDN::DispositionType d, bool forceSend = false );
54 MessageCore::MDNStateAttribute::MDNSentState dispositionToSentState( KMime::MDN::DispositionType d );
57 private:
58 MDNAdviceHelper(QObject* parent = 0) {}
59 virtual ~MDNAdviceHelper() {}
61 int requestAdviceOnMDN( const char * what );
62 MessageComposer::MDNAdvice questionIgnoreSend( const QString &text, bool canDeny );
64 static MDNAdviceHelper* s_instance;
67 class MDNAdviceDialog : public KDialog
69 Q_OBJECT
71 public:
72 MDNAdviceDialog( const QString &text, bool canDeny, QWidget *parent = 0 );
73 ~MDNAdviceDialog();
75 MessageComposer::MDNAdvice result() const;
77 private:
78 MessageComposer::MDNAdvice m_result;
80 protected:
82 // Reimplemented
83 virtual void slotButtonClicked( int button );
88 #endif