Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/converter/webpricequote.cpp
Show First 20 Lines • Show All 162 Lines • ▼ Show 20 Line(s) | 119 | // emit status(QString("(Debug) symbol=%1 id=%2...").arg(_symbol,_id)); | |||
---|---|---|---|---|---|
163 | if (urlStr.contains(QLatin1String("%y")) || urlStr.contains(QLatin1String("%m")) || urlStr.contains(QLatin1String("%d"))) { | 163 | if (urlStr.contains(QLatin1String("%y")) || urlStr.contains(QLatin1String("%m")) || urlStr.contains(QLatin1String("%d"))) { | ||
164 | emit error(i18n("Cannot resolve input date.")); | 164 | emit error(i18n("Cannot resolve input date.")); | ||
165 | emit failed(d->m_kmmID, d->m_webID); | 165 | emit failed(d->m_kmmID, d->m_webID); | ||
166 | return false; | 166 | return false; | ||
167 | } | 167 | } | ||
168 | 168 | | |||
169 | bool isCurrency = false; | 169 | bool isCurrency = false; | ||
170 | if (urlStr.contains(QLatin1String("%2"))) { | 170 | if (urlStr.contains(QLatin1String("%2"))) { | ||
171 | d->m_CSVSource.m_profileType = ProfileCurrencyPrices; | 171 | d->m_CSVSource.m_profileType = Profile::CurrencyPrices; | ||
172 | isCurrency = true; | 172 | isCurrency = true; | ||
173 | } else | 173 | } else | ||
174 | d->m_CSVSource.m_profileType = ProfileStockPrices; | 174 | d->m_CSVSource.m_profileType = Profile::StockPrices; | ||
175 | 175 | | |||
176 | d->m_CSVSource.m_profileName = sourcename; | 176 | d->m_CSVSource.m_profileName = sourcename; | ||
177 | if (!d->m_CSVSource.readSettings(CSVImporter::configFile())) { | 177 | if (!d->m_CSVSource.readSettings(CSVImporter::configFile())) { | ||
178 | QMap<QString, PricesProfile> result = defaultCSVQuoteSources(); | 178 | QMap<QString, PricesProfile> result = defaultCSVQuoteSources(); | ||
179 | d->m_CSVSource = result.value(sourcename); | 179 | d->m_CSVSource = result.value(sourcename); | ||
180 | if (d->m_CSVSource.m_profileName.isEmpty()) { | 180 | if (d->m_CSVSource.m_profileName.isEmpty()) { | ||
181 | emit error(i18n("CSV source <placeholder>%1</placeholder> does not exist.", sourcename)); | 181 | emit error(i18n("CSV source <placeholder>%1</placeholder> does not exist.", sourcename)); | ||
182 | emit failed(d->m_kmmID, d->m_webID); | 182 | emit failed(d->m_kmmID, d->m_webID); | ||
▲ Show 20 Lines • Show All 332 Lines • ▼ Show 20 Line(s) | 513 | } else { | |||
515 | emit failed(d->m_kmmID, d->m_webID); | 515 | emit failed(d->m_kmmID, d->m_webID); | ||
516 | } | 516 | } | ||
517 | } | 517 | } | ||
518 | 518 | | |||
519 | const QMap<QString, PricesProfile> WebPriceQuote::defaultCSVQuoteSources() | 519 | const QMap<QString, PricesProfile> WebPriceQuote::defaultCSVQuoteSources() | ||
520 | { | 520 | { | ||
521 | QMap<QString, PricesProfile> result; | 521 | QMap<QString, PricesProfile> result; | ||
522 | 522 | | |||
523 | // tip: possible delimiter indexes are in csvutil.cpp | 523 | // tip: possible delimiter indexes are in csvenums.h | ||
524 | 524 | | |||
525 | result[QLatin1String("Stooq")] = PricesProfile(QLatin1String("Stooq"), | 525 | result[QLatin1String("Stooq")] = PricesProfile(QLatin1String("Stooq"), | ||
526 | 106, 1, 0, 0, 1, 0, 0, | 526 | 106, 1, 0, DateFormat::YearMonthDay, FieldDelimiter::Semicolon, | ||
527 | QMap<columnTypeE, int>{{ColumnDate, 0}, {ColumnPrice, 4}}, | 527 | TextDelimiter::DoubleQuote, DecimalSymbol::Dot, | ||
528 | 2, ProfileStockPrices); | 528 | QMap<Column, int>{{Column::Date, 0}, {Column::Price, 4}}, | ||
529 | 2, Profile::StockPrices); | ||||
529 | 530 | | |||
530 | result[QLatin1String("Stooq Currency")] = PricesProfile(QLatin1String("Stooq Currency"), | 531 | result[QLatin1String("Stooq Currency")] = PricesProfile(QLatin1String("Stooq Currency"), | ||
531 | 106, 1, 0, 0, 1, 0, 0, | 532 | 106, 1, 0, DateFormat::YearMonthDay, FieldDelimiter::Semicolon, | ||
532 | QMap<columnTypeE, int>{{ColumnDate, 0}, {ColumnPrice, 4}}, | 533 | TextDelimiter::DoubleQuote, DecimalSymbol::Dot, | ||
533 | 2, ProfileCurrencyPrices); | 534 | QMap<Column, int>{{Column::Date, 0}, {Column::Price, 4}}, | ||
535 | 2, Profile::CurrencyPrices); | ||||
534 | 536 | | |||
535 | result[QLatin1String("Yahoo")] = PricesProfile(QLatin1String("Yahoo"), | 537 | result[QLatin1String("Yahoo")] = PricesProfile(QLatin1String("Yahoo"), | ||
536 | 106, 1, 0, 0, 0, 0, 0, | 538 | 106, 1, 0, DateFormat::YearMonthDay, FieldDelimiter::Comma, | ||
537 | QMap<columnTypeE, int>{{ColumnDate, 0}, {ColumnPrice, 4}}, | 539 | TextDelimiter::DoubleQuote, DecimalSymbol::Dot, | ||
538 | 2, ProfileStockPrices); | 540 | QMap<Column, int>{{Column::Date, 0}, {Column::Price, 4}}, | ||
541 | 2, Profile::StockPrices); | ||||
539 | 542 | | |||
540 | result[QLatin1String("Nasdaq Baltic - Shares")] = PricesProfile(QLatin1String("Nasdaq Baltic - Shares"), | 543 | result[QLatin1String("Nasdaq Baltic - Shares")] = PricesProfile(QLatin1String("Nasdaq Baltic - Shares"), | ||
541 | 106, 1, 0, 2, 3, 0, 0, | 544 | 106, 1, 0, DateFormat::DayMonthYear, FieldDelimiter::Tab, | ||
542 | QMap<columnTypeE, int>{{ColumnDate, 0}, {ColumnPrice, 5}}, | 545 | TextDelimiter::DoubleQuote, DecimalSymbol::Dot, | ||
543 | 2, ProfileStockPrices); | 546 | QMap<Column, int>{{Column::Date, 0}, {Column::Price, 5}}, | ||
547 | 2, Profile::StockPrices); | ||||
544 | 548 | | |||
545 | result[QLatin1String("Nasdaq Baltic - Funds")] = PricesProfile(QLatin1String("Nasdaq Baltic - Funds"), | 549 | result[QLatin1String("Nasdaq Baltic - Funds")] = PricesProfile(QLatin1String("Nasdaq Baltic - Funds"), | ||
546 | 106, 1, 0, 2, 3, 0, 0, | 550 | 106, 1, 0, DateFormat::DayMonthYear, FieldDelimiter::Tab, | ||
547 | QMap<columnTypeE, int>{{ColumnDate, 0}, {ColumnPrice, 5}}, | 551 | TextDelimiter::DoubleQuote, DecimalSymbol::Dot, | ||
548 | 2, ProfileStockPrices); | 552 | QMap<Column, int>{{Column::Date, 0}, {Column::Price, 5}}, | ||
553 | 2, Profile::StockPrices); | ||||
549 | return result; | 554 | return result; | ||
550 | } | 555 | } | ||
551 | 556 | | |||
552 | const QMap<QString, WebPriceQuoteSource> WebPriceQuote::defaultQuoteSources() | 557 | const QMap<QString, WebPriceQuoteSource> WebPriceQuote::defaultQuoteSources() | ||
553 | { | 558 | { | ||
554 | QMap<QString, WebPriceQuoteSource> result; | 559 | QMap<QString, WebPriceQuoteSource> result; | ||
555 | 560 | | |||
556 | result["Yahoo"] = WebPriceQuoteSource("Yahoo", | 561 | result["Yahoo"] = WebPriceQuoteSource("Yahoo", | ||
▲ Show 20 Lines • Show All 724 Lines • Show Last 20 Lines |