diff --git a/src/widget/about/aboutuser.ui b/src/widget/about/aboutuser.ui index d098ac193..7ae77ec68 100644 --- a/src/widget/about/aboutuser.ui +++ b/src/widget/about/aboutuser.ui @@ -31,12 +31,15 @@ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + - + 0 0 @@ -53,6 +56,12 @@ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + true + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + diff --git a/src/widget/form/chatform.cpp b/src/widget/form/chatform.cpp index 2d8fb4fc7..d6744d92f 100644 --- a/src/widget/form/chatform.cpp +++ b/src/widget/form/chatform.cpp @@ -29,9 +29,11 @@ #include #include #include +#include #include #include #include +#include #include #include "chatform.h" #include "src/audio/audio.h" @@ -79,6 +81,7 @@ ChatForm::ChatForm(Friend* chatFriend) statusMessageLabel->setFont(Style::getFont(Style::Medium)); statusMessageLabel->setMinimumHeight(Style::getFont(Style::Medium).pixelSize()); statusMessageLabel->setTextFormat(Qt::PlainText); + statusMessageLabel->setContextMenuPolicy(Qt::CustomContextMenu); callConfirm = nullptr; offlineEngine = new OfflineMsgEngine(f); @@ -100,6 +103,7 @@ ChatForm::ChatForm(Friend* chatFriend) connect(this, &GenericChatForm::messageInserted, this, &ChatForm::onMessageInserted); loadHistoryAction = menu.addAction(QString(), this, SLOT(onLoadHistory())); + copyStatusAction = statusMessageMenu.addAction(QString(), this, SLOT(onCopyStatusMessage())); connect(core, &Core::fileSendStarted, this, &ChatForm::startFileSend); connect(sendButton, &QPushButton::clicked, this, &ChatForm::onSendTriggered); @@ -111,6 +115,15 @@ ChatForm::ChatForm(Friend* chatFriend) connect(msgEdit, &ChatTextEdit::textChanged, this, &ChatForm::onTextEditChanged); connect(core, &Core::fileSendFailed, this, &ChatForm::onFileSendFailed); connect(this, &ChatForm::chatAreaCleared, getOfflineMsgEngine(), &OfflineMsgEngine::removeAllReceipts); + connect(statusMessageLabel, &CroppingLabel::customContextMenuRequested, this, [&](const QPoint& pos) + { + if(!statusMessageLabel->text().isEmpty()) + { + QWidget* sender = static_cast(this->sender()); + + statusMessageMenu.exec(sender->mapToGlobal(pos)); + } + } ); connect(&typingTimer, &QTimer::timeout, this, [=]{ Core::getInstance()->sendTyping(f->getFriendID(), false); isTyping = false; @@ -826,6 +839,17 @@ void ChatForm::onMessageInserted() netcam->setShowMessages(true, true); } +void ChatForm::onCopyStatusMessage() +{ + QString text = statusMessageLabel->text(); + QClipboard* clipboard = QApplication::clipboard(); + + if (clipboard) + { + clipboard->setText(text, QClipboard::Clipboard); + } +} + void ChatForm::startCounter() { if (!callDurationTimer) @@ -975,6 +999,7 @@ void ChatForm::retranslateUi() QString volObjectName = volButton->objectName(); QString micObjectName = micButton->objectName(); loadHistoryAction->setText(tr("Load chat history...")); + copyStatusAction->setText(tr("Copy")); if (volObjectName == QStringLiteral("green")) volButton->setToolTip(tr("Mute call")); diff --git a/src/widget/form/chatform.h b/src/widget/form/chatform.h index 842af1ac0..938a6e8d0 100644 --- a/src/widget/form/chatform.h +++ b/src/widget/form/chatform.h @@ -84,6 +84,7 @@ private slots: void onScreenshotTaken(const QPixmap &pixmap); void doScreenshot(); void onMessageInserted(); + void onCopyStatusMessage(); private: void retranslateUi(); @@ -101,6 +102,7 @@ private: CoreAV* coreav; Friend* f; CroppingLabel *statusMessageLabel; + QMenu statusMessageMenu; QLabel *callDuration; QTimer *callDurationTimer; QTimer typingTimer; @@ -108,6 +110,7 @@ private: QElapsedTimer timeElapsed; OfflineMsgEngine *offlineEngine; QAction* loadHistoryAction; + QAction* copyStatusAction; QHash ftransWidgets; void startCounter();