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/converter/webpricequote.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/converter/webpricequote.cpp')
-rw-r--r-- | kmymoney2/converter/webpricequote.cpp | 316 |
1 files changed, 158 insertions, 158 deletions
diff --git a/kmymoney2/converter/webpricequote.cpp b/kmymoney2/converter/webpricequote.cpp index de30963..325560b 100644 --- a/kmymoney2/converter/webpricequote.cpp +++ b/kmymoney2/converter/webpricequote.cpp @@ -18,10 +18,10 @@ // ---------------------------------------------------------------------------- // QT Headers -#include <qfile.h> -#include <qregexp.h> -#include <qtextstream.h> -#include <qprocess.h> +#include <tqfile.h> +#include <tqregexp.h> +#include <tqtextstream.h> +#include <tqprocess.h> // ---------------------------------------------------------------------------- // KDE Headers @@ -46,51 +46,51 @@ #include "webpricequote.h" // define static members -QString WebPriceQuote::m_financeQuoteScriptPath; -QStringList WebPriceQuote::m_financeQuoteSources; +TQString WebPriceQuote::m_financeQuoteScriptPath; +TQStringList WebPriceQuote::m_financeQuoteSources; -QString * WebPriceQuote::lastErrorMsg; +TQString * WebPriceQuote::lastErrorMsg; int WebPriceQuote::lastErrorCode = 0; -WebPriceQuote::WebPriceQuote( QObject* _parent, const char* _name ): - QObject( _parent, _name ) +WebPriceQuote::WebPriceQuote( TQObject* _parent, const char* _name ): + TQObject( _parent, _name ) { m_financeQuoteScriptPath = - KGlobal::dirs()->findResource("appdata", QString("misc/financequote.pl")); - connect(&m_filter,SIGNAL(processExited(const QString&)),this,SLOT(slotParseQuote(const QString&))); + KGlobal::dirs()->findResource("appdata", TQString("misc/financequote.pl")); + connect(&m_filter,TQT_SIGNAL(processExited(const TQString&)),this,TQT_SLOT(slotParseQuote(const TQString&))); } WebPriceQuote::~WebPriceQuote() { } -bool WebPriceQuote::launch( const QString& _symbol, const QString& _id, const QString& _sourcename ) +bool WebPriceQuote::launch( const TQString& _symbol, const TQString& _id, const TQString& _sourcename ) { - if (_sourcename.contains("Finance::Quote")) + if (_sourcename.tqcontains("Finance::Quote")) return (launchFinanceQuote (_symbol, _id, _sourcename)); else return (launchNative (_symbol, _id, _sourcename)); } -bool WebPriceQuote::launchNative( const QString& _symbol, const QString& _id, const QString& _sourcename ) { +bool WebPriceQuote::launchNative( const TQString& _symbol, const TQString& _id, const TQString& _sourcename ) { bool result = true; m_symbol = _symbol; m_id = _id; -// emit status(QString("(Debug) symbol=%1 id=%2...").arg(_symbol,_id)); +// emit status(TQString("(Debug) symbol=%1 id=%2...").tqarg(_symbol,_id)); // if we're running normally, with a UI, we can just get these the normal way, // from the config file if ( kapp ) { - QString sourcename = _sourcename; + TQString sourcename = _sourcename; if ( sourcename.isEmpty() ) sourcename = "Yahoo"; - if ( quoteSources().contains(sourcename) ) + if ( quoteSources().tqcontains(sourcename) ) m_source = WebPriceQuoteSource(sourcename); else - emit error(QString("Source <%1> does not exist.").arg(sourcename)); + emit error(TQString("Source <%1> does not exist.").tqarg(sourcename)); } // otherwise, if we have no kapp, we have no config. so we just get them from // the defaults @@ -105,21 +105,21 @@ bool WebPriceQuote::launchNative( const QString& _symbol, const QString& _id, co KURL url; // if the source has room for TWO symbols.. - if ( m_source.m_url.contains("%2") ) + if ( m_source.m_url.tqcontains("%2") ) { // this is a two-symbol quote. split the symbol into two. valid symbol // characters are: 0-9, A-Z and the dot. anything else is a separator - QRegExp splitrx("([0-9a-z\\.]+)[^a-z0-9]+([0-9a-z\\.]+)",false /*case sensitive*/); + TQRegExp splitrx("([0-9a-z\\.]+)[^a-z0-9]+([0-9a-z\\.]+)",false /*case sensitive*/); // if we've truly found 2 symbols delimited this way... if ( splitrx.search(m_symbol) != -1 ) - url = KURL::fromPathOrURL(m_source.m_url.arg(splitrx.cap(1),splitrx.cap(2))); + url = KURL::fromPathOrURL(m_source.m_url.tqarg(splitrx.cap(1),splitrx.cap(2))); else - kdDebug(2) << "WebPriceQuote::launch() did not find 2 symbols" << endl; + kdDebug(2) << "WebPriceQuote::launch() did not tqfind 2 symbols" << endl; } else // a regular one-symbol quote - url = KURL::fromPathOrURL(m_source.m_url.arg(m_symbol)); + url = KURL::fromPathOrURL(m_source.m_url.tqarg(m_symbol)); // If we're running a non-interactive session (with no UI), we can't // use KIO::NetAccess, so we have to get our web data the old-fashioned @@ -133,10 +133,10 @@ bool WebPriceQuote::launchNative( const QString& _symbol, const QString& _id, co if ( url.isLocalFile() ) { - emit status(QString("Executing %1...").arg(url.path())); + emit status(TQString("Executing %1...").tqarg(url.path())); m_filter.clearArguments(); - m_filter << QStringList::split(" ",url.path()); + m_filter << TQStringList::split(" ",url.path()); m_filter.setSymbol(m_symbol); // if we're running non-interactive, we'll need to block. @@ -152,52 +152,52 @@ bool WebPriceQuote::launchNative( const QString& _symbol, const QString& _id, co } else { - emit error(QString("Unable to launch: %1").arg(url.path())); - slotParseQuote(QString()); + emit error(TQString("Unable to launch: %1").tqarg(url.path())); + slotParseQuote(TQString()); } } else { - emit status(QString("Fetching URL %1...").arg(url.prettyURL())); + emit status(TQString("Fetching URL %1...").tqarg(url.prettyURL())); - QString tmpFile; + TQString tmpFile; if( download( url, tmpFile, NULL ) ) { kdDebug(2) << "Downloaded " << tmpFile << endl; - QFile f(tmpFile); + TQFile f(tmpFile); if ( f.open( IO_ReadOnly ) ) { result = true; - QString quote = QTextStream(&f).read(); + TQString quote = TQTextStream(&f).read(); f.close(); slotParseQuote(quote); } else { - slotParseQuote(QString()); + slotParseQuote(TQString()); } removeTempFile( tmpFile ); } else { emit error(KIO::NetAccess::lastErrorString()); - slotParseQuote(QString()); + slotParseQuote(TQString()); } } return result; } -void WebPriceQuote::removeTempFile(const QString& tmpFile) +void WebPriceQuote::removeTempFile(const TQString& tmpFile) { if(tmpFile == m_tmpFile) { unlink(tmpFile); - m_tmpFile = QString(); + m_tmpFile = TQString(); } } -bool WebPriceQuote::download(const KURL& u, QString & target, QWidget* window) +bool WebPriceQuote::download(const KURL& u, TQString & target, TQWidget* window) { - m_tmpFile = QString(); + m_tmpFile = TQString(); // the following code taken and adapted from KIO::NetAccess::download() if (target.isEmpty()) @@ -218,8 +218,8 @@ bool WebPriceQuote::download(const KURL& u, QString & target, QWidget* window) KIO::Job * job = KIO::file_copy( u, dest, -1, true, false, false ); job->setWindow (window); job->addMetaData("cache", "reload"); // bypass cache - connect( job, SIGNAL( result (KIO::Job *) ), - this, SLOT( slotResult (KIO::Job *) ) ); + connect( job, TQT_SIGNAL( result (KIO::Job *) ), + this, TQT_SLOT( slotResult (KIO::Job *) ) ); enter_loop(); return bJobOK; @@ -229,15 +229,15 @@ bool WebPriceQuote::download(const KURL& u, QString & target, QWidget* window) // The following parts are copied and adjusted from KIO::NetAccess // If a troll sees this, he kills me -void qt_enter_modal( QWidget *widget ); -void qt_leave_modal( QWidget *widget ); +void qt_enter_modal( TQWidget *widget ); +void qt_leave_modal( TQWidget *widget ); void WebPriceQuote::enter_loop(void) { - QWidget dummy(0,0,WType_Dialog | WShowModal); - dummy.setFocusPolicy( QWidget::NoFocus ); + TQWidget dummy(0,0,WType_Dialog | WShowModal); + dummy.setFocusPolicy( TQ_NoFocus ); qt_enter_modal(&dummy); - qApp->enter_loop(); + tqApp->enter_loop(); qt_leave_modal(&dummy); } @@ -248,34 +248,34 @@ void WebPriceQuote::slotResult( KIO::Job * job ) if ( !bJobOK ) { if ( !lastErrorMsg ) - lastErrorMsg = new QString; + lastErrorMsg = new TQString; *lastErrorMsg = job->errorString(); } - qApp->exit_loop(); + tqApp->exit_loop(); } // The above parts are copied and adjusted from KIO::NetAccess -bool WebPriceQuote::launchFinanceQuote ( const QString& _symbol, const QString& _id, - const QString& _sourcename ) { +bool WebPriceQuote::launchFinanceQuote ( const TQString& _symbol, const TQString& _id, + const TQString& _sourcename ) { bool result = true; m_symbol = _symbol; m_id = _id; - QString FQSource = _sourcename.section (" ", 1); + TQString FTQSource = _sourcename.section (" ", 1); m_source = WebPriceQuoteSource (_sourcename, m_financeQuoteScriptPath, "\"([^,\"]*)\",.*", // symbol regexp "[^,]*,[^,]*,\"([^\"]*)\"", // price regexp "[^,]*,([^,]*),.*", // date regexp "%y-%m-%d"); // date format - //emit status(QString("(Debug) symbol=%1 id=%2...").arg(_symbol,_id)); + //emit status(TQString("(Debug) symbol=%1 id=%2...").tqarg(_symbol,_id)); m_filter.clearArguments(); - m_filter << "perl" << m_financeQuoteScriptPath << FQSource << KProcess::quote(_symbol); + m_filter << "perl" << m_financeQuoteScriptPath << FTQSource << KProcess::quote(_symbol); m_filter.setUseShell(true); m_filter.setSymbol(m_symbol); - emit status(QString("Executing %1 %2 %3...").arg(m_financeQuoteScriptPath).arg(FQSource).arg(_symbol)); + emit status(TQString("Executing %1 %2 %3...").tqarg(m_financeQuoteScriptPath).tqarg(FTQSource).tqarg(_symbol)); // if we're running non-interactive, we'll need to block. // otherwise, just let us know when it's done. @@ -290,16 +290,16 @@ bool WebPriceQuote::launchFinanceQuote ( const QString& _symbol, const QString& } else { - emit error(QString("Unable to launch: %1").arg(m_financeQuoteScriptPath)); - slotParseQuote(QString()); + emit error(TQString("Unable to launch: %1").tqarg(m_financeQuoteScriptPath)); + slotParseQuote(TQString()); } return result; } -void WebPriceQuote::slotParseQuote(const QString& _quotedata) +void WebPriceQuote::slotParseQuote(const TQString& _quotedata) { - QString quotedata = _quotedata; + TQString quotedata = _quotedata; bool gotprice = false; bool gotdate = false; @@ -313,10 +313,10 @@ void WebPriceQuote::slotParseQuote(const QString& _quotedata) // // HTML tags - quotedata.remove(QRegExp("<[^>]*>")); + quotedata.remove(TQRegExp("<[^>]*>")); // &...;'s - quotedata.replace(QRegExp("&\\w+;")," "); + quotedata.tqreplace(TQRegExp("&\\w+;")," "); // Extra white space quotedata = quotedata.simplifyWhiteSpace(); @@ -324,20 +324,20 @@ void WebPriceQuote::slotParseQuote(const QString& _quotedata) #if KMM_DEBUG // Enable to get a look at the data coming back from the source after it's stripped - QFile file("stripped.txt"); + TQFile file("stripped.txt"); if ( file.open( IO_WriteOnly ) ) { - QTextStream( &file ) << quotedata; + TQTextStream( &file ) << quotedata; file.close(); } #endif - QRegExp symbolRegExp(m_source.m_sym); - QRegExp dateRegExp(m_source.m_date); - QRegExp priceRegExp(m_source.m_price); + TQRegExp symbolRegExp(m_source.m_sym); + TQRegExp dateRegExp(m_source.m_date); + TQRegExp priceRegExp(m_source.m_price); if( symbolRegExp.search(quotedata) > -1) - emit status(i18n("Symbol found: %1").arg(symbolRegExp.cap(1))); + emit status(i18n("Symbol found: %1").tqarg(symbolRegExp.cap(1))); if(priceRegExp.search(quotedata)> -1) { @@ -350,39 +350,39 @@ void WebPriceQuote::slotParseQuote(const QString& _quotedata) // // Remove all non-digits from the price string except the last one, and // set the last one to a period. - QString pricestr = priceRegExp.cap(1); + TQString pricestr = priceRegExp.cap(1); - int pos = pricestr.findRev(QRegExp("\\D")); + int pos = pricestr.tqfindRev(TQRegExp("\\D")); if ( pos > 0 ) { pricestr[pos] = '.'; - pos = pricestr.findRev(QRegExp("\\D"),pos-1); + pos = pricestr.tqfindRev(TQRegExp("\\D"),pos-1); } while ( pos > 0 ) { pricestr.remove(pos,1); - pos = pricestr.findRev(QRegExp("\\D"),pos); + pos = pricestr.tqfindRev(TQRegExp("\\D"),pos); } m_price = pricestr.toDouble(); - emit status(i18n("Price found: %1 (%2)").arg(pricestr).arg(m_price)); + emit status(i18n("Price found: %1 (%2)").tqarg(pricestr).tqarg(m_price)); } if(dateRegExp.search(quotedata) > -1) { - QString datestr = dateRegExp.cap(1); + TQString datestr = dateRegExp.cap(1); MyMoneyDateFormat dateparse(m_source.m_dateformat); try { m_date = dateparse.convertString( datestr,false /*strict*/ ); gotdate = true; - emit status(i18n("Date found: %1").arg(m_date.toString()));; + emit status(i18n("Date found: %1").tqarg(m_date.toString()));; } catch (MyMoneyException* e) { - // emit error(i18n("Unable to parse date %1 using format %2: %3").arg(datestr,dateparse.format(),e->what())); - m_date = QDate::currentDate(); + // emit error(i18n("Unable to parse date %1 using format %2: %3").tqarg(datestr,dateparse.format(),e->what())); + m_date = TQDate::tqcurrentDate(); gotdate = true; delete e; } @@ -394,20 +394,20 @@ void WebPriceQuote::slotParseQuote(const QString& _quotedata) } else { - emit error(i18n("Unable to update price for %1").arg(m_symbol)); + emit error(i18n("Unable to update price for %1").tqarg(m_symbol)); emit failed( m_id, m_symbol ); } } else { - emit error(i18n("Unable to update price for %1").arg(m_symbol)); + emit error(i18n("Unable to update price for %1").tqarg(m_symbol)); emit failed( m_id, m_symbol ); } } -QMap<QString,WebPriceQuoteSource> WebPriceQuote::defaultQuoteSources(void) +TQMap<TQString,WebPriceQuoteSource> WebPriceQuote::defaultQuoteSources(void) { - QMap<QString,WebPriceQuoteSource> result; + TQMap<TQString,WebPriceQuoteSource> result; result["Yahoo"] = WebPriceQuoteSource("Yahoo", "http://finance.yahoo.com/d/quotes.csv?s=%1&f=sl1d1", @@ -448,7 +448,7 @@ QMap<QString,WebPriceQuoteSource> WebPriceQuote::defaultQuoteSources(void) result["Globe & Mail"] = WebPriceQuoteSource("Globe & Mail", "http://globefunddb.theglobeandmail.com/gishome/plsql/gis.price_history?pi_fund_id=%1", - QString(), // symbolregexp + TQString(), // symbolregexp "Reinvestment Price \\w+ \\d+, \\d+ (\\d+\\.\\d+)", // priceregexp "Reinvestment Price (\\w+ \\d+, \\d+)", // dateregexp "%m %d %y" // dateformat @@ -456,7 +456,7 @@ QMap<QString,WebPriceQuoteSource> WebPriceQuote::defaultQuoteSources(void) result["MSN.CA"] = WebPriceQuoteSource("MSN.CA", "http://ca.moneycentral.msn.com/investor/quotes/quotes.asp?symbol=%1", - QString(), // symbolregexp + TQString(), // symbolregexp "Net Asset Value (\\d+\\.\\d+)", // priceregexp "NAV update (\\d+\\D+\\d+\\D+\\d+)", // dateregexp "%d %m %y" // dateformat @@ -464,7 +464,7 @@ QMap<QString,WebPriceQuoteSource> WebPriceQuote::defaultQuoteSources(void) // Finanztreff (replaces VWD.DE) and boerseonline supplied by Micahel Zimmerman result["Finanztreff"] = WebPriceQuoteSource("Finanztreff", "http://finanztreff.de/kurse_einzelkurs_detail.htn?u=100&i=%1", - QString(), // symbolregexp + TQString(), // symbolregexp "([0-9]+,\\d+).+Gattung:Fonds", // priceregexp "\\).(\\d+\\D+\\d+\\D+\\d+)", // dateregexp (doesn't work; date in chart "%d.%m.%y" // dateformat @@ -472,7 +472,7 @@ QMap<QString,WebPriceQuoteSource> WebPriceQuote::defaultQuoteSources(void) result["boerseonline"] = WebPriceQuoteSource("boerseonline", "http://www.boerse-online.de/tools/boerse/einzelkurs_kurse.htm?&s=%1", - QString(), // symbolregexp + TQString(), // symbolregexp "Akt\\. Kurs.(\\d+,\\d\\d)", // priceregexp "Datum.(\\d+\\.\\d+\\.\\d+)", // dateregexp (doesn't work; date in chart "%d.%m.%y" // dateformat @@ -538,7 +538,7 @@ QMap<QString,WebPriceQuoteSource> WebPriceQuote::defaultQuoteSources(void) result["Gielda Papierow Wartosciowych (GPW)"] = WebPriceQuoteSource("Gielda Papierow Wartosciowych (GPW)", "http://stooq.com/q/?s=%1", - QString(), // symbol regexp + TQString(), // symbol regexp "Kurs.*(\\d+\\.\\d+).*Data", // price regexp "(\\d{4,4}-\\d{2,2}-\\d{2,2})", // date regexp "%y %m %d" // date format @@ -548,7 +548,7 @@ QMap<QString,WebPriceQuoteSource> WebPriceQuote::defaultQuoteSources(void) // at OMX Baltic market. result["OMX Baltic funds"] = WebPriceQuoteSource("OMX Baltic funds", "http://www.baltic.omxgroup.com/market/?pg=nontradeddetails¤cy=0&instrument=%1", - QString(), // symbolregexp + TQString(), // symbolregexp "NAV (\\d+,\\d+)", // priceregexp "Kpv (\\d+.\\d+.\\d+)", // dateregexp "%d.%m.%y" // dateformat @@ -589,20 +589,20 @@ QMap<QString,WebPriceQuoteSource> WebPriceQuote::defaultQuoteSources(void) return result; } -QStringList WebPriceQuote::quoteSources (const _quoteSystemE _system) { +TQStringList WebPriceQuote::quoteSources (const _quoteSystemE _system) { if (_system == Native) return (quoteSourcesNative()); else return (quoteSourcesFinanceQuote()); } -QStringList WebPriceQuote::quoteSourcesNative() +TQStringList WebPriceQuote::quoteSourcesNative() { KConfig *kconfig = KGlobal::config(); - QStringList groups = kconfig->groupList(); + TQStringList groups = kconfig->groupList(); - QStringList::Iterator it; - QRegExp onlineQuoteSource(QString("^Online-Quote-Source-(.*)$")); + TQStringList::Iterator it; + TQRegExp onlineQuoteSource(TQString("^Online-Quote-Source-(.*)$")); // get rid of all 'non online quote source' entries for(it = groups.begin(); it != groups.end(); it = groups.remove(it)) { @@ -617,14 +617,14 @@ QStringList WebPriceQuote::quoteSourcesNative() if ( ! groups.count() && kconfig->hasGroup("Online Quotes Options") ) { kconfig->setGroup("Online Quotes Options"); - QString url(kconfig->readEntry("URL","http://finance.yahoo.com/d/quotes.csv?s=%1&f=sl1d1")); - QString symbolRegExp(kconfig->readEntry("SymbolRegex","\"([^,\"]*)\",.*")); - QString priceRegExp(kconfig->readEntry("PriceRegex","[^,]*,([^,]*),.*")); - QString dateRegExp(kconfig->readEntry("DateRegex","[^,]*,[^,]*,\"([^\"]*)\"")); + TQString url(kconfig->readEntry("URL","http://finance.yahoo.com/d/quotes.csv?s=%1&f=sl1d1")); + TQString symbolRegExp(kconfig->readEntry("SymbolRegex","\"([^,\"]*)\",.*")); + TQString priceRegExp(kconfig->readEntry("PriceRegex","[^,]*,([^,]*),.*")); + TQString dateRegExp(kconfig->readEntry("DateRegex","[^,]*,[^,]*,\"([^\"]*)\"")); kconfig->deleteGroup("Online Quotes Options"); groups += "Old Source"; - kconfig->setGroup(QString("Online-Quote-Source-%1").arg("Old Source")); + kconfig->setGroup(TQString("Online-Quote-Source-%1").tqarg("Old Source")); kconfig->writeEntry("URL", url); kconfig->writeEntry("SymbolRegex", symbolRegExp); kconfig->writeEntry("PriceRegex",priceRegExp); @@ -635,11 +635,11 @@ QStringList WebPriceQuote::quoteSourcesNative() // Set up each of the default sources. These are done piecemeal so that // when we add a new source, it's automatically picked up. - QMap<QString,WebPriceQuoteSource> defaults = defaultQuoteSources(); - QMap<QString,WebPriceQuoteSource>::const_iterator it_source = defaults.begin(); + TQMap<TQString,WebPriceQuoteSource> defaults = defaultQuoteSources(); + TQMap<TQString,WebPriceQuoteSource>::const_iterator it_source = defaults.begin(); while ( it_source != defaults.end() ) { - if ( ! groups.contains( (*it_source).m_name ) ) + if ( ! groups.tqcontains( (*it_source).m_name ) ) { groups += (*it_source).m_name; (*it_source).write(); @@ -651,15 +651,15 @@ QStringList WebPriceQuote::quoteSourcesNative() return groups; } -QStringList WebPriceQuote::quoteSourcesFinanceQuote() +TQStringList WebPriceQuote::quoteSourcesFinanceQuote() { if (m_financeQuoteSources.empty()) { // run the process one time only FinanceQuoteProcess getList; m_financeQuoteScriptPath = - KGlobal::dirs()->findResource("appdata", QString("misc/financequote.pl")); + KGlobal::dirs()->findResource("appdata", TQString("misc/financequote.pl")); getList.launch( m_financeQuoteScriptPath ); while (!getList.isFinished()) { - qApp->processEvents(); + tqApp->processEvents(); } m_financeQuoteSources = getList.getSourceList(); } @@ -670,7 +670,7 @@ QStringList WebPriceQuote::quoteSourcesFinanceQuote() // Helper class to load/save an individual source // -WebPriceQuoteSource::WebPriceQuoteSource(const QString& name, const QString& url, const QString& sym, const QString& price, const QString& date, const QString& dateformat): +WebPriceQuoteSource::WebPriceQuoteSource(const TQString& name, const TQString& url, const TQString& sym, const TQString& price, const TQString& date, const TQString& dateformat): m_name(name), m_url(url), m_sym(sym), @@ -680,11 +680,11 @@ WebPriceQuoteSource::WebPriceQuoteSource(const QString& name, const QString& url { } -WebPriceQuoteSource::WebPriceQuoteSource(const QString& name) +WebPriceQuoteSource::WebPriceQuoteSource(const TQString& name) { m_name = name; KConfig *kconfig = KGlobal::config(); - kconfig->setGroup(QString("Online-Quote-Source-%1").arg(m_name)); + kconfig->setGroup(TQString("Online-Quote-Source-%1").tqarg(m_name)); m_sym = kconfig->readEntry("SymbolRegex"); m_date = kconfig->readEntry("DateRegex"); m_dateformat = kconfig->readEntry("DateFormatRegex","%m %d %y"); @@ -696,7 +696,7 @@ WebPriceQuoteSource::WebPriceQuoteSource(const QString& name) void WebPriceQuoteSource::write(void) const { KConfig *kconfig = KGlobal::config(); - kconfig->setGroup(QString("Online-Quote-Source-%1").arg(m_name)); + kconfig->setGroup(TQString("Online-Quote-Source-%1").tqarg(m_name)); kconfig->writeEntry("URL", m_url); kconfig->writeEntry("PriceRegex", m_price); kconfig->writeEntry("DateRegex", m_date); @@ -708,7 +708,7 @@ void WebPriceQuoteSource::write(void) const kconfig->deleteEntry("SkipStripping"); } -void WebPriceQuoteSource::rename(const QString& name) +void WebPriceQuoteSource::rename(const TQString& name) { remove(); m_name = name; @@ -718,7 +718,7 @@ void WebPriceQuoteSource::rename(const QString& name) void WebPriceQuoteSource::remove(void) const { KConfig *kconfig = KGlobal::config(); - kconfig->deleteGroup(QString("Online-Quote-Source-%1").arg(m_name)); + kconfig->deleteGroup(TQString("Online-Quote-Source-%1").tqarg(m_name)); } // @@ -727,17 +727,17 @@ void WebPriceQuoteSource::remove(void) const WebPriceQuoteProcess::WebPriceQuoteProcess(void) { - connect(this, SIGNAL(receivedStdout(KProcess*, char*, int)), this, SLOT(slotReceivedDataFromFilter(KProcess*, char*, int))); - connect(this, SIGNAL(processExited(KProcess*)), this, SLOT(slotProcessExited(KProcess*))); + connect(this, TQT_SIGNAL(receivedStdout(KProcess*, char*, int)), this, TQT_SLOT(slotReceivedDataFromFilter(KProcess*, char*, int))); + connect(this, TQT_SIGNAL(processExited(KProcess*)), this, TQT_SLOT(slotProcessExited(KProcess*))); } void WebPriceQuoteProcess::slotReceivedDataFromFilter(KProcess* /*_process*/, char* _pcbuffer, int _nbufferlen) { - QByteArray data; + TQByteArray data; data.duplicate(_pcbuffer, _nbufferlen); -// kdDebug(2) << "WebPriceQuoteProcess::slotReceivedDataFromFilter(): " << QString(data) << endl; - m_string += QString(data); +// kdDebug(2) << "WebPriceQuoteProcess::slotReceivedDataFromFilter(): " << TQString(data) << endl; + m_string += TQString(data); } void WebPriceQuoteProcess::slotProcessExited(KProcess*) @@ -809,17 +809,17 @@ FinanceQuoteProcess::FinanceQuoteProcess(void) m_fqNames["yahoo_europe"] = "Yahoo Europe"; m_fqNames["yahoo_nz"] = "Yahoo New Zealand"; m_fqNames["zifunds"] = "Zuerich Investments"; - connect(this, SIGNAL(receivedStdout(KProcess*, char*, int)), this, SLOT(slotReceivedDataFromFilter(KProcess*, char*, int))); - connect(this, SIGNAL(processExited(KProcess*)), this, SLOT(slotProcessExited(KProcess*))); + connect(this, TQT_SIGNAL(receivedStdout(KProcess*, char*, int)), this, TQT_SLOT(slotReceivedDataFromFilter(KProcess*, char*, int))); + connect(this, TQT_SIGNAL(processExited(KProcess*)), this, TQT_SLOT(slotProcessExited(KProcess*))); } void FinanceQuoteProcess::slotReceivedDataFromFilter(KProcess* /*_process*/, char* _pcbuffer, int _nbufferlen) { - QByteArray data; + TQByteArray data; data.duplicate(_pcbuffer, _nbufferlen); -// kdDebug(2) << "WebPriceQuoteProcess::slotReceivedDataFromFilter(): " << QString(data) << endl; - m_string += QString(data); +// kdDebug(2) << "WebPriceQuoteProcess::slotReceivedDataFromFilter(): " << TQString(data) << endl; + m_string += TQString(data); } void FinanceQuoteProcess::slotProcessExited(KProcess*) @@ -828,19 +828,19 @@ void FinanceQuoteProcess::slotProcessExited(KProcess*) m_isDone = true; } -void FinanceQuoteProcess::launch (const QString& scriptPath) { +void FinanceQuoteProcess::launch (const TQString& scriptPath) { clearArguments(); - arguments.append(QCString("perl")); - arguments.append (QCString(scriptPath)); - arguments.append (QCString("-l")); + arguments.append(TQCString("perl")); + arguments.append (TQCString(scriptPath)); + arguments.append (TQCString("-l")); if (!start(KProcess::NotifyOnExit, KProcess::Stdout)) qFatal ("Unable to start FQ script"); return; } -QStringList FinanceQuoteProcess::getSourceList() { - QStringList raw = QStringList::split(0x0A, m_string); - QStringList sources; - QStringList::iterator it; +TQStringList FinanceQuoteProcess::getSourceList() { + TQStringList raw = TQStringList::split(0x0A, m_string); + TQStringList sources; + TQStringList::iterator it; for (it = raw.begin(); it != raw.end(); ++it) { if (m_fqNames[*it].isEmpty()) sources.append(*it); else sources.append(m_fqNames[*it]); @@ -849,8 +849,8 @@ QStringList FinanceQuoteProcess::getSourceList() { return (sources); } -const QString FinanceQuoteProcess::crypticName(const QString& niceName) { - QString ret (niceName); +const TQString FinanceQuoteProcess::crypticName(const TQString& niceName) { + TQString ret (niceName); fqNameMap::iterator it; for (it = m_fqNames.begin(); it != m_fqNames.end(); ++it) { if (niceName == it.data()) { @@ -861,8 +861,8 @@ const QString FinanceQuoteProcess::crypticName(const QString& niceName) { return (ret); } -const QString FinanceQuoteProcess::niceName(const QString& crypticName) { - QString ret (m_fqNames[crypticName]); +const TQString FinanceQuoteProcess::niceName(const TQString& crypticName) { + TQString ret (m_fqNames[crypticName]); if (ret.isEmpty()) ret = crypticName; return (ret); } @@ -870,29 +870,29 @@ const QString FinanceQuoteProcess::niceName(const QString& crypticName) { // Universal date converter // -// In 'strict' mode, this is designed to be compatable with the QIF profile date +// In 'strict' mode, this is designed to be compatable with the TQIF profile date // converter. However, that converter deals with the concept of an apostrophe // format in a way I don't understand. So for the moment, they are 99% // compatable, waiting on that issue. (acejones) -QDate MyMoneyDateFormat::convertString(const QString& _in, bool _strict, unsigned _centurymidpoint) const +TQDate MyMoneyDateFormat::convertString(const TQString& _in, bool _strict, unsigned _centurymidpoint) const { // // Break date format string into component parts // - QRegExp formatrex("%([mdy]+)(\\W+)%([mdy]+)(\\W+)%([mdy]+)",false /* case sensitive */); + TQRegExp formatrex("%([mdy]+)(\\W+)%([mdy]+)(\\W+)%([mdy]+)",false /* case sensitive */); if ( formatrex.search(m_format) == -1 ) { throw new MYMONEYEXCEPTION("Invalid format string"); } - QStringList formatParts; + TQStringList formatParts; formatParts += formatrex.cap(1); formatParts += formatrex.cap(3); formatParts += formatrex.cap(5); - QStringList formatDelimiters; + TQStringList formatDelimiters; formatDelimiters += formatrex.cap(2); formatDelimiters += formatrex.cap(4); @@ -901,13 +901,13 @@ QDate MyMoneyDateFormat::convertString(const QString& _in, bool _strict, unsigne // using the delimiters found in the format string // - QRegExp inputrex; + TQRegExp inputrex; inputrex.setCaseSensitive(false); // strict mode means we must enforce the delimiters as specified in the // format. non-strict allows any delimiters if ( _strict ) - inputrex.setPattern(QString("(\\w+)%1(\\w+)%2(\\w+)").arg(formatDelimiters[0],formatDelimiters[1])); + inputrex.setPattern(TQString("(\\w+)%1(\\w+)%2(\\w+)").tqarg(formatDelimiters[0],formatDelimiters[1])); else inputrex.setPattern("(\\w+)\\W+(\\w+)\\W+(\\w+)"); @@ -916,7 +916,7 @@ QDate MyMoneyDateFormat::convertString(const QString& _in, bool _strict, unsigne throw new MYMONEYEXCEPTION("Invalid input string"); } - QStringList scannedParts; + TQStringList scannedParts; scannedParts += inputrex.cap(1).lower(); scannedParts += inputrex.cap(2).lower(); scannedParts += inputrex.cap(3).lower(); @@ -927,9 +927,9 @@ QDate MyMoneyDateFormat::convertString(const QString& _in, bool _strict, unsigne unsigned day = 0, month = 0, year = 0; bool ok; - QRegExp digitrex("(\\d+)"); - QStringList::const_iterator it_scanned = scannedParts.begin(); - QStringList::const_iterator it_format = formatParts.begin(); + TQRegExp digitrex("(\\d+)"); + TQStringList::const_iterator it_scanned = scannedParts.begin(); + TQStringList::const_iterator it_format = formatParts.begin(); while ( it_scanned != scannedParts.end() ) { switch ( (*it_format)[0] ) @@ -940,7 +940,7 @@ QDate MyMoneyDateFormat::convertString(const QString& _in, bool _strict, unsigne if ( digitrex.search(*it_scanned) != -1 ) day = digitrex.cap(1).toUInt(&ok); if ( !ok || day > 31 ) - throw new MYMONEYEXCEPTION(QString("Invalid day entry: %1").arg(*it_scanned)); + throw new MYMONEYEXCEPTION(TQString("Invalid day entry: %1").tqarg(*it_scanned)); break; case 'm': month = (*it_scanned).toUInt(&ok); @@ -958,18 +958,18 @@ QDate MyMoneyDateFormat::convertString(const QString& _in, bool _strict, unsigne } if ( month < 1 || month > 12 ) - throw new MYMONEYEXCEPTION(QString("Invalid month entry: %1").arg(*it_scanned)); + throw new MYMONEYEXCEPTION(TQString("Invalid month entry: %1").tqarg(*it_scanned)); break; case 'y': if ( _strict && (*it_scanned).length() != (*it_format).length()) - throw new MYMONEYEXCEPTION(QString("Length of year (%1) does not match expected length (%2).") - .arg(*it_scanned,*it_format)); + throw new MYMONEYEXCEPTION(TQString("Length of year (%1) does not match expected length (%2).") + .tqarg(*it_scanned,*it_format)); year = (*it_scanned).toUInt(&ok); if (!ok) - throw new MYMONEYEXCEPTION(QString("Invalid year entry: %1").arg(*it_scanned)); + throw new MYMONEYEXCEPTION(TQString("Invalid year entry: %1").tqarg(*it_scanned)); // // 2-digit year case @@ -988,7 +988,7 @@ QDate MyMoneyDateFormat::convertString(const QString& _in, bool _strict, unsigne } if ( year < 1900 ) - throw new MYMONEYEXCEPTION(QString("Invalid year (%1)").arg(year)); + throw new MYMONEYEXCEPTION(TQString("Invalid year (%1)").tqarg(year)); break; default: @@ -999,9 +999,9 @@ QDate MyMoneyDateFormat::convertString(const QString& _in, bool _strict, unsigne ++it_format; } - QDate result(year,month,day); + TQDate result(year,month,day); if ( ! result.isValid() ) - throw new MYMONEYEXCEPTION(QString("Invalid date (yr%1 mo%2 dy%3)").arg(year).arg(month).arg(day)); + throw new MYMONEYEXCEPTION(TQString("Invalid date (yr%1 mo%2 dy%3)").tqarg(year).tqarg(month).tqarg(day)); return result; } @@ -1010,35 +1010,35 @@ QDate MyMoneyDateFormat::convertString(const QString& _in, bool _strict, unsigne // Unit test helpers // -convertertest::QuoteReceiver::QuoteReceiver(WebPriceQuote* q, QObject* parent, const char *name) : - QObject(parent,name) +convertertest::QuoteReceiver::QuoteReceiver(WebPriceQuote* q, TQObject* tqparent, const char *name) : + TQObject(tqparent,name) { - connect(q,SIGNAL(quote(const QString&,const QDate&, const double&)), - this,SLOT(slotGetQuote(const QString&,const QDate&, const double&))); - connect(q,SIGNAL(status(const QString&)), - this,SLOT(slotStatus(const QString&))); - connect(q,SIGNAL(error(const QString&)), - this,SLOT(slotError(const QString&))); + connect(q,TQT_SIGNAL(quote(const TQString&,const TQDate&, const double&)), + this,TQT_SLOT(slotGetQuote(const TQString&,const TQDate&, const double&))); + connect(q,TQT_SIGNAL(status(const TQString&)), + this,TQT_SLOT(slottqStatus(const TQString&))); + connect(q,TQT_SIGNAL(error(const TQString&)), + this,TQT_SLOT(slotError(const TQString&))); } convertertest::QuoteReceiver::~QuoteReceiver() { } -void convertertest::QuoteReceiver::slotGetQuote(const QString&,const QDate& d, const double& m) +void convertertest::QuoteReceiver::slotGetQuote(const TQString&,const TQDate& d, const double& m) { // kdDebug(2) << "test::QuoteReceiver::slotGetQuote( , " << d << " , " << m.toString() << " )" << endl; m_price = MyMoneyMoney(m); m_date = d; } -void convertertest::QuoteReceiver::slotStatus(const QString& msg) +void convertertest::QuoteReceiver::slottqStatus(const TQString& msg) { -// kdDebug(2) << "test::QuoteReceiver::slotStatus( " << msg << " )" << endl; +// kdDebug(2) << "test::QuoteReceiver::slottqStatus( " << msg << " )" << endl; m_statuses += msg; } -void convertertest::QuoteReceiver::slotError(const QString& msg) +void convertertest::QuoteReceiver::slotError(const TQString& msg) { // kdDebug(2) << "test::QuoteReceiver::slotError( " << msg << " )" << endl; |