[office/kmymoney/5.1] kmymoney/dialogs: Provide detailed creation of currencies
Thomas Baumgart
null at kde.org
Sun Sep 13 13:29:33 BST 2020
Git commit f68278ea401af18af92cb708c5899dfefa07ae52 by Thomas Baumgart.
Committed on 13/09/2020 at 12:28.
Pushed by tbaumgart into branch '5.1'.
Provide detailed creation of currencies
The current implementation does not allow to specify all attributes for
currencies but rather uses default values which cannot be changed
afterwards.
This change adds functionality to set all relevant attributes during
creation and also provides a feature to change those which can be
changed after creation of the currency.
BUG: 425935
FIXED-IN: 5.1.1
GUI:
(cherry picked from commit 2afa09b0691f4eb79a2f22c5a2ac4adf8b50c7ec)
M +59 -30 kmymoney/dialogs/kcurrencyeditdlg.cpp
M +1 -1 kmymoney/dialogs/kcurrencyeditdlg.h
M +23 -15 kmymoney/dialogs/kcurrencyeditdlg.ui
M +101 -16 kmymoney/dialogs/kcurrencyeditordlg.cpp
M +9 -5 kmymoney/dialogs/kcurrencyeditordlg.h
M +104 -29 kmymoney/dialogs/kcurrencyeditordlg.ui
https://invent.kde.org/office/kmymoney/commit/f68278ea401af18af92cb708c5899dfefa07ae52
diff --git a/kmymoney/dialogs/kcurrencyeditdlg.cpp b/kmymoney/dialogs/kcurrencyeditdlg.cpp
index 9ca3f3d11..7aeff6f73 100644
--- a/kmymoney/dialogs/kcurrencyeditdlg.cpp
+++ b/kmymoney/dialogs/kcurrencyeditdlg.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2004-2018 Thomas Baumgart <tbaumgart at kde.org>
+ * Copyright 2004-2020 Thomas Baumgart <tbaumgart at kde.org>
* Copyright 2009-2010 Alvaro Soliverez <asoliverez at gmail.com>
* Copyright 2017-2018 Łukasz Wojniłowicz <lukasz.wojnilowicz at gmail.com>
*
@@ -47,8 +47,6 @@
// Project Includes
#include "ui_kcurrencyeditdlg.h"
-#include "ui_kcurrencyeditordlg.h"
-#include "ui_kavailablecurrencydlg.h"
#include "mymoneyexception.h"
#include "mymoneysecurity.h"
@@ -189,6 +187,48 @@ public:
}
}
+ /**
+ * Edit or create a currency
+ *
+ * @param currency reference to currency object
+ *
+ * @returns @c true in case the operation was successful @c false otherwise
+ * @note @a currency will be updated with the modified values
+ */
+ bool editCurrency(MyMoneySecurity& currency)
+ {
+ QScopedPointer<KCurrencyEditorDlg> currencyEditorDlg(new KCurrencyEditorDlg(currency, q_ptr));
+ bool rc = true;
+ do {
+ if (currencyEditorDlg->exec() != QDialog::Rejected) {
+ auto file = MyMoneyFile::instance();
+ MyMoneyFileTransaction ft;
+ try {
+ if (currency.id().isEmpty()) {
+ file->addCurrency(currencyEditorDlg->currency());
+ } else {
+ file->modifyCurrency(currencyEditorDlg->currency());
+ }
+ ft.commit();
+ // if the modification worked, then we copy the data
+ // to inform caller
+ currency = currencyEditorDlg->currency();
+
+ } catch (const MyMoneyException &e) {
+ if (currency.id().isEmpty()) {
+ KMessageBox::sorry(q_ptr, i18n("Cannot create new currency. %1", QString::fromLatin1(e.what())), i18n("New currency"));
+ } else {
+ KMessageBox::sorry(q_ptr, i18n("Cannot modify currency. %1", QString::fromLatin1(e.what())), i18n("Edit currency"));
+ }
+ }
+ } else {
+ rc = false; // aborted by user
+ }
+ } while(false);
+
+ return rc;
+ }
+
KCurrencyEditDlg *q_ptr;
Ui::KCurrencyEditDlg *ui;
@@ -214,6 +254,7 @@ KCurrencyEditDlg::KCurrencyEditDlg(QWidget *parent) :
d->ui->verticalLayout->insertWidget(0, d->m_searchWidget);
d->ui->m_currencyList->setItemDelegate(new KCurrencyEditDelegate(d->ui->m_currencyList));
d->ui->m_closeButton->setIcon(Icons::get(Icon::DialogClose));
+ d->ui->m_newCurrencyButton->setIcon(Icons::get(Icon::DocumentNew));
d->ui->m_editCurrencyButton->setIcon(Icons::get(Icon::DocumentEdit));
d->ui->m_selectBaseCurrencyButton->setIcon(Icons::get(Icon::KMyMoney));
@@ -224,6 +265,7 @@ KCurrencyEditDlg::KCurrencyEditDlg(QWidget *parent) :
connect(d->ui->m_selectBaseCurrencyButton, &QAbstractButton::clicked, this, &KCurrencyEditDlg::slotSelectBaseCurrency);
connect(d->ui->m_addCurrencyButton, &QAbstractButton::clicked, this, &KCurrencyEditDlg::slotAddCurrency);
+ connect(d->ui->m_newCurrencyButton, &QAbstractButton::clicked, this, &KCurrencyEditDlg::slotNewCurrency);
connect(d->ui->m_removeCurrencyButton, &QAbstractButton::clicked, this, &KCurrencyEditDlg::slotRemoveCurrency);
connect(d->ui->m_editCurrencyButton, &QAbstractButton::clicked, this, &KCurrencyEditDlg::slotEditCurrency);
connect(d->ui->m_removeUnusedCurrencyButton, &QAbstractButton::clicked, this, &KCurrencyEditDlg::slotRemoveUnusedCurrency);
@@ -470,7 +512,7 @@ void KCurrencyEditDlg::slotShowCurrencyMenu(const QPoint& p)
};
const QVector<actionInfo> actionInfos {
- {eMenu::Action::NewCurrency, &KCurrencyEditDlg::slotNewCurrency, i18n("New currency"), Icon::ListAdd, true},
+ {eMenu::Action::NewCurrency, &KCurrencyEditDlg::slotNewCurrency, i18n("New currency"), Icon::DocumentNew, true},
{eMenu::Action::RenameCurrency, &KCurrencyEditDlg::slotRenameCurrency, i18n("Rename currency"), Icon::EditRename, cond1},
{eMenu::Action::DeleteCurrency, &KCurrencyEditDlg::slotDeleteCurrency, i18n("Delete currency"), Icon::EditDelete, cond2},
{eMenu::Action::SetBaseCurrency, &KCurrencyEditDlg::slotSetBaseCurrency, i18n("Select as base currency"), Icon::KMyMoney, cond3}
@@ -563,36 +605,23 @@ void KCurrencyEditDlg::slotRemoveUnusedCurrency()
void KCurrencyEditDlg::slotEditCurrency()
{
Q_D(KCurrencyEditDlg);
- MyMoneySecurity currency = d->ui->m_currencyList->currentItem()->data(0, Qt::UserRole).value<MyMoneySecurity>();
- d->m_currencyEditorDlg = new KCurrencyEditorDlg(currency); // create new dialog for editing currency
- if (d->m_currencyEditorDlg->exec() != QDialog::Rejected) {
- auto file = MyMoneyFile::instance();
- MyMoneyFileTransaction ft;
- currency.setPricePrecision(d->m_currencyEditorDlg->ui->m_pricePrecision->value());
- try {
- file->modifyCurrency(currency);
- ft.commit();
- } catch (const MyMoneyException &e) {
- qDebug("%s", e.what());
- }
- }
- delete d->m_currencyEditorDlg;
+ auto currency = d->ui->m_currencyList->currentItem()->data(0, Qt::UserRole).value<MyMoneySecurity>();
+ d->editCurrency(currency);
+
+ // update the model data
+ const auto item = d->ui->m_currencyList->currentItem();
+ item->setData(0, Qt::UserRole, QVariant::fromValue(currency));
+ item->setText(0, currency.name());
+ item->setText(1, currency.id());
+ item->setText(2, currency.tradingSymbol());
}
void KCurrencyEditDlg::slotNewCurrency()
{
- QString sid = QInputDialog::getText(0, i18n("New currency"), i18n("Enter ISO 4217 code for the new currency"));
- if (!sid.isEmpty()) {
- QString id(sid);
- MyMoneySecurity currency(id, i18n("New currency"));
- MyMoneyFileTransaction ft;
- try {
- MyMoneyFile::instance()->addCurrency(currency);
- ft.commit();
- } catch (const MyMoneyException &e) {
- KMessageBox::sorry(this, i18n("Cannot create new currency. %1", QString::fromLatin1(e.what())), i18n("New currency"));
- }
- slotSelectCurrency(id);
+ Q_D(KCurrencyEditDlg);
+ MyMoneySecurity currency;
+ if (d->editCurrency(currency)) {
+ slotSelectCurrency(currency.id());
}
}
diff --git a/kmymoney/dialogs/kcurrencyeditdlg.h b/kmymoney/dialogs/kcurrencyeditdlg.h
index eb4990d16..4f2ff42d7 100644
--- a/kmymoney/dialogs/kcurrencyeditdlg.h
+++ b/kmymoney/dialogs/kcurrencyeditdlg.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2004-2018 Thomas Baumgart <tbaumgart at kde.org>
+ * Copyright 2004-2020 Thomas Baumgart <tbaumgart at kde.org>
* Copyright 2009-2010 Alvaro Soliverez <asoliverez at gmail.com>
* Copyright 2017-2018 Łukasz Wojniłowicz <lukasz.wojnilowicz at gmail.com>
*
diff --git a/kmymoney/dialogs/kcurrencyeditdlg.ui b/kmymoney/dialogs/kcurrencyeditdlg.ui
index 0e2a9428d..de92d5b00 100644
--- a/kmymoney/dialogs/kcurrencyeditdlg.ui
+++ b/kmymoney/dialogs/kcurrencyeditdlg.ui
@@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
- <string>Currencies</string>
+ <string comment="@title:window">Currencies</string>
</property>
<property name="sizeGripEnabled">
<bool>true</bool>
@@ -39,27 +39,27 @@
</property>
<column>
<property name="text">
- <string comment="@title header of the currency name column">Name</string>
+ <string comment="@title:column currency name">Name</string>
</property>
</column>
<column>
<property name="text">
- <string>ID</string>
+ <string comment="@title:column currency ISO4217 code">ISO 4217 ID</string>
</property>
</column>
<column>
<property name="text">
- <string comment="@title currency symbol column">Symbol</string>
+ <string comment="@title:column currency symbol">Symbol</string>
</property>
</column>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
- <item row="1" column="1">
+ <item row="1" column="2">
<widget class="QPushButton" name="m_removeCurrencyButton">
<property name="text">
- <string>Remove</string>
+ <string comment="@action:button Remove currency">Remove</string>
</property>
<property name="icon">
<iconset theme="list-remove">
@@ -70,7 +70,7 @@
<item row="1" column="0">
<widget class="QPushButton" name="m_addCurrencyButton">
<property name="text">
- <string>Add</string>
+ <string comment="@action:button Add currency from existing list">Add</string>
</property>
<property name="icon">
<iconset theme="list-add">
@@ -78,17 +78,17 @@
</property>
</widget>
</item>
- <item row="1" column="2">
+ <item row="1" column="3">
<widget class="QPushButton" name="m_editCurrencyButton">
<property name="text">
- <string>Edit</string>
+ <string comment="@action:button Edit currency">Edit</string>
</property>
</widget>
</item>
- <item row="2" column="0" colspan="3">
+ <item row="2" column="0" colspan="4">
<widget class="QPushButton" name="m_removeUnusedCurrencyButton">
<property name="text">
- <string>Remove unused currencies</string>
+ <string comment="@action:button">Remove unused currencies</string>
</property>
<property name="icon">
<iconset theme="edit-clear">
@@ -96,17 +96,24 @@
</property>
</widget>
</item>
- <item row="4" column="2">
+ <item row="4" column="3">
<widget class="QPushButton" name="m_closeButton">
<property name="text">
- <string>Close</string>
+ <string comment="@action:button Close currency dialog">Close</string>
</property>
</widget>
</item>
- <item row="4" column="0" colspan="2">
+ <item row="4" column="0" colspan="3">
<widget class="QPushButton" name="m_selectBaseCurrencyButton">
<property name="text">
- <string>Select as base currency</string>
+ <string comment="@action:button">Select as base currency</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QPushButton" name="m_newCurrencyButton">
+ <property name="text">
+ <string comment="@action:button Create new currency">New</string>
</property>
</widget>
</item>
@@ -118,6 +125,7 @@
<tabstops>
<tabstop>m_currencyList</tabstop>
<tabstop>m_addCurrencyButton</tabstop>
+ <tabstop>m_newCurrencyButton</tabstop>
<tabstop>m_removeCurrencyButton</tabstop>
<tabstop>m_editCurrencyButton</tabstop>
<tabstop>m_removeUnusedCurrencyButton</tabstop>
diff --git a/kmymoney/dialogs/kcurrencyeditordlg.cpp b/kmymoney/dialogs/kcurrencyeditordlg.cpp
index 05594ab7c..87aaef187 100644
--- a/kmymoney/dialogs/kcurrencyeditordlg.cpp
+++ b/kmymoney/dialogs/kcurrencyeditordlg.cpp
@@ -1,5 +1,6 @@
/*
* Copyright 2017 Łukasz Wojniłowicz <lukasz.wojnilowicz at gmail.com>
+ * Copyright 2020 Thomas Baumgart <tbaumgart at 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
@@ -20,38 +21,122 @@
// ----------------------------------------------------------------------------
// QT Includes
+#include <QPushButton>
+
// ----------------------------------------------------------------------------
// KDE Includes
// ----------------------------------------------------------------------------
// Project Includes
-#include "ui_kcurrencyeditordlg.h"
+#include <ui_kcurrencyeditordlg.h>
#include "mymoneymoney.h"
#include "mymoneysecurity.h"
-KCurrencyEditorDlg::KCurrencyEditorDlg(MyMoneySecurity& currency, QWidget *parent) : ui(new Ui::KCurrencyEditorDlg)
+class KCurrencyEditorDlgPrivate
+{
+public:
+ KCurrencyEditorDlgPrivate()
+ : ui(new Ui::KCurrencyEditorDlg)
+ {
+ }
+
+ ~KCurrencyEditorDlgPrivate()
+ {
+ delete ui;
+ }
+
+ void validateValues()
+ {
+ // enable the OK button only, if all values are valid
+ ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
+
+ if (ui->leIsoCode->text().isEmpty()
+ || ui->leName->text().isEmpty()
+ || ui->leSymbol->text().isEmpty()
+ || MyMoneyMoney(ui->leCashFraction->text()).isZero()
+ || MyMoneyMoney(ui->leCashFraction->text()).isNegative()
+ || MyMoneyMoney(ui->leAccountFraction->text()).isZero()
+ || MyMoneyMoney(ui->leAccountFraction->text()).isNegative()) {
+ ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
+ }
+ }
+
+ MyMoneySecurity currency;
+ Ui::KCurrencyEditorDlg* ui;
+};
+
+KCurrencyEditorDlg::KCurrencyEditorDlg(const MyMoneySecurity& currency, QWidget *parent)
+ : d_ptr(new KCurrencyEditorDlgPrivate)
{
Q_UNUSED(parent);
- ui->setupUi(this);
- loadCurrency(currency);
+ Q_D(KCurrencyEditorDlg);
+ d->currency = currency;
+ d->ui->setupUi(this);
+
+ connect(d->ui->leIsoCode, &QLineEdit::textChanged, this, [&]() { Q_D(KCurrencyEditorDlg); d->validateValues(); });
+ connect(d->ui->leName, &QLineEdit::textChanged, this, [&]() { Q_D(KCurrencyEditorDlg); d->validateValues(); });
+ connect(d->ui->leSymbol, &QLineEdit::textChanged, this, [&]() { Q_D(KCurrencyEditorDlg); d->validateValues(); });
+ connect(d->ui->leCashFraction, &QLineEdit::textChanged, this, [&]() { Q_D(KCurrencyEditorDlg); d->validateValues(); });
+ connect(d->ui->leAccountFraction, &QLineEdit::textChanged, this, [&]() { Q_D(KCurrencyEditorDlg); d->validateValues(); });
+
+ // fill the fields
+ d->ui->leIsoCode->setText(currency.id());
+
+ d->ui->leName->setText(currency.name());
+ d->ui->leSymbol->setText(currency.tradingSymbol());
+
+ int precision = MyMoneyMoney::denomToPrec(currency.smallestCashFraction());
+ MyMoneyMoney smallestFraction = MyMoneyMoney::ONE / MyMoneyMoney(currency.smallestCashFraction());
+ d->ui->leCashFraction->setText(smallestFraction.formatMoney(QString(), precision));
+
+ precision = MyMoneyMoney::denomToPrec(currency.smallestAccountFraction());
+ smallestFraction = MyMoneyMoney::ONE / MyMoneyMoney(currency.smallestAccountFraction());
+ d->ui->leAccountFraction->setText(smallestFraction.formatMoney(QString(), precision));
+
+ d->ui->comboRoundingMethod->setCurrentIndex(currency.roundingMethod());
+ d->ui->spbPricePrecision->setValue(currency.pricePrecision());
+
+
+ // make those widgets readonly that are not allowed to change
+ if (!currency.id().isEmpty()) {
+ d->ui->leIsoCode->setReadOnly(true);
+ d->ui->leCashFraction->setReadOnly(true);
+ d->ui->leAccountFraction->setReadOnly(true);
+ }
+
+ d->validateValues();
}
KCurrencyEditorDlg::~KCurrencyEditorDlg()
{
- delete ui;
+ Q_D(KCurrencyEditorDlg);
+ delete d;
}
-void KCurrencyEditorDlg::loadCurrency(MyMoneySecurity& currency)
+MyMoneySecurity KCurrencyEditorDlg::currency() const
{
- ui->leName->setText(currency.name());
- ui->leSymbol->setText(currency.tradingSymbol());
- int precision = MyMoneyMoney::denomToPrec(currency.smallestCashFraction());
- MyMoneyMoney smallestFraction = MyMoneyMoney::ONE / MyMoneyMoney(currency.smallestCashFraction());
- ui->leCashFraction->setText(smallestFraction.formatMoney(currency.tradingSymbol(), precision));
- precision = MyMoneyMoney::denomToPrec(currency.smallestAccountFraction());
- smallestFraction = MyMoneyMoney::ONE / MyMoneyMoney(currency.smallestAccountFraction());
- ui->leAccountFraction->setText(smallestFraction.formatMoney(currency.tradingSymbol(), precision));
- ui->leRoundingMethod->setText(currency.roundingMethodToString(currency.roundingMethod()));
- ui->m_pricePrecision->setValue(currency.pricePrecision());
+ Q_D(const KCurrencyEditorDlg);
+ MyMoneySecurity newCurrency = d->currency;
+
+ // if we are creating a new currency, we need to assing the ID
+ if (d->currency.id().isEmpty()) {
+ newCurrency = MyMoneySecurity(d->ui->leIsoCode->text(), newCurrency);
+ }
+
+ newCurrency.setName(d->ui->leName->text());
+ newCurrency.setTradingSymbol(d->ui->leSymbol->text());
+
+ MyMoneyMoney value(d->ui->leCashFraction->text());
+ int fraction = static_cast<int>((MyMoneyMoney::ONE / value).toDouble());
+ newCurrency.setSmallestCashFraction(fraction);
+
+ value = MyMoneyMoney(d->ui->leAccountFraction->text());
+ fraction = static_cast<int>((MyMoneyMoney::ONE / value).toDouble());
+ newCurrency.setSmallestAccountFraction(fraction);
+
+ newCurrency.setRoundingMethod(static_cast<AlkValue::RoundingMethod>(d->ui->comboRoundingMethod->currentIndex()));
+ newCurrency.setPricePrecision(d->ui->spbPricePrecision->value());
+ return newCurrency;
}
+
diff --git a/kmymoney/dialogs/kcurrencyeditordlg.h b/kmymoney/dialogs/kcurrencyeditordlg.h
index c60cb0fdd..65597ae13 100644
--- a/kmymoney/dialogs/kcurrencyeditordlg.h
+++ b/kmymoney/dialogs/kcurrencyeditordlg.h
@@ -1,5 +1,6 @@
/*
* Copyright 2017 Łukasz Wojniłowicz <lukasz.wojnilowicz at gmail.com>
+ * Copyright 2020 Thomas Baumgart <tbaumgart at 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
@@ -35,18 +36,21 @@ class KCurrencyEditorDlg;
}
class MyMoneySecurity;
+class KCurrencyEditorDlgPrivate;
class KCurrencyEditorDlg : public QDialog
{
+ Q_DISABLE_COPY(KCurrencyEditorDlg)
+
Q_OBJECT
public:
- explicit KCurrencyEditorDlg(MyMoneySecurity ¤cy, QWidget *parent = nullptr);
+ explicit KCurrencyEditorDlg(const MyMoneySecurity ¤cy, QWidget *parent = nullptr);
~KCurrencyEditorDlg();
- Ui::KCurrencyEditorDlg* ui;
-
-protected Q_SLOTS:
- void loadCurrency(MyMoneySecurity& currency);
+ MyMoneySecurity currency() const;
+private:
+ KCurrencyEditorDlgPrivate * const d_ptr;
+ Q_DECLARE_PRIVATE(KCurrencyEditorDlg)
};
#endif
diff --git a/kmymoney/dialogs/kcurrencyeditordlg.ui b/kmymoney/dialogs/kcurrencyeditordlg.ui
index d645ac069..9725070d3 100644
--- a/kmymoney/dialogs/kcurrencyeditordlg.ui
+++ b/kmymoney/dialogs/kcurrencyeditordlg.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>226</width>
- <height>206</height>
+ <width>303</width>
+ <height>314</height>
</rect>
</property>
<property name="windowTitle">
@@ -20,90 +20,156 @@
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
- <widget class="QLabel" name="lblName">
+ <widget class="QLabel" name="lblIsoCode">
<property name="text">
- <string>Name:</string>
+ <string>ISO Code</string>
</property>
</widget>
</item>
- <item row="1" column="0">
+ <item row="2" column="0">
<widget class="QLabel" name="lblSymbol">
<property name="text">
<string>Symbol:</string>
</property>
</widget>
</item>
- <item row="2" column="0">
+ <item row="3" column="0">
<widget class="QLabel" name="lblCashFraction">
<property name="text">
- <string>Smallest cash unit:</string>
+ <string>Smallest account unit:</string>
</property>
</widget>
</item>
- <item row="3" column="0">
+ <item row="4" column="0">
<widget class="QLabel" name="lblAccountFraction">
<property name="text">
- <string>Smallest money unit:</string>
+ <string>Smallest cash unit:</string>
</property>
</widget>
</item>
- <item row="4" column="0">
+ <item row="5" column="0">
<widget class="QLabel" name="lblRemainder">
<property name="text">
- <string>Remainder:</string>
+ <string>Rounding method</string>
</property>
</widget>
</item>
- <item row="5" column="0">
+ <item row="6" column="0">
<widget class="QLabel" name="lblpricePrecision">
<property name="text">
<string>Price precision:</string>
</property>
</widget>
</item>
- <item row="5" column="1">
- <widget class="QSpinBox" name="m_pricePrecision">
+ <item row="6" column="1">
+ <widget class="QSpinBox" name="spbPricePrecision">
+ <property name="toolTip">
+ <string comment="@info:tooltip">Enter the price precision for this currency to be used for exchange rates.</string>
+ </property>
<property name="minimum">
<number>2</number>
</property>
<property name="maximum">
<number>10</number>
</property>
+ <property name="value">
+ <number>4</number>
+ </property>
</widget>
</item>
- <item row="0" column="1">
- <widget class="QLabel" name="leName">
+ <item row="1" column="0">
+ <widget class="QLabel" name="lblName">
<property name="text">
- <string>TextLabel</string>
+ <string>Name</string>
</property>
</widget>
</item>
<item row="1" column="1">
- <widget class="QLabel" name="leSymbol">
- <property name="text">
- <string>TextLabel</string>
+ <widget class="QLineEdit" name="leName">
+ <property name="toolTip">
+ <string comment="@info:tooltip">Enter the name of the currency here (e.g. Euro)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="leIsoCode">
+ <property name="toolTip">
+ <string comment="@info:tooltip"><html><head/><body><p>Enter the ISO4217 code for the currency here (e.g. EUR for the Euro). This cannot be changed once the currency is created.</p></body></html></string>
</property>
</widget>
</item>
<item row="2" column="1">
- <widget class="QLabel" name="leAccountFraction">
- <property name="text">
- <string>TextLabel</string>
+ <widget class="QLineEdit" name="leSymbol">
+ <property name="toolTip">
+ <string comment="@info:tooltip">Enter the monetary symbol of the currency here (e.g. € for the Euro)</string>
</property>
</widget>
</item>
<item row="3" column="1">
- <widget class="QLabel" name="leCashFraction">
- <property name="text">
- <string>TextLabel</string>
+ <widget class="QLineEdit" name="leAccountFraction">
+ <property name="toolTip">
+ <string comment="@info:tooltip">Enter the smallest fraction of the currency used for bank accounts here. This cannot be changed once the currency is created.</string>
</property>
</widget>
</item>
<item row="4" column="1">
- <widget class="QLabel" name="leRoundingMethod">
- <property name="text">
- <string>TextLabel</string>
+ <widget class="QLineEdit" name="leCashFraction">
+ <property name="toolTip">
+ <string comment="@info:tooltip">Enter the smallest fraction of the currency used for cash accounts here. This cannot be changed once the currency is created.</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="1">
+ <widget class="QComboBox" name="comboRoundingMethod">
+ <property name="toolTip">
+ <string comment="@info:tooltip"><html><head/><body><p>Enter the rounding method used for this currency. See <span style=" font-weight:600;">What's this</span> for more details.</p></body></html></string>
+ </property>
+ <property name="whatsThis">
+ <string comment="@info:whatsthis"><html><head/><body><p><span style=" font-weight:600;">RoundNever</span></p><p>Don't do any rounding, simply truncate and print a warning in case of a remainder. Otherwise the same as RoundTrunc.</p><p><span style=" font-weight:600;">RoundFloor</span></p><p>Round to the largest integral value not greater than the value. E.g. 0.5 -> 0.0 and -0.5 -> -1.0</p><p><span style=" font-weight:600;">RoundCeil</span></p><p>Round to the smallest integral value not less than the value. E.g. 0.5 -> 1.0 and -0.5 -> -0.0</p><p><span style=" font-weight:600;">RoundTruncate</span></p><p>No rounding, simply truncate any fraction</p><p><span style=" font-weight:600;">RoundPromote</span></p><p>Use RoundCeil for positive and RoundFloor for negative values. E.g. 0.5 -> 1.0 and -0.5 -> -1.0</p><p><span style=" font-weight:600;">RoundHalfDown</span></p><p>Round up or down with the following constraints: 0.1 .. 0.5 -> 0.0 and 0.6 .. 0.9 -> 1.0</p><p><span style=" font-weight:600;">RoundHalfUp</span></p><p>Round up or down with the following constraints: 0.1 .. 0.4 -> 0.0 and 0.5 .. 0.9 -> 1.0</p><p><span style=" font-weight:600;">RoundRound</span></p><p>Use RoundHalfDown for 0.1 .. 0.4 and RoundHalfUp for 0.6 .. 0.9. Use RoundHalfUp for 0.5 in case the resulting numerator is odd, RoundHalfDown in case the resulting numerator is even. E.g. 0.5 -> 0.0 and 1.5 -> 2.0</p></body></html></string>
+ </property>
+ <property name="currentIndex">
+ <number>7</number>
</property>
+ <item>
+ <property name="text">
+ <string>Never</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Floor</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Ceil</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Truncate</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Promote</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Half Down</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Half Up</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Round</string>
+ </property>
+ </item>
</widget>
</item>
</layout>
@@ -118,6 +184,15 @@
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
+ <tabstops>
+ <tabstop>leIsoCode</tabstop>
+ <tabstop>leName</tabstop>
+ <tabstop>leSymbol</tabstop>
+ <tabstop>leAccountFraction</tabstop>
+ <tabstop>leCashFraction</tabstop>
+ <tabstop>comboRoundingMethod</tabstop>
+ <tabstop>spbPricePrecision</tabstop>
+ </tabstops>
<resources/>
<connections>
<connection>
More information about the kde-doc-english
mailing list