Commit 719f7139 authored by Thomas Baumgart's avatar Thomas Baumgart
Browse files

Fix account editor's online tab

Bring back the online tab of the mapped provider for old data files,
where the provider name may be spelled with mixed case letters and now
the provider name is lower case only.

Make sure to use and compare only lowercase provider names from now on.
parent 95335d8a
......@@ -3204,12 +3204,12 @@ void KMyMoneyApp::slotAccountMapOnline()
return;
// find the provider
it_p = d->m_plugins.online.constFind(provider);
it_p = d->m_plugins.online.constFind(provider.toLower());
if (it_p != d->m_plugins.online.constEnd()) {
// plugin found, call it
MyMoneyKeyValueContainer settings;
if ((*it_p)->mapAccount(d->m_selectedAccount, settings)) {
settings["provider"] = provider;
settings["provider"] = provider.toLower();
MyMoneyAccount acc(d->m_selectedAccount);
acc.setOnlineBankingSettings(settings);
MyMoneyFileTransaction ft;
......
......@@ -290,7 +290,7 @@ QWidget* KBanking::accountConfigTab(const MyMoneyAccount& acc, QString& name)
MyMoneyKeyValueContainer KBanking::onlineBankingSettings(const MyMoneyKeyValueContainer& current)
{
MyMoneyKeyValueContainer kvp(current);
kvp["provider"] = objectName();
kvp["provider"] = objectName().toLower();
if (m_accountSettings) {
m_accountSettings->loadKvp(kvp);
}
......@@ -431,7 +431,7 @@ void KBanking::setupAccountReference(const MyMoneyAccount& acc, AB_ACCOUNT* ab_a
}
kvp.setValue("kbanking-acc-ref", val);
kvp.setValue("provider", objectName());
kvp.setValue("provider", objectName().toLower());
setAccountOnlineParameters(acc, kvp);
}
} else {
......
......@@ -53,21 +53,21 @@ bool onlineJobPluginMockup::mapAccount(const MyMoneyAccount& acc, MyMoneyKeyValu
{
Q_UNUSED(acc);
onlineBankingSettings.setValue("provider", objectName());
onlineBankingSettings.setValue("provider", objectName().toLower());
return true;
}
MyMoneyKeyValueContainer onlineJobPluginMockup::onlineBankingSettings(const MyMoneyKeyValueContainer& current)
{
MyMoneyKeyValueContainer nextKvp(current);
nextKvp.setValue("provider", objectName());
nextKvp.setValue("provider", objectName().toLower());
return nextKvp;
}
bool onlineJobPluginMockup::updateAccount(const MyMoneyAccount& acc, bool moreAccounts)
{
Q_UNUSED(moreAccounts);
if (acc.onlineBankingSettings().value("provider").toLower() == objectName())
if (acc.onlineBankingSettings().value("provider").toLower() == objectName().toLower())
return true;
return false;
}
......@@ -75,7 +75,7 @@ bool onlineJobPluginMockup::updateAccount(const MyMoneyAccount& acc, bool moreAc
QStringList onlineJobPluginMockup::availableJobs(QString accountId)
{
try {
if (MyMoneyFile::instance()->account(accountId).onlineBankingSettings().value("provider").toLower() == objectName())
if (MyMoneyFile::instance()->account(accountId).onlineBankingSettings().value("provider").toLower() == objectName().toLower())
return onlineJobAdministration::instance()->availableOnlineTasks();
} catch (MyMoneyException&) {
}
......@@ -86,7 +86,7 @@ QStringList onlineJobPluginMockup::availableJobs(QString accountId)
IonlineTaskSettings::ptr onlineJobPluginMockup::settings(QString accountId, QString taskName)
{
try {
if (taskName == sepaOnlineTransfer::name() && MyMoneyFile::instance()->account(accountId).onlineBankingSettings().value("provider").toLower() == objectName())
if (taskName == sepaOnlineTransfer::name() && MyMoneyFile::instance()->account(accountId).onlineBankingSettings().value("provider").toLower() == objectName().toLower())
return IonlineTaskSettings::ptr(new sepaCreditTransferSettingsMockup);
} catch (MyMoneyException&) {
}
......
......@@ -86,7 +86,7 @@ QWidget* Weboob::accountConfigTab(const MyMoneyAccount& account, QString& tabNam
MyMoneyKeyValueContainer Weboob::onlineBankingSettings(const MyMoneyKeyValueContainer& current)
{
MyMoneyKeyValueContainer kvp(current);
kvp["provider"] = objectName();
kvp["provider"] = objectName().toLower();
if (d->accountSettings) {
d->accountSettings->loadKvp(kvp);
}
......
......@@ -161,7 +161,7 @@ void KAccountsView::updateActions(const MyMoneyObject& obj)
if (d->m_onlinePlugins) {
// check if provider is available
QMap<QString, KMyMoneyPlugin::OnlinePlugin*>::const_iterator it_p;
it_p = d->m_onlinePlugins->constFind(d->m_currentAccount.onlineBankingSettings().value(QLatin1String("provider")));
it_p = d->m_onlinePlugins->constFind(d->m_currentAccount.onlineBankingSettings().value(QLatin1String("provider")).toLower());
if (it_p != d->m_onlinePlugins->constEnd()) {
QStringList protocols;
(*it_p)->protocols(protocols);
......
......@@ -181,7 +181,7 @@ public:
// if we have an online provider for this account, we need to check
// that we have the corresponding plugin. If that exists, we ask it
// to provide an additional tab for the account editor.
it_plugin = m_onlinePlugins->constFind(kvp["provider"]);
it_plugin = m_onlinePlugins->constFind(kvp["provider"].toLower());
if (it_plugin != m_onlinePlugins->constEnd()) {
QString name;
auto w = (*it_plugin)->accountConfigTab(m_currentAccount, name);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment