From 74d470d428fd93f40e2c99aa35993346730c81d5 Mon Sep 17 00:00:00 2001 From: Pavel Karelin Date: Fri, 12 Jan 2018 17:03:27 +0300 Subject: [PATCH] chore: Reorganization of the context menu for chat 1. The action "Quote selected text" moved to top of the menu list. We assume that this is the most used menu item. 2. The short keys for "Quote selected text" and for "Clear displayed messages" now is visible in the context menu. 3. For action "Clear displayed messages" add message box with confirmation of this operation. --- src/widget/form/genericchatform.cpp | 29 +++++++++++++++++++---------- translations/ru.ts | 8 ++++++++ 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/src/widget/form/genericchatform.cpp b/src/widget/form/genericchatform.cpp index 87b8642d0..bc079c431 100644 --- a/src/widget/form/genericchatform.cpp +++ b/src/widget/form/genericchatform.cpp @@ -43,7 +43,7 @@ #include #include #include -#include +#include /** * @class GenericChatForm @@ -193,25 +193,27 @@ GenericChatForm::GenericChatForm(QWidget* parent) contentLayout->addWidget(chatWidget); contentLayout->addLayout(mainFootLayout); + quoteAction = menu.addAction(QIcon(), QString(), this, SLOT(quoteSelectedText()), + QKeySequence(Qt::ALT + Qt::Key_Q)); + addAction(quoteAction); + menu.addSeparator(); + menu.addActions(chatWidget->actions()); menu.addSeparator(); - saveChatAction = - menu.addAction(QIcon::fromTheme("document-save"), QString(), this, SLOT(onSaveLogClicked())); - clearAction = - menu.addAction(QIcon::fromTheme("edit-clear"), QString(), this, SLOT(clearChatArea(bool))); - quoteAction = menu.addAction(QIcon(), QString(), this, SLOT(quoteSelectedText())); + saveChatAction = menu.addAction(QIcon::fromTheme("document-save"), QString(), + this, SLOT(onSaveLogClicked())); + clearAction = menu.addAction(QIcon::fromTheme("edit-clear"), QString(), + this, SLOT(clearChatArea(bool)), + QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_L)); + addAction(clearAction); copyLinkAction = menu.addAction(QIcon(), QString(), this, SLOT(copyLink())); - menu.addSeparator(); connect(chatWidget, &ChatLog::customContextMenuRequested, this, &GenericChatForm::onChatContextMenuRequested); - new QShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_L, this, SLOT(clearChatArea())); - new QShortcut(Qt::ALT + Qt::Key_Q, this, SLOT(quoteSelectedText())); - chatWidget->setStyleSheet(Style::getStylesheet(":/ui/chatArea/chatArea.css")); headWidget->setStyleSheet(Style::getStylesheet(":/ui/chatArea/chatHead.css")); @@ -524,6 +526,13 @@ void GenericChatForm::clearChatArea() void GenericChatForm::clearChatArea(bool notinform) { + QMessageBox::StandardButton mboxResult = + QMessageBox::question(this, tr("Confirmation"), + tr("You are sure that you want to clear all displayed messages?"), + QMessageBox::Yes | QMessageBox::No, QMessageBox::No); + if (mboxResult == QMessageBox::No) { + return; + } chatWidget->clear(); previousId = ToxPk(); diff --git a/translations/ru.ts b/translations/ru.ts index 8d3e6915e..29486ba25 100644 --- a/translations/ru.ts +++ b/translations/ru.ts @@ -1240,6 +1240,14 @@ instead of system taskbar. Copy link address Копировать адрес ссылки + + Confirmation + Подтверждение + + + You are sure that you want to clear all displayed messages? + Вы уверены, что хотите удалить все отображаемые сообщения? + GenericNetCamView