summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2016-05-19 07:04:28 +0200
committerMontel Laurent <[email protected]>2016-05-19 07:04:28 +0200
commite59826ef78745099ceb3ccb3689e06e2b04794b9 (patch)
treedf89329d13c96a514621ef01f1c83357239fb9ee
parentc65539e257846118a14756743158c57a0ca48673 (diff)
Add support for copy available in html mode
-rw-r--r--src/ksieveui/editor/sieveeditorhelphtmlwidget.cpp6
-rw-r--r--src/ksieveui/editor/sieveeditorhelphtmlwidget.h2
-rw-r--r--src/ksieveui/editor/sieveeditortabwidget.cpp1
-rw-r--r--src/ksieveui/editor/sieveeditortabwidget.h3
-rw-r--r--src/ksieveui/editor/sieveeditortextmodewidget.cpp1
5 files changed, 13 insertions, 0 deletions
diff --git a/src/ksieveui/editor/sieveeditorhelphtmlwidget.cpp b/src/ksieveui/editor/sieveeditorhelphtmlwidget.cpp
index c8bb05a..ee71d1d 100644
--- a/src/ksieveui/editor/sieveeditorhelphtmlwidget.cpp
+++ b/src/ksieveui/editor/sieveeditorhelphtmlwidget.cpp
@@ -41,6 +41,7 @@ SieveEditorHelpHtmlWidget::SieveEditorHelpHtmlWidget(QWidget *parent)
connect(mWebView, &SieveEditorWebEngineView::titleChanged, this, &SieveEditorHelpHtmlWidget::slotTitleChanged);
connect(mWebView, &SieveEditorWebEngineView::loadStarted, this, &SieveEditorHelpHtmlWidget::slotLoadStarted);
connect(mWebView, &SieveEditorWebEngineView::loadFinished, this, &SieveEditorHelpHtmlWidget::slotFinished);
+ connect(mWebView, &SieveEditorWebEngineView::selectionChanged, this, &SieveEditorHelpHtmlWidget::slotSelectionChanged);
QVBoxLayout *lay = new QVBoxLayout;
lay->addWidget(mWebView);
setLayout(lay);
@@ -133,3 +134,8 @@ void SieveEditorHelpHtmlWidget::resetZoom()
mZoomFactor = 100;
mWebView->setZoomFactor(1.0);
}
+
+void SieveEditorHelpHtmlWidget::slotSelectionChanged()
+{
+ Q_EMIT copyAvailable(mWebView->hasSelection());
+}
diff --git a/src/ksieveui/editor/sieveeditorhelphtmlwidget.h b/src/ksieveui/editor/sieveeditorhelphtmlwidget.h
index 7509f5b..6f4e0cb 100644
--- a/src/ksieveui/editor/sieveeditorhelphtmlwidget.h
+++ b/src/ksieveui/editor/sieveeditorhelphtmlwidget.h
@@ -49,6 +49,7 @@ Q_SIGNALS:
void titleChanged(KSieveUi::SieveEditorHelpHtmlWidget *widget, const QString &title);
void progressIndicatorPixmapChanged(KSieveUi::SieveEditorHelpHtmlWidget *widget, const QPixmap &);
void loadFinished(KSieveUi::SieveEditorHelpHtmlWidget *widget, bool success);
+ void copyAvailable(bool);
private Q_SLOTS:
void slotTitleChanged(const QString &title);
@@ -56,6 +57,7 @@ private Q_SLOTS:
void slotLoadStarted();
void slotPixmapChanged(const QPixmap &pixmap);
void slotLoadFinished(bool success);
+ void slotSelectionChanged();
private:
QString mTitle;
SieveEditorWebEngineView *mWebView;
diff --git a/src/ksieveui/editor/sieveeditortabwidget.cpp b/src/ksieveui/editor/sieveeditortabwidget.cpp
index 3a9149c..8666c27 100644
--- a/src/ksieveui/editor/sieveeditortabwidget.cpp
+++ b/src/ksieveui/editor/sieveeditortabwidget.cpp
@@ -76,6 +76,7 @@ void SieveEditorTabWidget::slotAddHelpPage(const QUrl &url)
connect(htmlPage, &SieveEditorHelpHtmlWidget::titleChanged, this, &SieveEditorTabWidget::slotTitleChanged);
connect(htmlPage, &SieveEditorHelpHtmlWidget::progressIndicatorPixmapChanged, this, &SieveEditorTabWidget::slotProgressIndicatorPixmapChanged);
connect(htmlPage, &SieveEditorHelpHtmlWidget::loadFinished, this, &SieveEditorTabWidget::slotLoadFinished);
+ connect(htmlPage, &SieveEditorHelpHtmlWidget::copyAvailable, this, &SieveEditorTabWidget::copyAvailable);
htmlPage->openUrl(url);
const int index = addTab(htmlPage, i18n("Help"));
setCurrentIndex(index);
diff --git a/src/ksieveui/editor/sieveeditortabwidget.h b/src/ksieveui/editor/sieveeditortabwidget.h
index d82e03c..86e6649 100644
--- a/src/ksieveui/editor/sieveeditortabwidget.h
+++ b/src/ksieveui/editor/sieveeditortabwidget.h
@@ -39,6 +39,9 @@ protected:
void tabRemoved(int index) Q_DECL_OVERRIDE;
void tabInserted(int index) Q_DECL_OVERRIDE;
+Q_SIGNALS:
+ void copyAvailable(bool);
+
private Q_SLOTS:
void slotTitleChanged(KSieveUi::SieveEditorHelpHtmlWidget *widget, const QString &title);
void slotTabCloseRequested(int index);
diff --git a/src/ksieveui/editor/sieveeditortextmodewidget.cpp b/src/ksieveui/editor/sieveeditortextmodewidget.cpp
index 5551924..e18762d 100644
--- a/src/ksieveui/editor/sieveeditortextmodewidget.cpp
+++ b/src/ksieveui/editor/sieveeditortextmodewidget.cpp
@@ -90,6 +90,7 @@ SieveEditorTextModeWidget::SieveEditorTextModeWidget(QWidget *parent)
mTabWidget = new SieveEditorTabWidget;
connect(mTabWidget, &SieveEditorTabWidget::currentChanged, this, &SieveEditorTextModeWidget::sieveEditorTabCurrentChanged);
+ connect(mTabWidget, &SieveEditorTabWidget::copyAvailable, this, &SieveEditorTextModeWidget::copyAvailable);
mTextToSpeechWidget = new KPIMTextEdit::TextToSpeechWidget(this);
textEditLayout->addWidget(mTextToSpeechWidget);