diff --git a/include/lrreportengine.h b/include/lrreportengine.h index cea1052..ce78b75 100644 --- a/include/lrreportengine.h +++ b/include/lrreportengine.h @@ -182,6 +182,12 @@ public: void setPreviewPageBackgroundColor(QColor color); void setResultEditable(bool value); bool resultIsEditable(); + void setSaveToFileVisible(bool value); + bool saveToFileIsVisible(); + void setPrintToPdfVisible(bool value); + bool printToPdfIsVisible(); + void setPrintVisible(bool value); + bool printIsVisible(); bool isBusy(); void setPassPharse(QString& passPharse); QList aviableLanguages(); diff --git a/limereport/lrpreviewreportwindow.cpp b/limereport/lrpreviewreportwindow.cpp index 7d01c0c..9900b33 100644 --- a/limereport/lrpreviewreportwindow.cpp +++ b/limereport/lrpreviewreportwindow.cpp @@ -186,6 +186,26 @@ void PreviewReportWindow::setHideResultEditButton(bool value) ui->actionEdit_Mode->setVisible(value); } +void PreviewReportWindow::setHidePrintButton(bool value) +{ + ui->actionPrint->setVisible(value); +} + +void PreviewReportWindow::setHideSaveToFileButton(bool value) +{ + ui->actionSaveToFile->setVisible(value); +} + +void PreviewReportWindow::setHidePrintToPdfButton(bool value) +{ + ui->actionPrint_To_PDF->setVisible(value); +} + +void PreviewReportWindow::setEnablePrintMenu(bool value) +{ + ui->menuReport->setEnabled(value); +} + QSettings*PreviewReportWindow::settings() { if (m_settings){ diff --git a/limereport/lrpreviewreportwindow.h b/limereport/lrpreviewreportwindow.h index 992a34d..d7c4652 100644 --- a/limereport/lrpreviewreportwindow.h +++ b/limereport/lrpreviewreportwindow.h @@ -72,6 +72,10 @@ public: void setStatusBarVisible(bool value); void setMenuVisible(bool value); void setHideResultEditButton(bool value); + void setHidePrintButton(bool value); + void setHideSaveToFileButton(bool value); + void setHidePrintToPdfButton(bool value); + void setEnablePrintMenu(bool value); QSettings* settings(); ScaleType previewScaleType() const; void setPreviewScaleType(const ScaleType &previewScaleType, int percent = 0); diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index a8dabb4..ca44b0f 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -84,7 +84,9 @@ ReportEnginePrivate::ReportEnginePrivate(QObject *parent) : m_fileWatcher( new QFileSystemWatcher( this ) ), m_reportLanguage(QLocale::AnyLanguage), m_previewLayoutDirection(Qt::LayoutDirectionAuto), m_designerFactory(0), m_previewScaleType(FitWidth), m_previewScalePercent(0), m_startTOCPage(0), - m_previewPageBackgroundColor(Qt::gray) + m_previewPageBackgroundColor(Qt::gray), + m_saveToFileVisible(true), m_printToPdfVisible(true), + m_printVisible(true) { #ifdef HAVE_STATIC_BUILD initResources(); @@ -532,8 +534,13 @@ void ReportEnginePrivate::previewReport(QPrinter *printer, PreviewHints hints) w->setStatusBarVisible(!hints.testFlag(HidePreviewStatusBar)); w->setToolBarVisible(!hints.testFlag(HidePreviewToolBar)); } - + w->setHideResultEditButton(resultIsEditable()); + w->setHidePrintButton(printIsVisible()); + w->setHideSaveToFileButton(saveToFileIsVisible()); + w->setHidePrintToPdfButton(printToPdfIsVisible()); + w->setEnablePrintMenu(printIsVisible() || printToPdfIsVisible()); + w->setStyleSheet(m_styleSheet); m_activePreview = w; @@ -1090,6 +1097,36 @@ void ReportEnginePrivate::setResultEditable(bool value) m_resultIsEditable = value; } +bool ReportEnginePrivate::saveToFileIsVisible() const +{ + return m_saveToFileVisible; +} + +void ReportEnginePrivate::setSaveToFileVisible(bool value) +{ + m_saveToFileVisible = value; +} + +bool ReportEnginePrivate::printToPdfIsVisible() const +{ + return m_printToPdfVisible; +} + +void ReportEnginePrivate::setPrintToPdfVisible(bool value) +{ + m_printToPdfVisible = value; +} + +bool ReportEnginePrivate::printIsVisible() const +{ + return m_printVisible; +} + +void ReportEnginePrivate::setPrintVisible(bool value) +{ + m_printVisible = value; +} + bool ReportEnginePrivate::suppressFieldAndVarError() const { return m_reportSettings.suppressAbsentFieldsAndVarsWarnings(); @@ -1432,6 +1469,42 @@ bool ReportEngine::resultIsEditable() return d->resultIsEditable(); } +void ReportEngine::setSaveToFileVisible(bool value) +{ + Q_D(ReportEngine); + d->setSaveToFileVisible(value); +} + +bool ReportEngine::saveToFileIsVisible() +{ + Q_D(ReportEngine); + return d->saveToFileIsVisible(); +} + +void ReportEngine::setPrintToPdfVisible(bool value) +{ + Q_D(ReportEngine); + d->setPrintToPdfVisible(value); +} + +bool ReportEngine::printToPdfIsVisible() +{ + Q_D(ReportEngine); + return d->printToPdfIsVisible(); +} + +void ReportEngine::setPrintVisible(bool value) +{ + Q_D(ReportEngine); + d->setPrintVisible(value); +} + +bool ReportEngine::printIsVisible() +{ + Q_D(ReportEngine); + return d->printIsVisible(); +} + bool ReportEngine::isBusy() { Q_D(ReportEngine); diff --git a/limereport/lrreportengine.h b/limereport/lrreportengine.h index cea1052..ce78b75 100644 --- a/limereport/lrreportengine.h +++ b/limereport/lrreportengine.h @@ -182,6 +182,12 @@ public: void setPreviewPageBackgroundColor(QColor color); void setResultEditable(bool value); bool resultIsEditable(); + void setSaveToFileVisible(bool value); + bool saveToFileIsVisible(); + void setPrintToPdfVisible(bool value); + bool printToPdfIsVisible(); + void setPrintVisible(bool value); + bool printIsVisible(); bool isBusy(); void setPassPharse(QString& passPharse); QList aviableLanguages(); diff --git a/limereport/lrreportengine_p.h b/limereport/lrreportengine_p.h index 686a757..2e9754d 100644 --- a/limereport/lrreportengine_p.h +++ b/limereport/lrreportengine_p.h @@ -216,6 +216,12 @@ public: bool isBusy(); bool resultIsEditable() const; void setResultEditable(bool value); + bool saveToFileIsVisible() const; + void setSaveToFileVisible(bool value); + bool printToPdfIsVisible() const; + void setPrintToPdfVisible(bool value); + bool printIsVisible() const; + void setPrintVisible(bool value); void setPassPhrase(const QString &passPhrase); bool addTranslationLanguage(QLocale::Language language); @@ -325,6 +331,9 @@ private: QColor m_previewPageBackgroundColor; QVector m_watermarks; BaseDesignIntf *createWatermark(PageDesignIntf *page, WatermarkSetting watermarkSetting); + bool m_saveToFileVisible; + bool m_printToPdfVisible; + bool m_printVisible; }; }