Fix NO_PRINTING building again

Back in 6699e3ab ("Add print button to planner") unconditional printing
code was added. This puts that same code behind NO_PRINTING macro.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Anton Lundin 2014-06-23 15:43:51 +02:00 committed by Dirk Hohndel
parent 9f7c79557e
commit 5904be2e06
2 changed files with 6 additions and 1 deletions

View file

@ -276,6 +276,9 @@ DivePlannerWidget::DivePlannerWidget(QWidget *parent, Qt::WindowFlags f) : QWidg
connect(ui.gflow, SIGNAL(valueChanged(int)), plannerModel, SLOT(setGFLow(int))); connect(ui.gflow, SIGNAL(valueChanged(int)), plannerModel, SLOT(setGFLow(int)));
connect(ui.gflow, SIGNAL(editingFinished()), plannerModel, SLOT(emitDataChanged())); connect(ui.gflow, SIGNAL(editingFinished()), plannerModel, SLOT(emitDataChanged()));
connect(ui.printPlan, SIGNAL(pressed()), this, SLOT(printDecoPlan())); connect(ui.printPlan, SIGNAL(pressed()), this, SLOT(printDecoPlan()));
#ifdef NO_PRINTING
ui.printPlan->hide();
#endif
// Creating (and canceling) the plan // Creating (and canceling) the plan
connect(ui.buttonBox, SIGNAL(accepted()), plannerModel, SLOT(createPlan())); connect(ui.buttonBox, SIGNAL(accepted()), plannerModel, SLOT(createPlan()));

View file

@ -20,7 +20,6 @@
#include <QStringList> #include <QStringList>
#include <QSettings> #include <QSettings>
#include <QShortcut> #include <QShortcut>
#include <QPrintDialog>
#include <fcntl.h> #include <fcntl.h>
#include "divelistview.h" #include "divelistview.h"
#include "starwidget.h" #include "starwidget.h"
@ -43,6 +42,7 @@
#include "updatemanager.h" #include "updatemanager.h"
#include "planner.h" #include "planner.h"
#ifndef NO_PRINTING #ifndef NO_PRINTING
#include <QPrintDialog>
#include "printdialog.h" #include "printdialog.h"
#endif #endif
#include "divelogimportdialog.h" #include "divelogimportdialog.h"
@ -440,6 +440,7 @@ void MainWindow::setPlanNotes(const char *notes)
void MainWindow::printPlan() void MainWindow::printPlan()
{ {
#ifndef NO_PRINTING
QString diveplan = ui.divePlanOutput->toHtml(); QString diveplan = ui.divePlanOutput->toHtml();
QString withDisclaimer = diveplan + QString(disclaimer); QString withDisclaimer = diveplan + QString(disclaimer);
@ -452,6 +453,7 @@ void MainWindow::printPlan()
ui.divePlanOutput->setHtml(withDisclaimer); ui.divePlanOutput->setHtml(withDisclaimer);
ui.divePlanOutput->print(&printer); ui.divePlanOutput->print(&printer);
ui.divePlanOutput->setHtml(diveplan); ui.divePlanOutput->setHtml(diveplan);
#endif
} }
void MainWindow::on_actionDivePlanner_triggered() void MainWindow::on_actionDivePlanner_triggered()