diff --git a/src/librssguard/gui/litehtml/litehtmlviewer.cpp b/src/librssguard/gui/litehtml/litehtmlviewer.cpp
index 24a823f86..a55cbbcfb 100755
--- a/src/librssguard/gui/litehtml/litehtmlviewer.cpp
+++ b/src/librssguard/gui/litehtml/litehtmlviewer.cpp
@@ -12,6 +12,7 @@
#include "network-web/webfactory.h"
#include
+#include
#include
#include
@@ -20,6 +21,18 @@ LiteHtmlViewer::LiteHtmlViewer(QWidget* parent) : QLiteHtmlWidget(parent) {
emit loadProgress(-1);
return handleResource(url);
});
+
+ connect(this, &LiteHtmlViewer::copyAvailable, this, [this](bool available) {
+ if (!available) {
+ return;
+ }
+
+ QString sel_text = QLiteHtmlWidget::selectedText();
+
+ if (!sel_text.isEmpty()) {
+ QGuiApplication::clipboard()->setText(sel_text, QClipboard::Mode::Selection);
+ }
+ });
}
void LiteHtmlViewer::bindToBrowser(WebBrowser* browser) {
@@ -28,6 +41,14 @@ void LiteHtmlViewer::bindToBrowser(WebBrowser* browser) {
browser->m_actionReload = new QAction(this);
browser->m_actionStop = new QAction(this);
+ browser->m_actionBack->setEnabled(false);
+ browser->m_actionForward->setEnabled(false);
+ browser->m_actionReload->setEnabled(false);
+
+ // TODO: When clicked "Stop", save the "Stop" state and return {} from "handleResource(...)"
+ // right away.
+ browser->m_actionStop->setEnabled(false);
+
connect(this, &LiteHtmlViewer::zoomFactorChanged, browser, &WebBrowser::onZoomFactorChanged);
connect(this, &LiteHtmlViewer::linkHighlighted, browser, [browser](const QUrl& url) {
browser->onLinkHovered(url.toString());
@@ -260,3 +281,15 @@ QByteArray LiteHtmlViewer::handleResource(const QUrl& url) {
return output;
}
}
+
+void LiteHtmlViewer::keyPressEvent(QKeyEvent* event) {
+ if (event->matches(QKeySequence::StandardKey::Copy)) {
+ QString sel_text = QLiteHtmlWidget::selectedText();
+
+ if (!sel_text.isEmpty()) {
+ QGuiApplication::clipboard()->setText(sel_text, QClipboard::Mode::Clipboard);
+ }
+ }
+
+ QLiteHtmlWidget::keyPressEvent(event);
+}
diff --git a/src/librssguard/gui/litehtml/litehtmlviewer.h b/src/librssguard/gui/litehtml/litehtmlviewer.h
index 065f23372..e90fae1ef 100755
--- a/src/librssguard/gui/litehtml/litehtmlviewer.h
+++ b/src/librssguard/gui/litehtml/litehtmlviewer.h
@@ -42,6 +42,7 @@ class LiteHtmlViewer : public QLiteHtmlWidget, public WebViewer {
void loadFinished(bool success);
protected:
+ virtual void keyPressEvent(QKeyEvent* event);
virtual void wheelEvent(QWheelEvent* event);
private: