Commit e59826ef authored by Laurent Montel's avatar Laurent Montel 😁

Add support for copy available in html mode

parent c65539e2
......@@ -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());
}
......@@ -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;
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment