[kde-doc-english] [trojita] src/Gui: GUI: enable/disable the reply actions based on the message's contents

Jan Kundrát jkt at flaska.net
Sat Jan 5 15:04:28 UTC 2013


Git commit 2e4c15baeff5ca5d157e9f01f03b4ceebfcb5bba by Jan Kundrát.
Committed on 05/01/2013 at 15:51.
Pushed by jkt into branch 'master'.

GUI: enable/disable the reply actions based on the message's contents

M  +5    -0    src/Gui/MessageView.cpp
M  +1    -0    src/Gui/MessageView.h
M  +9    -1    src/Gui/Window.cpp

http://commits.kde.org/trojita/2e4c15baeff5ca5d157e9f01f03b4ceebfcb5bba

diff --git a/src/Gui/MessageView.cpp b/src/Gui/MessageView.cpp
index 70d9152..1d74792 100644
--- a/src/Gui/MessageView.cpp
+++ b/src/Gui/MessageView.cpp
@@ -572,4 +572,9 @@ void MessageView::partLinkHovered(const QString &link, const QString &title, con
     emit linkHovered(link);
 }
 
+QModelIndex MessageView::currentMessage() const
+{
+    return message;
+}
+
 }
diff --git a/src/Gui/MessageView.h b/src/Gui/MessageView.h
index 635f308..5975b2a 100644
--- a/src/Gui/MessageView.h
+++ b/src/Gui/MessageView.h
@@ -67,6 +67,7 @@ public:
     ~MessageView();
 
     void reply(MainWindow *mainWindow, Composer::ReplyMode mode);
+    QModelIndex currentMessage() const;
 public slots:
     void setMessage(const QModelIndex &index);
     void setEmpty();
diff --git a/src/Gui/Window.cpp b/src/Gui/Window.cpp
index a9e1a59..f2cf301 100644
--- a/src/Gui/Window.cpp
+++ b/src/Gui/Window.cpp
@@ -1169,7 +1169,15 @@ void MainWindow::updateActionsOnlineOffline(bool online)
 
 void MainWindow::slotUpdateMessageActions()
 {
-    // FIXME
+    Composer::RecipientList dummy;
+    m_replyPrivate->setEnabled(Composer::Util::replyRecipientList(Composer::REPLY_PRIVATE, msgView->currentMessage(), dummy));
+    m_replyAll->setEnabled(Composer::Util::replyRecipientList(Composer::REPLY_ALL, msgView->currentMessage(), dummy));
+    m_replyList->setEnabled(Composer::Util::replyRecipientList(Composer::REPLY_LIST, msgView->currentMessage(), dummy));
+    if (m_replyList->isEnabled()) {
+        m_replyButton->setDefaultAction(m_replyList);
+    } else {
+        m_replyButton->setDefaultAction(m_replyPrivate);
+    }
 }
 
 void MainWindow::scrollMessageUp()



More information about the kde-doc-english mailing list