Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/views/kinvestmentview.cpp
Show First 20 Lines • Show All 143 Lines • ▼ Show 20 Line(s) | 95 | { | |||
---|---|---|---|---|---|
144 | KGuiItem::assign(m_deleteSecurityButton, removeButtonItem); | 144 | KGuiItem::assign(m_deleteSecurityButton, removeButtonItem); | ||
145 | 145 | | |||
146 | KGuiItem editButtonItem(i18n("&Edit"), | 146 | KGuiItem editButtonItem(i18n("&Edit"), | ||
147 | QIcon::fromTheme("document-edit"), | 147 | QIcon::fromTheme("document-edit"), | ||
148 | i18n("Modify the selected entry"), | 148 | i18n("Modify the selected entry"), | ||
149 | i18n("Change the security information of the selected entry.")); | 149 | i18n("Change the security information of the selected entry.")); | ||
150 | KGuiItem::assign(m_editSecurityButton, editButtonItem); | 150 | KGuiItem::assign(m_editSecurityButton, editButtonItem); | ||
151 | 151 | | |||
152 | connect(m_showCurrencyButton, SIGNAL(toggled(bool)), this, SLOT(slotLoadView())); | | |||
153 | connect(m_securitiesList, SIGNAL(itemSelectionChanged()), this, SLOT(slotUpdateSecuritiesButtons())); | 152 | connect(m_securitiesList, SIGNAL(itemSelectionChanged()), this, SLOT(slotUpdateSecuritiesButtons())); | ||
154 | connect(m_editSecurityButton, SIGNAL(clicked()), this, SLOT(slotEditSecurity())); | 153 | connect(m_editSecurityButton, SIGNAL(clicked()), this, SLOT(slotEditSecurity())); | ||
155 | connect(m_deleteSecurityButton, SIGNAL(clicked()), this, SLOT(slotDeleteSecurity())); | 154 | connect(m_deleteSecurityButton, SIGNAL(clicked()), this, SLOT(slotDeleteSecurity())); | ||
156 | } | 155 | } | ||
157 | 156 | | |||
158 | KInvestmentView::~KInvestmentView() | 157 | KInvestmentView::~KInvestmentView() | ||
159 | { | 158 | { | ||
160 | // save the header state of the equities list | 159 | // save the header state of the equities list | ||
▲ Show 20 Lines • Show All 278 Lines • ▼ Show 20 Line(s) | 408 | { | |||
439 | prec = MyMoneyMoney::denomToPrec(security.smallestAccountFraction()); | 438 | prec = MyMoneyMoney::denomToPrec(security.smallestAccountFraction()); | ||
440 | 439 | | |||
441 | item->setText(eQuantityColumn, balance.formatMoney("", prec)); | 440 | item->setText(eQuantityColumn, balance.formatMoney("", prec)); | ||
442 | item->setTextAlignment(eQuantityColumn, Qt::AlignRight | Qt::AlignVCenter); | 441 | item->setTextAlignment(eQuantityColumn, Qt::AlignRight | Qt::AlignVCenter); | ||
443 | item->setData(eQuantityColumn, Qt::UserRole, QVariant::fromValue(balance)); | 442 | item->setData(eQuantityColumn, Qt::UserRole, QVariant::fromValue(balance)); | ||
444 | 443 | | |||
445 | //column 4 is the current price | 444 | //column 4 is the current price | ||
446 | // Get the price precision from the configuration | 445 | // Get the price precision from the configuration | ||
447 | prec = KMyMoneyGlobalSettings::pricePrecision(); | 446 | prec = security.pricePrecision(); | ||
448 | 447 | | |||
449 | // prec = MyMoneyMoney::denomToPrec(m_tradingCurrency.smallestAccountFraction()); | 448 | // prec = MyMoneyMoney::denomToPrec(m_tradingCurrency.smallestAccountFraction()); | ||
450 | if (price.isValid()) { | 449 | if (price.isValid()) { | ||
451 | item->setText(ePriceColumn, price.rate(tradingCurrency.id()).formatMoney(tradingCurrency.tradingSymbol(), prec)); | 450 | item->setText(ePriceColumn, price.rate(tradingCurrency.id()).formatMoney(tradingCurrency.tradingSymbol(), prec)); | ||
452 | item->setData(ePriceColumn, Qt::UserRole, QVariant::fromValue(price.rate(tradingCurrency.id()))); | 451 | item->setData(ePriceColumn, Qt::UserRole, QVariant::fromValue(price.rate(tradingCurrency.id()))); | ||
453 | } else { | 452 | } else { | ||
454 | item->setText(ePriceColumn, "---"); | 453 | item->setText(ePriceColumn, "---"); | ||
455 | } | 454 | } | ||
Show All 22 Lines | |||||
478 | void KInvestmentView::loadSecuritiesList() | 477 | void KInvestmentView::loadSecuritiesList() | ||
479 | { | 478 | { | ||
480 | m_securitiesList->setColumnWidth(eIdColumn, 0); | 479 | m_securitiesList->setColumnWidth(eIdColumn, 0); | ||
481 | m_securitiesList->setSortingEnabled(false); | 480 | m_securitiesList->setSortingEnabled(false); | ||
482 | m_securitiesList->clear(); | 481 | m_securitiesList->clear(); | ||
483 | 482 | | |||
484 | QList<MyMoneySecurity> list = MyMoneyFile::instance()->securityList(); | 483 | QList<MyMoneySecurity> list = MyMoneyFile::instance()->securityList(); | ||
485 | QList<MyMoneySecurity>::ConstIterator it; | 484 | QList<MyMoneySecurity>::ConstIterator it; | ||
486 | if (m_showCurrencyButton->isChecked()) { | | |||
487 | list += MyMoneyFile::instance()->currencyList(); | | |||
488 | } | | |||
489 | for (it = list.constBegin(); it != list.constEnd(); ++it) { | 485 | for (it = list.constBegin(); it != list.constEnd(); ++it) { | ||
490 | QTreeWidgetItem* newItem = new QTreeWidgetItem(m_securitiesList); | 486 | QTreeWidgetItem* newItem = new QTreeWidgetItem(m_securitiesList); | ||
491 | loadSecurityItem(newItem, *it); | 487 | loadSecurityItem(newItem, *it); | ||
492 | 488 | | |||
493 | } | 489 | } | ||
494 | m_securitiesList->setSortingEnabled(true); | 490 | m_securitiesList->setSortingEnabled(true); | ||
495 | 491 | | |||
496 | slotUpdateSecuritiesButtons(); | 492 | slotUpdateSecuritiesButtons(); | ||
▲ Show 20 Lines • Show All 76 Lines • Show Last 20 Lines |