summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-11-03 20:33:52 (GMT)
committerMontel Laurent <montel@kde.org>2016-11-03 20:33:52 (GMT)
commit2ecf5b5ae66fe32c68662a0133a72b1a1222b883 (patch)
tree401cb6b55dda94ac2ddca3240b422ed42615f0a8
parent86fe837ecb2863e7c6120a651be6a07ec4da6ed7 (diff)
Start to implement reply action against encapsuled message
-rw-r--r--CMakeLists.txt2
-rw-r--r--messageviewer/src/viewer/viewer.cpp1
-rw-r--r--messageviewer/src/viewer/viewer.h6
-rw-r--r--messageviewer/src/viewer/viewer_p.cpp37
-rw-r--r--messageviewer/src/viewer/viewer_p.h3
5 files changed, 45 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index aa781d8..01205a4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,7 +18,7 @@ include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
include(ECMQtDeclareLoggingCategory)
include(ECMAddTests)
-set(PIM_VERSION "5.3.77")
+set(PIM_VERSION "5.3.78")
set(MESSAGELIB_LIB_VERSION ${PIM_VERSION})
set(AKONADIMIME_LIB_VERSION "5.3.40")
diff --git a/messageviewer/src/viewer/viewer.cpp b/messageviewer/src/viewer/viewer.cpp
index 41298ee..547abb9 100644
--- a/messageviewer/src/viewer/viewer.cpp
+++ b/messageviewer/src/viewer/viewer.cpp
@@ -76,6 +76,7 @@ void Viewer::initialize()
connect(d_ptr, &ViewerPrivate::showReader,
this, &Viewer::showReader);
connect(d_ptr, &ViewerPrivate::showMessage, this, &Viewer::showMessage);
+ connect(d_ptr, &ViewerPrivate::replyMessageTo, this, &Viewer::replyMessageTo);
connect(d_ptr, &ViewerPrivate::showStatusBarMessage,
this, &Viewer::showStatusBarMessage);
connect(d_ptr, &ViewerPrivate::itemRemoved,
diff --git a/messageviewer/src/viewer/viewer.h b/messageviewer/src/viewer/viewer.h
index 0098319..d7d33a2 100644
--- a/messageviewer/src/viewer/viewer.h
+++ b/messageviewer/src/viewer/viewer.h
@@ -136,7 +136,9 @@ public:
Delete = 7,
Edit = 8,
Copy = 9,
- ScrollTo = 10
+ ScrollTo = 10,
+ ReplyMessageToAuthor = 11,
+ ReplyMessageToAll = 12
};
enum MailAction {
@@ -359,6 +361,8 @@ Q_SIGNALS:
/// Emitted when the message should be shown in a separate window
void showMessage(const KMime::Message::Ptr &message, const QString &encoding);
+ void replyMessageTo(const KMime::Message::Ptr &message, bool replyToAll);
+
void deleteMessage(const Akonadi::Item &);
/// Emitted when the item, previously set with setMessageItem, has been removed.
diff --git a/messageviewer/src/viewer/viewer_p.cpp b/messageviewer/src/viewer/viewer_p.cpp
index 5526617..b1d7401 100644
--- a/messageviewer/src/viewer/viewer_p.cpp
+++ b/messageviewer/src/viewer/viewer_p.cpp
@@ -566,7 +566,6 @@ void ViewerPrivate::showAttachmentPopup(KMime::Content *node, const QString &nam
Q_UNUSED(name);
prepareHandleAttachment(node);
QMenu *menu = new QMenu();
- QAction *action;
bool deletedAttachment = false;
if (node->contentType(false)) {
deletedAttachment = (node->contentType()->mimeType() == "text/x-moz-deleted");
@@ -577,7 +576,7 @@ void ViewerPrivate::showAttachmentPopup(KMime::Content *node, const QString &nam
connect(attachmentMapper, SIGNAL(mapped(int)),
this, SLOT(slotHandleAttachment(int)));
- action = menu->addAction(QIcon::fromTheme(QStringLiteral("document-open")), i18nc("to open", "Open"));
+ QAction *action = menu->addAction(QIcon::fromTheme(QStringLiteral("document-open")), i18nc("to open", "Open"));
action->setEnabled(!deletedAttachment);
connect(action, SIGNAL(triggered(bool)), attachmentMapper, SLOT(map()));
attachmentMapper->setMapping(action, Viewer::Open);
@@ -636,6 +635,14 @@ void ViewerPrivate::showAttachmentPopup(KMime::Content *node, const QString &nam
connect(action, SIGNAL(triggered()), attachmentMapper, SLOT(map()));
attachmentMapper->setMapping(action, Viewer::Delete);
action->setEnabled(canChange && !deletedAttachment);
+#if 0
+ menu->addSeparator();
+
+ action = menu->addAction(QIcon::fromTheme(QStringLiteral("mail-reply-sender")), i18n("Reply To Author"));
+ connect(action, SIGNAL(triggered()), attachmentMapper, SLOT(map()));
+ attachmentMapper->setMapping(action, Viewer::ReplyMessageToAuthor);
+#endif
+ menu->addSeparator();
action = menu->addAction(i18n("Properties"));
connect(action, SIGNAL(triggered(bool)), attachmentMapper, SLOT(map()));
attachmentMapper->setMapping(action, Viewer::Properties);
@@ -2658,6 +2665,32 @@ void ViewerPrivate::slotHandleAttachment(int choice)
case Viewer::ScrollTo:
scrollToAttachment(mCurrentContent);
break;
+ case Viewer::ReplyMessageToAuthor:
+ replyMessageToAuthor(mCurrentContent);
+ break;
+ case Viewer::ReplyMessageToAll:
+ replyMessageToAll(mCurrentContent);
+ break;
+ }
+}
+
+void ViewerPrivate::replyMessageToAuthor(KMime::Content *atmNode)
+{
+ if (atmNode) {
+ const bool isEncapsulatedMessage = atmNode->parent() && atmNode->parent()->bodyIsMessage();
+ if (isEncapsulatedMessage) {
+ Q_EMIT replyMessageTo(atmNode->parent()->bodyAsMessage(), false);
+ }
+ }
+}
+
+void ViewerPrivate::replyMessageToAll(KMime::Content *atmNode)
+{
+ if (atmNode) {
+ const bool isEncapsulatedMessage = atmNode->parent() && atmNode->parent()->bodyIsMessage();
+ if (isEncapsulatedMessage) {
+ Q_EMIT replyMessageTo(atmNode->parent()->bodyAsMessage(), true);
+ }
}
}
diff --git a/messageviewer/src/viewer/viewer_p.h b/messageviewer/src/viewer/viewer_p.h
index 228645b..3dbb38f 100644
--- a/messageviewer/src/viewer/viewer_p.h
+++ b/messageviewer/src/viewer/viewer_p.h
@@ -576,6 +576,7 @@ Q_SIGNALS:
void requestConfigSync();
void showReader(KMime::Content *aMsgPart, bool aHTML, const QString &encoding);
void showMessage(const KMime::Message::Ptr &message, const QString &encoding);
+ void replyMessageTo(const KMime::Message::Ptr &message, bool replyToAll);
void itemRemoved();
void makeResourceOnline(MessageViewer::Viewer::ResourceOnlineMode mode);
@@ -591,6 +592,8 @@ private:
void addHelpTextAction(QAction *act, const QString &text);
void readGravatarConfig();
+ void replyMessageToAuthor(KMime::Content *atmNode);
+ void replyMessageToAll(KMime::Content *atmNode);
public:
MimeTreeParser::NodeHelper *mNodeHelper;
bool mHtmlMailGlobalSetting;