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

Add info about printing support

parent 7fbe18e6
......@@ -18,7 +18,7 @@ include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
include(ECMQtDeclareLoggingCategory)
include(ECMAddTests)
set(PIM_VERSION "5.2.42")
set(PIM_VERSION "5.2.43")
set(KF5_VERSION "5.19.0")
set(LIBKSIEVE_LIB_VERSION ${PIM_VERSION})
set(KDEPIMLIBS_LIB_VERSION "5.2.40")
......
......@@ -324,22 +324,29 @@ bool SieveEditorTextModeWidget::isWordWrap() const
void SieveEditorTextModeWidget::print()
{
QPrinter printer;
QWidget *w = mTabWidget->currentWidget();
if (w == mTextEdit) {
QPrinter printer;
QScopedPointer<QPrintDialog> dlg(new QPrintDialog(&printer));
QScopedPointer<QPrintDialog> dlg(new QPrintDialog(&printer));
if (dlg && dlg->exec() == QDialog::Accepted) {
mTextEdit->print(&printer);
if (dlg && dlg->exec() == QDialog::Accepted) {
mTextEdit->print(&printer);
}
}
}
void SieveEditorTextModeWidget::printPreview()
{
PimCommon::KPimPrintPreviewDialog previewdlg(this);
connect(&previewdlg, &QPrintPreviewDialog::paintRequested, this, [this](QPrinter * printer) {
mTextEdit->print(printer);
});
previewdlg.exec();
QWidget *w = mTabWidget->currentWidget();
if (w == mTextEdit) {
PimCommon::KPimPrintPreviewDialog previewdlg(this);
connect(&previewdlg, &QPrintPreviewDialog::paintRequested, this, [this](QPrinter * printer) {
mTextEdit->print(printer);
});
previewdlg.exec();
}
}
void SieveEditorTextModeWidget::wordWrap(bool state)
......@@ -504,3 +511,9 @@ void SieveEditorTextModeWidget::debugSieveScript()
}
delete dlg;
}
bool SieveEditorTextModeWidget::printSupportEnabled() const
{
QWidget *w = mTabWidget->currentWidget();
return (w == mTextEdit);
}
......@@ -98,6 +98,7 @@ public:
bool isWordWrap() const;
void print();
void printPreview();
bool printSupportEnabled() const;
Q_SIGNALS:
void enableButtonOk(bool);
void switchToGraphicalMode();
......
......@@ -687,3 +687,11 @@ QUrl SieveEditorWidget::currentHelpUrl() const
}
return QUrl();
}
bool SieveEditorWidget::printSupportEnabled() const
{
if (mMode == TextMode) {
return mTextModeWidget->printSupportEnabled();
}
return false;
}
......@@ -85,6 +85,7 @@ public:
void print();
void printPreview();
bool printSupportEnabled() const;
public Q_SLOTS:
void find();
void replace();
......
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