summaryrefslogtreecommitdiffstats
path: root/kmymoney2/dialogs/kequitypriceupdatedlg.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kmymoney2/dialogs/kequitypriceupdatedlg.cpp')
-rw-r--r--kmymoney2/dialogs/kequitypriceupdatedlg.cpp188
1 files changed, 94 insertions, 94 deletions
diff --git a/kmymoney2/dialogs/kequitypriceupdatedlg.cpp b/kmymoney2/dialogs/kequitypriceupdatedlg.cpp
index 4111bfa..f5014d0 100644
--- a/kmymoney2/dialogs/kequitypriceupdatedlg.cpp
+++ b/kmymoney2/dialogs/kequitypriceupdatedlg.cpp
@@ -24,13 +24,13 @@
// ----------------------------------------------------------------------------
// QT Includes
-#include <qlabel.h>
-#include <qpushbutton.h>
-#include <qradiobutton.h>
-#include <qfile.h>
-#include <qtextstream.h>
-#include <qtimer.h>
-#include <qlayout.h>
+#include <tqlabel.h>
+#include <tqpushbutton.h>
+#include <tqradiobutton.h>
+#include <tqfile.h>
+#include <tqtextstream.h>
+#include <tqtimer.h>
+#include <tqlayout.h>
// ----------------------------------------------------------------------------
// KDE Includes
@@ -61,8 +61,8 @@
#define ID_COL 4
#define SOURCE_COL 5
-KEquityPriceUpdateDlg::KEquityPriceUpdateDlg(QWidget *parent, const QString& securityId) :
- KEquityPriceUpdateDlgDecl(parent),
+KEquityPriceUpdateDlg::KEquityPriceUpdateDlg(TQWidget *tqparent, const TQString& securityId) :
+ KEquityPriceUpdateDlgDecl(tqparent),
m_fUpdateAll(false)
{
lvEquityList->setRootIsDecorated(false);
@@ -78,8 +78,8 @@ KEquityPriceUpdateDlg::KEquityPriceUpdateDlg(QWidget *parent, const QString& sec
lvEquityList->setColumnWidth(ID_COL, 0);
lvEquityList->setMultiSelection(true);
- lvEquityList->setColumnWidthMode(SYMBOL_COL, QListView::Maximum);
- lvEquityList->setColumnWidthMode(ID_COL, QListView::Manual);
+ lvEquityList->setColumnWidthMode(SYMBOL_COL, TQListView::Maximum);
+ lvEquityList->setColumnWidthMode(ID_COL, TQListView::Manual);
lvEquityList->setAllColumnsShowFocus(true);
btnUpdateAll->setEnabled(false);
@@ -92,7 +92,7 @@ KEquityPriceUpdateDlg::KEquityPriceUpdateDlg(QWidget *parent, const QString& sec
// send in securityId == "XXX YYY" to get a single-shot update for XXX to YYY.
// for consistency reasons, this accepts the same delimiters as WebPriceQuote::launch()
- 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*/);
MyMoneySecurityPair currencyIds;
if ( splitrx.search(securityId) != -1 )
currencyIds = MyMoneySecurityPair(splitrx.cap(1).utf8(),splitrx.cap(2).utf8());
@@ -104,7 +104,7 @@ KEquityPriceUpdateDlg::KEquityPriceUpdateDlg(QWidget *parent, const QString& sec
if ( file->security( pair.first ).isCurrency() && ( securityId.isEmpty() || ( pair == currencyIds ) ) )
{
const MyMoneyPriceEntries& entries = (*it_price);
- if(entries.count() > 0 && entries.begin().key() <= QDate::currentDate()) {
+ if(entries.count() > 0 && entries.begin().key() <= TQDate::tqcurrentDate()) {
addPricePair(pair);
btnUpdateAll->setEnabled(true);
}
@@ -115,8 +115,8 @@ KEquityPriceUpdateDlg::KEquityPriceUpdateDlg(QWidget *parent, const QString& sec
// Add each investment
//
- QValueList<MyMoneySecurity> securities = file->securityList();
- for(QValueList<MyMoneySecurity>::ConstIterator it = securities.begin(); it != securities.end(); ++it)
+ TQValueList<MyMoneySecurity> securities = file->securityList();
+ for(TQValueList<MyMoneySecurity>::ConstIterator it = securities.begin(); it != securities.end(); ++it)
{
if ( !(*it).isCurrency()
&& ( securityId.isEmpty() || ( (*it).id() == securityId ) )
@@ -133,33 +133,33 @@ KEquityPriceUpdateDlg::KEquityPriceUpdateDlg(QWidget *parent, const QString& sec
addPricePair(currencyIds, true);
}
- connect(btnOK, SIGNAL(clicked()), this, SLOT(accept()));
- connect(btnCancel, SIGNAL(clicked()), this, SLOT(reject()));
- connect(btnUpdateSelected, SIGNAL(clicked()), this, SLOT(slotUpdateSelectedClicked()));
- connect(btnUpdateAll, SIGNAL(clicked()), this, SLOT(slotUpdateAllClicked()));
+ connect(btnOK, TQT_SIGNAL(clicked()), this, TQT_SLOT(accept()));
+ connect(btnCancel, TQT_SIGNAL(clicked()), this, TQT_SLOT(reject()));
+ connect(btnUpdateSelected, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotUpdateSelectedClicked()));
+ connect(btnUpdateAll, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotUpdateAllClicked()));
- connect(&m_webQuote,SIGNAL(quote(const QString&, const QString&,const QDate&, const double&)),
- this,SLOT(slotReceivedQuote(const QString&, const QString&,const QDate&, const double&)));
- connect(&m_webQuote,SIGNAL(failed(const QString&, const QString&)),
- this,SLOT(slotQuoteFailed(const QString&, const QString&)));
- connect(&m_webQuote,SIGNAL(status(const QString&)),
- this,SLOT(logStatusMessage(const QString&)));
- connect(&m_webQuote,SIGNAL(error(const QString&)),
- this,SLOT(logErrorMessage(const QString&)));
+ connect(&m_webQuote,TQT_SIGNAL(quote(const TQString&, const TQString&,const TQDate&, const double&)),
+ this,TQT_SLOT(slotReceivedQuote(const TQString&, const TQString&,const TQDate&, const double&)));
+ connect(&m_webQuote,TQT_SIGNAL(failed(const TQString&, const TQString&)),
+ this,TQT_SLOT(slotQuoteFailed(const TQString&, const TQString&)));
+ connect(&m_webQuote,TQT_SIGNAL(status(const TQString&)),
+ this,TQT_SLOT(logStatusMessage(const TQString&)));
+ connect(&m_webQuote,TQT_SIGNAL(error(const TQString&)),
+ this,TQT_SLOT(logErrorMessage(const TQString&)));
- connect(lvEquityList, SIGNAL(selectionChanged()), this, SLOT(slotUpdateSelection()));
+ connect(lvEquityList, TQT_SIGNAL(selectionChanged()), this, TQT_SLOT(slotUpdateSelection()));
// Not implemented yet.
btnConfigure->hide();
- //connect(btnConfigure, SIGNAL(clicked()), this, SLOT(slotConfigureClicked()));
+ //connect(btnConfigure, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotConfigureClicked()));
if ( !securityId.isEmpty() )
{
btnUpdateSelected->hide();
btnUpdateAll->hide();
- // delete layout1;
+ // delete tqlayout1;
- QTimer::singleShot(100,this,SLOT(slotUpdateAllClicked()));
+ TQTimer::singleShot(100,this,TQT_SLOT(slotUpdateAllClicked()));
}
// Hide OK button until we have received the first update
@@ -183,19 +183,19 @@ void KEquityPriceUpdateDlg::addPricePair(const MyMoneySecurityPair& pair, bool d
{
MyMoneyFile* file = MyMoneyFile::instance();
- QString symbol = QString("%1 > %2").arg(pair.first,pair.second);
- QString id = QString("%1 %2").arg(pair.first,pair.second);
- if ( ! lvEquityList->findItem(id,ID_COL,Qt::ExactMatch) )
+ TQString symbol = TQString("%1 > %2").tqarg(pair.first,pair.second);
+ TQString id = TQString("%1 %2").tqarg(pair.first,pair.second);
+ if ( ! lvEquityList->tqfindItem(id,ID_COL,TQt::ExactMatch) )
{
MyMoneyPrice pr = file->price(pair.first,pair.second);
if(pr.source() != "KMyMoney") {
bool keep = true;
if((pair.first == file->baseCurrency().id())
|| (pair.second == file->baseCurrency().id())) {
- const QString& foreignCurrency = file->foreignCurrency(pair.first, pair.second);
+ const TQString& foreignCurrency = file->foreignCurrency(pair.first, pair.second);
// check that the foreign currency is still in use
- QValueList<MyMoneyAccount>::const_iterator it_a;
- QValueList<MyMoneyAccount> list;
+ TQValueList<MyMoneyAccount>::const_iterator it_a;
+ TQValueList<MyMoneyAccount> list;
file->accountList(list);
for(it_a = list.begin(); !dontCheckExistance && it_a != list.end(); ++it_a) {
// if it's an account denominated in the foreign currency
@@ -219,7 +219,7 @@ void KEquityPriceUpdateDlg::addPricePair(const MyMoneySecurityPair& pair, bool d
if(keep) {
KListViewItem* item = new KListViewItem(lvEquityList,
symbol,
- i18n("%1 units in %2").arg(pair.first,pair.second));
+ i18n("%1 units in %2").tqarg(pair.first,pair.second));
if(pr.isValid()) {
item->setText(PRICE_COL, pr.rate(pair.second).formatMoney(file->currency(pair.second).tradingSymbol(), KMyMoneyGlobalSettings::pricePrecision()));
item->setText(DATE_COL, pr.date().toString(Qt::ISODate));
@@ -235,13 +235,13 @@ void KEquityPriceUpdateDlg::addInvestment(const MyMoneySecurity& inv)
{
MyMoneyFile* file = MyMoneyFile::instance();
- QString symbol = inv.tradingSymbol();
- QString id = inv.id();
- if ( ! lvEquityList->findItem(id, ID_COL, Qt::ExactMatch) )
+ TQString symbol = inv.tradingSymbol();
+ TQString id = inv.id();
+ if ( ! lvEquityList->tqfindItem(id, ID_COL, TQt::ExactMatch) )
{
// check that the security is still in use
- QValueList<MyMoneyAccount>::const_iterator it_a;
- QValueList<MyMoneyAccount> list;
+ TQValueList<MyMoneyAccount>::const_iterator it_a;
+ TQValueList<MyMoneyAccount> list;
file->accountList(list);
for(it_a = list.begin(); it_a != list.end(); ++it_a) {
if((*it_a).isInvest()
@@ -260,7 +260,7 @@ void KEquityPriceUpdateDlg::addInvestment(const MyMoneySecurity& inv)
}
item->setText(ID_COL,id);
if (inv.value("kmm-online-quote-system") == "Finance::Quote")
- item->setText(SOURCE_COL, QString("Finance::Quote %1").arg( inv.value("kmm-online-source")));
+ item->setText(SOURCE_COL, TQString("Finance::Quote %1").tqarg( inv.value("kmm-online-source")));
else
item->setText(SOURCE_COL, inv.value("kmm-online-source"));
@@ -275,40 +275,40 @@ void KEquityPriceUpdateDlg::addInvestment(const MyMoneySecurity& inv)
}
}
-void KEquityPriceUpdateDlg::logErrorMessage(const QString& message)
+void KEquityPriceUpdateDlg::logErrorMessage(const TQString& message)
{
- logStatusMessage(QString("<font color=\"red\"><b>") + message + QString("</b></font>"));
+ logStatusMessage(TQString("<font color=\"red\"><b>") + message + TQString("</b></font>"));
}
-void KEquityPriceUpdateDlg::logStatusMessage(const QString& message)
+void KEquityPriceUpdateDlg::logStatusMessage(const TQString& message)
{
- lbStatus->append(message);
+ lbtqStatus->append(message);
}
-MyMoneyPrice KEquityPriceUpdateDlg::price(const QString& id) const
+MyMoneyPrice KEquityPriceUpdateDlg::price(const TQString& id) const
{
MyMoneyPrice price;
- QListViewItem* item;
+ TQListViewItem* item;
- if((item = lvEquityList->findItem(id, ID_COL, Qt::ExactMatch)) != 0) {
+ if((item = lvEquityList->tqfindItem(id, ID_COL, TQt::ExactMatch)) != 0) {
MyMoneyMoney rate(item->text(PRICE_COL));
if ( !rate.isZero() )
{
- QString id = item->text(ID_COL).utf8();
+ TQString id = item->text(ID_COL).utf8();
// if the ID has a space, then this is TWO ID's, so it's a currency quote
- if ( QString(id).contains(" ") )
+ if ( TQString(id).tqcontains(" ") )
{
- QStringList ids = QStringList::split(" ",QString(id));
- QString fromid = ids[0].utf8();
- QString toid = ids[1].utf8();
- price = MyMoneyPrice(fromid,toid,QDate().fromString(item->text(DATE_COL), Qt::ISODate),rate,item->text(SOURCE_COL));
+ TQStringList ids = TQStringList::split(" ",TQString(id));
+ TQString fromid = ids[0].utf8();
+ TQString toid = ids[1].utf8();
+ price = MyMoneyPrice(fromid,toid,TQDate().fromString(item->text(DATE_COL), Qt::ISODate),rate,item->text(SOURCE_COL));
}
else
// otherwise, it's a security quote
{
MyMoneySecurity security = MyMoneyFile::instance()->security(id);
- price = MyMoneyPrice(id, security.tradingCurrency(), QDate().fromString(item->text(DATE_COL), Qt::ISODate), rate, item->text(SOURCE_COL));
+ price = MyMoneyPrice(id, security.tradingCurrency(), TQDate().fromString(item->text(DATE_COL), Qt::ISODate), rate, item->text(SOURCE_COL));
}
}
}
@@ -320,11 +320,11 @@ void KEquityPriceUpdateDlg::storePrices(void)
// update the new prices into the equities
MyMoneyFile* file = MyMoneyFile::instance();
- QValueList<MyMoneySecurity> equities = file->securityList();
+ TQValueList<MyMoneySecurity> equities = file->securityList();
- QListViewItem* item = lvEquityList->firstChild();
+ TQListViewItem* item = lvEquityList->firstChild();
MyMoneyFileTransaction ft;
- QString name;
+ TQString name;
try {
while ( item )
{
@@ -334,16 +334,16 @@ void KEquityPriceUpdateDlg::storePrices(void)
MyMoneyMoney rate(item->text(PRICE_COL));
if ( !rate.isZero() )
{
- QString id = item->text(ID_COL).utf8();
+ TQString id = item->text(ID_COL).utf8();
// if the ID has a space, then this is TWO ID's, so it's a currency quote
- if ( QString(id).contains(" ") )
+ if ( TQString(id).tqcontains(" ") )
{
- QStringList ids = QStringList::split(" ",QString(id));
- QString fromid = ids[0].utf8();
- QString toid = ids[1].utf8();
- name = QString("%1 --> %2").arg(fromid).arg(toid);
- MyMoneyPrice price(fromid,toid,QDate().fromString(item->text(DATE_COL), Qt::ISODate),rate,item->text(SOURCE_COL));
+ TQStringList ids = TQStringList::split(" ",TQString(id));
+ TQString fromid = ids[0].utf8();
+ TQString toid = ids[1].utf8();
+ name = TQString("%1 --> %2").tqarg(fromid).tqarg(toid);
+ MyMoneyPrice price(fromid,toid,TQDate().fromString(item->text(DATE_COL), Qt::ISODate),rate,item->text(SOURCE_COL));
file->addPrice(price);
}
else
@@ -351,7 +351,7 @@ void KEquityPriceUpdateDlg::storePrices(void)
{
MyMoneySecurity security = MyMoneyFile::instance()->security(id);
name = security.name();
- MyMoneyPrice price(id, security.tradingCurrency(), QDate().fromString(item->text(DATE_COL), Qt::ISODate), rate, item->text(SOURCE_COL));
+ MyMoneyPrice price(id, security.tradingCurrency(), TQDate().fromString(item->text(DATE_COL), Qt::ISODate), rate, item->text(SOURCE_COL));
// TODO (Ace) Better handling of the case where there is already a price
// for this date. Currently, it just overrides the old value. Really it
@@ -374,7 +374,7 @@ void KEquityPriceUpdateDlg::slotUpdateSelection(void)
{
btnUpdateSelected->setEnabled(false);
- QListViewItem* item = lvEquityList->firstChild();
+ TQListViewItem* item = lvEquityList->firstChild();
while ( item && !item->isSelected())
item = item->nextSibling();
@@ -384,7 +384,7 @@ void KEquityPriceUpdateDlg::slotUpdateSelection(void)
void KEquityPriceUpdateDlg::slotUpdateSelectedClicked(void)
{
- QListViewItem* item = lvEquityList->firstChild();
+ TQListViewItem* item = lvEquityList->firstChild();
int skipCnt = 1;
while ( item && !item->isSelected())
{
@@ -403,7 +403,7 @@ void KEquityPriceUpdateDlg::slotUpdateSelectedClicked(void)
void KEquityPriceUpdateDlg::slotUpdateAllClicked(void)
{
- QListViewItem* item = lvEquityList->firstChild();
+ TQListViewItem* item = lvEquityList->firstChild();
if ( item )
{
prgOnlineProgress->setTotalSteps(1+lvEquityList->childCount());
@@ -415,16 +415,16 @@ void KEquityPriceUpdateDlg::slotUpdateAllClicked(void)
logErrorMessage("Security list is empty.");
}
-void KEquityPriceUpdateDlg::slotQuoteFailed(const QString& _id, const QString& _symbol)
+void KEquityPriceUpdateDlg::slotQuoteFailed(const TQString& _id, const TQString& _symbol)
{
- QListViewItem* item = lvEquityList->findItem(_id,ID_COL,Qt::ExactMatch);
+ TQListViewItem* item = lvEquityList->tqfindItem(_id,ID_COL,TQt::ExactMatch);
// Give the user some options
int result;
- if(_id.contains(" ")) {
- result = KMessageBox::warningContinueCancel(this, i18n("Failed to retrieve an exchange rate for %1 from %2. It will be skipped this time.").arg(_symbol, item->text(SOURCE_COL)), i18n("Price Update Failed"));
+ if(_id.tqcontains(" ")) {
+ result = KMessageBox::warningContinueCancel(this, i18n("Failed to retrieve an exchange rate for %1 from %2. It will be skipped this time.").tqarg(_symbol, item->text(SOURCE_COL)), i18n("Price Update Failed"));
} else {
- result = KMessageBox::questionYesNoCancel(this, QString("<qt>%1</qt>").arg(i18n("Failed to retrieve a quote for %1 from %2. Press <b>No</b> to remove the online price source from this security permanently, <b>Yes</b> to continue updating this security during future price updates or <b>Cancel</b> to stop the current update operation.").arg(_symbol, item->text(SOURCE_COL))), i18n("Price Update Failed"), KStdGuiItem::yes(), KStdGuiItem::no());
+ result = KMessageBox::questionYesNoCancel(this, TQString("<qt>%1</qt>").tqarg(i18n("Failed to retrieve a quote for %1 from %2. Press <b>No</b> to remove the online price source from this security permanently, <b>Yes</b> to continue updating this security during future price updates or <b>Cancel</b> to stop the current update operation.").tqarg(_symbol, item->text(SOURCE_COL))), i18n("Price Update Failed"), KStdGuiItem::yes(), KStdGuiItem::no());
}
if ( result == KMessageBox::No )
@@ -437,14 +437,14 @@ void KEquityPriceUpdateDlg::slotQuoteFailed(const QString& _id, const QString& _
MyMoneySecurity security = MyMoneyFile::instance()->security(_id.utf8());
// Set the quote source to blank
- security.setValue("kmm-online-source",QString());
- security.setValue("kmm-online-quote-system",QString());
+ security.setValue("kmm-online-source",TQString());
+ security.setValue("kmm-online-quote-system",TQString());
// Re-commit the security
MyMoneyFile::instance()->modifySecurity(security);
ft.commit();
} catch(MyMoneyException* e) {
- KMessageBox::error(this, QString("<qt>")+i18n("Cannot update security <b>%1</b>: %2").arg(_symbol, e->what())+QString("</qt>"), i18n("Price Update Failed"));
+ KMessageBox::error(this, TQString("<qt>")+i18n("Cannot update security <b>%1</b>: %2").tqarg(_symbol, e->what())+TQString("</qt>"), i18n("Price Update Failed"));
delete e;
}
}
@@ -452,7 +452,7 @@ void KEquityPriceUpdateDlg::slotQuoteFailed(const QString& _id, const QString& _
// As long as the user doesn't want to cancel, move on!
if ( result != KMessageBox::Cancel )
{
- QListViewItem* next = NULL;
+ TQListViewItem* next = NULL;
prgOnlineProgress->advance(1);
item->listView()->setSelected(item, false);
@@ -482,25 +482,25 @@ void KEquityPriceUpdateDlg::slotQuoteFailed(const QString& _id, const QString& _
}
}
-void KEquityPriceUpdateDlg::slotReceivedQuote(const QString& _id, const QString& _symbol,const QDate& _date, const double& _price)
+void KEquityPriceUpdateDlg::slotReceivedQuote(const TQString& _id, const TQString& _symbol,const TQDate& _date, const double& _price)
{
- QListViewItem* item = lvEquityList->findItem(_id,ID_COL,Qt::ExactMatch);
- QListViewItem* next = NULL;
+ TQListViewItem* item = lvEquityList->tqfindItem(_id,ID_COL,TQt::ExactMatch);
+ TQListViewItem* next = NULL;
if ( item )
{
if ( _price > 0.0f && _date.isValid() )
{
- QDate date = _date;
- if ( date > QDate::currentDate() )
- date = QDate::currentDate();
+ TQDate date = _date;
+ if ( date > TQDate::tqcurrentDate() )
+ date = TQDate::tqcurrentDate();
double price = _price;
- QString id = _id.utf8();
+ TQString id = _id.utf8();
MyMoneySecurity sec;
- if ( _id.contains(" ") == 0) {
+ if ( _id.tqcontains(" ") == 0) {
MyMoneySecurity security = MyMoneyFile::instance()->security(id);
- QString factor = security.value("kmm-online-factor");
+ TQString factor = security.value("kmm-online-factor");
if(!factor.isEmpty()) {
price *= MyMoneyMoney(factor).toDouble();
}
@@ -513,7 +513,7 @@ void KEquityPriceUpdateDlg::slotReceivedQuote(const QString& _id, const QString&
}
} else {
- 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 ( splitrx.search(_id) != -1 ) {
try {
sec = MyMoneyFile::instance()->security(splitrx.cap(2).utf8());
@@ -525,13 +525,13 @@ void KEquityPriceUpdateDlg::slotReceivedQuote(const QString& _id, const QString&
}
item->setText(PRICE_COL, KGlobal::locale()->formatMoney(price, sec.tradingSymbol(), KMyMoneyGlobalSettings::pricePrecision()));
item->setText(DATE_COL, date.toString(Qt::ISODate));
- logStatusMessage(i18n("Price for %1 updated (id %2)").arg(_symbol,_id));
+ logStatusMessage(i18n("Price for %1 updated (id %2)").tqarg(_symbol,_id));
// make sure to make OK button available
btnOK->setEnabled(true);
}
else
{
- logErrorMessage(i18n("Received an invalid price for %1, unable to update.").arg(_symbol));
+ logErrorMessage(i18n("Received an invalid price for %1, unable to update.").tqarg(_symbol));
}
prgOnlineProgress->advance(1);
@@ -551,7 +551,7 @@ void KEquityPriceUpdateDlg::slotReceivedQuote(const QString& _id, const QString&
}
else
{
- logErrorMessage(i18n("Received a price for %1 (id %2), but this symbol is not on the list! Aborting entire update.").arg(_symbol,_id));
+ logErrorMessage(i18n("Received a price for %1 (id %2), but this symbol is not on the list! Aborting entire update.").tqarg(_symbol,_id));
}
if (next)