Commit 8d9f9ca7 authored by Thomas Baumgart's avatar Thomas Baumgart
Browse files

Bring back feature to copy an executed online transaction

The feature to create a new online transaction based on an already
executed one has been fixed and is now available again. At the same time
the status of the enqueue and send button is now updated accordingly.

BUG: 389944
FIXED-IN: 5.0.7
parent 4b2abb2e
/*
* This file is part of KMyMoney, A Personal Finance Manager by KDE
* Copyright (C) 2013-2014 Christian Dávid <christian-david@web.de>
* Copyright 2013-2014 Christian Dávid <christian-david@web.de>
* Copyright 2019 Thomas Baumgart <tbaumgart@kde.org>
*
* 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.
* 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
......@@ -187,9 +187,12 @@ void KOnlineJobOutboxView::updateButtonState() const
if (!job.isEditable()) {
editable = false;
if (job.sendDate().isValid())
if (job.sendDate().isValid()) {
/// @todo maybe add a word about unable to edit but able to copy here
// I don't do it right away since we are in string freeze for 5.0.7
tooltip = i18n("This job cannot be edited anymore because it was sent already.");
else if (job.isLocked())
editable = true;
} else if (job.isLocked())
tooltip = i18n("Job is being processed at the moment.");
else
Q_ASSERT(false);
......
/*
* This file is part of KMyMoney, A Personal Finance Manager by KDE
* Copyright (C) 2014 Christian Dávid <christian-david@web.de>
* (C) 2017 by Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com>
* Copyright 2014 Christian Dávid <christian-david@web.de>
* Copyright 2017 Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com>
* Copyright 2019 Thomas Baumgart <tbaumgart@kde.org>
*
* 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.
* 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
......@@ -58,8 +58,7 @@ kOnlineTransferForm::kOnlineTransferForm(QWidget *parent)
delete ui->creditTransferEdit->takeWidget();
OnlineBankingAccountNamesFilterProxyModel* accountsModel = new OnlineBankingAccountNamesFilterProxyModel(this);
auto const model = Models::instance()->accountsModel();
accountsModel->setSourceModel(model);
accountsModel->setSourceModel(Models::instance()->accountsModel());
ui->originAccount->setModel(accountsModel);
ui->convertMessage->hide();
......@@ -82,14 +81,15 @@ kOnlineTransferForm::kOnlineTransferForm(QWidget *parent)
connect(ui->buttonAbort, &QAbstractButton::clicked, this, &kOnlineTransferForm::reject);
connect(ui->buttonSend, &QAbstractButton::clicked, this, &kOnlineTransferForm::sendJob);
connect(ui->buttonEnque, &QAbstractButton::clicked, this, &kOnlineTransferForm::accept);
connect(m_requiredFields, static_cast<void (KMandatoryFieldGroup::*)(bool)>(&KMandatoryFieldGroup::stateChanged), ui->buttonEnque, &QPushButton::setEnabled);
connect(m_requiredFields, static_cast<void (KMandatoryFieldGroup::*)(bool)>(&KMandatoryFieldGroup::stateChanged), this, &kOnlineTransferForm::enableSendAndEnqueue);
connect(ui->originAccount, &KMyMoneyAccountCombo::accountSelected, this, &kOnlineTransferForm::accountChanged);
accountChanged();
setJobReadOnly(false);
m_requiredFields->add(ui->originAccount);
m_requiredFields->setOkButton(ui->buttonSend);
// no need to call setOkButton() here as this is controlled
// via kOnlineTransferForm::enableSendAndEnqueue()
}
void kOnlineTransferForm::loadOnlineJobEditPlugin(const onlineJobAdministration::onlineJobEditOffer& pluginDesc)
......@@ -175,6 +175,7 @@ void kOnlineTransferForm::duplicateCurrentJob()
onlineJob duplicate(QString(), activeOnlineJob());
widget->setOnlineJob(duplicate);
setJobReadOnly(false);
}
void kOnlineTransferForm::accept()
......@@ -186,7 +187,7 @@ void kOnlineTransferForm::accept()
void kOnlineTransferForm::sendJob()
{
emit acceptedForSend(activeOnlineJob());
QDialog::accept();
QDialog::accept();
}
void kOnlineTransferForm::reject()
......@@ -268,10 +269,22 @@ onlineJob kOnlineTransferForm::activeOnlineJob() const
return widget->getOnlineJob();
}
void kOnlineTransferForm::enableSendAndEnqueue(bool enable)
{
// force buttons to be disabled in case of read-only job
if (!ui->originAccount->isEnabled()) {
enable = false;
}
ui->buttonSend->setEnabled(enable);
ui->buttonEnque->setEnabled(enable);
}
void kOnlineTransferForm::setJobReadOnly(const bool& readOnly)
{
ui->originAccount->setDisabled(readOnly);
ui->transferTypeSelection->setDisabled(readOnly);
ui->buttonSend->setDisabled(readOnly);
ui->buttonEnque->setDisabled(readOnly);
if (readOnly) {
ui->headMessage->setMessageType(KMessageWidget::Information);
......
/*
* This file is part of KMyMoney, A Personal Finance Manager by KDE
* Copyright (C) 2014 Christian Dávid <christian-david@web.de>
* (C) 2017 by Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com>
* Copyright 2014 Christian Dávid <christian-david@web.de>
* Copyright 2017 Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com>
* Copyright 2019 Thomas Baumgart <tbaumgart@kde.org>
*
* 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.
* 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
......@@ -17,7 +17,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KONLINETRANSFERFORM_H
#define KONLINETRANSFERFORM_H
......@@ -109,6 +108,15 @@ private Q_SLOTS:
void setJobReadOnly(const bool&);
/**
* @brief Control availability of send and enqueue button
*
* This slot makes sure that the send and enqueue buttons are
* kept disabled in case a read only job is displayed. Otherwise
* the availability is controlled by the @a enable argument.
*/
void enableSendAndEnqueue(bool enable);
private:
/**
* @brief returns the currently edited onlineJob
......
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