Commit 97a23c74 authored by Laurent Montel's avatar Laurent Montel 😁

Allow to open bookmark url as help page

parent d58edc4b
......@@ -60,7 +60,7 @@ void SieveEditorBookmarks::openBookmark(const KBookmark &bm, Qt::MouseButtons mb
{
Q_UNUSED(mb);
Q_UNUSED(km);
Q_EMIT openUrl(bm.url());
Q_EMIT openUrl(bm.url(), bm.text());
}
QString SieveEditorBookmarks::currentTitle() const
......
......@@ -43,7 +43,7 @@ public:
QUrl currentUrl() const Q_DECL_OVERRIDE;
Q_SIGNALS:
void openUrl(const QUrl& url);
void openUrl(const QUrl& url, const QString &description);
private:
KBookmarkMenu *mBookmarkMenu;
......
......@@ -517,6 +517,17 @@ KSieveUi::SieveEditorWidget::EditorMode SieveEditorMainWidget::pageMode() const
return KSieveUi::SieveEditorWidget::Unknown;
}
void SieveEditorMainWidget::openBookmarkUrl(const QUrl &url, const QString &description)
{
QWidget *w = mTabWidget->currentWidget();
if (w) {
SieveEditorPageWidget *page = qobject_cast<SieveEditorPageWidget *>(w);
if (page) {
page->openBookmarkUrl(url, description);
}
}
}
QString SieveEditorMainWidget::currentHelpTitle() const
{
QWidget *w = mTabWidget->currentWidget();
......
......@@ -53,6 +53,7 @@ public:
bool hasSelection() const;
QString currentHelpTitle() const;
QUrl currentHelpUrl() const;
void openBookmarkUrl(const QUrl &url, const QString &description);
public Q_SLOTS:
void slotGoToLine();
......
......@@ -309,7 +309,7 @@ void SieveEditorMainWindow::slotUpdateActions()
mZoomInAction->setEnabled(editActionEnabled);
mZoomOutAction->setEnabled(editActionEnabled);
mBookmarkMenu->setEnabled(hasPage);
mBookmarkMenu->setEnabled(editActionEnabled);
}
void SieveEditorMainWindow::slotUndoAvailable(bool b)
......@@ -334,9 +334,9 @@ void SieveEditorMainWindow::slotCopyAvailable(bool b)
mCutAction->setEnabled(editActionEnabled && b);
}
void SieveEditorMainWindow::slotOpenBookmarkUrl(const QUrl &url)
void SieveEditorMainWindow::slotOpenBookmarkUrl(const QUrl &url, const QString &description)
{
//TODO
mMainWidget->sieveEditorMainWidget()->openBookmarkUrl(url, description);
}
QString SieveEditorMainWindow::currentHelpTitle() const
......
......@@ -62,7 +62,7 @@ private Q_SLOTS:
void slotUndoAvailable(bool);
void slotRedoAvailable(bool);
void slotCopyAvailable(bool b);
void slotOpenBookmarkUrl(const QUrl &url);
void slotOpenBookmarkUrl(const QUrl &url, const QString &description);
private:
void initStatusBar();
void readConfig();
......
......@@ -303,6 +303,11 @@ void SieveEditorPageWidget::zoomOut()
mSieveEditorWidget->zoomOut();
}
void SieveEditorPageWidget::openBookmarkUrl(const QUrl &url, const QString &description)
{
mSieveEditorWidget->openBookmarkUrl(url, description);
}
QString SieveEditorPageWidget::currentHelpTitle() const
{
return mSieveEditorWidget->currentHelpTitle();
......
......@@ -77,6 +77,7 @@ public:
void zoomOut();
QString currentHelpTitle() const;
QUrl currentHelpUrl() const;
void openBookmarkUrl(const QUrl &url, const QString &description);
Q_SIGNALS:
void refreshList();
void scriptModified(bool, SieveEditorPageWidget *);
......
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