Git commit e598c8fb388cbbde8585e0d8423f1bd5161a0cee by Jan Kundr?t. Committed on 03/02/2013 at 13:11. Pushed by jkt into branch 'master'.
GUI: add a "smart" replying mode which will just pick the "default action" It's better to call this a "guess", not a "smart mode", really. M +18 -0 src/Gui/Window.cpp M +2 -0 src/Gui/Window.h http://commits.kde.org/trojita/e598c8fb388cbbde8585e0d8423f1bd5161a0cee diff --git a/src/Gui/Window.cpp b/src/Gui/Window.cpp index 4cd9f8a..d165f45 100644 --- a/src/Gui/Window.cpp +++ b/src/Gui/Window.cpp @@ -274,6 +274,10 @@ void MainWindow::createActions() m_replyList->setEnabled(false); connect(m_replyList, SIGNAL(triggered()), this, SLOT(slotReplyList())); + m_replyGuess = new QAction(tr("Reply by Guess"), this); + m_replyGuess->setEnabled(true); + connect(m_replyGuess, SIGNAL(triggered()), this, SLOT(slotReplyGuess())); + actionThreadMsgList = new QAction(tr("Show Messages in Threads"), this); actionThreadMsgList->setCheckable(true); // This action is enabled/disabled by model's capabilities @@ -394,6 +398,7 @@ void MainWindow::createMenus() { QMenu *imapMenu = menuBar()->addMenu(tr("IMAP")); imapMenu->addAction(composeMail); + imapMenu->addAction(m_replyGuess); imapMenu->addAction(m_replyPrivate); imapMenu->addAction(m_replyAll); imapMenu->addAction(m_replyList); @@ -1217,6 +1222,7 @@ void MainWindow::updateActionsOnlineOffline(bool online) markAsRead->setEnabled(online); showImapCapabilities->setEnabled(online); if (!online) { + m_replyGuess->setEnabled(false); m_replyPrivate->setEnabled(false); m_replyAll->setEnabled(false); m_replyList->setEnabled(false); @@ -1229,6 +1235,7 @@ void MainWindow::slotUpdateMessageActions() 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)); + m_replyGuess->setEnabled(m_replyPrivate->isEnabled() || m_replyAll->isEnabled() || m_replyList->isEnabled()); if (m_replyList->isEnabled()) { m_replyButton->setDefaultAction(m_replyList); } else { @@ -1256,6 +1263,17 @@ void MainWindow::slotReplyList() msgView->reply(this, Composer::REPLY_LIST); } +void MainWindow::slotReplyGuess() +{ + if (m_replyButton->defaultAction() == m_replyAll) { + slotReplyAll(); + } else if (m_replyButton->defaultAction() == m_replyList) { + slotReplyList(); + } else { + slotReplyTo(); + } +} + void MainWindow::slotComposeMailUrl(const QUrl &url) { Q_ASSERT(url.scheme().toLower() == QLatin1String("mailto")); diff --git a/src/Gui/Window.h b/src/Gui/Window.h index e153406..670c690 100644 --- a/src/Gui/Window.h +++ b/src/Gui/Window.h @@ -114,6 +114,7 @@ private slots: void slotReplyTo(); void slotReplyAll(); void slotReplyList(); + void slotReplyGuess(); void slotUpdateMessageActions(); void handleMarkAsRead(bool); void handleMarkAsDeleted(bool); @@ -219,6 +220,7 @@ private: QAction *m_replyPrivate; QAction *m_replyAll; QAction *m_replyList; + QAction *m_replyGuess; QAction *expunge; QAction *createChildMailbox; QAction *createTopMailbox;
