1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

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.
This commit is contained in:
Pavel Karelin 2018-01-12 17:03:27 +03:00
parent 3fb42b75d7
commit 74d470d428
2 changed files with 27 additions and 10 deletions

View File

@ -43,7 +43,7 @@
#include <QClipboard>
#include <QFileDialog>
#include <QKeyEvent>
#include <QShortcut>
#include <QMessageBox>
/**
* @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();

8
translations/ru.ts vendored
View File

@ -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>