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

Start to implement print/printpreview

parent f8726670
...@@ -537,6 +537,28 @@ void SieveEditorMainWidget::slotWordWrap(bool state) ...@@ -537,6 +537,28 @@ void SieveEditorMainWidget::slotWordWrap(bool state)
} }
} }
void SieveEditorMainWidget::slotPrintPreview()
{
QWidget *w = mTabWidget->currentWidget();
if (w) {
SieveEditorPageWidget *page = qobject_cast<SieveEditorPageWidget *>(w);
if (page) {
page->printPreview();
}
}
}
void SieveEditorMainWidget::slotPrint()
{
QWidget *w = mTabWidget->currentWidget();
if (w) {
SieveEditorPageWidget *page = qobject_cast<SieveEditorPageWidget *>(w);
if (page) {
page->print();
}
}
}
void SieveEditorMainWidget::slotGeneralPaletteChanged() void SieveEditorMainWidget::slotGeneralPaletteChanged()
{ {
const QPalette pal = palette(); const QPalette pal = palette();
......
...@@ -82,6 +82,9 @@ public Q_SLOTS: ...@@ -82,6 +82,9 @@ public Q_SLOTS:
void slotZoomOut(); void slotZoomOut();
void slotZoomReset(); void slotZoomReset();
void slotWordWrap(bool); void slotWordWrap(bool);
void slotPrintPreview();
void slotPrint();
Q_SIGNALS: Q_SIGNALS:
void updateButtons(bool newScriptAction, bool editScriptAction, bool deleteScriptAction, bool desactivateScriptAction); void updateButtons(bool newScriptAction, bool editScriptAction, bool deleteScriptAction, bool desactivateScriptAction);
......
...@@ -233,6 +233,10 @@ void SieveEditorMainWindow::setupActions() ...@@ -233,6 +233,10 @@ void SieveEditorMainWindow::setupActions()
mWrapTextAction->setCheckable(true); mWrapTextAction->setCheckable(true);
ac->addAction(QStringLiteral("wordwrap"), mWrapTextAction); ac->addAction(QStringLiteral("wordwrap"), mWrapTextAction);
connect(mWrapTextAction, &QAction::triggered, mMainWidget->sieveEditorMainWidget(), &SieveEditorMainWidget::slotWordWrap); connect(mWrapTextAction, &QAction::triggered, mMainWidget->sieveEditorMainWidget(), &SieveEditorMainWidget::slotWordWrap);
mPrintAction = KStandardAction::print(mMainWidget->sieveEditorMainWidget(), SLOT(slotPrint()), ac);
mPrintPreviewAction = KStandardAction::printPreview(mMainWidget->sieveEditorMainWidget(), SLOT(slotPrintPreview()), ac);
} }
void SieveEditorMainWindow::slotRefreshList() void SieveEditorMainWindow::slotRefreshList()
......
...@@ -96,6 +96,8 @@ private: ...@@ -96,6 +96,8 @@ private:
QAction *mZoomResetAction; QAction *mZoomResetAction;
QAction *mDebugSieveScriptAction; QAction *mDebugSieveScriptAction;
QAction *mWrapTextAction; QAction *mWrapTextAction;
QAction *mPrintAction;
QAction *mPrintPreviewAction;
PimCommon::KActionMenuChangeCase *mMenuChangeCaseAction; PimCommon::KActionMenuChangeCase *mMenuChangeCaseAction;
QLabel *mStatusBarInfo; QLabel *mStatusBarInfo;
......
...@@ -323,6 +323,16 @@ bool SieveEditorPageWidget::isWordWrap() const ...@@ -323,6 +323,16 @@ bool SieveEditorPageWidget::isWordWrap() const
return mSieveEditorWidget->isWordWrap(); return mSieveEditorWidget->isWordWrap();
} }
void SieveEditorPageWidget::print()
{
//TODO
}
void SieveEditorPageWidget::printPreview()
{
//TODO
}
void SieveEditorPageWidget::zoomReset() void SieveEditorPageWidget::zoomReset()
{ {
mSieveEditorWidget->zoomReset(); mSieveEditorWidget->zoomReset();
......
...@@ -82,6 +82,8 @@ public: ...@@ -82,6 +82,8 @@ public:
void zoomReset(); void zoomReset();
void wordWrap(bool state); void wordWrap(bool state);
bool isWordWrap() const; bool isWordWrap() const;
void print();
void printPreview();
Q_SIGNALS: Q_SIGNALS:
void refreshList(); void refreshList();
void scriptModified(bool, SieveEditorPageWidget *); 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