Commit 72192b04 authored by Laurent Montel's avatar Laurent Montel 😁

Disable action when we can't use it in html page

parent 1be34bff
......@@ -36,7 +36,7 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${sieveeditor_SOURCE_DIR})
set(MESSAGELIB_LIB_VERSION_LIB "5.2.64")
set(PIMCOMMON_LIB_VERSION_LIB "5.2.40")
set(LIBKSIEVE_LIB_VERSION_LIB "5.2.43")
set(LIBKSIEVE_LIB_VERSION_LIB "5.2.44")
set(QT_REQUIRED_VERSION "5.6.0")
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Widgets Network Test)
......
......@@ -663,3 +663,15 @@ bool SieveEditorMainWidget::printSupportEnabled() const
}
return false;
}
bool SieveEditorMainWidget::isTextEditor() const
{
QWidget *w = mTabWidget->currentWidget();
if (w) {
SieveEditorPageWidget *page = qobject_cast<SieveEditorPageWidget *>(w);
if (page) {
return page->isTextEditor();
}
}
return false;
}
......@@ -58,6 +58,7 @@ public:
QUrl currentHelpUrl() const;
void openBookmarkUrl(const QUrl &url);
bool printSupportEnabled() const;
bool isTextEditor() const;
public Q_SLOTS:
void slotDebugSieveScript();
void slotGoToLine();
......
......@@ -307,7 +307,7 @@ void SieveEditorMainWindow::slotUpdateActions()
{
const bool hasPage = (mMainWidget->sieveEditorMainWidget()->tabWidget()->count() > 0);
mUploadScript->setEnabled(hasPage);
const bool editActionEnabled = (hasPage && mMainWidget->sieveEditorMainWidget()->pageMode() == KSieveUi::SieveEditorWidget::TextMode);
const bool editActionEnabled = (hasPage && mMainWidget->sieveEditorMainWidget()->isTextEditor());
mGoToLine->setEnabled(editActionEnabled);
mFindAction->setEnabled(editActionEnabled);
mReplaceAction->setEnabled(editActionEnabled);
......
......@@ -334,11 +334,16 @@ void SieveEditorPageWidget::printPreview()
mSieveEditorWidget->printPreview();
}
bool SieveEditorPageWidget::printSupportEnabled()
bool SieveEditorPageWidget::printSupportEnabled() const
{
return mSieveEditorWidget->printSupportEnabled();
}
bool SieveEditorPageWidget::isTextEditor() const
{
return mSieveEditorWidget->isTextEditor();
}
void SieveEditorPageWidget::zoomReset()
{
mSieveEditorWidget->zoomReset();
......
......@@ -84,7 +84,8 @@ public:
bool isWordWrap() const;
void print();
void printPreview();
bool printSupportEnabled();
bool printSupportEnabled() const;
bool isTextEditor() const;
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