diff options
Diffstat (limited to 'kexi/main/printing/kexisimpleprintingpagesetup.cpp')
-rw-r--r-- | kexi/main/printing/kexisimpleprintingpagesetup.cpp | 162 |
1 files changed, 81 insertions, 81 deletions
diff --git a/kexi/main/printing/kexisimpleprintingpagesetup.cpp b/kexi/main/printing/kexisimpleprintingpagesetup.cpp index 5d20f36e..f528cb23 100644 --- a/kexi/main/printing/kexisimpleprintingpagesetup.cpp +++ b/kexi/main/printing/kexisimpleprintingpagesetup.cpp @@ -36,27 +36,27 @@ #include <kpushbutton.h> #include <kdeversion.h> -#include <qlabel.h> -#include <qtimer.h> -#include <qlayout.h> -#include <qpainter.h> -#include <qcheckbox.h> -#include <qwhatsthis.h> -#include <qtooltip.h> +#include <tqlabel.h> +#include <tqtimer.h> +#include <tqlayout.h> +#include <tqpainter.h> +#include <tqcheckbox.h> +#include <tqwhatsthis.h> +#include <tqtooltip.h> #include <kexiutils/tristate.h> KexiSimplePrintingCommand::KexiSimplePrintingCommand( - KexiMainWindow* mainWin, int objectId, QObject* parent) - : QObject(parent, "KexiSimplePrintCommand") + KexiMainWindow* mainWin, int objectId, TQObject* tqparent) + : TQObject(tqparent, "KexiSimplePrintCommand") , m_previewEngine(0) , m_mainWin(mainWin) , m_objectId(objectId) , m_previewWindow(0) , m_printPreviewNeedsReloading(false) { - connect(this, SIGNAL(showPageSetupRequested(KexiPart::Item*)), - m_mainWin, SLOT(showPageSetupForItem(KexiPart::Item*))); + connect(this, TQT_SIGNAL(showPageSetupRequested(KexiPart::Item*)), + m_mainWin, TQT_SLOT(showPageSetupForItem(KexiPart::Item*))); } KexiSimplePrintingCommand::~KexiSimplePrintingCommand() @@ -68,13 +68,13 @@ KexiSimplePrintingCommand::~KexiSimplePrintingCommand() bool KexiSimplePrintingCommand::print(const KexiSimplePrintingSettings& settings, - const QString& aTitleText) + const TQString& aTitleText) { m_settings = settings; return print(aTitleText); } -bool KexiSimplePrintingCommand::print(const QString& aTitleText) +bool KexiSimplePrintingCommand::print(const TQString& aTitleText) { KexiDB::Connection *conn = m_mainWin->project()->dbConnection(); KexiDB::TableOrQuerySchema tableOrQuery(conn, m_objectId); @@ -82,12 +82,12 @@ bool KexiSimplePrintingCommand::print(const QString& aTitleText) //! @todo item not found return false; } - QString titleText(aTitleText.stripWhiteSpace()); + TQString titleText(aTitleText.stripWhiteSpace()); if (titleText.isEmpty()) titleText = tableOrQuery.captionOrName(); KexiSimplePrintingEngine engine(m_settings, this); - QString errorMessage; + TQString errorMessage; if (!engine.init(*conn, tableOrQuery, titleText, errorMessage)) { if (!errorMessage.isEmpty()) KMessageBox::sorry(m_mainWin, errorMessage, i18n("Printing")); @@ -95,12 +95,12 @@ bool KexiSimplePrintingCommand::print(const QString& aTitleText) } //setup printing -#ifdef Q_WS_WIN - QPrinter printer(QPrinter::HighResolution); +#ifdef TQ_WS_WIN + TQPrinter printer(TQPrinter::HighResolution); printer.setOrientation( m_settings.pageLayout.orientation == PG_PORTRAIT - ? QPrinter::Portrait : QPrinter::Landscape ); + ? TQPrinter::Portrait : TQPrinter::Landscape ); printer.setPageSize( - (QPrinter::PageSize)KoPageFormat::printerPageSize( m_settings.pageLayout.format ) ); + (TQPrinter::PageSize)KoPageFormat::printerPageSize( m_settings.pageLayout.format ) ); // "chicken-egg" problem: // we cannot use real from/to values in setMinMax() and setFromTo() @@ -115,7 +115,7 @@ bool KexiSimplePrintingCommand::print(const QString& aTitleText) #endif printer.setFullPage(true); - QString docName( titleText ); + TQString docName( titleText ); printer.setDocName( docName ); printer.setCreator(KEXI_APP_NAME); if ( !printer.setup( m_mainWin ) ) { @@ -125,7 +125,7 @@ bool KexiSimplePrintingCommand::print(const QString& aTitleText) // now we have final settings //! @todo get printer.pageOrder() (for reversed order requires improved engine) - QPainter painter; + TQPainter painter; if (!painter.begin(&printer)) { //! @todo msg @@ -134,11 +134,11 @@ bool KexiSimplePrintingCommand::print(const QString& aTitleText) engine.calculatePagesCount(painter); uint loops, loopsPerPage; - QValueList<int> pagesToPrint; + TQValueList<int> pagesToPrint; int fromPage = 0; -#ifdef Q_WS_WIN +#ifdef TQ_WS_WIN int toPage = 0; - if (QPrinter::PageRange == printer.printRange()) { + if (TQPrinter::PageRange == printer.printRange()) { fromPage = printer.fromPage(); toPage = printer.toPage(); } @@ -160,7 +160,7 @@ bool KexiSimplePrintingCommand::print(const QString& aTitleText) loops = 1; loopsPerPage = printer.collateCopies() ? 1 : printer.numCopies(); #else - // on !win32 print QPrinter::numCopies() times (the OS does not perform buffering) + // on !win32 print TQPrinter::numCopies() times (the OS does not perform buffering) pagesToPrint = printer.pageList(); kdDebug() << pagesToPrint << endl; if (pagesToPrint.isEmpty()) { @@ -190,7 +190,7 @@ bool KexiSimplePrintingCommand::print(const QString& aTitleText) for (uint copy = 0;copy < loops; copy++) { kdDebug() << "copy " << (copy+1) << " of " << loops << endl; uint pageNumber = fromPage; - QValueList<int>::ConstIterator pagesIt = pagesToPrint.constBegin(); + TQValueList<int>::ConstIterator pagesIt = pagesToPrint.constBegin(); for(;(int)pageNumber == fromPage || !engine.eof(); ++pageNumber) { kdDebug() << "printing..." << endl; if (pagesIt == pagesToPrint.constEnd()) //no more pages to print @@ -227,7 +227,7 @@ bool KexiSimplePrintingCommand::print(const QString& aTitleText) } bool KexiSimplePrintingCommand::showPrintPreview(const KexiSimplePrintingSettings& settings, - const QString& aTitleText, bool reload) + const TQString& aTitleText, bool reload) { m_settings = settings; if (!m_previewEngine) @@ -237,7 +237,7 @@ bool KexiSimplePrintingCommand::showPrintPreview(const KexiSimplePrintingSetting m_printPreviewNeedsReloading = true; bool backToPage0 = true; - QString titleText(aTitleText.stripWhiteSpace()); + TQString titleText(aTitleText.stripWhiteSpace()); KexiDB::Connection *conn = m_mainWin->project()->dbConnection(); KexiDB::TableOrQuerySchema tableOrQuery(conn, m_objectId); if (!tableOrQuery.table() && !tableOrQuery.query()) { @@ -247,7 +247,7 @@ bool KexiSimplePrintingCommand::showPrintPreview(const KexiSimplePrintingSetting if (titleText.isEmpty()) titleText = tableOrQuery.captionOrName(); if (!m_previewWindow || m_printPreviewNeedsReloading) { - QString errorMessage; + TQString errorMessage; if (!m_previewEngine->init( *conn, tableOrQuery, titleText, errorMessage)) { if (!errorMessage.isEmpty()) @@ -259,10 +259,10 @@ bool KexiSimplePrintingCommand::showPrintPreview(const KexiSimplePrintingSetting backToPage0 = false; m_previewWindow = new KexiSimplePrintPreviewWindow( *m_previewEngine, tableOrQuery.captionOrName(), 0, - Qt::WStyle_Customize|Qt::WStyle_NormalBorder|Qt::WStyle_Title| - Qt::WStyle_SysMenu|Qt::WStyle_MinMax|Qt::WStyle_ContextHelp); - connect(m_previewWindow, SIGNAL(printRequested()), this, SLOT(print())); - connect(m_previewWindow, SIGNAL(pageSetupRequested()), this, SLOT(slotShowPageSetupRequested())); + TQt::WStyle_Customize|TQt::WStyle_NormalBorder|TQt::WStyle_Title| + TQt::WStyle_SysMenu|TQt::WStyle_MinMax|TQt::WStyle_ContextHelp); + connect(m_previewWindow, TQT_SIGNAL(printRequested()), this, TQT_SLOT(print())); + connect(m_previewWindow, TQT_SIGNAL(pageSetupRequested()), this, TQT_SLOT(slotShowPageSetupRequested())); m_previewWindow->show(); KDialog::centerOnScreen(m_previewWindow); m_printPreviewNeedsReloading = false; @@ -297,9 +297,9 @@ void KexiSimplePrintingCommand::slotShowPageSetupRequested() //---------------------------------------------------------- -KexiSimplePrintingPageSetup::KexiSimplePrintingPageSetup( KexiMainWindow *mainWin, QWidget *parent, - QMap<QString,QString>* args ) - : KexiViewBase( mainWin, parent, "KexiSimplePrintingPageSetup" ) +KexiSimplePrintingPageSetup::KexiSimplePrintingPageSetup( KexiMainWindow *mainWin, TQWidget *tqparent, + TQMap<TQString,TQString>* args ) + : KexiViewBase( mainWin, tqparent, "KexiSimplePrintingPageSetup" ) , m_settings( KexiSimplePrintingSettings::load() ) // , m_command(0) { @@ -327,7 +327,7 @@ KexiSimplePrintingPageSetup::KexiSimplePrintingPageSetup( KexiMainWindow *mainWi m_unit = KLocale::Metric == KGlobal::locale()->measureSystem() ? KoUnit::U_CM : KoUnit::U_INCH; // GUI - QVBoxLayout *lyr = new QVBoxLayout(this); + TQVBoxLayout *lyr = new TQVBoxLayout(this); m_contents = new KexiSimplePrintingPageSetupBase(this, "KexiSimplePrintingPageSetupBase"); lyr->addWidget(m_contents); @@ -337,17 +337,17 @@ KexiSimplePrintingPageSetup::KexiSimplePrintingPageSetup( KexiMainWindow *mainWi m_contents->printButton->setIconSet( KStdGuiItem::print().iconSet(KIcon::Small) ); m_contents->printButton->setText( KStdGuiItem::print().text() ); - connect(m_contents->printButton, SIGNAL(clicked()), this, SLOT(print())); + connect(m_contents->printButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(print())); m_contents->printPreviewButton->setIconSet( SmallIconSet("filequickprint") ); m_contents->printPreviewButton->setText( i18n("Print Previe&w...") ); - connect(m_contents->printPreviewButton, SIGNAL(clicked()), this, SLOT(printPreview())); + connect(m_contents->printPreviewButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(printPreview())); m_contents->iconLabel->setFixedWidth(32+6); m_contents->iconLabel->setPixmap( DesktopIcon("document", 32) ); - QWhatsThis::add(m_contents->headerTitleFontButton, i18n("Changes font for title text.")); - connect(m_contents->headerTitleFontButton, SIGNAL(clicked()), - this, SLOT(slotChangeTitleFont())); + TQWhatsThis::add(m_contents->headerTitleFontButton, i18n("Changes font for title text.")); + connect(m_contents->headerTitleFontButton, TQT_SIGNAL(clicked()), + this, TQT_SLOT(slotChangeTitleFont())); if (m_item) { m_origCaptionLabelText = m_contents->captionLabel->text(); @@ -356,29 +356,29 @@ KexiSimplePrintingPageSetup::KexiSimplePrintingPageSetup( KexiMainWindow *mainWi m_contents->openDataLink->setText( i18n("Open This Query") ); m_origCaptionLabelText = i18n("<h2>Page setup for printing \"%1\" query data</h2>"); } - m_contents->captionLabel->setText( m_origCaptionLabelText.arg(m_item->name()) ); + m_contents->captionLabel->setText( m_origCaptionLabelText.tqarg(m_item->name()) ); } - connect(m_contents->headerTitleLineEdit,SIGNAL(textChanged(const QString&)), - this, SLOT(slotTitleTextChanged(const QString&))); + connect(m_contents->headerTitleLineEdit,TQT_SIGNAL(textChanged(const TQString&)), + this, TQT_SLOT(slotTitleTextChanged(const TQString&))); m_contents->headerTitleLineEdit->setFont( m_settings.pageTitleFont ); - QWhatsThis::add(m_contents->openDataLink, + TQWhatsThis::add(m_contents->openDataLink, i18n("Shows data for table or query associated with this page setup.")); - QToolTip::add(m_contents->openDataLink, + TQToolTip::add(m_contents->openDataLink, i18n("Shows data for table or query associated with this page setup.")); - connect(m_contents->openDataLink, SIGNAL(leftClickedURL()), this, SLOT(slotOpenData())); + connect(m_contents->openDataLink, TQT_SIGNAL(leftClickedURL()), this, TQT_SLOT(slotOpenData())); - QWhatsThis::add(m_contents->saveSetupLink, i18n("Saves settings for this setup as default.")); - connect(m_contents->saveSetupLink, SIGNAL(leftClickedURL()), this, SLOT(slotSaveSetup())); -#if !KDE_IS_VERSION(3,5,1) && !defined(Q_WS_WIN) + TQWhatsThis::add(m_contents->saveSetupLink, i18n("Saves settings for this setup as default.")); + connect(m_contents->saveSetupLink, TQT_SIGNAL(leftClickedURL()), this, TQT_SLOT(slotSaveSetup())); +#if !KDE_IS_VERSION(3,5,1) && !defined(TQ_WS_WIN) //a fix for problems with focusable KUrlLabel on KDElibs<=3.5.0 m_contents->openDataLink->setFocusPolicy(NoFocus); m_contents->saveSetupLink->setFocusPolicy(NoFocus); #endif - QWhatsThis::add(m_contents->addDateTimeCheckbox, i18n("Adds date and time to the header.")); - QWhatsThis::add(m_contents->addPageNumbersCheckbox, i18n("Adds page numbers to the footer.")); - QWhatsThis::add(m_contents->addTableBordersCheckbox, i18n("Adds table borders.")); + TQWhatsThis::add(m_contents->addDateTimeCheckbox, i18n("Adds date and time to the header.")); + TQWhatsThis::add(m_contents->addPageNumbersCheckbox, i18n("Adds page numbers to the footer.")); + TQWhatsThis::add(m_contents->addTableBordersCheckbox, i18n("Adds table borders.")); #ifdef KEXI_NO_UNFINISHED m_contents->addDateTimeCheckbox->hide(); @@ -386,17 +386,17 @@ KexiSimplePrintingPageSetup::KexiSimplePrintingPageSetup( KexiMainWindow *mainWi #endif updatePageLayoutAndUnitInfo(); - QWhatsThis::add(m_contents->changePageSizeAndMarginsButton, + TQWhatsThis::add(m_contents->changePageSizeAndMarginsButton, i18n("Changes page size and margins.")); - connect(m_contents->changePageSizeAndMarginsButton, SIGNAL(clicked()), - this, SLOT(slotChangePageSizeAndMargins())); + connect(m_contents->changePageSizeAndMarginsButton, TQT_SIGNAL(clicked()), + this, TQT_SLOT(slotChangePageSizeAndMargins())); - connect(m_contents->addPageNumbersCheckbox, SIGNAL(toggled(bool)), - this, SLOT(slotAddPageNumbersCheckboxToggled(bool))); - connect(m_contents->addDateTimeCheckbox, SIGNAL(toggled(bool)), - this, SLOT(slotAddDateTimeCheckboxToggled(bool))); - connect(m_contents->addTableBordersCheckbox, SIGNAL(toggled(bool)), - this, SLOT(slotAddTableBordersCheckboxToggled(bool))); + connect(m_contents->addPageNumbersCheckbox, TQT_SIGNAL(toggled(bool)), + this, TQT_SLOT(slotAddPageNumbersCheckboxToggled(bool))); + connect(m_contents->addDateTimeCheckbox, TQT_SIGNAL(toggled(bool)), + this, TQT_SLOT(slotAddDateTimeCheckboxToggled(bool))); + connect(m_contents->addTableBordersCheckbox, TQT_SIGNAL(toggled(bool)), + this, TQT_SLOT(slotAddTableBordersCheckboxToggled(bool))); if (!ok) { // no data! @@ -414,17 +414,17 @@ KexiSimplePrintingPageSetup::KexiSimplePrintingPageSetup( KexiMainWindow *mainWi m_printPreviewNeedsReloading = false; /* if (printPreview) - QTimer::singleShot(50, this, SLOT(printPreview())); + TQTimer::singleShot(50, this, TQT_SLOT(printPreview())); else if (print) - QTimer::singleShot(50, this, SLOT(print()));*/ - connect(this, SIGNAL(printItemRequested(KexiPart::Item*,const KexiSimplePrintingSettings&, - const QString&)), - m_mainWin, SLOT(printItem(KexiPart::Item*,const KexiSimplePrintingSettings&, - const QString&))); - connect(this, SIGNAL(printPreviewForItemRequested(KexiPart::Item*, - const KexiSimplePrintingSettings&,const QString&,bool)), - m_mainWin, SLOT(printPreviewForItem(KexiPart::Item*, - const KexiSimplePrintingSettings&,const QString&,bool))); + TQTimer::singleShot(50, this, TQT_SLOT(print()));*/ + connect(this, TQT_SIGNAL(printItemRequested(KexiPart::Item*,const KexiSimplePrintingSettings&, + const TQString&)), + m_mainWin, TQT_SLOT(printItem(KexiPart::Item*,const KexiSimplePrintingSettings&, + const TQString&))); + connect(this, TQT_SIGNAL(printPreviewForItemRequested(KexiPart::Item*, + const KexiSimplePrintingSettings&,const TQString&,bool)), + m_mainWin, TQT_SLOT(printPreviewForItem(KexiPart::Item*, + const KexiSimplePrintingSettings&,const TQString&,bool))); } KexiSimplePrintingPageSetup::~KexiSimplePrintingPageSetup() @@ -439,15 +439,15 @@ void KexiSimplePrintingPageSetup::slotSaveSetup() void KexiSimplePrintingPageSetup::updatePageLayoutAndUnitInfo() { - QString s; + TQString s; if (m_settings.pageLayout.format == PG_CUSTOM) { - s += QString(" (%1 %2 x %3 %4)") - .arg(m_settings.pageLayout.ptWidth).arg(KoUnit::unitName(m_unit)) - .arg(m_settings.pageLayout.ptHeight).arg(KoUnit::unitName(m_unit)); + s += TQString(" (%1 %2 x %3 %4)") + .tqarg(m_settings.pageLayout.ptWidth).tqarg(KoUnit::unitName(m_unit)) + .tqarg(m_settings.pageLayout.ptHeight).tqarg(KoUnit::unitName(m_unit)); } else s += KoPageFormat::name(m_settings.pageLayout.format); - s += QString(", ") + s += TQString(", ") + (m_settings.pageLayout.orientation == PG_PORTRAIT ? i18n("Portrait") : i18n("Landscape")) + ", " + i18n("margins:") + " " + KoUnit::toUserStringValue(m_settings.pageLayout.ptLeft, m_unit) @@ -488,7 +488,7 @@ void KexiSimplePrintingPageSetup::slotOpenData() m_mainWin->openObject(m_item, Kexi::DataViewMode, openingCancelled); } -void KexiSimplePrintingPageSetup::slotTitleTextChanged(const QString&) +void KexiSimplePrintingPageSetup::slotTitleTextChanged(const TQString&) { if (m_contents->headerTitleLineEdit->isModified()) { m_printPreviewNeedsReloading = true; @@ -501,7 +501,7 @@ void KexiSimplePrintingPageSetup::slotTitleTextChanged(const QString&) void KexiSimplePrintingPageSetup::slotChangeTitleFont() { - if (QDialog::Accepted != KFontDialog::getFont(m_settings.pageTitleFont, false, this)) + if (TQDialog::Accepted != KFontDialog::getFont(m_settings.pageTitleFont, false, this)) return; m_contents->headerTitleLineEdit->setFont( m_settings.pageTitleFont ); setDirty(true); @@ -511,7 +511,7 @@ void KexiSimplePrintingPageSetup::slotChangePageSizeAndMargins() { KoHeadFoot headfoot; //dummy - if (int(QDialog::Accepted) != KoPageLayoutDia::pageLayout( + if (int(TQDialog::Accepted) != KoPageLayoutDia::pageLayout( m_settings.pageLayout, headfoot, FORMAT_AND_BORDERS | DISABLE_UNIT, m_unit, this )) return; |