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/translators/csvexporter.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/translators/csvexporter.cpp')
-rw-r--r-- | src/translators/csvexporter.cpp | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/src/translators/csvexporter.cpp b/src/translators/csvexporter.cpp index bb206e1..4d4d32e 100644 --- a/src/translators/csvexporter.cpp +++ b/src/translators/csvexporter.cpp @@ -21,38 +21,38 @@ #include <klineedit.h> #include <kconfig.h> -#include <qgroupbox.h> -#include <qcheckbox.h> -#include <qlayout.h> -#include <qbuttongroup.h> -#include <qradiobutton.h> -#include <qwhatsthis.h> +#include <tqgroupbox.h> +#include <tqcheckbox.h> +#include <tqlayout.h> +#include <tqbuttongroup.h> +#include <tqradiobutton.h> +#include <tqwhatsthis.h> using Tellico::Export::CSVExporter; CSVExporter::CSVExporter() : Tellico::Export::Exporter(), m_includeTitles(true), - m_delimiter(QChar(',')), + m_delimiter(TQChar(',')), m_widget(0) { } -QString CSVExporter::formatString() const { +TQString CSVExporter::formatString() const { return i18n("CSV"); } -QString CSVExporter::fileFilter() const { - return i18n("*.csv|CSV Files (*.csv)") + QChar('\n') + i18n("*|All Files"); +TQString CSVExporter::fileFilter() const { + return i18n("*.csv|CSV Files (*.csv)") + TQChar('\n') + i18n("*|All Files"); } -QString& CSVExporter::escapeText(QString& text_) { +TQString& CSVExporter::escapeText(TQString& text_) { bool quotes = false; - if(text_.find('"') != -1) { + if(text_.tqfind('"') != -1) { quotes = true; // quotation marks will be escaped by using a double pair - text_.replace('"', QString::fromLatin1("\"\"")); + text_.tqreplace('"', TQString::tqfromLatin1("\"\"")); } // if the text contains quotes or the delimiter, it needs to be surrounded by quotes - if(quotes || text_.find(m_delimiter) != -1) { + if(quotes || text_.tqfind(m_delimiter) != -1) { text_.prepend('"'); text_.append('"'); } @@ -64,14 +64,14 @@ bool CSVExporter::exec() { return false; } - QString text; + TQString text; Data::FieldVec fields = collection()->fields(); Data::FieldVec::Iterator fIt; if(m_includeTitles) { for(fIt = fields.begin(); fIt != fields.end(); ++fIt) { - QString title = fIt->title(); + TQString title = fIt->title(); text += escapeText(title); if(!fIt.nextEnd()) { text += m_delimiter; @@ -82,7 +82,7 @@ bool CSVExporter::exec() { bool format = options() & Export::ExportFormatted; - QString tmp; + TQString tmp; for(Data::EntryVec::ConstIterator entryIt = entries().begin(); entryIt != entries().end(); ++entryIt) { for(fIt = fields.begin(); fIt != fields.end(); ++fIt) { tmp = entryIt->field(fIt->name(), format); @@ -98,61 +98,61 @@ bool CSVExporter::exec() { return FileHandler::writeTextURL(url(), text, options() & ExportUTF8, options() & Export::ExportForce); } -QWidget* CSVExporter::widget(QWidget* parent_, const char* name_/*=0*/) { - if(m_widget && m_widget->parent() == parent_) { +TQWidget* CSVExporter::widget(TQWidget* tqparent_, const char* name_/*=0*/) { + if(m_widget && TQT_BASE_OBJECT(m_widget->tqparent()) == TQT_BASE_OBJECT(tqparent_)) { return m_widget; } - m_widget = new QWidget(parent_, name_); - QVBoxLayout* l = new QVBoxLayout(m_widget); + m_widget = new TQWidget(tqparent_, name_); + TQVBoxLayout* l = new TQVBoxLayout(m_widget); - QGroupBox* box = new QGroupBox(1, Qt::Horizontal, i18n("CSV Options"), m_widget); + TQGroupBox* box = new TQGroupBox(1, Qt::Horizontal, i18n("CSV Options"), m_widget); l->addWidget(box); - m_checkIncludeTitles = new QCheckBox(i18n("Include field titles as column headers"), box); + m_checkIncludeTitles = new TQCheckBox(i18n("Include field titles as column headers"), box); m_checkIncludeTitles->setChecked(m_includeTitles); - QWhatsThis::add(m_checkIncludeTitles, i18n("If checked, a header row will be added with the " + TQWhatsThis::add(m_checkIncludeTitles, i18n("If checked, a header row will be added with the " "field titles.")); - QButtonGroup* delimiterGroup = new QButtonGroup(0, Qt::Vertical, i18n("Delimiter"), box); - QGridLayout* m_delimiterGroupLayout = new QGridLayout(delimiterGroup->layout()); - m_delimiterGroupLayout->setAlignment(Qt::AlignTop); - QWhatsThis::add(delimiterGroup, i18n("In addition to a comma, other characters may be used as " + TQButtonGroup* delimiterGroup = new TQButtonGroup(0, Qt::Vertical, i18n("Delimiter"), box); + TQGridLayout* m_delimiterGroupLayout = new TQGridLayout(delimiterGroup->tqlayout()); + m_delimiterGroupLayout->tqsetAlignment(TQt::AlignTop); + TQWhatsThis::add(delimiterGroup, i18n("In addition to a comma, other characters may be used as " "a delimiter, separating each value in the file.")); - m_radioComma = new QRadioButton(delimiterGroup); + m_radioComma = new TQRadioButton(delimiterGroup); m_radioComma->setText(i18n("Comma")); m_radioComma->setChecked(true); - QWhatsThis::add(m_radioComma, i18n("Use a comma as the delimiter.")); + TQWhatsThis::add(m_radioComma, i18n("Use a comma as the delimiter.")); m_delimiterGroupLayout->addWidget(m_radioComma, 0, 0); - m_radioSemicolon = new QRadioButton( delimiterGroup); + m_radioSemicolon = new TQRadioButton( delimiterGroup); m_radioSemicolon->setText(i18n("Semicolon")); - QWhatsThis::add(m_radioSemicolon, i18n("Use a semi-colon as the delimiter.")); + TQWhatsThis::add(m_radioSemicolon, i18n("Use a semi-colon as the delimiter.")); m_delimiterGroupLayout->addWidget(m_radioSemicolon, 0, 1); - m_radioTab = new QRadioButton(delimiterGroup); + m_radioTab = new TQRadioButton(delimiterGroup); m_radioTab->setText(i18n("Tab")); - QWhatsThis::add(m_radioTab, i18n("Use a tab as the delimiter.")); + TQWhatsThis::add(m_radioTab, i18n("Use a tab as the delimiter.")); m_delimiterGroupLayout->addWidget(m_radioTab, 1, 0); - m_radioOther = new QRadioButton(delimiterGroup); + m_radioOther = new TQRadioButton(delimiterGroup); m_radioOther->setText(i18n("Other")); - QWhatsThis::add(m_radioOther, i18n("Use a custom string as the delimiter.")); + TQWhatsThis::add(m_radioOther, i18n("Use a custom string as the delimiter.")); m_delimiterGroupLayout->addWidget(m_radioOther, 1, 1); m_editOther = new KLineEdit(delimiterGroup); m_editOther->setEnabled(m_radioOther->isChecked()); - QWhatsThis::add(m_editOther, i18n("A custom string, such as a colon, may be used as a delimiter.")); + TQWhatsThis::add(m_editOther, i18n("A custom string, such as a colon, may be used as a delimiter.")); m_delimiterGroupLayout->addWidget(m_editOther, 1, 2); - QObject::connect(m_radioOther, SIGNAL(toggled(bool)), - m_editOther, SLOT(setEnabled(bool))); + TQObject::connect(m_radioOther, TQT_SIGNAL(toggled(bool)), + m_editOther, TQT_SLOT(setEnabled(bool))); - if(m_delimiter == QChar(',')) { + if(m_delimiter == TQChar(',')) { m_radioComma->setChecked(true); - } else if(m_delimiter == QChar(';')) { + } else if(m_delimiter == TQChar(';')) { m_radioSemicolon->setChecked(true); - } else if(m_delimiter == QChar('\t')) { + } else if(m_delimiter == TQChar('\t')) { m_radioTab->setChecked(true); } else if(!m_delimiter.isEmpty()) { m_radioOther->setChecked(true); @@ -165,7 +165,7 @@ QWidget* CSVExporter::widget(QWidget* parent_, const char* name_/*=0*/) { } void CSVExporter::readOptions(KConfig* config_) { - KConfigGroup group(config_, QString::fromLatin1("ExportOptions - %1").arg(formatString())); + KConfigGroup group(config_, TQString::tqfromLatin1("ExportOptions - %1").tqarg(formatString())); m_includeTitles = group.readBoolEntry("Include Titles", m_includeTitles); m_delimiter = group.readEntry("Delimiter", m_delimiter); } @@ -173,16 +173,16 @@ void CSVExporter::readOptions(KConfig* config_) { void CSVExporter::saveOptions(KConfig* config_) { m_includeTitles = m_checkIncludeTitles->isChecked(); if(m_radioComma->isChecked()) { - m_delimiter = QChar(','); + m_delimiter = TQChar(','); } else if(m_radioSemicolon->isChecked()) { - m_delimiter = QChar(';'); + m_delimiter = TQChar(';'); } else if(m_radioTab->isChecked()) { - m_delimiter = QChar('\t'); + m_delimiter = TQChar('\t'); } else { m_delimiter = m_editOther->text(); } - KConfigGroup group(config_, QString::fromLatin1("ExportOptions - %1").arg(formatString())); + KConfigGroup group(config_, TQString::tqfromLatin1("ExportOptions - %1").tqarg(formatString())); group.writeEntry("Include Titles", m_includeTitles); group.writeEntry("Delimiter", m_delimiter); } |