KOffice – TDE office suite
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

kexisimpleprintingpagesetup.cpp 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550
  1. /* This file is part of the KDE project
  2. Copyright (C) 2005 Jaroslaw Staniek <js@iidea.pl>
  3. This program is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Library General Public
  5. License as published by the Free Software Foundation; either
  6. version 2 of the License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Library General Public License for more details.
  11. You should have received a copy of the GNU Library General Public License
  12. along with this program; see the file COPYING.LIB. If not, write to
  13. the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  14. * Boston, MA 02110-1301, USA.
  15. */
  16. #include "kexisimpleprintingpagesetup.h"
  17. #include "kexisimpleprintingpagesetupbase.h"
  18. #include "kexisimpleprintpreviewwindow.h"
  19. #include <core/keximainwindow.h>
  20. #include <kexiutils/utils.h>
  21. #include <kexi_version.h>
  22. #include <tdeapplication.h>
  23. #include <kiconloader.h>
  24. #include <tdelocale.h>
  25. #include <tdefontdialog.h>
  26. #include <kurllabel.h>
  27. #include <kdebug.h>
  28. #include <klineedit.h>
  29. #include <kprinter.h>
  30. #include <kpushbutton.h>
  31. #include <tdeversion.h>
  32. #include <tqlabel.h>
  33. #include <tqtimer.h>
  34. #include <tqlayout.h>
  35. #include <tqpainter.h>
  36. #include <tqcheckbox.h>
  37. #include <tqwhatsthis.h>
  38. #include <tqtooltip.h>
  39. #include <kexiutils/tristate.h>
  40. KexiSimplePrintingCommand::KexiSimplePrintingCommand(
  41. KexiMainWindow* mainWin, int objectId, TQObject* parent)
  42. : TQObject(parent, "KexiSimplePrintCommand")
  43. , m_previewEngine(0)
  44. , m_mainWin(mainWin)
  45. , m_objectId(objectId)
  46. , m_previewWindow(0)
  47. , m_printPreviewNeedsReloading(false)
  48. {
  49. connect(this, TQT_SIGNAL(showPageSetupRequested(KexiPart::Item*)),
  50. m_mainWin, TQT_SLOT(showPageSetupForItem(KexiPart::Item*)));
  51. }
  52. KexiSimplePrintingCommand::~KexiSimplePrintingCommand()
  53. {
  54. delete m_previewWindow;
  55. delete m_previewEngine;
  56. // delete m_settings;
  57. }
  58. bool KexiSimplePrintingCommand::print(const KexiSimplePrintingSettings& settings,
  59. const TQString& aTitleText)
  60. {
  61. m_settings = settings;
  62. return print(aTitleText);
  63. }
  64. bool KexiSimplePrintingCommand::print(const TQString& aTitleText)
  65. {
  66. KexiDB::Connection *conn = m_mainWin->project()->dbConnection();
  67. KexiDB::TableOrQuerySchema tableOrQuery(conn, m_objectId);
  68. if (!tableOrQuery.table() && !tableOrQuery.query()) {
  69. //! @todo item not found
  70. return false;
  71. }
  72. TQString titleText(aTitleText.stripWhiteSpace());
  73. if (titleText.isEmpty())
  74. titleText = tableOrQuery.captionOrName();
  75. KexiSimplePrintingEngine engine(m_settings, this);
  76. TQString errorMessage;
  77. if (!engine.init(*conn, tableOrQuery, titleText, errorMessage)) {
  78. if (!errorMessage.isEmpty())
  79. KMessageBox::sorry(m_mainWin, errorMessage, i18n("Printing"));
  80. return false;
  81. }
  82. //setup printing
  83. #ifdef TQ_WS_WIN
  84. TQPrinter printer(TQPrinter::HighResolution);
  85. printer.setOrientation( m_settings.pageLayout.orientation == PG_PORTRAIT
  86. ? TQPrinter::Portrait : TQPrinter::Landscape );
  87. printer.setPageSize(
  88. (TQPrinter::PageSize)KoPageFormat::printerPageSize( m_settings.pageLayout.format ) );
  89. // "chicken-egg" problem:
  90. // we cannot use real from/to values in setMinMax() and setFromTo()
  91. // because page count is known after obtaining print settings
  92. printer.setFromTo(1,1);
  93. #else
  94. KPrinter printer;
  95. printer.setOrientation( m_settings.pageLayout.orientation == PG_PORTRAIT
  96. ? KPrinter::Portrait : KPrinter::Landscape );
  97. printer.setPageSize(
  98. (KPrinter::PageSize)KoPageFormat::printerPageSize( m_settings.pageLayout.format ) );
  99. #endif
  100. printer.setFullPage(true);
  101. TQString docName( titleText );
  102. printer.setDocName( docName );
  103. printer.setCreator(KEXI_APP_NAME);
  104. if ( !printer.setup( m_mainWin ) ) {
  105. return true;
  106. }
  107. // now we have final settings
  108. //! @todo get printer.pageOrder() (for reversed order requires improved engine)
  109. TQPainter painter;
  110. if (!painter.begin(&printer)) {
  111. //! @todo msg
  112. return false;
  113. }
  114. engine.calculatePagesCount(painter);
  115. uint loops, loopsPerPage;
  116. TQValueList<int> pagesToPrint;
  117. int fromPage = 0;
  118. #ifdef TQ_WS_WIN
  119. int toPage = 0;
  120. if (TQPrinter::PageRange == printer.printRange()) {
  121. fromPage = printer.fromPage();
  122. toPage = printer.toPage();
  123. }
  124. if (fromPage==0 || toPage==0) {
  125. fromPage = 0;
  126. toPage = (int)engine.pagesCount()-1;
  127. }
  128. else {
  129. fromPage--;
  130. if (toPage > (int)engine.pagesCount())
  131. toPage = (int)engine.pagesCount();
  132. toPage--;
  133. }
  134. // win32 only supports one range, build the list
  135. for (int i = fromPage; i<=toPage; i++) {
  136. pagesToPrint.append(i);
  137. }
  138. // on win32 the OS does perform buffering (only when collation is off, each copy needs to be repeated)
  139. loops = 1;
  140. loopsPerPage = printer.collateCopies() ? 1 : printer.numCopies();
  141. #else
  142. // on !win32 print TQPrinter::numCopies() times (the OS does not perform buffering)
  143. pagesToPrint = printer.pageList();
  144. kdDebug() << pagesToPrint << endl;
  145. if (pagesToPrint.isEmpty()) {
  146. fromPage = 0;
  147. for (int i = 0; i<(int)engine.pagesCount(); i++) {
  148. pagesToPrint.append(i);
  149. }
  150. }
  151. else
  152. fromPage = pagesToPrint.first();
  153. if (printer.collate()==KPrinter::Collate) {
  154. //collation: p1, p2,..pn; p1, p2,..pn; ......; p1, p2,..pn
  155. loops = printer.numCopies();
  156. loopsPerPage = 1;
  157. }
  158. else {
  159. //no collation: p1, p1, ..., p1; p2, p2, ..., p2; ......; pn, pn,..pn
  160. loops = 1;
  161. loopsPerPage = printer.numCopies();
  162. }
  163. //! @todo also look at printer.pageSet() option : all/odd/even pages
  164. #endif
  165. // now, total number of printed pages is printer.numCopies()*printer.pageList().count()
  166. kdDebug() << "printing..." << endl;
  167. bool firstPage = true;
  168. for (uint copy = 0;copy < loops; copy++) {
  169. kdDebug() << "copy " << (copy+1) << " of " << loops << endl;
  170. uint pageNumber = fromPage;
  171. TQValueList<int>::ConstIterator pagesIt = pagesToPrint.constBegin();
  172. for(;(int)pageNumber == fromPage || !engine.eof(); ++pageNumber) {
  173. kdDebug() << "printing..." << endl;
  174. if (pagesIt == pagesToPrint.constEnd()) //no more pages to print
  175. break;
  176. if ((int)pageNumber < *pagesIt) { //skip pages without printing (needed for computation)
  177. engine.paintPage(pageNumber, painter, false);
  178. continue;
  179. }
  180. if (*pagesIt < (int)pageNumber) { //sanity
  181. ++pagesIt;
  182. continue;
  183. }
  184. for (uint onePageCounter = 0; onePageCounter < loopsPerPage; onePageCounter++) {
  185. if (!firstPage)
  186. printer.newPage();
  187. else
  188. firstPage = false;
  189. kdDebug() << "page #" << pageNumber << endl;
  190. engine.paintPage(pageNumber, painter);
  191. }
  192. ++pagesIt;
  193. }
  194. }
  195. kdDebug() << "end of printing." << endl;
  196. // stop painting, this will automatically send the print data to the printer
  197. if (!painter.end())
  198. return false;
  199. if (!engine.done())
  200. return false;
  201. return true;
  202. }
  203. bool KexiSimplePrintingCommand::showPrintPreview(const KexiSimplePrintingSettings& settings,
  204. const TQString& aTitleText, bool reload)
  205. {
  206. m_settings = settings;
  207. if (!m_previewEngine)
  208. m_previewEngine = new KexiSimplePrintingEngine(m_settings, this);
  209. if (reload)
  210. m_printPreviewNeedsReloading = true;
  211. bool backToPage0 = true;
  212. TQString titleText(aTitleText.stripWhiteSpace());
  213. KexiDB::Connection *conn = m_mainWin->project()->dbConnection();
  214. KexiDB::TableOrQuerySchema tableOrQuery(conn, m_objectId);
  215. if (!tableOrQuery.table() && !tableOrQuery.query()) {
  216. //! @todo item not found
  217. return false;
  218. }
  219. if (titleText.isEmpty())
  220. titleText = tableOrQuery.captionOrName();
  221. if (!m_previewWindow || m_printPreviewNeedsReloading) {
  222. TQString errorMessage;
  223. if (!m_previewEngine->init(
  224. *conn, tableOrQuery, titleText, errorMessage)) {
  225. if (!errorMessage.isEmpty())
  226. KMessageBox::sorry(m_mainWin, errorMessage, i18n("Print Preview"));
  227. return false;
  228. }
  229. }
  230. if (!m_previewWindow) {
  231. backToPage0 = false;
  232. m_previewWindow = new KexiSimplePrintPreviewWindow(
  233. *m_previewEngine, tableOrQuery.captionOrName(), 0,
  234. TQt::WStyle_Customize|TQt::WStyle_NormalBorder|TQt::WStyle_Title|
  235. TQt::WStyle_SysMenu|TQt::WStyle_MinMax|TQt::WStyle_ContextHelp);
  236. connect(m_previewWindow, TQT_SIGNAL(printRequested()), this, TQT_SLOT(print()));
  237. connect(m_previewWindow, TQT_SIGNAL(pageSetupRequested()), this, TQT_SLOT(slotShowPageSetupRequested()));
  238. m_previewWindow->show();
  239. KDialog::centerOnScreen(m_previewWindow);
  240. m_printPreviewNeedsReloading = false;
  241. }
  242. if (m_printPreviewNeedsReloading) {//dirty
  243. m_previewEngine->clear();
  244. //! @todo progress bar...
  245. m_previewEngine->setTitleText( titleText );
  246. m_previewWindow->setFullWidth();
  247. m_previewWindow->updatePagesCount();
  248. m_printPreviewNeedsReloading = false;
  249. }
  250. if (backToPage0)
  251. m_previewWindow->goToPage(0);
  252. m_previewWindow->show();
  253. m_previewWindow->raise();
  254. // m_previewWindow->setPagesCount(INT_MAX); //will be properly set on demand
  255. return true;
  256. }
  257. void KexiSimplePrintingCommand::slotShowPageSetupRequested()
  258. {
  259. m_mainWin->raise();
  260. emit showPageSetupRequested( m_mainWin->project()->item( m_objectId ) );
  261. }
  262. /*void KexiSimplePrintingCommand::setPrintPreviewNeedsReloading()
  263. {
  264. m_printPreviewNeedsReloading = true;
  265. }*/
  266. //----------------------------------------------------------
  267. KexiSimplePrintingPageSetup::KexiSimplePrintingPageSetup( KexiMainWindow *mainWin, TQWidget *parent,
  268. TQMap<TQString,TQString>* args )
  269. : KexiViewBase( mainWin, parent, "KexiSimplePrintingPageSetup" )
  270. , m_settings( KexiSimplePrintingSettings::load() )
  271. // , m_command(0)
  272. {
  273. // object to print
  274. bool ok = args;
  275. int objectId;
  276. if (ok)
  277. objectId = (*args)["identifier"].toInt();
  278. ok = objectId<=0;
  279. m_item = mainWin->project()->item( objectId );
  280. ok = m_item;
  281. bool printPreview = false;
  282. bool print = false;
  283. bool pageSetup = false;
  284. if (ok) {
  285. printPreview = (*args)["action"]=="printPreview";
  286. print = (*args)["action"]=="print";
  287. pageSetup = (*args)["action"]=="pageSetup";
  288. ok = printPreview || print || pageSetup;
  289. }
  290. // settings
  291. //! @todo default?
  292. m_unit = TDELocale::Metric == TDEGlobal::locale()->measureSystem() ? KoUnit::U_CM : KoUnit::U_INCH;
  293. // GUI
  294. TQVBoxLayout *lyr = new TQVBoxLayout(this);
  295. m_contents = new KexiSimplePrintingPageSetupBase(this, "KexiSimplePrintingPageSetupBase");
  296. lyr->addWidget(m_contents);
  297. setViewWidget(m_contents, true);
  298. // setFocusPolicy(WheelFocus);
  299. m_contents->setFocusProxy(m_contents->headerTitleLineEdit);
  300. m_contents->printButton->setIconSet( KStdGuiItem::print().iconSet(TDEIcon::Small) );
  301. m_contents->printButton->setText( KStdGuiItem::print().text() );
  302. connect(m_contents->printButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(print()));
  303. m_contents->printPreviewButton->setIconSet( SmallIconSet("document-print-preview") );
  304. m_contents->printPreviewButton->setText( i18n("Print Previe&w...") );
  305. connect(m_contents->printPreviewButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(printPreview()));
  306. m_contents->iconLabel->setFixedWidth(32+6);
  307. m_contents->iconLabel->setPixmap( DesktopIcon("text-x-generic", 32) );
  308. TQWhatsThis::add(m_contents->headerTitleFontButton, i18n("Changes font for title text."));
  309. connect(m_contents->headerTitleFontButton, TQT_SIGNAL(clicked()),
  310. this, TQT_SLOT(slotChangeTitleFont()));
  311. if (m_item) {
  312. m_origCaptionLabelText = m_contents->captionLabel->text();
  313. m_contents->headerTitleLineEdit->setText( m_item->captionOrName() );
  314. if (m_item->mimeType()=="kexi/query") {
  315. m_contents->openDataLink->setText( i18n("Open This Query") );
  316. m_origCaptionLabelText = i18n("<h2>Page setup for printing \"%1\" query data</h2>");
  317. }
  318. m_contents->captionLabel->setText( m_origCaptionLabelText.arg(m_item->name()) );
  319. }
  320. connect(m_contents->headerTitleLineEdit,TQT_SIGNAL(textChanged(const TQString&)),
  321. this, TQT_SLOT(slotTitleTextChanged(const TQString&)));
  322. m_contents->headerTitleLineEdit->setFont( m_settings.pageTitleFont );
  323. TQWhatsThis::add(m_contents->openDataLink,
  324. i18n("Shows data for table or query associated with this page setup."));
  325. TQToolTip::add(m_contents->openDataLink,
  326. i18n("Shows data for table or query associated with this page setup."));
  327. connect(m_contents->openDataLink, TQT_SIGNAL(leftClickedURL()), this, TQT_SLOT(slotOpenData()));
  328. TQWhatsThis::add(m_contents->saveSetupLink, i18n("Saves settings for this setup as default."));
  329. connect(m_contents->saveSetupLink, TQT_SIGNAL(leftClickedURL()), this, TQT_SLOT(slotSaveSetup()));
  330. #if !KDE_IS_VERSION(3,5,1) && !defined(TQ_WS_WIN)
  331. //a fix for problems with focusable KUrlLabel on KDElibs<=3.5.0
  332. m_contents->openDataLink->setFocusPolicy(NoFocus);
  333. m_contents->saveSetupLink->setFocusPolicy(NoFocus);
  334. #endif
  335. TQWhatsThis::add(m_contents->addDateTimeCheckbox, i18n("Adds date and time to the header."));
  336. TQWhatsThis::add(m_contents->addPageNumbersCheckbox, i18n("Adds page numbers to the footer."));
  337. TQWhatsThis::add(m_contents->addTableBordersCheckbox, i18n("Adds table borders."));
  338. #ifdef KEXI_NO_UNFINISHED
  339. m_contents->addDateTimeCheckbox->hide();
  340. m_contents->addPageNumbersCheckbox->hide();
  341. #endif
  342. updatePageLayoutAndUnitInfo();
  343. TQWhatsThis::add(m_contents->changePageSizeAndMarginsButton,
  344. i18n("Changes page size and margins."));
  345. connect(m_contents->changePageSizeAndMarginsButton, TQT_SIGNAL(clicked()),
  346. this, TQT_SLOT(slotChangePageSizeAndMargins()));
  347. connect(m_contents->addPageNumbersCheckbox, TQT_SIGNAL(toggled(bool)),
  348. this, TQT_SLOT(slotAddPageNumbersCheckboxToggled(bool)));
  349. connect(m_contents->addDateTimeCheckbox, TQT_SIGNAL(toggled(bool)),
  350. this, TQT_SLOT(slotAddDateTimeCheckboxToggled(bool)));
  351. connect(m_contents->addTableBordersCheckbox, TQT_SIGNAL(toggled(bool)),
  352. this, TQT_SLOT(slotAddTableBordersCheckboxToggled(bool)));
  353. if (!ok) {
  354. // no data!
  355. setEnabled(false);
  356. }
  357. m_contents->addPageNumbersCheckbox->setChecked( m_settings.addPageNumbers );
  358. m_contents->addDateTimeCheckbox->setChecked( m_settings.addDateAndTime );
  359. m_contents->addTableBordersCheckbox->setChecked( m_settings.addTableBorders );
  360. setDirty(false);
  361. // m_engine = new KexiSimplePrintingEngine(m_settings, this);
  362. //clear it back to false after widgets initialization
  363. m_printPreviewNeedsReloading = false;
  364. /* if (printPreview)
  365. TQTimer::singleShot(50, this, TQT_SLOT(printPreview()));
  366. else if (print)
  367. TQTimer::singleShot(50, this, TQT_SLOT(print()));*/
  368. connect(this, TQT_SIGNAL(printItemRequested(KexiPart::Item*,const KexiSimplePrintingSettings&,
  369. const TQString&)),
  370. m_mainWin, TQT_SLOT(printItem(KexiPart::Item*,const KexiSimplePrintingSettings&,
  371. const TQString&)));
  372. connect(this, TQT_SIGNAL(printPreviewForItemRequested(KexiPart::Item*,
  373. const KexiSimplePrintingSettings&,const TQString&,bool)),
  374. m_mainWin, TQT_SLOT(printPreviewForItem(KexiPart::Item*,
  375. const KexiSimplePrintingSettings&,const TQString&,bool)));
  376. }
  377. KexiSimplePrintingPageSetup::~KexiSimplePrintingPageSetup()
  378. {
  379. }
  380. void KexiSimplePrintingPageSetup::slotSaveSetup()
  381. {
  382. m_settings.save();
  383. setDirty(false);
  384. }
  385. void KexiSimplePrintingPageSetup::updatePageLayoutAndUnitInfo()
  386. {
  387. TQString s;
  388. if (m_settings.pageLayout.format == PG_CUSTOM) {
  389. s += TQString(" (%1 %2 x %3 %4)")
  390. .arg(m_settings.pageLayout.ptWidth).arg(KoUnit::unitName(m_unit))
  391. .arg(m_settings.pageLayout.ptHeight).arg(KoUnit::unitName(m_unit));
  392. }
  393. else
  394. s += KoPageFormat::name(m_settings.pageLayout.format);
  395. s += TQString(", ")
  396. + (m_settings.pageLayout.orientation == PG_PORTRAIT ? i18n("Portrait") : i18n("Landscape"))
  397. + ", " + i18n("margins:")
  398. + " " + KoUnit::toUserStringValue(m_settings.pageLayout.ptLeft, m_unit)
  399. + "/" + KoUnit::toUserStringValue(m_settings.pageLayout.ptRight, m_unit)
  400. + "/" + KoUnit::toUserStringValue(m_settings.pageLayout.ptTop, m_unit)
  401. + "/" + KoUnit::toUserStringValue(m_settings.pageLayout.ptBottom, m_unit)
  402. + " " + KoUnit::unitName(m_unit);
  403. m_contents->pageSizeAndMarginsLabel->setText( s );
  404. }
  405. /*void KexiSimplePrintingPageSetup::setupPrintingCommand()
  406. {
  407. if (!m_command) {
  408. m_command = new KexiSimplePrintingCommand(
  409. m_mainWin, m_item->identifier(), m_settings, false/!owned/, this);
  410. }
  411. }*/
  412. void KexiSimplePrintingPageSetup::print()
  413. {
  414. // setupPrintingCommand();
  415. // m_command->print(m_contents->headerTitleLineEdit->text());
  416. emit printItemRequested(m_item, m_settings, m_contents->headerTitleLineEdit->text());
  417. }
  418. void KexiSimplePrintingPageSetup::printPreview()
  419. {
  420. // setupPrintingCommand();
  421. // m_command->showPrintPreview(m_contents->headerTitleLineEdit->text());
  422. emit printPreviewForItemRequested(m_item, m_settings,
  423. m_contents->headerTitleLineEdit->text(), m_printPreviewNeedsReloading);
  424. m_printPreviewNeedsReloading = false;
  425. }
  426. void KexiSimplePrintingPageSetup::slotOpenData()
  427. {
  428. bool openingCancelled;
  429. m_mainWin->openObject(m_item, Kexi::DataViewMode, openingCancelled);
  430. }
  431. void KexiSimplePrintingPageSetup::slotTitleTextChanged(const TQString&)
  432. {
  433. if (m_contents->headerTitleLineEdit->isModified()) {
  434. m_printPreviewNeedsReloading = true;
  435. // if (m_command)
  436. // m_command->setPrintPreviewNeedsReloading();
  437. }
  438. m_contents->headerTitleLineEdit->clearModified();
  439. }
  440. void KexiSimplePrintingPageSetup::slotChangeTitleFont()
  441. {
  442. if (TQDialog::Accepted != TDEFontDialog::getFont(m_settings.pageTitleFont, false, this))
  443. return;
  444. m_contents->headerTitleLineEdit->setFont( m_settings.pageTitleFont );
  445. setDirty(true);
  446. }
  447. void KexiSimplePrintingPageSetup::slotChangePageSizeAndMargins()
  448. {
  449. KoHeadFoot headfoot; //dummy
  450. if (int(TQDialog::Accepted) != KoPageLayoutDia::pageLayout(
  451. m_settings.pageLayout, headfoot, FORMAT_AND_BORDERS | DISABLE_UNIT, m_unit, this ))
  452. return;
  453. //update
  454. updatePageLayoutAndUnitInfo();
  455. setDirty(true);
  456. }
  457. void KexiSimplePrintingPageSetup::setDirty(bool set)
  458. {
  459. m_contents->saveSetupLink->setEnabled(set);
  460. // if (m_command)
  461. // m_command->setPrintPreviewNeedsReloading();
  462. if (set)
  463. m_printPreviewNeedsReloading = true;
  464. }
  465. void KexiSimplePrintingPageSetup::slotAddPageNumbersCheckboxToggled(bool set)
  466. {
  467. m_settings.addPageNumbers = set;
  468. setDirty(true);
  469. }
  470. void KexiSimplePrintingPageSetup::slotAddDateTimeCheckboxToggled(bool set)
  471. {
  472. m_settings.addDateAndTime = set;
  473. setDirty(true);
  474. }
  475. void KexiSimplePrintingPageSetup::slotAddTableBordersCheckboxToggled(bool set)
  476. {
  477. m_settings.addTableBorders = set;
  478. setDirty(true);
  479. }
  480. #include "kexisimpleprintingpagesetup.moc"