Browse Source

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.
reviewable/pr4906/r4
Pavel Karelin 8 years ago
parent
commit
74d470d428
  1. 29
      src/widget/form/genericchatform.cpp
  2. 8
      translations/ru.ts

29
src/widget/form/genericchatform.cpp

@ -43,7 +43,7 @@ @@ -43,7 +43,7 @@
#include <QClipboard>
#include <QFileDialog>
#include <QKeyEvent>
#include <QShortcut>
#include <QMessageBox>
/**
* @class GenericChatForm
@ -193,25 +193,27 @@ GenericChatForm::GenericChatForm(QWidget* parent) @@ -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() @@ -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();

8
translations/ru.ts vendored

@ -1240,6 +1240,14 @@ instead of system taskbar.</source> @@ -1240,6 +1240,14 @@ instead of system taskbar.</source>
<source>Copy link address</source>
<translation>Копировать адрес ссылки</translation>
</message>
<message>
<source>Confirmation</source>
<translation>Подтверждение</translation>
</message>
<message>
<source>You are sure that you want to clear all displayed messages?</source>
<translation>Вы уверены, что хотите удалить все отображаемые сообщения?</translation>
</message>
</context>
<context>
<name>GenericNetCamView</name>

Loading…
Cancel
Save