Commit 24c258f9 authored by Laurent Montel's avatar Laurent Montel 😁

Implement reset zoom

parent b570986a
......@@ -503,6 +503,17 @@ void SieveEditorMainWidget::slotZoomOut()
}
}
void SieveEditorMainWidget::slotZoomReset()
{
QWidget *w = mTabWidget->currentWidget();
if (w) {
SieveEditorPageWidget *page = qobject_cast<SieveEditorPageWidget *>(w);
if (page) {
page->zoomReset();
}
}
}
void SieveEditorMainWidget::slotGeneralPaletteChanged()
{
const QPalette pal = palette();
......
......@@ -78,7 +78,8 @@ public Q_SLOTS:
void slotLowerCase();
void slotReverseCase();
void slotZoomIn();
void slotZoomOut();
void slotZoomOut();
void slotZoomReset();
Q_SIGNALS:
void updateButtons(bool newScriptAction, bool editScriptAction, bool deleteScriptAction, bool desactivateScriptAction);
......
......@@ -197,9 +197,19 @@ void SieveEditorMainWindow::setupActions()
mUncommentAction = ac->addAction(QStringLiteral("uncomment_code"), mMainWidget->sieveEditorMainWidget(), SLOT(slotUncomment()));
mUncommentAction->setText(i18n("Uncomment"));
mZoomInAction = KStandardAction::zoomIn(mMainWidget->sieveEditorMainWidget(), SLOT(slotZoomIn()), ac);
mZoomInAction = new QAction(QIcon::fromTheme(QStringLiteral("zoom-in")), i18n("&Zoom In"), this);
ac->addAction(QStringLiteral("zoom_in"), mZoomInAction);
connect(mZoomInAction, &QAction::triggered, mMainWidget->sieveEditorMainWidget(), &SieveEditorMainWidget::slotZoomIn);
ac->setDefaultShortcut(mZoomInAction, QKeySequence(Qt::CTRL | Qt::Key_Plus));
mZoomOutAction = KStandardAction::zoomOut(mMainWidget->sieveEditorMainWidget(), SLOT(slotZoomOut()), ac);
mZoomOutAction = new QAction(QIcon::fromTheme(QStringLiteral("zoom-out")), i18n("Zoom &Out"), this);
ac->addAction(QStringLiteral("zoom_out"), mZoomOutAction);
connect(mZoomOutAction, &QAction::triggered, mMainWidget->sieveEditorMainWidget(), &SieveEditorMainWidget::slotZoomOut);
ac->setDefaultShortcut(mZoomOutAction, QKeySequence(Qt::CTRL | Qt::Key_Minus));
mZoomResetAction = ac->addAction(QStringLiteral("zoom_reset"), mMainWidget->sieveEditorMainWidget(), SLOT(slotZoomReset()));
ac->setDefaultShortcut(mZoomResetAction, QKeySequence(Qt::CTRL | Qt::Key_0));
mZoomResetAction->setText(i18nc("Reset the zoom", "Reset"));
mMenuChangeCaseAction = new PimCommon::KActionMenuChangeCase(this);
ac->addAction(QStringLiteral("change_case_menu"), mMenuChangeCaseAction);
......@@ -312,6 +322,7 @@ void SieveEditorMainWindow::slotUpdateActions()
mMenuChangeCaseAction->setEnabled(editActionEnabled);
mZoomInAction->setEnabled(editActionEnabled);
mZoomOutAction->setEnabled(editActionEnabled);
mZoomResetAction->setEnabled(editActionEnabled);
mBookmarkMenu->setEnabled(editActionEnabled);
mDebugSieveScriptAction->setEnabled(editActionEnabled);
......
......@@ -93,6 +93,7 @@ private:
QAction *mUncommentAction;
QAction *mZoomInAction;
QAction *mZoomOutAction;
QAction *mZoomResetAction;
QAction *mDebugSieveScriptAction;
PimCommon::KActionMenuChangeCase *mMenuChangeCaseAction;
......
......@@ -312,6 +312,11 @@ void SieveEditorPageWidget::zoomOut()
mSieveEditorWidget->zoomOut();
}
void SieveEditorPageWidget::zoomReset()
{
mSieveEditorWidget->zoomReset();
}
void SieveEditorPageWidget::openBookmarkUrl(const QUrl &url)
{
mSieveEditorWidget->openBookmarkUrl(url);
......
......@@ -79,6 +79,7 @@ public:
QUrl currentHelpUrl() const;
void openBookmarkUrl(const QUrl &url);
void debugSieveScript();
void zoomReset();
Q_SIGNALS:
void refreshList();
void scriptModified(bool, SieveEditorPageWidget *);
......
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui name="sieveeditor" version="12">
<kpartgui name="sieveeditor" version="14">
<MenuBar>
<Menu name="file" >
<Action name="add_server_sieve" />
......@@ -28,6 +28,12 @@
<Separator/>
<Action name="change_case_menu" />
</Menu>
<Menu name="display" >
<text>Display</text>
<Action name="zoom_in" />
<Action name="zoom_out" />
<Action name="zoom_reset" />
</Menu>
<Action name="bookmark"/>
<Menu name="Tools" >
<text>Tools</text>
......
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