diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-05 06:00:29 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-05 06:00:29 +0000 |
commit | fecb0e67b23e8b83ba7fc881bb57bc48c0852d62 (patch) | |
tree | 6b8614802f0d01b353bc9ba78aff2090846c198e /kmymoney2/plugins/ofximport/ofximporterplugin.cpp | |
parent | dadc34655c3ab961b0b0b94a10eaaba710f0b5e8 (diff) | |
download | kmymoney-fecb0e67b23e8b83ba7fc881bb57bc48c0852d62.tar.gz kmymoney-fecb0e67b23e8b83ba7fc881bb57bc48c0852d62.zip |
TQt4 port kmymoney
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kmymoney@1239855 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmymoney2/plugins/ofximport/ofximporterplugin.cpp')
-rw-r--r-- | kmymoney2/plugins/ofximport/ofximporterplugin.cpp | 110 |
1 files changed, 55 insertions, 55 deletions
diff --git a/kmymoney2/plugins/ofximport/ofximporterplugin.cpp b/kmymoney2/plugins/ofximport/ofximporterplugin.cpp index 21a6466..77b790e 100644 --- a/kmymoney2/plugins/ofximport/ofximporterplugin.cpp +++ b/kmymoney2/plugins/ofximport/ofximporterplugin.cpp @@ -18,11 +18,11 @@ // ---------------------------------------------------------------------------- // QT Includes -#include <qfile.h> -#include <qtextstream.h> -#include <qradiobutton.h> -#include <qspinbox.h> -#include <qdatetimeedit.h> +#include <tqfile.h> +#include <tqtextstream.h> +#include <tqradiobutton.h> +#include <tqspinbox.h> +#include <tqdatetimeedit.h> // ---------------------------------------------------------------------------- // KDE Includes @@ -45,8 +45,8 @@ K_EXPORT_COMPONENT_FACTORY( kmm_ofximport, KGenericFactory<OfxImporterPlugin>( "kmm_ofximport" ) ) -OfxImporterPlugin::OfxImporterPlugin(QObject *parent, const char *name, const QStringList&) : - KMyMoneyPlugin::Plugin( parent, name ), +OfxImporterPlugin::OfxImporterPlugin(TQObject *tqparent, const char *name, const TQStringList&) : + KMyMoneyPlugin::Plugin( tqparent, name ), KMyMoneyPlugin::ImporterPlugin(), m_valid( false ) { @@ -61,7 +61,7 @@ OfxImporterPlugin::~OfxImporterPlugin() void OfxImporterPlugin::createActions(void) { - new KAction(i18n("OFX..."), "", 0, this, SLOT(slotImportFile()), actionCollection(), "file_import_ofx"); + new KAction(i18n("OFX..."), "", 0, this, TQT_SLOT(slotImportFile()), actionCollection(), "file_import_ofx"); } void OfxImporterPlugin::slotImportFile(void) @@ -74,42 +74,42 @@ void OfxImporterPlugin::slotImportFile(void) if ( isMyFormat(url.path()) ) { slotImportFile(url.path()); } else { - KMessageBox::error( 0, i18n("Unable to import %1 using the OFX importer plugin. This file is not the correct format.").arg(url.prettyURL(0, KURL::StripFileProtocol)), i18n("Incorrect format")); + KMessageBox::error( 0, i18n("Unable to import %1 using the OFX importer plugin. This file is not the correct format.").tqarg(url.prettyURL(0, KURL::StripFileProtocol)), i18n("Incorrect format")); } } } -QString OfxImporterPlugin::formatName(void) const +TQString OfxImporterPlugin::formatName(void) const { return "OFX"; } -QString OfxImporterPlugin::formatFilenameFilter(void) const +TQString OfxImporterPlugin::formatFilenameFilter(void) const { return "*.ofx *.qfx *.ofc"; } -bool OfxImporterPlugin::isMyFormat( const QString& filename ) const +bool OfxImporterPlugin::isMyFormat( const TQString& filename ) const { - // filename is considered an Ofx file if it contains + // filename is considered an Ofx file if it tqcontains // the tag "<OFX>" or "<OFC>" in the first 20 lines // which contain some data. bool result = false; - QFile f( filename ); + TQFile f( filename ); if ( f.open( IO_ReadOnly ) ) { - QTextStream ts( &f ); + TQTextStream ts( &f ); int lineCount = 20; while ( !ts.atEnd() && !result && lineCount != 0) { // get a line of data and remove all unnecessary whitepace chars - QString line = ts.readLine().simplifyWhiteSpace(); - if ( line.contains("<OFX>",false) - || line.contains("<OFC>",false) ) + TQString line = ts.readLine().simplifyWhiteSpace(); + if ( line.tqcontains("<OFX>",false) + || line.tqcontains("<OFC>",false) ) result = true; // count only lines that contains some non white space chars if(!line.isEmpty()) @@ -121,7 +121,7 @@ bool OfxImporterPlugin::isMyFormat( const QString& filename ) const return result; } -bool OfxImporterPlugin::import( const QString& filename ) +bool OfxImporterPlugin::import( const TQString& filename ) { m_fatalerror = i18n("Unable to parse file"); m_valid = false; @@ -132,7 +132,7 @@ bool OfxImporterPlugin::import( const QString& filename ) m_statementlist.clear(); m_securitylist.clear(); - QCString filename_deep( filename.utf8() ); + TQCString filename_deep( filename.utf8() ); LibofxContextPtr ctx = libofx_get_new_context(); Q_CHECK_PTR(ctx); @@ -147,13 +147,13 @@ bool OfxImporterPlugin::import( const QString& filename ) if ( m_valid ) { - m_fatalerror = QString(); + m_fatalerror = TQString(); m_valid = storeStatements(m_statementlist); } return m_valid; } -QString OfxImporterPlugin::lastError(void) const +TQString OfxImporterPlugin::lastError(void) const { if(m_errors.count() == 0) return m_fatalerror; @@ -179,13 +179,13 @@ int OfxImporterPlugin::ofxTransactionCallback(struct OfxTransactionData data, vo if(data.date_posted_valid==true) { - QDateTime dt; + TQDateTime dt; dt.setTime_t(data.date_posted, Qt::UTC); t.m_datePosted = dt.date(); } else if(data.date_initiated_valid==true) { - QDateTime dt; + TQDateTime dt; dt.setTime_t(data.date_initiated, Qt::UTC); t.m_datePosted = dt.date(); } @@ -206,11 +206,11 @@ int OfxImporterPlugin::ofxTransactionCallback(struct OfxTransactionData data, vo if(data.fi_id_valid==true) { - t.m_strBankID = QString("ID ") + data.fi_id; + t.m_strBankID = TQString("ID ") + data.fi_id; } else if(data.reference_number_valid==true) { - t.m_strBankID = QString("REF ") + data.reference_number; + t.m_strBankID = TQString("REF ") + data.reference_number; } // Decide whether to import NAME or PAYEEID if both are present in the download if (pofx->m_preferName) { @@ -288,7 +288,7 @@ int OfxImporterPlugin::ofxTransactionCallback(struct OfxTransactionData data, vo } bool unhandledtype = false; - QString type; + TQString type; if(data.invtransactiontype_valid==true) { @@ -351,7 +351,7 @@ int OfxImporterPlugin::ofxTransactionCallback(struct OfxTransactionData data, vo break; default: unhandledtype = true; - type = QString("UNKNOWN %1").arg(data.invtransactiontype); + type = TQString("UNKNOWN %1").tqarg(data.invtransactiontype); break; } } @@ -373,14 +373,14 @@ int OfxImporterPlugin::ofxTransactionCallback(struct OfxTransactionData data, vo double proper_total = t.m_dShares * data.unitprice + t.m_moneyFees; if ( proper_total != t.m_moneyAmount ) { - pofx->addWarning(QString("Transaction %1 has an incorrect total of %2. Using calculated total of %3 instead.").arg(t.m_strBankID).arg(t.m_moneyAmount).arg(proper_total)); + pofx->addWarning(TQString("Transaction %1 has an incorrect total of %2. Using calculated total of %3 instead.").tqarg(t.m_strBankID).tqarg(t.m_moneyAmount).tqarg(proper_total)); t.m_moneyAmount = proper_total; } } #endif if ( unhandledtype ) - pofx->addWarning(QString("Transaction %1 has an unsupported type (%2).").arg(t.m_strBankID,type)); + pofx->addWarning(TQString("Transaction %1 has an unsupported type (%2).").tqarg(t.m_strBankID,type)); else s.m_listTransactions += t; @@ -409,14 +409,14 @@ int OfxImporterPlugin::ofxStatementCallback(struct OfxStatementData data, void* if(data.date_start_valid==true) { - QDateTime dt; + TQDateTime dt; dt.setTime_t(data.date_start, Qt::UTC); s.m_dateBegin = dt.date(); } if(data.date_end_valid==true) { - QDateTime dt; + TQDateTime dt; dt.setTime_t(data.date_end, Qt::UTC); s.m_dateEnd = dt.date(); } @@ -482,7 +482,7 @@ int OfxImporterPlugin::ofxAccountCallback(struct OfxAccountData data, void * pv) } // ask KMyMoney for an account id - s.m_accountId = pofx->account("kmmofx-acc-ref", QString("%1-%2").arg(s.m_strRoutingNumber, s.m_strAccountNumber)).id(); + s.m_accountId = pofx->account("kmmofx-acc-ref", TQString("%1-%2").tqarg(s.m_strRoutingNumber, s.m_strAccountNumber)).id(); // copy over the securities s.m_listSecurities = pofx->m_securitylist; @@ -519,7 +519,7 @@ int OfxImporterPlugin::ofxStatusCallback(struct OfxStatusData data, void * pv) // kdDebug(2) << __func__ << endl; OfxImporterPlugin* pofx = reinterpret_cast<OfxImporterPlugin*>(pv); - QString message; + TQString message; // if we got this far, we know we were able to parse the file. // so if it fails after here it can only because there were no actual @@ -527,13 +527,13 @@ int OfxImporterPlugin::ofxStatusCallback(struct OfxStatusData data, void * pv) pofx->m_fatalerror = "No accounts found."; if(data.ofx_element_name_valid==true) - message.prepend(QString("%1: ").arg(data.ofx_element_name)); + message.prepend(TQString("%1: ").tqarg(data.ofx_element_name)); if(data.code_valid==true) - message += QString("%1 (Code %2): %3").arg(data.name).arg(data.code).arg(data.description); + message += TQString("%1 (Code %2): %3").tqarg(data.name).tqarg(data.code).tqarg(data.description); if(data.server_message_valid==true) - message += QString(" (%1)").arg(data.server_message); + message += TQString(" (%1)").tqarg(data.server_message); if(data.severity_valid==true){ switch(data.severity){ @@ -564,21 +564,21 @@ bool OfxImporterPlugin::importStatement(const MyMoneyStatement& s) return statementInterface()->import(s); } -const MyMoneyAccount& OfxImporterPlugin::account(const QString& key, const QString& value) const +const MyMoneyAccount& OfxImporterPlugin::account(const TQString& key, const TQString& value) const { return statementInterface()->account(key, value); } -void OfxImporterPlugin::protocols(QStringList& protocolList) const +void OfxImporterPlugin::protocols(TQStringList& protocolList) const { protocolList.clear(); protocolList << "OFX"; } -QWidget* OfxImporterPlugin::accountConfigTab(const MyMoneyAccount& acc, QString& name) +TQWidget* OfxImporterPlugin::accountConfigTab(const MyMoneyAccount& acc, TQString& name) { name = i18n("Online settings"); - m_statusDlg = new KOnlineBankingStatus(acc, 0, 0); + m_statusDlg = new KOnlineBankingtqStatus(acc, 0, 0); return m_statusDlg; } @@ -593,13 +593,13 @@ MyMoneyKeyValueContainer OfxImporterPlugin::onlineBankingSettings(const MyMoneyK if(!m_statusDlg->appId().isEmpty()) kvp.setValue("appId", m_statusDlg->appId()); kvp.setValue("kmmofx-headerVersion", m_statusDlg->headerVersion()); - kvp.setValue("kmmofx-numRequestDays", QString::number(m_statusDlg->m_numdaysSpin->value())); - kvp.setValue("kmmofx-todayMinus", QString::number(m_statusDlg->m_todayRB->isChecked())); - kvp.setValue("kmmofx-lastUpdate", QString::number(m_statusDlg->m_lastUpdateRB->isChecked())); - kvp.setValue("kmmofx-pickDate", QString::number(m_statusDlg->m_pickDateRB->isChecked())); + kvp.setValue("kmmofx-numRequestDays", TQString::number(m_statusDlg->m_numdaysSpin->value())); + kvp.setValue("kmmofx-todayMinus", TQString::number(m_statusDlg->m_todayRB->isChecked())); + kvp.setValue("kmmofx-lastUpdate", TQString::number(m_statusDlg->m_lastUpdateRB->isChecked())); + kvp.setValue("kmmofx-pickDate", TQString::number(m_statusDlg->m_pickDateRB->isChecked())); kvp.setValue("kmmofx-specificDate", m_statusDlg->m_specificDate->date().toString()); - kvp.setValue("kmmofx-preferPayeeid", QString::number(m_statusDlg->m_payeeidRB->isChecked())); - kvp.setValue("kmmofx-preferName", QString::number(m_statusDlg->m_nameRB->isChecked())); + kvp.setValue("kmmofx-preferPayeeid", TQString::number(m_statusDlg->m_payeeidRB->isChecked())); + kvp.setValue("kmmofx-preferName", TQString::number(m_statusDlg->m_nameRB->isChecked())); } return kvp; } @@ -611,7 +611,7 @@ bool OfxImporterPlugin::mapAccount(const MyMoneyAccount& acc, MyMoneyKeyValueCon bool rc = false; KOnlineBankingSetupWizard wiz(0, "onlinebankingsetup"); if(wiz.isInit()) { - if(wiz.exec() == QDialog::Accepted) { + if(wiz.exec() == TQDialog::Accepted) { rc = wiz.chosenSettings( settings ); } } @@ -629,29 +629,29 @@ bool OfxImporterPlugin::updateAccount(const MyMoneyAccount& acc, bool moreAccoun m_preferName = acc.onlineBankingSettings().value("kmmofx-preferName").toInt() != 0; KOfxDirectConnectDlg dlg(acc); - connect(&dlg, SIGNAL(statementReady(const QString&)), - this, SLOT(slotImportFile(const QString&))); + connect(&dlg, TQT_SIGNAL(statementReady(const TQString&)), + this, TQT_SLOT(slotImportFile(const TQString&))); dlg.init(); dlg.exec(); } } catch (MyMoneyException *e) { - KMessageBox::information(0 ,i18n("Error connecting to bank: %1").arg(e->what())); + KMessageBox::information(0 ,i18n("Error connecting to bank: %1").tqarg(e->what())); delete e; } return false; } -void OfxImporterPlugin::slotImportFile(const QString& url) +void OfxImporterPlugin::slotImportFile(const TQString& url) { if(!import(url)) { - KMessageBox::error( 0, QString("<qt>%1</qt>").arg(i18n("Unable to import %1 using the OFX importer plugin. The plugin returned the following error:<p>%2").arg(url, lastError())), i18n("Importing error")); + KMessageBox::error( 0, TQString("<qt>%1</qt>").tqarg(i18n("Unable to import %1 using the OFX importer plugin. The plugin returned the following error:<p>%2").tqarg(url, lastError())), i18n("Importing error")); } } -bool OfxImporterPlugin::storeStatements(QValueList<MyMoneyStatement>& statements) +bool OfxImporterPlugin::storeStatements(TQValueList<MyMoneyStatement>& statements) { bool hasstatements = (statements.count() > 0); bool ok = true; @@ -671,7 +671,7 @@ bool OfxImporterPlugin::storeStatements(QValueList<MyMoneyStatement>& statements }*/ qDebug("OfxImporterPlugin::storeStatements() with %d statements called", static_cast<int>(statements.count())); - QValueList<MyMoneyStatement>::const_iterator it_s = statements.begin(); + TQValueList<MyMoneyStatement>::const_iterator it_s = statements.begin(); while ( it_s != statements.end() && !abort ) { ok = ok && importStatement((*it_s)); ++it_s; |