diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-02 06:40:27 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-02 06:40:27 +0000 |
commit | 2595a15ebeb6fc46b7cb241d01ec0c2460ec2111 (patch) | |
tree | 18a8f0f4ac5a86dacfa74c3537551ec39bc85e75 /src/reportdialog.cpp | |
parent | 1d90725a4001fab9d3922b2cbcceeee5e2d1686f (diff) | |
download | tellico-2595a15ebeb6fc46b7cb241d01ec0c2460ec2111.tar.gz tellico-2595a15ebeb6fc46b7cb241d01ec0c2460ec2111.zip |
TQt4 port tellico
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/tellico@1239054 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/reportdialog.cpp')
-rw-r--r-- | src/reportdialog.cpp | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/src/reportdialog.cpp b/src/reportdialog.cpp index ee879de..cfdfe8b 100644 --- a/src/reportdialog.cpp +++ b/src/reportdialog.cpp @@ -35,11 +35,11 @@ #include <ksortablevaluelist.h> #include <kfiledialog.h> -#include <qlayout.h> -#include <qfile.h> -#include <qlabel.h> -#include <qfileinfo.h> -#include <qtimer.h> +#include <tqlayout.h> +#include <tqfile.h> +#include <tqlabel.h> +#include <tqfileinfo.h> +#include <tqtimer.h> namespace { static const int REPORT_MIN_WIDTH = 600; @@ -49,50 +49,50 @@ namespace { using Tellico::ReportDialog; // default button is going to be used as a print button, so it's separated -ReportDialog::ReportDialog(QWidget* parent_, const char* name_/*=0*/) - : KDialogBase(parent_, name_, false, i18n("Collection Report"), Close, Close), +ReportDialog::ReportDialog(TQWidget* tqparent_, const char* name_/*=0*/) + : KDialogBase(tqparent_, name_, false, i18n("Collection Report"), Close, Close), m_exporter(0) { - QWidget* mainWidget = new QWidget(this, "ReportDialog mainWidget"); + TQWidget* mainWidget = new TQWidget(this, "ReportDialog mainWidget"); setMainWidget(mainWidget); - QVBoxLayout* topLayout = new QVBoxLayout(mainWidget, 0, KDialog::spacingHint()); + TQVBoxLayout* topLayout = new TQVBoxLayout(mainWidget, 0, KDialog::spacingHint()); - QHBoxLayout* hlay = new QHBoxLayout(topLayout); - QLabel* l = new QLabel(i18n("&Report template:"), mainWidget); + TQHBoxLayout* hlay = new TQHBoxLayout(topLayout); + TQLabel* l = new TQLabel(i18n("&Report template:"), mainWidget); hlay->addWidget(l); -// KStandardDirs::findAllResources(const char *type, const QString &filter, bool recursive, bool uniq) - QStringList files = KGlobal::dirs()->findAllResources("appdata", QString::fromLatin1("report-templates/*.xsl"), +// KStandardDirs::findAllResources(const char *type, const TQString &filter, bool recursive, bool uniq) + TQStringList files = KGlobal::dirs()->findAllResources("appdata", TQString::tqfromLatin1("report-templates/*.xsl"), false, true); - KSortableValueList<QString, QString> templates; - for(QStringList::ConstIterator it = files.begin(); it != files.end(); ++it) { - QFileInfo fi(*it); - QString file = fi.fileName(); - QString name = file.section('.', 0, -2); - name.replace('_', ' '); - QString title = i18n((name + QString::fromLatin1(" XSL Template")).utf8(), name.utf8()); + KSortableValueList<TQString, TQString> templates; + for(TQStringList::ConstIterator it = files.begin(); it != files.end(); ++it) { + TQFileInfo fi(*it); + TQString file = fi.fileName(); + TQString name = file.section('.', 0, -2); + name.tqreplace('_', ' '); + TQString title = i18n((name + TQString::tqfromLatin1(" XSL Template")).utf8(), name.utf8()); templates.insert(title, file); } templates.sort(); m_templateCombo = new GUI::ComboBox(mainWidget); - for(KSortableValueList<QString, QString>::iterator it = templates.begin(); it != templates.end(); ++it) { + for(KSortableValueList<TQString, TQString>::iterator it = templates.begin(); it != templates.end(); ++it) { m_templateCombo->insertItem((*it).index(), (*it).value()); } hlay->addWidget(m_templateCombo); l->setBuddy(m_templateCombo); - KPushButton* pb1 = new KPushButton(SmallIconSet(QString::fromLatin1("exec")), i18n("&Generate"), mainWidget); + KPushButton* pb1 = new KPushButton(SmallIconSet(TQString::tqfromLatin1("exec")), i18n("&Generate"), mainWidget); hlay->addWidget(pb1); - connect(pb1, SIGNAL(clicked()), SLOT(slotGenerate())); + connect(pb1, TQT_SIGNAL(clicked()), TQT_SLOT(slotGenerate())); hlay->addStretch(); KPushButton* pb2 = new KPushButton(KStdGuiItem::saveAs(), mainWidget); hlay->addWidget(pb2); - connect(pb2, SIGNAL(clicked()), SLOT(slotSaveAs())); + connect(pb2, TQT_SIGNAL(clicked()), TQT_SLOT(slotSaveAs())); KPushButton* pb3 = new KPushButton(KStdGuiItem::print(), mainWidget); hlay->addWidget(pb3); - connect(pb3, SIGNAL(clicked()), SLOT(slotPrint())); + connect(pb3, TQT_SIGNAL(clicked()), TQT_SLOT(slotPrint())); m_HTMLPart = new KHTMLPart(mainWidget); m_HTMLPart->setJScriptEnabled(false); @@ -101,33 +101,33 @@ ReportDialog::ReportDialog(QWidget* parent_, const char* name_/*=0*/) m_HTMLPart->setPluginsEnabled(false); topLayout->addWidget(m_HTMLPart->view()); - QString text = QString::fromLatin1("<html><style>p{font-weight:bold;width:50%;" + TQString text = TQString::tqfromLatin1("<html><style>p{font-weight:bold;width:50%;" "margin:20% auto auto auto;text-align:center;" - "background:white;color:%1;}</style><body><p>").arg(contrastColor.name()) + "background:white;color:%1;}</style><body><p>").tqarg(contrastColor.name()) + i18n("Select a report template and click <em>Generate</em>.") + ' ' + i18n("Some reports may take several seconds to generate for large collections."); - + QString::fromLatin1("</p></body></html>"); + + TQString::tqfromLatin1("</p></body></html>"); m_HTMLPart->begin(); m_HTMLPart->write(text); m_HTMLPart->end(); - setMinimumWidth(QMAX(minimumWidth(), REPORT_MIN_WIDTH)); - setMinimumHeight(QMAX(minimumHeight(), REPORT_MIN_HEIGHT)); - resize(configDialogSize(QString::fromLatin1("Report Dialog Options"))); + setMinimumWidth(TQMAX(minimumWidth(), REPORT_MIN_WIDTH)); + setMinimumHeight(TQMAX(minimumHeight(), REPORT_MIN_HEIGHT)); + resize(configDialogSize(TQString::tqfromLatin1("Report Dialog Options"))); } ReportDialog::~ReportDialog() { delete m_exporter; m_exporter = 0; - saveDialogSize(QString::fromLatin1("Report Dialog Options")); + saveDialogSize(TQString::tqfromLatin1("Report Dialog Options")); } void ReportDialog::slotGenerate() { - GUI::CursorSaver cs(Qt::waitCursor); + GUI::CursorSaver cs(TQt::waitCursor); - QString fileName = QString::fromLatin1("report-templates/") + m_templateCombo->currentData().toString(); - QString xsltFile = locate("appdata", fileName); + TQString fileName = TQString::tqfromLatin1("report-templates/") + m_templateCombo->currentData().toString(); + TQString xsltFile = locate("appdata", fileName); if(xsltFile.isEmpty()) { kdWarning() << "ReportDialog::setXSLTFile() - can't locate " << m_templateCombo->currentData().toString() << endl; return; @@ -174,16 +174,16 @@ void ReportDialog::slotRefresh() { m_HTMLPart->begin(u); m_HTMLPart->write(m_exporter->text()); #if 0 - QFile f(QString::fromLatin1("/tmp/test.html")); + TQFile f(TQString::tqfromLatin1("/tmp/test.html")); if(f.open(IO_WriteOnly)) { - QTextStream t(&f); + TQTextStream t(&f); t << m_exporter->text(); } f.close(); #endif m_HTMLPart->end(); // is this needed? -// view()->layout(); +// view()->tqlayout(); } // actually the print button @@ -192,8 +192,8 @@ void ReportDialog::slotPrint() { } void ReportDialog::slotSaveAs() { - QString filter = i18n("*.html|HTML Files (*.html)") + QChar('\n') + i18n("*|All Files"); - KURL u = KFileDialog::getSaveURL(QString::null, filter, this); + TQString filter = i18n("*.html|HTML Files (*.html)") + TQChar('\n') + i18n("*|All Files"); + KURL u = KFileDialog::getSaveURL(TQString(), filter, this); if(!u.isEmpty() && u.isValid()) { KConfigGroup config(KGlobal::config(), "ExportOptions"); bool encode = config.readBoolEntry("EncodeUTF8", true); |