[office/kmymoney/26-consider-removing-support-for-finance-quote] /: Remove support for Finance::Quote
Dawid Wróbel
null at kde.org
Wed Jul 1 15:46:52 BST 2020
Git commit 46dc4e984f0ad216aca788a33a17b16ed5a61a6d by Dawid Wróbel.
Committed on 01/07/2020 at 14:46.
Pushed by wrobelda into branch '26-consider-removing-support-for-finance-quote'.
Remove support for Finance::Quote
- support the built-in sources only
- update the documentation
M +4 -6 doc/details-impexp.docbook
M +3 -21 doc/details-investments.docbook
M +0 -1 kmymoney/converter/tests/converter-test.cpp
M +2 -201 kmymoney/converter/webpricequote.cpp
M +1 -47 kmymoney/converter/webpricequote.h
M +1 -5 kmymoney/dialogs/kequitypriceupdatedlg.cpp
M +0 -3 kmymoney/misc/CMakeLists.txt
D +0 -118 kmymoney/misc/financequote.pl
M +0 -9 kmymoney/plugins/gnc/import/kgncimportoptionsdlg.cpp
M +0 -1 kmymoney/plugins/gnc/import/kgncimportoptionsdlg.h
M +3 -23 kmymoney/plugins/gnc/import/kgncimportoptionsdlg.ui
M +0 -10 kmymoney/plugins/gnc/import/mymoneygncreader.cpp
M +1 -5 kmymoney/plugins/gnc/import/mymoneygncreader.h
M +0 -8 kmymoney/wizards/newinvestmentwizard/knewinvestmentwizard.cpp
M +5 -26 kmymoney/wizards/newinvestmentwizard/konlineupdatewizardpage.cpp
M +0 -1 kmymoney/wizards/newinvestmentwizard/konlineupdatewizardpage.h
M +127 -141 kmymoney/wizards/newinvestmentwizard/konlineupdatewizardpage.ui
https://invent.kde.org/office/kmymoney/commit/46dc4e984f0ad216aca788a33a17b16ed5a61a6d
diff --git a/doc/details-impexp.docbook b/doc/details-impexp.docbook
index 528722a15..542723232 100644
--- a/doc/details-impexp.docbook
+++ b/doc/details-impexp.docbook
@@ -315,10 +315,9 @@
<para>
For obtaining online price and currency rate quotations, GnuCash uses a
- package called Finance::Quote. Recent versions of &kmymoney; contain support
- for this package for obtaining stock quotes, and this will be used by default
- when importing data. You may however select to convert to the native method
- used by &kmymoney; which is covered in more detail in
+ package called Finance::Quote. &kmymoney; no longer supports it, but you may,
+ however, select to convert to the native method used by &kmymoney; which is
+ covered in more detail in
<link linkend="details.investments.onlinequotes">online quotes</link>.
</para>
@@ -328,8 +327,7 @@
for which online quotes are required. However, the stock (ticker) symbol will
be imported unchanged. Since this symbol will almost certainly be different in
the two packages, it will need to be manually edited after completion of the
- import process. Future currency rate updates will not use Finance::Quote, and
- will always use the native retrieval method.
+ import process.
</para>
<para>
diff --git a/doc/details-investments.docbook b/doc/details-investments.docbook
index 231d4bef7..3d7835fa2 100644
--- a/doc/details-investments.docbook
+++ b/doc/details-investments.docbook
@@ -210,19 +210,12 @@
</para>
<itemizedlist>
- <listitem>
- <para>
- Use Finance::Quote. This is an option for GnuCash users who are used to
- this style of quotes. Most users can leave this unchecked.
- </para>
- </listitem>
-
<listitem>
<para>
Online Source. The online source you'd like to use for this particular
- investment. The most common choice is <quote>Yahoo</quote>. Try that first,
- and if the investment cannot be found using this source, then experiment with
- the others.
+ investment. The most common choice is <quote>Yahoo Finance</quote>. Try that
+ first, and if the investment cannot be found using this source, then experiment
+ with the others.
</para>
</listitem>
@@ -599,17 +592,6 @@
section. In the Online source dropdown box, select the online source for your
needs.
</para>
-
-<para>
- Versions of &kmymoney; starting with 0.9 contain support for the Finance::Quote
- package for obtaining online quotes. This is intended primarily as a convenience
- for those users converting from the GnuCash finance package, which uses it as its
- native method. If you do select this option, you should see a different list of
- sources, those supported by Finance::Quote. If the list is empty, it suggests that
- the package is not properly installed. See their web site at
- <ulink url="http://finance-quote.sourceforge.net">
- http://finance-quote.sourceforge.net</ulink> for more information.
-</para>
</sect3>
<sect3>
diff --git a/kmymoney/converter/tests/converter-test.cpp b/kmymoney/converter/tests/converter-test.cpp
index 7da31bb58..d71dc82fe 100644
--- a/kmymoney/converter/tests/converter-test.cpp
+++ b/kmymoney/converter/tests/converter-test.cpp
@@ -102,7 +102,6 @@ void ConverterTest::testWebQuotes_data()
// QTest::newRow("Gielda Papierow Wartosciowych (GPW)") << "TDB647" << "test Gielda Papierow Wartosciowych (GPW)" << "Gielda Papierow Wartosciowych (GPW)";
// QTest::newRow("OMX Baltic") << "TDB647" << "test OMX Baltic funds" << "OMX Baltic funds";
- QTest::newRow("Finance::Quote usa") << "DIS" << "test F::Q usa" << "Finance::Quote usa";
//UNTESTED: Other F::Q sources, local files, user custom sources
}
diff --git a/kmymoney/converter/webpricequote.cpp b/kmymoney/converter/webpricequote.cpp
index 1d8f892b0..7c6b31b4b 100644
--- a/kmymoney/converter/webpricequote.cpp
+++ b/kmymoney/converter/webpricequote.cpp
@@ -55,10 +55,6 @@
Q_DECLARE_LOGGING_CATEGORY(WEBPRICEQUOTE)
Q_LOGGING_CATEGORY(WEBPRICEQUOTE, "kmymoney_webpricequote")
-// define static members
-QString WebPriceQuote::m_financeQuoteScriptPath;
-QStringList WebPriceQuote::m_financeQuoteSources;
-
class WebPriceQuote::Private
{
public:
@@ -78,11 +74,6 @@ WebPriceQuote::WebPriceQuote(QObject* _parent):
QObject(_parent),
d(new Private)
{
- // only do this once (I know, it is not thread safe, but it should
- // always yield the same result so we don't do any semaphore foo here)
- if (m_financeQuoteScriptPath.isEmpty()) {
- m_financeQuoteScriptPath = QStandardPaths::locate(QStandardPaths::DataLocation, QString("misc/financequote.pl"));
- }
connect(&d->m_filter, SIGNAL(processExited(QString)), this, SLOT(slotParseQuote(QString)));
}
@@ -99,9 +90,7 @@ void WebPriceQuote::setDate(const QDate& _from, const QDate& _to)
bool WebPriceQuote::launch(const QString& _webID, const QString& _kmmID, const QString& _sourcename)
{
- if (_sourcename.contains("Finance::Quote"))
- return (launchFinanceQuote(_webID, _kmmID, _sourcename));
- else if ((!d->m_fromDate.isValid() || !d->m_toDate.isValid()) ||
+ if ((!d->m_fromDate.isValid() || !d->m_toDate.isValid()) ||
(d->m_fromDate == d->m_toDate && d->m_toDate == QDate::currentDate()))
return (launchNative(_webID, _kmmID, _sourcename));
else
@@ -375,41 +364,6 @@ void WebPriceQuote::downloadResult(KJob* job)
}
}
-bool WebPriceQuote::launchFinanceQuote(const QString& _webID, const QString& _kmmID,
- const QString& _sourcename)
-{
- bool result = true;
- d->m_webID = _webID;
- d->m_kmmID = _kmmID;
- QString FQSource = _sourcename.section(' ', 1);
- d->m_source = WebPriceQuoteSource(_sourcename, m_financeQuoteScriptPath, m_financeQuoteScriptPath,
- "\"([^,\"]*)\",.*", // webIDRegExp
- WebPriceQuoteSource::identifyBy::Symbol,
- "[^,]*,[^,]*,\"([^\"]*)\"", // price regexp
- "[^,]*,([^,]*),.*", // date regexp
- "%y-%m-%d"); // date format
-
- //emit status(QString("(Debug) symbol=%1 id=%2...").arg(_symbol,_id));
-
- QStringList arguments;
- arguments << m_financeQuoteScriptPath << FQSource << KShell::quoteArg(_webID);
- d->m_filter.setWebID(d->m_webID);
- emit status(i18nc("Executing 'script' 'online source' 'investment symbol' ", "Executing %1 %2 %3...", m_financeQuoteScriptPath, FQSource, _webID));
-
- d->m_filter.setProcessChannelMode(QProcess::MergedChannels);
- d->m_filter.start(QLatin1Literal("perl"), arguments);
-
- // This seems to work best if we just block until done.
- if (d->m_filter.waitForFinished()) {
- result = true;
- } else {
- emit error(i18n("Unable to launch: %1", m_financeQuoteScriptPath));
- slotParseQuote(QString());
- }
-
- return result;
-}
-
void WebPriceQuote::slotParseCSVQuote(const QString& filename)
{
bool isOK = true;
@@ -762,15 +716,7 @@ const QMap<QString, WebPriceQuoteSource> WebPriceQuote::defaultQuoteSources()
return result;
}
-const QStringList WebPriceQuote::quoteSources(const _quoteSystemE _system)
-{
- if (_system == Native)
- return (quoteSourcesNative());
- else
- return (quoteSourcesFinanceQuote());
-}
-
-const QStringList WebPriceQuote::quoteSourcesNative()
+const QStringList WebPriceQuote::quoteSources()
{
KSharedConfigPtr kconfig = KSharedConfig::openConfig();
QStringList groups = kconfig->groupList();
@@ -837,28 +783,6 @@ const QStringList WebPriceQuote::quoteSourcesNative()
return groups;
}
-const QStringList WebPriceQuote::quoteSourcesFinanceQuote()
-{
- if (m_financeQuoteSources.empty()) { // run the process one time only
- // since this is a static function it can be called without constructing an object
- // so we need to make sure that m_financeQuoteScriptPath is properly initialized
- if (m_financeQuoteScriptPath.isEmpty()) {
- m_financeQuoteScriptPath = QStandardPaths::locate(QStandardPaths::DataLocation, QString("misc/financequote.pl"));
- }
- FinanceQuoteProcess getList;
- getList.launch(m_financeQuoteScriptPath);
- while (!getList.isFinished()) {
- QCoreApplication::processEvents();
- }
- m_financeQuoteSources = getList.getSourceList();
- }
- return (m_financeQuoteSources);
-}
-
-//
-// Helper class to load/save an individual source
-//
-
WebPriceQuoteSource::WebPriceQuoteSource(const QString& name, const QString& url, const QString &csvUrl, const QString& id, const identifyBy idBy, const QString& price, const QString& date, const QString& dateformat, bool skipStripping):
m_name(name),
m_url(url),
@@ -941,129 +865,6 @@ void WebPriceQuoteProcess::slotProcessExited(int /*exitCode*/, QProcess::ExitSta
m_string.truncate(0);
}
-//
-// Helper class to babysit the KProcess used for running the Finance Quote sources script
-//
-
-FinanceQuoteProcess::FinanceQuoteProcess()
-{
- m_isDone = false;
- m_string = "";
- m_fqNames["aex"] = "AEX";
- m_fqNames["aex_futures"] = "AEX Futures";
- m_fqNames["aex_options"] = "AEX Options";
- m_fqNames["amfiindia"] = "AMFI India";
- m_fqNames["asegr"] = "ASE";
- m_fqNames["asia"] = "Asia (Yahoo, ...)";
- m_fqNames["asx"] = "ASX";
- m_fqNames["australia"] = "Australia (ASX, Yahoo, ...)";
- m_fqNames["bmonesbittburns"] = "BMO NesbittBurns";
- m_fqNames["brasil"] = "Brasil (Yahoo, ...)";
- m_fqNames["canada"] = "Canada (Yahoo, ...)";
- m_fqNames["canadamutual"] = "Canada Mutual (Fund Library, ...)";
- m_fqNames["deka"] = "Deka Investments";
- m_fqNames["dutch"] = "Dutch (AEX, ...)";
- m_fqNames["dwsfunds"] = "DWS";
- m_fqNames["europe"] = "Europe (Yahoo, ...)";
- m_fqNames["fidelity"] = "Fidelity (Fidelity, ...)";
- m_fqNames["fidelity_direct"] = "Fidelity Direct";
- m_fqNames["financecanada"] = "Finance Canada";
- m_fqNames["ftportfolios"] = "First Trust (First Trust, ...)";
- m_fqNames["ftportfolios_direct"] = "First Trust Portfolios";
- m_fqNames["fundlibrary"] = "Fund Library";
- m_fqNames["greece"] = "Greece (ASE, ...)";
- m_fqNames["indiamutual"] = "India Mutual (AMFI, ...)";
- m_fqNames["maninv"] = "Man Investments";
- m_fqNames["fool"] = "Motley Fool";
- m_fqNames["nasdaq"] = "Nasdaq (Yahoo, ...)";
- m_fqNames["nz"] = "New Zealand (Yahoo, ...)";
- m_fqNames["nyse"] = "NYSE (Yahoo, ...)";
- m_fqNames["nzx"] = "NZX";
- m_fqNames["platinum"] = "Platinum Asset Management";
- m_fqNames["seb_funds"] = "SEB";
- m_fqNames["sharenet"] = "Sharenet";
- m_fqNames["za"] = "South Africa (Sharenet, ...)";
- m_fqNames["troweprice_direct"] = "T. Rowe Price";
- m_fqNames["troweprice"] = "T. Rowe Price";
- m_fqNames["tdefunds"] = "TD Efunds";
- m_fqNames["tdwaterhouse"] = "TD Waterhouse Canada";
- m_fqNames["tiaacref"] = "TIAA-CREF";
- m_fqNames["trustnet"] = "Trustnet";
- m_fqNames["uk_unit_trusts"] = "U.K. Unit Trusts";
- m_fqNames["unionfunds"] = "Union Investments";
- m_fqNames["tsp"] = "US Govt. Thrift Savings Plan";
- m_fqNames["usfedbonds"] = "US Treasury Bonds";
- m_fqNames["usa"] = "USA (Yahoo, Fool ...)";
- m_fqNames["vanguard"] = "Vanguard";
- m_fqNames["vwd"] = "VWD";
- m_fqNames["yahoo"] = "Yahoo";
- m_fqNames["yahoo_asia"] = "Yahoo Asia";
- m_fqNames["yahoo_australia"] = "Yahoo Australia";
- m_fqNames["yahoo_brasil"] = "Yahoo Brasil";
- m_fqNames["yahoo_europe"] = "Yahoo Europe";
- m_fqNames["yahoo_nz"] = "Yahoo New Zealand";
- m_fqNames["zifunds"] = "Zuerich Investments";
- connect(this, SIGNAL(readyReadStandardOutput()), this, SLOT(slotReceivedDataFromFilter()));
- connect(this, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(slotProcessExited()));
- connect(this, SIGNAL(error(QProcess::ProcessError)), this, SLOT(slotProcessExited()));
-}
-
-void FinanceQuoteProcess::slotReceivedDataFromFilter()
-{
- QByteArray data(readAllStandardOutput());
-
-// qDebug() << "WebPriceQuoteProcess::slotReceivedDataFromFilter(): " << QString(data);
- m_string += QString(data);
-}
-
-void FinanceQuoteProcess::slotProcessExited()
-{
-// qDebug() << "WebPriceQuoteProcess::slotProcessExited()";
- m_isDone = true;
-}
-
-void FinanceQuoteProcess::launch(const QString& scriptPath)
-{
- QStringList arguments;
- arguments << scriptPath << QLatin1Literal("-l");
- setProcessChannelMode(QProcess::SeparateChannels);
- start(QLatin1Literal("perl"), arguments);
- if (! waitForStarted()) qWarning("Unable to start FQ script");
- return;
-}
-
-const QStringList FinanceQuoteProcess::getSourceList() const
-{
- QStringList raw = m_string.split(0x0A, QString::SkipEmptyParts);
- QStringList sources;
- QStringList::iterator it;
- for (it = raw.begin(); it != raw.end(); ++it) {
- if (m_fqNames[*it].isEmpty()) sources.append(*it);
- else sources.append(m_fqNames[*it]);
- }
- sources.sort();
- return (sources);
-}
-
-const QString FinanceQuoteProcess::crypticName(const QString& niceName) const
-{
- QString ret(niceName);
- fqNameMap::const_iterator it;
- for (it = m_fqNames.begin(); it != m_fqNames.end(); ++it) {
- if (niceName == it.value()) {
- ret = it.key();
- break;
- }
- }
- return (ret);
-}
-
-const QString FinanceQuoteProcess::niceName(const QString& crypticName) const
-{
- QString ret(m_fqNames[crypticName]);
- if (ret.isEmpty()) ret = crypticName;
- return (ret);
-}
//
// Universal date converter
//
diff --git a/kmymoney/converter/webpricequote.h b/kmymoney/converter/webpricequote.h
index 7d75a7f23..4a23356d0 100644
--- a/kmymoney/converter/webpricequote.h
+++ b/kmymoney/converter/webpricequote.h
@@ -62,38 +62,6 @@ private:
QString m_string;
};
-/**
-Helper class to run the Finance::Quote process. This is used only for the purpose of obtaining
-a list of valid sources. The actual price quotes are obtained thru WebPriceQuoteProcess.
-The class also contains functions to convert between the rather cryptic source names used
-by the Finance::Quote package, and more user-friendly names.
-
- at author Thomas Baumgart <thb at net-bembel.de> & Ace Jones <acejones at users.sourceforge.net>, Tony B<tonybloom at users.sourceforge.net>
- */
-class FinanceQuoteProcess: public QProcess
-{
- Q_OBJECT
-public:
- FinanceQuoteProcess();
- void launch(const QString& scriptPath);
- bool isFinished() const {
- return(m_isDone);
- };
- const QStringList getSourceList() const;
- const QString crypticName(const QString& niceName) const;
- const QString niceName(const QString& crypticName) const;
-
-public Q_SLOTS:
- void slotReceivedDataFromFilter();
- void slotProcessExited();
-
-private:
- bool m_isDone;
- QString m_string;
- typedef QMap<QString, QString> fqNameMap;
- fqNameMap m_fqNames;
-};
-
/**
* @author Thomas Baumgart & Ace Jones
*
@@ -134,11 +102,6 @@ public:
explicit WebPriceQuote(QObject* = 0);
~WebPriceQuote();
- typedef enum _quoteSystemE {
- Native = 0,
- FinanceQuote
- } quoteSystemE;
-
void setDate(const QDate& _from, const QDate& _to);
/**
* This launches a web-based quote update for the given @p _webID.
@@ -160,10 +123,9 @@ public:
* This returns a list of the names of the quote sources
* currently defined.
*
- * @param _system whether to return Native or Finance::Quote source list
* @return QStringList of quote source names
*/
- static const QStringList quoteSources(const _quoteSystemE _system = Native);
+ static const QStringList quoteSources();
static const QMap<QString, PricesProfile> defaultCSVQuoteSources();
Q_SIGNALS:
@@ -185,21 +147,13 @@ protected:
private:
bool launchCSV(const QString& _webID, const QString& _kmmID, const QString& _source = QString());
bool launchNative(const QString& _webID, const QString& _kmmID, const QString& _source = QString());
- bool launchFinanceQuote(const QString& _webID, const QString& _kmmID, const QString& _source = QString());
void enter_loop();
- static const QStringList quoteSourcesNative();
- static const QStringList quoteSourcesFinanceQuote();
-
private:
/// \internal d-pointer class.
class Private;
/// \internal d-pointer instance.
Private* const d;
-
- static QString m_financeQuoteScriptPath;
- static QStringList m_financeQuoteSources;
-
};
class MyMoneyDateFormat
diff --git a/kmymoney/dialogs/kequitypriceupdatedlg.cpp b/kmymoney/dialogs/kequitypriceupdatedlg.cpp
index ba8f12662..56afad95d 100644
--- a/kmymoney/dialogs/kequitypriceupdatedlg.cpp
+++ b/kmymoney/dialogs/kequitypriceupdatedlg.cpp
@@ -298,10 +298,7 @@ public:
item->setText(DATE_COL, pr.date().toString(Qt::ISODate));
}
item->setText(KMMID_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")));
- else
- item->setText(SOURCE_COL, inv.value("kmm-online-source"));
+ item->setText(SOURCE_COL, inv.value("kmm-online-source"));
ui->lvEquityList->invisibleRootItem()->addChild(item);
@@ -534,7 +531,6 @@ void KEquityPriceUpdateDlg::slotQuoteFailed(const QString& _kmmID, const QString
// Set the quote source to blank
security.setValue("kmm-online-source", QString());
- security.setValue("kmm-online-quote-system", QString());
// Re-commit the security
MyMoneyFile::instance()->modifySecurity(security);
diff --git a/kmymoney/misc/CMakeLists.txt b/kmymoney/misc/CMakeLists.txt
index 080e82905..fd3e9caea 100644
--- a/kmymoney/misc/CMakeLists.txt
+++ b/kmymoney/misc/CMakeLists.txt
@@ -1,6 +1,3 @@
-install(PROGRAMS financequote.pl
- DESTINATION ${DATA_INSTALL_DIR}/kmymoney/misc)
-
set( kmm_utils_validators_SRCS
charvalidator.cpp
validators.cpp
diff --git a/kmymoney/misc/financequote.pl b/kmymoney/misc/financequote.pl
deleted file mode 100644
index 0e9d6394c..000000000
--- a/kmymoney/misc/financequote.pl
+++ /dev/null
@@ -1,118 +0,0 @@
-#!/usr/bin/perl
-######################################################################
-### financequote.pl - KMyMoney interface to Finance::Quote
-###
-### derived from GnuCash finance-quote-helper script which is
-### Copyright 2001 Rob Browning <rlb at cs.utexas.edu>
-###
-### This program is free software; you can redistribute it and/or
-### modify it under the terms of the GNU General Public License as
-### published by the Free Software Foundation; either version 2 of
-### the License, or (at your option) any later version.
-###
-### This program is distributed in the hope that it will be useful,
-### but WITHOUT ANY WARRANTY; without even the implied warranty of
-### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-### GNU General Public License for more details.
-###
-### You should have received a copy of the GNU General Public License
-### along with this program.
-### If not, see <http://www.gnu.org/licenses/>.
-######################################################################
-
-#use diagnostics; # while testing
-use strict;
-use Data::Dumper;
-
-my $prgnam = "kmymoneyfq.pl";
-my $version = "1.00";
-# perl modules required by this routine and Finance::Quote
-my @modules = qw(Date::Manip Finance::Quote LWP XML::Parser XML::Writer);
-
-# main - check command line arguments
-
-my $testonly;
-my $listonly;
-# analyze the arguments
-foreach my $arg (@ARGV) {
- my $listopt = "-l"; # I had a much slicker way of doing this but it stopped working...
- my $testopt = "-t";
- $testonly = 1 if $arg =~ $testopt;
- $listonly = 1 if $arg =~ $listopt;
-}
-
-# test call; check that all required modules are present
-if ($testonly) {
- my @absent_modules; # to build list of missing modules
-
- foreach my $module (@modules) {
- if (!eval "require $module") {
- push (@absent_modules, $module);
- }
- }
- if (@absent_modules) {
- foreach my $module (@absent_modules) {
- print STDERR " ".$module."\n";
- }
- exit 254; # missing modules exit code for kmymoney
- }
- exit 0;
-}
-
-# load the required modules
-foreach my $module (@modules) {
- eval "require $module";
- $module->import();
-}
-
-# create a finance quote object and set required parameters
-my $q = Finance::Quote->new();
-$q->set_currency(); # disable any currency conversion
-$q->timeout(60); # timeout 60 seconds
-$q->failover(0); # disable failover
-
-# process call for exchange list only
-if ($listonly) {
- my @sources = $q->sources();
- foreach my $source (@sources) {
- print "$source\n";
- }
- exit 0;
-}
-
-my $source = $ARGV[0];
-my $symbol = $ARGV[1];
-
-#print "\tfinding price for <$symbol> from <$source>\n";
-my %qhash = $q->fetch($source, $symbol); # get price data from F::Q
-#my %qhash = ("RHATsuccess" => 1, "RHATdate" => "4/4/2004", "RHATcurrency" => "USD",
- #"RHATbid" => "25.55", "RHATask" => "26.04");
-#print Dumper(%qhash);
-my $errcode;
-$errcode = 0;
-
-if (!%qhash) { $errcode = 1;} # no data from fq (?bad exchange?)
- elsif ($qhash {$symbol, "success"} != 1) {$errcode = 2;} # got data but quote failed (?bad symbol?)
- elsif (!$qhash{$symbol, "last"} and !$qhash{$symbol, "price"} ) {$errcode = 3;} # can't find a price (?hmmm?)
-if ($errcode != 0) {
- print "Error " => "$errcode";
-} else {
- # extract the date and convert from m/d/yyyy to yyyy-mm-dd
- my ($usdate, $month, $day, $year, $yyyymmdd);
- $usdate = $qhash{$symbol, "date"};
- ($month,$day,$year) = ($usdate =~ /([0-9]+)\/([0-9]+)\/([0-9]+)/);
- # i'm sure I can do the following with a regex but I'm just too idle...
- $month = "0$month" if ($month < 9);
- $day = "0$day" if ($day < 9);
- $yyyymmdd = "$year-$month-$day";
- # and the price
- # (tried having bid and ask here, but could be undef for some stocks (IBM)
- # and looked pretty unrealistic for others (e.g. RHAT on 15/5/04 was 12.09-38.32!))
- my $price = $qhash {$symbol, "last"};
- # if no price was found, try to extract it from the price symbol
- # see https://bugs.kde.org/show_bug.cgi?id=234268 for details
- $price = $qhash {$symbol, "price"} if (!$price);
-
- print "\"$symbol\",\"$yyyymmdd\",\"$price\"";
-}
-
diff --git a/kmymoney/plugins/gnc/import/kgncimportoptionsdlg.cpp b/kmymoney/plugins/gnc/import/kgncimportoptionsdlg.cpp
index 08bf0915d..5b72f00a6 100644
--- a/kmymoney/plugins/gnc/import/kgncimportoptionsdlg.cpp
+++ b/kmymoney/plugins/gnc/import/kgncimportoptionsdlg.cpp
@@ -63,9 +63,6 @@ public:
ui->buttonInvestGroup->setId(ui->radioInvest2, 1); // one invest acct for all stocks
ui->buttonInvestGroup->setId(ui->radioInvest3, 2); // prompt for each stock
- ui->buttonGroup5->setExclusive(false);
- ui->checkFinanceQuote->setChecked(true);
-
ui->buttonGroup2->setExclusive(false);
ui->checkSchedules->setChecked(false);
@@ -137,12 +134,6 @@ int KGncImportOptionsDlg::investmentOption() const
return (d->ui->buttonInvestGroup->checkedId());
};
-bool KGncImportOptionsDlg::quoteOption() const
-{
- Q_D(const KGncImportOptionsDlg);
- return (d->ui->checkFinanceQuote->isChecked());
-};
-
bool KGncImportOptionsDlg::scheduleOption() const
{
Q_D(const KGncImportOptionsDlg);
diff --git a/kmymoney/plugins/gnc/import/kgncimportoptionsdlg.h b/kmymoney/plugins/gnc/import/kgncimportoptionsdlg.h
index dfeebb1b2..38886a4d3 100644
--- a/kmymoney/plugins/gnc/import/kgncimportoptionsdlg.h
+++ b/kmymoney/plugins/gnc/import/kgncimportoptionsdlg.h
@@ -42,7 +42,6 @@ public:
~KGncImportOptionsDlg();
int investmentOption() const;
- bool quoteOption() const;
bool scheduleOption() const;
QTextCodec* decodeOption();
bool txNotesOption() const;
diff --git a/kmymoney/plugins/gnc/import/kgncimportoptionsdlg.ui b/kmymoney/plugins/gnc/import/kgncimportoptionsdlg.ui
index e34773b9f..b28c78d69 100644
--- a/kmymoney/plugins/gnc/import/kgncimportoptionsdlg.ui
+++ b/kmymoney/plugins/gnc/import/kgncimportoptionsdlg.ui
@@ -75,25 +75,6 @@
</layout>
</widget>
</item>
- <item>
- <widget class="QGroupBox" name="buttonGroupBox5">
- <property name="title">
- <string>Online price quotes</string>
- </property>
- <layout class="QVBoxLayout">
- <item>
- <widget class="QCheckBox" name="checkFinanceQuote">
- <property name="text">
- <string>Use Finance::Quote for share price quotes</string>
- </property>
- <attribute name="buttonGroup">
- <string notr="true">buttonGroup5</string>
- </attribute>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
<item>
<widget class="QGroupBox" name="buttonGroupBox2">
<property name="title">
@@ -304,11 +285,10 @@
</connection>
</connections>
<buttongroups>
- <buttongroup name="buttonGroup18"/>
- <buttongroup name="buttonGroup2"/>
<buttongroup name="buttonGroup3"/>
- <buttongroup name="buttonGroup4"/>
- <buttongroup name="buttonGroup5"/>
+ <buttongroup name="buttonGroup2"/>
<buttongroup name="buttonInvestGroup"/>
+ <buttongroup name="buttonGroup4"/>
+ <buttongroup name="buttonGroup18"/>
</buttongroups>
</ui>
diff --git a/kmymoney/plugins/gnc/import/mymoneygncreader.cpp b/kmymoney/plugins/gnc/import/mymoneygncreader.cpp
index a4d98a12f..0b105e24f 100644
--- a/kmymoney/plugins/gnc/import/mymoneygncreader.cpp
+++ b/kmymoney/plugins/gnc/import/mymoneygncreader.cpp
@@ -103,7 +103,6 @@ void MyMoneyGncReader::setOptions()
// set users input options
m_dropSuspectSchedules = dlg.scheduleOption();
m_investmentOption = dlg.investmentOption();
- m_useFinanceQuote = dlg.quoteOption();
m_useTxNotes = dlg.txNotesOption();
m_decoder = dlg.decodeOption();
gncdebug = dlg.generalDebugOption();
@@ -115,7 +114,6 @@ void MyMoneyGncReader::setOptions()
// investment option - 0, create investment a/c per stock a/c, 1 = single new investment account, 2 = prompt for each stock
// option 2 doesn't really work too well at present
m_investmentOption = 0;
- m_useFinanceQuote = false;
m_useTxNotes = false;
m_decoder = 0;
gncdebug = false; // general debug messages
@@ -1271,7 +1269,6 @@ bool XmlReader::endDocument()
MyMoneyGncReader::MyMoneyGncReader() :
m_dropSuspectSchedules(0),
m_investmentOption(0),
- m_useFinanceQuote(0),
m_useTxNotes(0),
gncdebug(0),
xmldebug(0),
@@ -2666,13 +2663,6 @@ void MyMoneyGncReader::checkInvestmentOption(QString stockId)
// get the price source for a stock (gnc account) where online quotes are requested
void MyMoneyGncReader::getPriceSource(MyMoneySecurity stock, QString gncSource)
{
- // if he wants to use Finance::Quote, no conversion of source name is needed
- if (m_useFinanceQuote) {
- stock.setValue("kmm-online-quote-system", "Finance::Quote");
- stock.setValue("kmm-online-source", gncSource.toLower());
- m_storage->modifySecurity(stock);
- return;
- }
// first check if we have already asked about this source
// (mapSources is initially empty. We may be able to pre-fill it with some equivalent
// sources, if such things do exist. User feedback may help here.)
diff --git a/kmymoney/plugins/gnc/import/mymoneygncreader.h b/kmymoney/plugins/gnc/import/mymoneygncreader.h
index 325bddfef..34cda50ce 100644
--- a/kmymoney/plugins/gnc/import/mymoneygncreader.h
+++ b/kmymoney/plugins/gnc/import/mymoneygncreader.h
@@ -944,11 +944,7 @@ protected:
N.B. :- option 2 doesn't really work quite as desired at present
*/
unsigned int m_investmentOption;
- /** Online quotes
- The user has the option to use the Finance::Quote system, as used by GnuCash, to
- retrieve online share price quotes
- */
- bool m_useFinanceQuote;
+
/** Tx Notes handling
Under some usage conditions, non-split GnuCash transactions may contain residual, usually incorrect, memo
data which is not normally visible to the user. When imported into KMyMoney however, due to display
diff --git a/kmymoney/wizards/newinvestmentwizard/knewinvestmentwizard.cpp b/kmymoney/wizards/newinvestmentwizard/knewinvestmentwizard.cpp
index 122482740..3af70ece9 100644
--- a/kmymoney/wizards/newinvestmentwizard/knewinvestmentwizard.cpp
+++ b/kmymoney/wizards/newinvestmentwizard/knewinvestmentwizard.cpp
@@ -64,8 +64,6 @@ public:
void init1()
{
Q_Q(KNewInvestmentWizard);
- ui->m_onlineUpdatePage->slotSourceChanged(false);
-
// make sure, the back button does not clear fields
q->setOption(QWizard::IndependentPages, true);
@@ -225,13 +223,7 @@ void KNewInvestmentWizard::createObjects(const QString& parentId)
newSecurity.deletePair("kmm-security-id");
if (!field("onlineSourceCombo").toString().isEmpty()) {
- if (field("useFinanceQuote").toBool()) {
- FinanceQuoteProcess p;
- newSecurity.setValue("kmm-online-quote-system", "Finance::Quote");
- newSecurity.setValue("kmm-online-source", p.crypticName(field("onlineSourceCombo").toString()));
- } else {
newSecurity.setValue("kmm-online-source", field("onlineSourceCombo").toString());
- }
}
if (d->ui->m_onlineUpdatePage->isOnlineFactorEnabled() && (field("onlineFactor").value<MyMoneyMoney>() != MyMoneyMoney::ONE))
newSecurity.setValue("kmm-online-factor", field("onlineFactor").value<MyMoneyMoney>().toString());
diff --git a/kmymoney/wizards/newinvestmentwizard/konlineupdatewizardpage.cpp b/kmymoney/wizards/newinvestmentwizard/konlineupdatewizardpage.cpp
index b94f3a8b5..89228ff07 100644
--- a/kmymoney/wizards/newinvestmentwizard/konlineupdatewizardpage.cpp
+++ b/kmymoney/wizards/newinvestmentwizard/konlineupdatewizardpage.cpp
@@ -50,23 +50,21 @@ KOnlineUpdateWizardPage::KOnlineUpdateWizardPage(QWidget *parent) :
ui->m_onlineSourceCombo->model()->setParent(proxy);
ui->m_onlineSourceCombo->setModel(proxy);
- // Connect signals-slots
- connect(ui->m_useFinanceQuote, &QAbstractButton::toggled, this, &KOnlineUpdateWizardPage::slotSourceChanged);
+ ui->m_onlineSourceCombo->clear();
+ ui->m_onlineSourceCombo->insertItem(0, QString());
+ ui->m_onlineSourceCombo->addItems(WebPriceQuote::quoteSources());
+ ui->m_onlineSourceCombo->model()->sort(0);
// Register the fields with the QWizard and connect the
// appropriate signals to update the "Next" button correctly
registerField("onlineFactor", ui->m_onlineFactor, "value");
registerField("onlineSourceCombo", ui->m_onlineSourceCombo, "currentText", SIGNAL(currentIndexChanged(QString)));
- registerField("useFinanceQuote", ui->m_useFinanceQuote);
connect(ui->m_onlineSourceCombo, static_cast<void (QComboBox::*)(const QString&)>(&QComboBox::currentIndexChanged), this, &KOnlineUpdateWizardPage::slotCheckPage);
connect(ui->m_onlineFactor, &AmountEdit::textChanged,
this, &QWizardPage::completeChanged);
connect(ui->m_onlineSourceCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated),
this, &QWizardPage::completeChanged);
-
- connect(ui->m_useFinanceQuote, &QAbstractButton::toggled,
- this, &QWizardPage::completeChanged);
}
KOnlineUpdateWizardPage::~KOnlineUpdateWizardPage()
@@ -79,14 +77,7 @@ KOnlineUpdateWizardPage::~KOnlineUpdateWizardPage()
*/
void KOnlineUpdateWizardPage::init2(const MyMoneySecurity& security)
{
- int idx;
- if (security.value("kmm-online-quote-system") == "Finance::Quote") {
- FinanceQuoteProcess p;
- ui->m_useFinanceQuote->setChecked(true);
- idx = ui->m_onlineSourceCombo->findText(p.niceName(security.value("kmm-online-source")));
- } else {
- idx = ui->m_onlineSourceCombo->findText(security.value("kmm-online-source"));
- }
+ int idx = ui->m_onlineSourceCombo->findText(security.value("kmm-online-source"));
// in case we did not find the entry, we use the empty one
if (idx == -1)
@@ -115,15 +106,3 @@ void KOnlineUpdateWizardPage::slotCheckPage(const QString& txt)
{
ui->m_onlineFactor->setEnabled(!txt.isEmpty());
}
-
-void KOnlineUpdateWizardPage::slotSourceChanged(bool useFQ)
-{
- ui->m_onlineSourceCombo->clear();
- ui->m_onlineSourceCombo->insertItem(0, QString());
- if (useFQ) {
- ui->m_onlineSourceCombo->addItems(WebPriceQuote::quoteSources(WebPriceQuote::FinanceQuote));
- } else {
- ui->m_onlineSourceCombo->addItems(WebPriceQuote::quoteSources());
- }
- ui->m_onlineSourceCombo->model()->sort(0);
-}
diff --git a/kmymoney/wizards/newinvestmentwizard/konlineupdatewizardpage.h b/kmymoney/wizards/newinvestmentwizard/konlineupdatewizardpage.h
index 97835e03c..b6b29b9a3 100644
--- a/kmymoney/wizards/newinvestmentwizard/konlineupdatewizardpage.h
+++ b/kmymoney/wizards/newinvestmentwizard/konlineupdatewizardpage.h
@@ -58,7 +58,6 @@ public:
public Q_SLOTS:
void slotCheckPage(const QString&);
- void slotSourceChanged(bool);
private:
Ui::KOnlineUpdateWizardPage *ui;
diff --git a/kmymoney/wizards/newinvestmentwizard/konlineupdatewizardpage.ui b/kmymoney/wizards/newinvestmentwizard/konlineupdatewizardpage.ui
index 99d511ec4..517375373 100644
--- a/kmymoney/wizards/newinvestmentwizard/konlineupdatewizardpage.ui
+++ b/kmymoney/wizards/newinvestmentwizard/konlineupdatewizardpage.ui
@@ -2,155 +2,141 @@
<ui version="4.0">
<class>KOnlineUpdateWizardPage</class>
<widget class="QWizardPage" name="KOnlineUpdateWizardPage">
- <attribute name="title">
- <string>Online Update</string>
- </attribute>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>666</width>
+ <height>329</height>
+ </rect>
+ </property>
+ <property name="title">
+ <string>Online Update</string>
+ </property>
<layout class="QVBoxLayout">
- <item>
- <widget class="QLabel" name="textLabel6">
- <property name="text">
- <string>Select an online source and click <b>Finish</b> to store the investment data. If you do not want to use online updates, just leave the data as is.</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignTop</set>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout">
- <property name="margin">
- <number>0</number>
- </property>
- <property name="spacing">
- <number>0</number>
- </property>
- <item>
- <layout class="QVBoxLayout">
- <item>
- <layout class="QHBoxLayout">
- <item>
- <widget class="QLabel" name="textLabel2_4">
- <property name="text">
- <string>Use Finance::Quote</string>
- </property>
- <property name="wordWrap">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="m_useFinanceQuote">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout">
- <item>
- <widget class="QLabel" name="textLabel2_3">
- <property name="text">
- <string>Online Source</string>
- </property>
- <property name="wordWrap">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KComboBox" name="m_onlineSourceCombo">
- <property name="minimumSize">
- <size>
- <width>180</width>
- <height>0</height>
- </size>
- </property>
- <item>
- <property name="text">
- <string/>
- </property>
- </item>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout">
- <item>
- <widget class="QLabel" name="textLabel1_6">
- <property name="text">
- <string>Factor</string>
- </property>
- <property name="wordWrap">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="AmountEdit" name="m_onlineFactor"/>
- </item>
- </layout>
- </item>
- </layout>
- </item>
- <item>
- <spacer name="spacer29">
- <property name="sizeHint">
- <size>
- <width>371</width>
- <height>20</height>
- </size>
+ <item>
+ <widget class="QLabel" name="textLabel6">
+ <property name="text">
+ <string>Select an online source and click <b>Finish</b> to store the investment data. If you do not want to use online updates, just leave the data as is.</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignTop</set>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout">
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <item>
+ <layout class="QVBoxLayout">
+ <item>
+ <layout class="QHBoxLayout"/>
+ </item>
+ <item>
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QLabel" name="textLabel2_3">
+ <property name="text">
+ <string>Online Source</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="KComboBox" name="m_onlineSourceCombo">
+ <property name="minimumSize">
+ <size>
+ <width>180</width>
+ <height>0</height>
+ </size>
+ </property>
+ <item>
+ <property name="text">
+ <string/>
</property>
- <property name="sizeType">
- <enum>QSizePolicy::Expanding</enum>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </spacer>
- </item>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QLabel" name="textLabel1_6">
+ <property name="text">
+ <string>Factor</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="AmountEdit" name="m_onlineFactor"/>
+ </item>
+ </layout>
+ </item>
</layout>
- </item>
- <item>
- <spacer name="spacer30">
- <property name="sizeHint">
- <size>
- <width>20</width>
- <height>181</height>
- </size>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Expanding</enum>
- </property>
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
+ </item>
+ <item>
+ <spacer name="spacer29">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>371</width>
+ <height>20</height>
+ </size>
+ </property>
</spacer>
- </item>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="spacer30">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>181</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
</layout>
</widget>
- <resources/>
- <connections/>
<customwidgets>
- <customwidget>
- <class>KComboBox</class>
- <extends>QComboBox</extends>
- <header location="global">kcombobox.h</header>
- </customwidget>
- <customwidget>
- <class>AmountEdit</class>
- <extends>QLineEdit</extends>
- <header location="global">amountedit.h</header>
- </customwidget>
+ <customwidget>
+ <class>KComboBox</class>
+ <extends>QComboBox</extends>
+ <header>kcombobox.h</header>
+ </customwidget>
+ <customwidget>
+ <class>AmountEdit</class>
+ <extends>QLineEdit</extends>
+ <header location="global">amountedit.h</header>
+ </customwidget>
</customwidgets>
<tabstops>
- <tabstop>m_useFinanceQuote</tabstop>
- <tabstop>m_onlineSourceCombo</tabstop>
- <tabstop>m_onlineFactor</tabstop>
+ <tabstop>m_onlineSourceCombo</tabstop>
+ <tabstop>m_onlineFactor</tabstop>
</tabstops>
+ <resources/>
+ <connections/>
</ui>
More information about the kde-doc-english
mailing list