diff --git a/kmymoney/CMakeLists.txt b/kmymoney/CMakeLists.txt --- a/kmymoney/CMakeLists.txt +++ b/kmymoney/CMakeLists.txt @@ -2,6 +2,8 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/settings/ + ${CMAKE_CURRENT_BINARY_DIR}/settings/ ${CMAKE_CURRENT_BINARY_DIR}/dialogs/ ${CMAKE_CURRENT_SOURCE_DIR}/widgets/ ${CMAKE_CURRENT_BINARY_DIR}/widgets/ @@ -33,6 +35,7 @@ ${KMyMoney_SOURCE_DIR}/libkgpgfile/ ) add_subdirectory( mymoney ) +add_subdirectory( settings ) add_subdirectory( models ) add_subdirectory( plugins ) add_subdirectory( reports ) @@ -51,13 +54,7 @@ add_subdirectory( tests ) endif() -set( _HEADERS kmymoneyutils.h kmymoneyglobalsettings.h ) - -########### settings code (kmm_config) STATIC ############### -set( kmm_config_SRCS kmymoneyglobalsettings.cpp ) -kconfig_add_kcfg_files( kmm_config_SRCS kmymoneysettings.kcfgc ) -add_library(kmm_config STATIC ${kmm_config_SRCS}) -target_link_libraries(kmm_config KF5::WidgetsAddons KF5::ConfigWidgets Qt5::Sql Alkimia::alkimia) +set( _HEADERS kmymoneyutils.h ) ########### common code (kmymoney_common) STATIC ############### # will be linked into kmymoney, kmymoneytest, and libkmymoney.so @@ -79,7 +76,7 @@ # must build kmymoney/transactionsortoption.h # from transactionsortoption.ui first -add_dependencies(kmymoney_common generate_base_ui_srcs kmm_config) +add_dependencies(kmymoney_common generate_base_ui_srcs kmm_settings) add_dependencies(wizardpages widgets) add_dependencies(dialogs widgets) @@ -120,7 +117,7 @@ settings converter models - kmm_config + kmm_settings kmm_widgets kmm_storage kmm_mymoney @@ -161,12 +158,6 @@ install(TARGETS kmymoney ${INSTALL_TARGETS_DEFAULT_ARGS}) -install(FILES kmymoney.kcfg - DESTINATION ${KCFG_INSTALL_DIR} - ) -install(FILES kmymoney.upd - DESTINATION ${KCONF_UPDATE_INSTALL_DIR} - ) install(FILES ${_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/kmymoney ) diff --git a/kmymoney/converter/mymoneystatementreader.cpp b/kmymoney/converter/mymoneystatementreader.cpp --- a/kmymoney/converter/mymoneystatementreader.cpp +++ b/kmymoney/converter/mymoneystatementreader.cpp @@ -55,7 +55,7 @@ #include "mymoneypayee.h" #include "mymoneystatement.h" #include "mymoneysecurity.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "transactioneditor.h" #include "stdtransactioneditor.h" #include "kmymoneyedit.h" @@ -336,7 +336,7 @@ m_ft(0), m_progressCallback(0) { - m_askPayeeCategory = KMyMoneyGlobalSettings::askForPayeeCategory(); + m_askPayeeCategory = KMyMoneySettings::askForPayeeCategory(); } MyMoneyStatementReader::~MyMoneyStatementReader() @@ -1049,7 +1049,7 @@ topcontents->addWidget(label1); auto filterProxyModel = new AccountNamesFilterProxyModel(this); - filterProxyModel->setHideEquityAccounts(!KMyMoneyGlobalSettings::expertMode()); + filterProxyModel->setHideEquityAccounts(!KMyMoneySettings::expertMode()); filterProxyModel->addAccountGroup(QVector {Account::Type::Asset, Account::Type::Liability, Account::Type::Equity, Account::Type::Income, Account::Type::Expense}); auto const model = Models::instance()->accountsModel(); @@ -1269,7 +1269,7 @@ TransactionMatcher matcher(thisaccount); d->transactionsCount++; - ExistingTransactionMatchFinder existingTrMatchFinder(KMyMoneyGlobalSettings::matchInterval()); + ExistingTransactionMatchFinder existingTrMatchFinder(KMyMoneySettings::matchInterval()); result = existingTrMatchFinder.findMatch(transactionUnderImport, s1); if (result != TransactionMatchFinder::MatchNotFound) { MyMoneyTransaction matchedTransaction = existingTrMatchFinder.getMatchedTransaction(); @@ -1283,7 +1283,7 @@ } addTransaction(transactionUnderImport); - ScheduledTransactionMatchFinder scheduledTrMatchFinder(thisaccount, KMyMoneyGlobalSettings::matchInterval()); + ScheduledTransactionMatchFinder scheduledTrMatchFinder(thisaccount, KMyMoneySettings::matchInterval()); result = scheduledTrMatchFinder.findMatch(transactionUnderImport, s1); if (result != TransactionMatchFinder::MatchNotFound) { MyMoneySplit matchedSplit = scheduledTrMatchFinder.getMatchedSplit(); @@ -1553,7 +1553,7 @@ // check that dates are within user's setting const int gap = std::abs(matchedSchedule.transaction().postDate().toJulianDay() - importedTransaction.postDate().toJulianDay()); - if (gap > KMyMoneyGlobalSettings::matchInterval()) + if (gap > KMyMoneySettings::matchInterval()) questionMsg = i18np("KMyMoney has found a scheduled transaction which matches an imported transaction.
" "Schedule name: %2
" "Transaction: %3 %4
" diff --git a/kmymoney/dialogs/investtransactioneditor.cpp b/kmymoney/dialogs/investtransactioneditor.cpp --- a/kmymoney/dialogs/investtransactioneditor.cpp +++ b/kmymoney/dialogs/investtransactioneditor.cpp @@ -55,7 +55,7 @@ #include "mymoneyprice.h" #include "ksplittransactiondlg.h" #include "kcurrencycalculator.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "investactivities.h" #include "kmymoneycompletion.h" #include "dialogenums.h" @@ -671,7 +671,7 @@ aSet.addAccountType(Account::Type::Asset); aSet.addAccountType(Account::Type::Currency); aSet.addAccountType(Account::Type::CreditCard); - if (KMyMoneyGlobalSettings::expertMode() || haveEquityAccount) + if (KMyMoneySettings::expertMode() || haveEquityAccount) aSet.addAccountGroup(Account::Type::Equity); aSet.load(asset->selector()); diff --git a/kmymoney/dialogs/kcurrencycalculator.cpp b/kmymoney/dialogs/kcurrencycalculator.cpp --- a/kmymoney/dialogs/kcurrencycalculator.cpp +++ b/kmymoney/dialogs/kcurrencycalculator.cpp @@ -54,7 +54,7 @@ #include "mymoneyexception.h" #include "mymoneysplit.h" #include "mymoneytransaction.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" class KCurrencyCalculatorPrivate { @@ -116,7 +116,7 @@ ui->m_dateText->setText(QLocale().toString(m_date)); - ui->m_updateButton->setChecked(KMyMoneyGlobalSettings::priceHistoryUpdate()); + ui->m_updateButton->setChecked(KMyMoneySettings::priceHistoryUpdate()); // setup initial result if (m_result == MyMoneyMoney() && !m_value.isZero()) { @@ -369,7 +369,7 @@ } // remember setting for next round - KMyMoneyGlobalSettings::setPriceHistoryUpdate(d->ui->m_updateButton->isChecked()); + KMyMoneySettings::setPriceHistoryUpdate(d->ui->m_updateButton->isChecked()); QDialog::accept(); } diff --git a/kmymoney/dialogs/kfindtransactiondlg.cpp b/kmymoney/dialogs/kfindtransactiondlg.cpp --- a/kmymoney/dialogs/kfindtransactiondlg.cpp +++ b/kmymoney/dialogs/kfindtransactiondlg.cpp @@ -46,7 +46,7 @@ #include "mymoneytransaction.h" #include "mymoneytransactionfilter.h" #include "kmymoneyedit.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "register.h" #include "transaction.h" #include "daterangedlg.h" @@ -450,13 +450,13 @@ { QPointer dlg = new KSortOptionDlg(this); - dlg->setSortOption(KMyMoneyGlobalSettings::sortSearchView(), QString()); + dlg->setSortOption(KMyMoneySettings::sortSearchView(), QString()); dlg->hideDefaultButton(); if (dlg->exec() == QDialog::Accepted) { QString sortOrder = dlg->sortOption(); - if (sortOrder != KMyMoneyGlobalSettings::sortSearchView()) { - KMyMoneyGlobalSettings::setSortSearchView(sortOrder); + if (sortOrder != KMyMoneySettings::sortSearchView()) { + KMyMoneySettings::setSortSearchView(sortOrder); slotRefreshView(); } } diff --git a/kmymoney/dialogs/kfindtransactiondlg_p.h b/kmymoney/dialogs/kfindtransactiondlg_p.h --- a/kmymoney/dialogs/kfindtransactiondlg_p.h +++ b/kmymoney/dialogs/kfindtransactiondlg_p.h @@ -51,7 +51,7 @@ #include "mymoneyfile.h" #include "mymoneypayee.h" #include "mymoneytag.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "register.h" #include "transaction.h" #include "daterangedlg.h" @@ -317,7 +317,7 @@ void loadView() { // setup sort order - ui->m_register->setSortOrder(KMyMoneyGlobalSettings::sortSearchView()); + ui->m_register->setSortOrder(KMyMoneySettings::sortSearchView()); // clear out old data ui->m_register->clear(); @@ -437,7 +437,7 @@ // if we're not in expert mode, we need to make sure // that all stock accounts for the selected investment // account are also selected - if (!KMyMoneyGlobalSettings::expertMode()) { + if (!KMyMoneySettings::expertMode()) { QStringList missing; foreach (const auto selection, list) { auto acc = MyMoneyFile::instance()->account(selection); @@ -606,7 +606,7 @@ accountSet.addAccountGroup(eMyMoney::Account::Type::Equity); //set the accountset to show closed account if the settings say so - accountSet.setHideClosedAccounts(KMyMoneyGlobalSettings::hideClosedAccounts()); + accountSet.setHideClosedAccounts(KMyMoneySettings::hideClosedAccounts()); accountSet.load(ui->m_accountsView); q->connect(ui->m_accountsView, &KMyMoneyAccountSelector::stateChanged, q, &KFindTransactionDlg::slotUpdateSelections); } diff --git a/kmymoney/dialogs/kmymoneysplittable.cpp b/kmymoney/dialogs/kmymoneysplittable.cpp --- a/kmymoney/dialogs/kmymoneysplittable.cpp +++ b/kmymoney/dialogs/kmymoneysplittable.cpp @@ -62,7 +62,7 @@ #include "kmymoneyaccountselector.h" #include "kmymoneylineedit.h" #include "mymoneysecurity.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "kcurrencycalculator.h" #include "mymoneyutils.h" #include "mymoneytracer.h" @@ -171,21 +171,21 @@ getContentsMargins(&left, &top, &right, &bottom); setContentsMargins(0, top, right, bottom); - setFont(KMyMoneyGlobalSettings::listCellFont()); + setFont(KMyMoneySettings::listCellFontEx()); setAlternatingRowColors(true); verticalHeader()->hide(); horizontalHeader()->setSectionsMovable(false); - horizontalHeader()->setFont(KMyMoneyGlobalSettings::listHeaderFont()); + horizontalHeader()->setFont(KMyMoneySettings::listHeaderFontEx()); KConfigGroup grp = KSharedConfig::openConfig()->group("SplitTable"); QByteArray columns; columns = grp.readEntry("HeaderState", columns); horizontalHeader()->restoreState(columns); horizontalHeader()->setStretchLastSection(true); - setShowGrid(KMyMoneyGlobalSettings::showGrid()); + setShowGrid(KMyMoneySettings::showGrid()); setEditTriggers(QAbstractItemView::NoEditTriggers); @@ -284,7 +284,7 @@ case Qt::Key_Return: case Qt::Key_Enter: if (row < d->m_transaction.splits().count() - 1 - && KMyMoneyGlobalSettings::enterMovesBetweenFields()) { + && KMyMoneySettings::enterMovesBetweenFields()) { slotStartEdit(); } else emit returnPressed(); @@ -360,7 +360,7 @@ // in case we have the 'enter moves focus between fields', we need to simulate // a TAB key when the object 'o' points to the category or memo field. - if (KMyMoneyGlobalSettings::enterMovesBetweenFields()) { + if (KMyMoneySettings::enterMovesBetweenFields()) { if (o == d->m_editCategory->lineEdit() || o == d->m_editMemo) { terminate = false; QKeyEvent evt(e->type(), @@ -441,7 +441,7 @@ scrollTo(model()->index(row, 0)); if (isEditMode()) { // in edit mode? - if (isEditSplitValid() && KMyMoneyGlobalSettings::focusChangeIsEnter()) + if (isEditSplitValid() && KMyMoneySettings::focusChangeIsEnter()) endEdit(false/*keyboard driven*/, false/*set focus to next row*/); else slotCancelEdit(); @@ -537,7 +537,7 @@ // determine row height according to the edit widgets // we use the category widget as the base - QFontMetrics fm(KMyMoneyGlobalSettings::listCellFont()); + QFontMetrics fm(KMyMoneySettings::listCellFontEx()); int height = fm.lineSpacing() + 6; #if 0 // recalculate row height hint @@ -857,7 +857,7 @@ // in case we have selected 'enter moves between fields' if (keyboardDriven && currentRow() < d->m_transaction.splits().count() - 1 - && KMyMoneyGlobalSettings::enterMovesBetweenFields()) { + && KMyMoneySettings::enterMovesBetweenFields()) { slotStartEdit(); } @@ -914,7 +914,7 @@ emit editStarted(); Q_D(KMyMoneySplitTable); - auto cellFont = KMyMoneyGlobalSettings::listCellFont(); + auto cellFont = KMyMoneySettings::listCellFontEx(); d->m_tabOrderWidgets.clear(); // create the widgets @@ -1020,7 +1020,7 @@ aSet.addAccountGroup(eMyMoney::Account::Type::Liability); aSet.addAccountGroup(eMyMoney::Account::Type::Income); aSet.addAccountGroup(eMyMoney::Account::Type::Expense); - if (KMyMoneyGlobalSettings::expertMode()) + if (KMyMoneySettings::expertMode()) aSet.addAccountGroup(eMyMoney::Account::Type::Equity); // remove the accounts with invalid types at this point diff --git a/kmymoney/dialogs/knewaccountdlg.cpp b/kmymoney/dialogs/knewaccountdlg.cpp --- a/kmymoney/dialogs/knewaccountdlg.cpp +++ b/kmymoney/dialogs/knewaccountdlg.cpp @@ -48,7 +48,7 @@ #include "mymoneyfile.h" #include "mymoneyinstitution.h" #include "mymoneyaccount.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "kmymoneycurrencyselector.h" #include "knewbankdlg.h" #include "models.h" @@ -118,7 +118,7 @@ // the proxy filter model m_filterProxyModel = new HierarchyFilterProxyModel(q); m_filterProxyModel->setHideClosedAccounts(true); - m_filterProxyModel->setHideEquityAccounts(!KMyMoneyGlobalSettings::expertMode()); + m_filterProxyModel->setHideEquityAccounts(!KMyMoneySettings::expertMode()); m_filterProxyModel->addAccountGroup(filterAccountGroup); m_filterProxyModel->setCurrentAccountId(m_account.id()); auto const model = Models::instance()->accountsModel(); @@ -152,7 +152,7 @@ bool haveMinBalance = false; bool haveMaxCredit = false; if (!m_account.openingDate().isValid()) { - m_account.setOpeningDate(KMyMoneyGlobalSettings::firstFiscalDate()); + m_account.setOpeningDate(KMyMoneySettings::firstFiscalDate()); } ui->m_openingDateEdit->setDate(m_account.openingDate()); @@ -697,7 +697,7 @@ d->m_account.setValue("minimumBalance", d->ui->m_minBalanceAbsoluteEdit->value().toString()); } } else { - if (KMyMoneyGlobalSettings::hideUnusedCategory() && !d->m_isEditing) { + if (KMyMoneySettings::hideUnusedCategory() && !d->m_isEditing) { KMessageBox::information(this, i18n("You have selected to suppress the display of unused categories in the KMyMoney configuration dialog. The category you just created will therefore only be shown if it is used. Otherwise, it will be hidden in the accounts/categories view."), i18n("Hidden categories"), "NewHiddenCategory"); } d->m_account.setCostCenterRequired(d->ui->m_costCenterRequiredCheckBox->isChecked()); diff --git a/kmymoney/dialogs/kselecttransactionsdlg.cpp b/kmymoney/dialogs/kselecttransactionsdlg.cpp --- a/kmymoney/dialogs/kselecttransactionsdlg.cpp +++ b/kmymoney/dialogs/kselecttransactionsdlg.cpp @@ -43,7 +43,7 @@ #include "mymoneysplit.h" #include "mymoneytransaction.h" #include "transaction.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "widgetenums.h" KSelectTransactionsDlg::KSelectTransactionsDlg(const MyMoneyAccount& _account, QWidget* parent) : @@ -64,15 +64,15 @@ d->ui->m_register->setSelectionMode(QTableWidget::SingleSelection); // setup header font - auto font = KMyMoneyGlobalSettings::listHeaderFont(); + auto font = KMyMoneySettings::listHeaderFontEx(); QFontMetrics fm(font); auto height = fm.lineSpacing() + 6; d->ui->m_register->horizontalHeader()->setMinimumHeight(height); d->ui->m_register->horizontalHeader()->setMaximumHeight(height); d->ui->m_register->horizontalHeader()->setFont(font); // setup cell font - font = KMyMoneyGlobalSettings::listCellFont(); + font = KMyMoneySettings::listCellFontEx(); d->ui->m_register->setFont(font); // ... setup the register columns ... diff --git a/kmymoney/dialogs/settings/CMakeLists.txt b/kmymoney/dialogs/settings/CMakeLists.txt --- a/kmymoney/dialogs/settings/CMakeLists.txt +++ b/kmymoney/dialogs/settings/CMakeLists.txt @@ -51,4 +51,4 @@ target_link_libraries(settings PUBLIC KF5::Holidays) endif() -add_dependencies(settings widgets kmm_config) +add_dependencies(settings widgets kmm_settings) diff --git a/kmymoney/dialogs/settings/ksettingscolors.cpp b/kmymoney/dialogs/settings/ksettingscolors.cpp --- a/kmymoney/dialogs/settings/ksettingscolors.cpp +++ b/kmymoney/dialogs/settings/ksettingscolors.cpp @@ -16,7 +16,7 @@ ***************************************************************************/ #include "ksettingscolors.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" // ---------------------------------------------------------------------------- // QT Includes @@ -44,10 +44,10 @@ void KSettingsColors::slotCustomColorsToggled(bool) { - ui->kcfg_transactionErroneousColor->setColor(KMyMoneyGlobalSettings::schemeColor(SchemeColor::TransactionErroneous)); - ui->kcfg_missingConversionRateColor->setColor(KMyMoneyGlobalSettings::schemeColor(SchemeColor::MissingConversionRate)); - ui->kcfg_groupMarkerColor->setColor(KMyMoneyGlobalSettings::schemeColor(SchemeColor::GroupMarker)); - ui->kcfg_fieldRequiredColor->setColor(KMyMoneyGlobalSettings::schemeColor(SchemeColor::FieldRequired)); - ui->kcfg_transactionImportedColor->setColor(KMyMoneyGlobalSettings::schemeColor(SchemeColor::TransactionImported)); - ui->kcfg_transactionMatchedColor->setColor(KMyMoneyGlobalSettings::schemeColor(SchemeColor::TransactionMatched)); + ui->kcfg_transactionErroneousColor->setColor(KMyMoneySettings::schemeColor(SchemeColor::TransactionErroneous)); + ui->kcfg_missingConversionRateColor->setColor(KMyMoneySettings::schemeColor(SchemeColor::MissingConversionRate)); + ui->kcfg_groupMarkerColor->setColor(KMyMoneySettings::schemeColor(SchemeColor::GroupMarker)); + ui->kcfg_fieldRequiredColor->setColor(KMyMoneySettings::schemeColor(SchemeColor::FieldRequired)); + ui->kcfg_transactionImportedColor->setColor(KMyMoneySettings::schemeColor(SchemeColor::TransactionImported)); + ui->kcfg_transactionMatchedColor->setColor(KMyMoneySettings::schemeColor(SchemeColor::TransactionMatched)); } diff --git a/kmymoney/dialogs/settings/ksettingshome.cpp b/kmymoney/dialogs/settings/ksettingshome.cpp --- a/kmymoney/dialogs/settings/ksettingshome.cpp +++ b/kmymoney/dialogs/settings/ksettingshome.cpp @@ -34,7 +34,7 @@ #include "ui_ksettingshome.h" -#include "kmymoney/kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "kmymoney/kmymoneyutils.h" #include "icons/icons.h" @@ -100,7 +100,7 @@ if (d->m_noNeedToUpdateList) return; - QStringList list = KMyMoneyGlobalSettings::itemList(); + QStringList list = KMyMoneySettings::listOfItems(); QStringList::ConstIterator it; d->ui->m_homePageList->clear(); QListWidgetItem *sel = 0; diff --git a/kmymoney/dialogs/settings/ksettingsreports.cpp b/kmymoney/dialogs/settings/ksettingsreports.cpp --- a/kmymoney/dialogs/settings/ksettingsreports.cpp +++ b/kmymoney/dialogs/settings/ksettingsreports.cpp @@ -35,7 +35,7 @@ #include "ui_ksettingsreports.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" class KSettingsReportsPrivate { @@ -136,10 +136,10 @@ d->ui->setupUi(this); // keep initial (default) css file in mind - d->m_cssFileOld = KMyMoneyGlobalSettings::cssFileDefault(); + d->m_cssFileOld = KMyMoneySettings::cssFileDefault(); // set default css file in ksettingsreports dialog - d->ui->kcfg_CssFileDefault->setUrl(QUrl::fromLocalFile(KMyMoneyGlobalSettings::cssFileDefault())); + d->ui->kcfg_CssFileDefault->setUrl(QUrl::fromLocalFile(KMyMoneySettings::cssFileDefault())); d->m_fileKLineEdit = d->ui->kcfg_CssFileDefault->lineEdit(); diff --git a/kmymoney/dialogs/stdtransactioneditor.cpp b/kmymoney/dialogs/stdtransactioneditor.cpp --- a/kmymoney/dialogs/stdtransactioneditor.cpp +++ b/kmymoney/dialogs/stdtransactioneditor.cpp @@ -58,7 +58,7 @@ #include "transaction.h" #include "transactionform.h" #include "mymoneytransactionfilter.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "transactioneditorcontainer.h" #include "ksplittransactiondlg.h" @@ -172,7 +172,7 @@ case eMyMoney::Account::Type::Asset: case eMyMoney::Account::Type::Liability: case eMyMoney::Account::Type::Equity: - showNumberField = KMyMoneyGlobalSettings::alwaysShowNrField(); + showNumberField = KMyMoneySettings::alwaysShowNrField(); break; case eMyMoney::Account::Type::Income: @@ -350,7 +350,7 @@ aSet.addAccountGroup(eMyMoney::Account::Type::Liability); aSet.addAccountGroup(eMyMoney::Account::Type::Income); aSet.addAccountGroup(eMyMoney::Account::Type::Expense); - if (KMyMoneyGlobalSettings::expertMode() || haveEquityAccount) + if (KMyMoneySettings::expertMode() || haveEquityAccount) aSet.addAccountGroup(eMyMoney::Account::Type::Equity); aSet.removeAccountType(eMyMoney::Account::Type::CertificateDep); @@ -383,7 +383,7 @@ if (d->m_transaction.id().isEmpty() // new transaction && dynamic_cast(w)->text().isEmpty() // no number filled in && d->m_account.accountType() == eMyMoney::Account::Type::Checkings // checkings account - && KMyMoneyGlobalSettings::autoIncCheckNumber() // and auto inc number turned on? + && KMyMoneySettings::autoIncCheckNumber() // and auto inc number turned on? && action != eRegister::Action::Deposit // only transfers or withdrawals && d->m_paymentMethod == eMyMoney::Schedule::PaymentType::WriteChecque) {// only for WriteChecque assignNextNumber(); @@ -540,7 +540,7 @@ aSet.addAccountGroup(eMyMoney::Account::Type::Liability); aSet.addAccountGroup(eMyMoney::Account::Type::Income); aSet.addAccountGroup(eMyMoney::Account::Type::Expense); - if (KMyMoneyGlobalSettings::expertMode()) + if (KMyMoneySettings::expertMode()) aSet.addAccountGroup(eMyMoney::Account::Type::Equity); aSet.load(category->selector()); @@ -584,7 +584,7 @@ // in the account. if (d->m_transaction.id().isEmpty() && d->m_splits.count() == 0 - && KMyMoneyGlobalSettings::autoFillTransaction() != 0) { + && KMyMoneySettings::autoFillTransaction() != 0) { // check if category is empty KMyMoneyCategory* category = dynamic_cast(d->m_editWidgets["category"]); QStringList list; @@ -679,7 +679,7 @@ if (it_u == uniqList.end()) { uniqList[ukey].t = &((*it_t).first); uniqList[ukey].cnt = 1; - } else if (KMyMoneyGlobalSettings::autoFillTransaction() == 1) { + } else if (KMyMoneySettings::autoFillTransaction() == 1) { // we already have a transaction with this signature. we must // now check, if we should really treat it as a duplicate according // to the value comparison delta. @@ -695,11 +695,11 @@ diff = s1.abs(); else diff = ((s1 - s2) / s2).convert(10000); - if (diff.isPositive() && diff <= MyMoneyMoney(KMyMoneyGlobalSettings::autoFillDifference(), 100)) { + if (diff.isPositive() && diff <= MyMoneyMoney(KMyMoneySettings::autoFillDifference(), 100)) { uniqList[ukey].t = &((*it_t).first); break; // end while loop } - } else if (KMyMoneyGlobalSettings::autoFillTransaction() == 2) { + } else if (KMyMoneySettings::autoFillTransaction() == 2) { (*it_u).cnt++; break; // end while loop } @@ -709,7 +709,7 @@ } MyMoneyTransaction t; - if (KMyMoneyGlobalSettings::autoFillTransaction() != 2) { + if (KMyMoneySettings::autoFillTransaction() != 2) { #if 0 // I removed this code to allow cancellation of an autofill if // it does not match even if there is only a single matching @@ -794,7 +794,7 @@ // the current account. This allows the user to change // the autofilled memo text which will then also be used // in this split. See createTransaction() for this logic. - if ((s.accountId() != d->m_account.id() && t.splitCount() == 2) || !KMyMoneyGlobalSettings::autoFillUseMemos()) + if ((s.accountId() != d->m_account.id() && t.splitCount() == 2) || !KMyMoneySettings::autoFillUseMemos()) s.setMemo(QString()); d->m_transaction.addSplit(s); @@ -1183,7 +1183,7 @@ } if (postDate->date().isValid() && (postDate->date() < accountOpeningDate)) { - postDate->markAsBadDate(true, KMyMoneyGlobalSettings::schemeColor(SchemeColor::Negative)); + postDate->markAsBadDate(true, KMyMoneySettings::schemeColor(SchemeColor::Negative)); reason = i18n("Cannot enter transaction with postdate prior to account's opening date."); postDate->setToolTip(reason); return false; diff --git a/kmymoney/dialogs/transactioneditor.cpp b/kmymoney/dialogs/transactioneditor.cpp --- a/kmymoney/dialogs/transactioneditor.cpp +++ b/kmymoney/dialogs/transactioneditor.cpp @@ -60,7 +60,7 @@ #include "kmymoneycompletion.h" #include "transaction.h" #include "transactionform.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "transactioneditorcontainer.h" #include "kcurrencycalculator.h" @@ -285,7 +285,7 @@ // key into a TAB key to move between the fields. Of course, we only need // to do this as long as the appropriate option is set. In all other cases, // we treat the return/enter key as such. - if (KMyMoneyGlobalSettings::enterMovesBetweenFields()) { + if (KMyMoneySettings::enterMovesBetweenFields()) { for (it_w = d->m_finalEditWidgets.constBegin(); !isFinal && it_w != d->m_finalEditWidgets.constEnd(); ++it_w) { if (*it_w == o) { if (dynamic_cast(*it_w)) { diff --git a/kmymoney/kmymoney.cpp b/kmymoney/kmymoney.cpp --- a/kmymoney/kmymoney.cpp +++ b/kmymoney/kmymoney.cpp @@ -75,7 +75,7 @@ // ---------------------------------------------------------------------------- // Project Includes -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "kmymoneyadaptor.h" #include "dialogs/settings/ksettingskmymoney.h" @@ -174,10 +174,6 @@ #include "misc/platformtools.h" -// includes needed for shared global settings -#include "mymoney_config.h" -#include "widgets_config.h" - #ifdef KMM_DEBUG #include "mymoneytracer.h" #endif @@ -383,16 +379,13 @@ qRegisterMetaType("MyMoneyMoney"); qRegisterMetaType("MyMoneySecurity"); - MyMoney::injectExternalSettings(KMyMoneyGlobalSettings::self()); - Widgets::injectExternalSettings(KMyMoneyGlobalSettings::self()); - // preset the pointer because we need it during the course of this constructor kmymoney = this; d->m_config = KSharedConfig::openConfig(); d->setThemedCSS(); - MyMoneyTransactionFilter::setFiscalYearStart(KMyMoneyGlobalSettings::firstFiscalMonth(), KMyMoneyGlobalSettings::firstFiscalDay()); + MyMoneyTransactionFilter::setFiscalYearStart(KMyMoneySettings::firstFiscalMonth(), KMyMoneySettings::firstFiscalDay()); updateCaption(true); @@ -495,8 +488,6 @@ #ifdef KF5Holidays_FOUND delete d->m_holidayRegion; #endif - Widgets::injectExternalSettings(nullptr); - MyMoney::injectExternalSettings(nullptr); delete d; } @@ -879,9 +870,9 @@ connect(onlineJobAdministration::instance(), &onlineJobAdministration::canSendCreditTransferChanged, lutActions.value(Action::AccountCreditTransfer), &QAction::setEnabled); // Setup transaction detail switch - lutActions[Action::ViewTransactionDetail]->setChecked(KMyMoneyGlobalSettings::showRegisterDetailed()); - lutActions[Action::ViewHideReconciled]->setChecked(KMyMoneyGlobalSettings::hideReconciledTransactions()); - lutActions[Action::ViewHideCategories]->setChecked(KMyMoneyGlobalSettings::hideUnusedCategory()); + lutActions[Action::ViewTransactionDetail]->setChecked(KMyMoneySettings::showRegisterDetailed()); + lutActions[Action::ViewHideReconciled]->setChecked(KMyMoneySettings::hideReconciledTransactions()); + lutActions[Action::ViewHideCategories]->setChecked(KMyMoneySettings::hideUnusedCategory()); lutActions[Action::ViewShowAll]->setChecked(false); // ************* @@ -969,8 +960,8 @@ KConfigGroup grp = d->m_config->group("General Options"); - pActions[Action::ViewHideReconciled]->setChecked(KMyMoneyGlobalSettings::hideReconciledTransactions()); - pActions[Action::ViewHideCategories]->setChecked(KMyMoneyGlobalSettings::hideUnusedCategory()); + pActions[Action::ViewHideReconciled]->setChecked(KMyMoneySettings::hideReconciledTransactions()); + pActions[Action::ViewHideCategories]->setChecked(KMyMoneySettings::hideUnusedCategory()); d->m_recentFiles->loadEntries(d->m_config->group("Recent Files")); @@ -987,7 +978,7 @@ int KMyMoneyApp::askSaveOnClose() { int ans; - if (KMyMoneyGlobalSettings::autoSaveOnClose()) { + if (KMyMoneySettings::autoSaveOnClose()) { ans = KMessageBox::Yes; } else { ans = KMessageBox::warningYesNoCancel(this, i18n("The file has been changed, save it?")); @@ -1199,7 +1190,7 @@ d->m_fileName = wizard->url(); ft.commit(); - KMyMoneyGlobalSettings::setFirstTimeRun(false); + KMyMoneySettings::setFirstTimeRun(false); // FIXME This is a bit clumsy. We re-read the freshly // created file to be able to run through all the @@ -1459,7 +1450,7 @@ KMSTATUS(i18n("Saving file with a new filename...")); // fill the additional key list with the default - d->m_additionalGpgKeys = KMyMoneyGlobalSettings::gpgRecipientList(); + d->m_additionalGpgKeys = KMyMoneySettings::gpgRecipientList(); QWidget* vbox = new QWidget(); QVBoxLayout *vboxVBoxLayout = new QVBoxLayout(vbox); @@ -1499,7 +1490,7 @@ name.replace(')', "]"); name = QString("%1 (0x%2)").arg(name).arg(fields[0]); d->m_saveEncrypted->addItem(name); - if (name.contains(KMyMoneyGlobalSettings::gpgRecipient())) { + if (name.contains(KMyMoneySettings::gpgRecipient())) { d->m_saveEncrypted->setCurrentItem(name); } } @@ -1693,19 +1684,19 @@ void KMyMoneyApp::slotHideReconciledTransactions() { - KMyMoneyGlobalSettings::setHideReconciledTransactions(pActions[Action::ViewHideReconciled]->isChecked()); + KMyMoneySettings::setHideReconciledTransactions(pActions[Action::ViewHideReconciled]->isChecked()); d->m_myMoneyView->slotRefreshViews(); } void KMyMoneyApp::slotHideUnusedCategories() { - KMyMoneyGlobalSettings::setHideUnusedCategory(pActions[Action::ViewHideCategories]->isChecked()); + KMyMoneySettings::setHideUnusedCategory(pActions[Action::ViewHideCategories]->isChecked()); d->m_myMoneyView->slotRefreshViews(); } void KMyMoneyApp::slotShowAllAccounts() { - KMyMoneyGlobalSettings::setShowAllAccounts(pActions[Action::ViewShowAll]->isChecked()); + KMyMoneySettings::setShowAllAccounts(pActions[Action::ViewShowAll]->isChecked()); d->m_myMoneyView->slotRefreshViews(); } @@ -1930,7 +1921,7 @@ return; // otherwise, we have to create it - auto dlg = new KSettingsKMyMoney(this, "KMyMoney-Settings", KMyMoneyGlobalSettings::self()); + auto dlg = new KSettingsKMyMoney(this, "KMyMoney-Settings", KMyMoneySettings::self()); connect(dlg, &KSettingsKMyMoney::settingsChanged, this, &KMyMoneyApp::slotUpdateConfiguration); dlg->show(); } @@ -1949,28 +1940,28 @@ onlineJobAdministration::instance()->updateActions(); return; } - MyMoneyTransactionFilter::setFiscalYearStart(KMyMoneyGlobalSettings::firstFiscalMonth(), KMyMoneyGlobalSettings::firstFiscalDay()); + MyMoneyTransactionFilter::setFiscalYearStart(KMyMoneySettings::firstFiscalMonth(), KMyMoneySettings::firstFiscalDay()); #ifdef ENABLE_UNFINISHEDFEATURES - LedgerSeparator::setFirstFiscalDate(KMyMoneyGlobalSettings::firstFiscalMonth(), KMyMoneyGlobalSettings::firstFiscalDay()); + LedgerSeparator::setFirstFiscalDate(KMyMoneySettings::firstFiscalMonth(), KMyMoneySettings::firstFiscalDay()); #endif d->m_myMoneyView->updateViewType(); // update the sql storage module settings - MyMoneyStorageSql::setStartDate(KMyMoneyGlobalSettings::startDate().date()); + MyMoneyStorageSql::setStartDate(KMyMoneySettings::startDate().date()); // update the report module settings - MyMoneyReport::setLineWidth(KMyMoneyGlobalSettings::lineWidth()); + MyMoneyReport::setLineWidth(KMyMoneySettings::lineWidth()); // update the holiday region configuration - setHolidayRegion(KMyMoneyGlobalSettings::holidayRegion()); + setHolidayRegion(KMyMoneySettings::holidayRegion()); d->m_myMoneyView->slotRefreshViews(); // re-read autosave configuration - d->m_autoSaveEnabled = KMyMoneyGlobalSettings::autoSaveFile(); - d->m_autoSavePeriod = KMyMoneyGlobalSettings::autoSavePeriod(); + d->m_autoSaveEnabled = KMyMoneySettings::autoSaveFile(); + d->m_autoSavePeriod = KMyMoneySettings::autoSavePeriod(); // stop timer if turned off but running if (d->m_autoSaveTimer->isActive() && !d->m_autoSaveEnabled) { @@ -2221,7 +2212,7 @@ void KMyMoneyApp::slotToolsStartKCalc() { - QString cmd = KMyMoneyGlobalSettings::externalCalculator(); + QString cmd = KMyMoneySettings::externalCalculator(); // if none is present, we fall back to the default if (cmd.isEmpty()) { #if defined(Q_OS_WIN32) @@ -2826,11 +2817,11 @@ QTextStream cssStream(&cssFile); auto cssText = cssStream.readAll(); cssText.replace(QLatin1String("./"), defaultCSSDir, Qt::CaseSensitive); - cssText.replace(QLatin1String("WindowText"), KMyMoneyGlobalSettings::schemeColor(SchemeColor::WindowText).name(), Qt::CaseSensitive); - cssText.replace(QLatin1String("Window"), KMyMoneyGlobalSettings::schemeColor(SchemeColor::WindowBackground).name(), Qt::CaseSensitive); - cssText.replace(QLatin1String("HighlightText"), KMyMoneyGlobalSettings::schemeColor(SchemeColor::ListHighlightText).name(), Qt::CaseSensitive); - cssText.replace(QLatin1String("Highlight"), KMyMoneyGlobalSettings::schemeColor(SchemeColor::ListHighlight).name(), Qt::CaseSensitive); - cssText.replace(QLatin1String("black"), KMyMoneyGlobalSettings::schemeColor(SchemeColor::ListGrid).name(), Qt::CaseSensitive); + cssText.replace(QLatin1String("WindowText"), KMyMoneySettings::schemeColor(SchemeColor::WindowText).name(), Qt::CaseSensitive); + cssText.replace(QLatin1String("Window"), KMyMoneySettings::schemeColor(SchemeColor::WindowBackground).name(), Qt::CaseSensitive); + cssText.replace(QLatin1String("HighlightText"), KMyMoneySettings::schemeColor(SchemeColor::ListHighlightText).name(), Qt::CaseSensitive); + cssText.replace(QLatin1String("Highlight"), KMyMoneySettings::schemeColor(SchemeColor::ListHighlight).name(), Qt::CaseSensitive); + cssText.replace(QLatin1String("black"), KMyMoneySettings::schemeColor(SchemeColor::ListGrid).name(), Qt::CaseSensitive); cssStream.seek(0); cssStream << cssText; cssFile.close(); @@ -2842,11 +2833,11 @@ void KMyMoneyApp::slotCheckSchedules() { - if (KMyMoneyGlobalSettings::checkSchedule() == true) { + if (KMyMoneySettings::checkSchedule() == true) { KMSTATUS(i18n("Checking for overdue scheduled transactions...")); MyMoneyFile *file = MyMoneyFile::instance(); - QDate checkDate = QDate::currentDate().addDays(KMyMoneyGlobalSettings::checkSchedulePreview()); + QDate checkDate = QDate::currentDate().addDays(KMyMoneySettings::checkSchedulePreview()); QList scheduleList = file->scheduleList(); QList::Iterator it; @@ -3340,7 +3331,7 @@ //only do this if it is a valid region if (d->m_holidayRegion && d->m_holidayRegion->isValid()) { //load holidays for the forecast days plus 1 cycle, to be on the safe side - int forecastDays = KMyMoneyGlobalSettings::forecastDays() + KMyMoneyGlobalSettings::forecastAccountCycle(); + int forecastDays = KMyMoneySettings::forecastDays() + KMyMoneySettings::forecastAccountCycle(); QDate endDate = QDate::currentDate().addDays(forecastDays); //look for holidays for the next 2 years as a minimum. That should give a good margin for the cache diff --git a/kmymoney/kmymoneysettings.kcfgc b/kmymoney/kmymoneysettings.kcfgc deleted file mode 100644 --- a/kmymoney/kmymoneysettings.kcfgc +++ /dev/null @@ -1,4 +0,0 @@ -File=kmymoney.kcfg -ClassName=KMyMoneySettings -Singleton=true -Mutators=true diff --git a/kmymoney/kmymoneyutils.h b/kmymoney/kmymoneyutils.h --- a/kmymoney/kmymoneyutils.h +++ b/kmymoney/kmymoneyutils.h @@ -62,6 +62,7 @@ class MyMoneyTransaction; class MyMoneyStatement; class MyMoneyInstitution; +class MyMoneyForecast; namespace eMyMoney { namespace Schedule { enum class Occurrence; enum class PaymentType; @@ -383,6 +384,8 @@ static void newInstitution(MyMoneyInstitution& institution); static QDebug debug(); + + static MyMoneyForecast forecast(); }; #endif diff --git a/kmymoney/kmymoneyutils.cpp b/kmymoney/kmymoneyutils.cpp --- a/kmymoney/kmymoneyutils.cpp +++ b/kmymoney/kmymoneyutils.cpp @@ -66,7 +66,7 @@ #include "mymoneyforecast.h" #include "mymoneysplit.h" #include "mymoneytransaction.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "icons.h" #include "storageenums.h" #include "mymoneyenums.h" @@ -204,9 +204,9 @@ QString css; css += "\n"; return css; @@ -767,3 +767,22 @@ { return qDebug() << QDateTime::currentDateTime().toString(QStringLiteral("HH:mm:ss.zzz")); } + +MyMoneyForecast KMyMoneyUtils::forecast() +{ + MyMoneyForecast forecast; + + // override object defaults with those of the application + forecast.setForecastCycles(KMyMoneySettings::forecastCycles()); + forecast.setAccountsCycle(KMyMoneySettings::forecastAccountCycle()); + forecast.setHistoryStartDate(QDate::currentDate().addDays(-forecast.forecastCycles()*forecast.accountsCycle())); + forecast.setHistoryEndDate(QDate::currentDate().addDays(-1)); + forecast.setForecastDays(KMyMoneySettings::forecastDays()); + forecast.setBeginForecastDay(KMyMoneySettings::beginForecastDay()); + forecast.setForecastMethod(KMyMoneySettings::forecastMethod()); + forecast.setHistoryMethod(KMyMoneySettings::historyMethod()); + forecast.setIncludeFutureTransactions(KMyMoneySettings::includeFutureTransactions()); + forecast.setIncludeScheduledTransactions(KMyMoneySettings::includeScheduledTransactions()); + + return forecast; +} diff --git a/kmymoney/main.cpp b/kmymoney/main.cpp --- a/kmymoney/main.cpp +++ b/kmymoney/main.cpp @@ -50,7 +50,7 @@ #include "kstartuplogo.h" #include "kcreditswindow.h" #include "kmymoneyutils.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "misc/webconnect.h" #ifdef KMM_DEBUG @@ -172,7 +172,7 @@ KMyMoneyUtils::checkConstants(); // show startup logo - std::unique_ptr splash(KMyMoneyGlobalSettings::showSplash() ? createStartupLogo() : nullptr); + std::unique_ptr splash(KMyMoneySettings::showSplash() ? createStartupLogo() : nullptr); app.processEvents(); // setup the MyMoneyMoney locale settings according to the KDE settings @@ -295,10 +295,10 @@ KTipDialog::showTip(kmymoney, QString(), false); if (url.isValid() && !noFile) { kmymoney->slotFileOpenRecent(url); - } else if (KMyMoneyGlobalSettings::firstTimeRun()) { + } else if (KMyMoneySettings::firstTimeRun()) { kmymoney->slotFileNew(); } - KMyMoneyGlobalSettings::setFirstTimeRun(false); + KMyMoneySettings::setFirstTimeRun(false); if (!importfile.isEmpty()) kmymoney->webConnect(importfile, QByteArray()); diff --git a/kmymoney/models/CMakeLists.txt b/kmymoney/models/CMakeLists.txt --- a/kmymoney/models/CMakeLists.txt +++ b/kmymoney/models/CMakeLists.txt @@ -43,4 +43,4 @@ target_link_libraries(models PRIVATE Qt5::Test) endif() -add_dependencies(models kmm_config) +add_dependencies(models kmm_settings) diff --git a/kmymoney/models/accountsmodel.cpp b/kmymoney/models/accountsmodel.cpp --- a/kmymoney/models/accountsmodel.cpp +++ b/kmymoney/models/accountsmodel.cpp @@ -43,7 +43,7 @@ #include "mymoneyaccount.h" #include "mymoneysecurity.h" #include "mymoneyprice.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "icons.h" #include "modelenums.h" #include "mymoneyenums.h" @@ -256,7 +256,7 @@ } QColor color; if (valInstitution.isNegative()) - color = KMyMoneyGlobalSettings::schemeColor(SchemeColor::Negative); + color = KMyMoneySettings::schemeColor(SchemeColor::Negative); else color = KColorScheme(QPalette::Active).foreground(KColorScheme::NormalText).color(); @@ -338,7 +338,7 @@ getCell(colNum); QColor color; if (accountTotalValue.isNegative()) - color = KMyMoneyGlobalSettings::schemeColor(SchemeColor::Negative); + color = KMyMoneySettings::schemeColor(SchemeColor::Negative); else color = KColorScheme(QPalette::Active).foreground(KColorScheme::NormalText).color(); @@ -656,7 +656,7 @@ // filter out stocks with zero balance if requested by user for (auto subaccStr = subaccountsStr.begin(); subaccStr != subaccountsStr.end();) { const auto subacc = d->m_file->account(*subaccStr); - if (subacc.isInvest() && KMyMoneyGlobalSettings::hideZeroBalanceEquities() && subacc.balance().isZero()) + if (subacc.isInvest() && KMyMoneySettings::hideZeroBalanceEquities() && subacc.balance().isZero()) subaccStr = subaccountsStr.erase(subaccStr); else ++subaccStr; @@ -1116,7 +1116,7 @@ } foreach (const auto stock, stocksList) { - if (!(KMyMoneyGlobalSettings::hideZeroBalanceEquities() && stock.balance().isZero())) + if (!(KMyMoneySettings::hideZeroBalanceEquities() && stock.balance().isZero())) modelUtils->loadInstitution(this, stock); } diff --git a/kmymoney/models/ledgermodel.cpp b/kmymoney/models/ledgermodel.cpp --- a/kmymoney/models/ledgermodel.cpp +++ b/kmymoney/models/ledgermodel.cpp @@ -213,7 +213,7 @@ case Qt::BackgroundColorRole: if(d->m_ledgerItems[index.row()]->isImported()) { - return KMyMoneyGlobalSettings::schemeColor(SchemeColor::TransactionImported); + return KMyMoneySettings::schemeColor(SchemeColor::TransactionImported); } break; @@ -493,7 +493,7 @@ // load all scheduled transactoins and splits into the model const int splitCount = rowCount(); QList sList = MyMoneyFile::instance()->scheduleList(); - addSchedules(sList, KMyMoneyGlobalSettings::schedulePreview()); + addSchedules(sList, KMyMoneySettings::schedulePreview()); qDebug() << "Loaded" << rowCount()-splitCount << "elements"; // create a dummy entry for new transactions diff --git a/kmymoney/mymoney/CMakeLists.txt b/kmymoney/mymoney/CMakeLists.txt --- a/kmymoney/mymoney/CMakeLists.txt +++ b/kmymoney/mymoney/CMakeLists.txt @@ -4,7 +4,6 @@ ########### next target ############### set(kmm_mymoney_LIB_SRCS - mymoney_config.cpp mymoneymoney.cpp mymoneyfinancialcalculator.cpp mymoneytransactionfilter.cpp mymoneyfile.cpp mymoneykeyvaluecontainer.cpp @@ -67,7 +66,6 @@ kmm_payeeidentifier payeeidentifier_iban_bic payeeidentifier_nationalAccount - kmm_config # TODO: fix this KF5::XmlGui PRIVATE diff --git a/kmymoney/mymoney/mymoney_config.h b/kmymoney/mymoney/mymoney_config.h deleted file mode 100644 --- a/kmymoney/mymoney/mymoney_config.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - This file is part of KMyMoney, A Personal Finance Manager by KDE - Copyright (C) 2018 Thomas Baumgart - - 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 . -*/ - -#ifndef MYMONEY_CONFIG_H -#define MYMONEY_CONFIG_H - -#include "kmm_mymoney_export.h" - -class KMyMoneySettings; - -namespace MyMoney -{ - KMM_MYMONEY_EXPORT void injectExternalSettings(KMyMoneySettings* p); -} -#endif // MYMONEY_CONFIG_H diff --git a/kmymoney/mymoney/mymoney_config.cpp b/kmymoney/mymoney/mymoney_config.cpp deleted file mode 100644 --- a/kmymoney/mymoney/mymoney_config.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/* - This file is part of KMyMoney, A Personal Finance Manager by KDE - Copyright (C) 2018 Thomas Baumgart - - 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 . -*/ - -#include "mymoney_config.h" -#include "kmymoneyglobalsettings.h" - -namespace MyMoney { - void injectExternalSettings(KMyMoneySettings* p) - { - KMyMoneyGlobalSettings::injectExternalSettings(p); - } -} diff --git a/kmymoney/mymoney/mymoneyreport.h b/kmymoney/mymoney/mymoneyreport.h --- a/kmymoney/mymoney/mymoneyreport.h +++ b/kmymoney/mymoney/mymoneyreport.h @@ -446,6 +446,9 @@ */ static int m_lineWidth; + static void setExpertMode(bool expertMode); + static bool m_expertMode; + /** * Return row type as string. * diff --git a/kmymoney/mymoney/mymoneyreport.cpp b/kmymoney/mymoney/mymoneyreport.cpp --- a/kmymoney/mymoney/mymoneyreport.cpp +++ b/kmymoney/mymoney/mymoneyreport.cpp @@ -37,7 +37,6 @@ #include "mymoneytransaction.h" #include "mymoneytransactionfilter.h" #include "mymoneyexception.h" -#include "kmymoneyglobalsettings.h" using namespace MyMoneyStorageNodes; @@ -197,7 +196,7 @@ addAccountGroup(Account::Type::Cash); addAccountGroup(Account::Type::Checkings); addAccountGroup(Account::Type::CreditCard); - if (KMyMoneyGlobalSettings::expertMode()) + if (m_expertMode) addAccountGroup(Account::Type::Equity); addAccountGroup(Account::Type::Expense); addAccountGroup(Account::Type::Income); @@ -1581,12 +1580,18 @@ } int MyMoneyReport::m_lineWidth = 2; +bool MyMoneyReport::m_expertMode = false; void MyMoneyReport::setLineWidth(int width) { m_lineWidth = width; } +void MyMoneyReport::setExpertMode(bool expertMode) +{ + m_expertMode = expertMode; +} + QString MyMoneyReport::toString(ERowType type) { switch(type) { diff --git a/kmymoney/mymoney/tests/mymoneyforecast-test.cpp b/kmymoney/mymoney/tests/mymoneyforecast-test.cpp --- a/kmymoney/mymoney/tests/mymoneyforecast-test.cpp +++ b/kmymoney/mymoney/tests/mymoneyforecast-test.cpp @@ -131,39 +131,39 @@ /* //check the illegal argument validation try { - KMyMoneyGlobalSettings::setForecastDays(-10); + KMyMoneySettings::setForecastDays(-10); a.doForecast(); } catch (const MyMoneyException &e) { QFAIL("Unexpected exception"); } try { - KMyMoneyGlobalSettings::setForecastAccountCycle(-20); + KMyMoneySettings::setForecastAccountCycle(-20); a.doForecast(); } catch (const MyMoneyException &e) { QFAIL("Unexpected exception"); } try { - KMyMoneyGlobalSettings::setForecastCycles(-10); + KMyMoneySettings::setForecastCycles(-10); a.doForecast(); } catch (const MyMoneyException &e) { QFAIL("Unexpected exception"); } try { - KMyMoneyGlobalSettings::setForecastAccountCycle(0); + KMyMoneySettings::setForecastAccountCycle(0); a.doForecast(); } catch (const MyMoneyException &e) { QFAIL("Unexpected exception"); } try { - KMyMoneyGlobalSettings::setForecastDays(0); - KMyMoneyGlobalSettings::setForecastCycles(0); - KMyMoneyGlobalSettings::setForecastAccountCycle(0); + KMyMoneySettings::setForecastDays(0); + KMyMoneySettings::setForecastCycles(0); + KMyMoneySettings::setForecastAccountCycle(0); a.doForecast(); } catch (const MyMoneyException &e) { diff --git a/kmymoney/pluginloader.cpp b/kmymoney/pluginloader.cpp --- a/kmymoney/pluginloader.cpp +++ b/kmymoney/pluginloader.cpp @@ -33,7 +33,6 @@ #include "kmymoneyplugin.h" #include "onlinepluginextended.h" -#include "kmymoneyglobalsettings.h" namespace KMyMoneyPlugin { @@ -94,7 +93,6 @@ guiFactory->removeClient(it.value()); it.value()->unplug(); - it.value()->injectExternalSettings(0); delete it.value(); it = plugins.erase(it); continue; @@ -127,7 +125,6 @@ } ctnPlugins.standard.insert((*it).pluginId(), plugin); - plugin->injectExternalSettings(KMyMoneyGlobalSettings::self()); plugin->plug(); guiFactory->addClient(plugin); diff --git a/kmymoney/plugins/checkprinting/checkprinting.h b/kmymoney/plugins/checkprinting/checkprinting.h --- a/kmymoney/plugins/checkprinting/checkprinting.h +++ b/kmymoney/plugins/checkprinting/checkprinting.h @@ -41,8 +41,6 @@ void unplug() override; void configurationChanged() override; - void injectExternalSettings(KMyMoneySettings* p) override; - private: void readCheckTemplate(); diff --git a/kmymoney/plugins/checkprinting/checkprinting.cpp b/kmymoney/plugins/checkprinting/checkprinting.cpp --- a/kmymoney/plugins/checkprinting/checkprinting.cpp +++ b/kmymoney/plugins/checkprinting/checkprinting.cpp @@ -56,7 +56,6 @@ #include "numbertowords.h" #include "pluginsettings.h" #include "mymoneyenums.h" -#include "kmymoneyglobalsettings.h" struct CheckPrinting::Private { QAction* m_action; @@ -103,11 +102,6 @@ qDebug("Plugins: checkprinting unloaded"); } -void CheckPrinting::injectExternalSettings(KMyMoneySettings* p) -{ - KMyMoneyGlobalSettings::injectExternalSettings(p); -} - void CheckPrinting::plug() { connect(viewInterface(), &KMyMoneyPlugin::ViewInterface::transactionsSelected, this, &CheckPrinting::slotTransactionsSelected); diff --git a/kmymoney/plugins/csv/export/csvexporter.h b/kmymoney/plugins/csv/export/csvexporter.h --- a/kmymoney/plugins/csv/export/csvexporter.h +++ b/kmymoney/plugins/csv/export/csvexporter.h @@ -44,8 +44,6 @@ return m_dlg; } - void injectExternalSettings(KMyMoneySettings* p) override; - private: CsvExportDlg* m_dlg; diff --git a/kmymoney/plugins/csv/export/csvexporter.cpp b/kmymoney/plugins/csv/export/csvexporter.cpp --- a/kmymoney/plugins/csv/export/csvexporter.cpp +++ b/kmymoney/plugins/csv/export/csvexporter.cpp @@ -35,8 +35,6 @@ // ---------------------------------------------------------------------------- // Project Includes -#include "kmymoneyglobalsettings.h" - CSVExporter::CSVExporter(QObject *parent, const QVariantList &args) : KMyMoneyPlugin::Plugin(parent, "csvexporter"/*must be the same as X-KDE-PluginInfo-Name*/) { @@ -53,11 +51,6 @@ qDebug("Plugins: csvexporter unloaded"); } -void CSVExporter::injectExternalSettings(KMyMoneySettings* p) -{ - KMyMoneyGlobalSettings::injectExternalSettings(p); -} - void CSVExporter::createActions() { m_action = actionCollection()->addAction("file_export_csv"); diff --git a/kmymoney/plugins/csv/import/csvimporter.h b/kmymoney/plugins/csv/import/csvimporter.h --- a/kmymoney/plugins/csv/import/csvimporter.h +++ b/kmymoney/plugins/csv/import/csvimporter.h @@ -92,8 +92,6 @@ */ virtual QString lastError() const override; - void injectExternalSettings(KMyMoneySettings* p) override; - private: bool m_silent; public Q_SLOTS: diff --git a/kmymoney/plugins/csv/import/csvimporter.cpp b/kmymoney/plugins/csv/import/csvimporter.cpp --- a/kmymoney/plugins/csv/import/csvimporter.cpp +++ b/kmymoney/plugins/csv/import/csvimporter.cpp @@ -37,7 +37,6 @@ #include "core/csvimportercore.h" #include "csvwizard.h" #include "statementinterface.h" -#include "kmymoneyglobalsettings.h" CSVImporter::CSVImporter(QObject *parent, const QVariantList &args) : KMyMoneyPlugin::Plugin(parent, "csvimporter"/*must be the same as X-KDE-PluginInfo-Name*/) @@ -55,11 +54,6 @@ qDebug("Plugins: csvimporter unloaded"); } -void CSVImporter::injectExternalSettings(KMyMoneySettings* p) -{ - KMyMoneyGlobalSettings::injectExternalSettings(p); -} - void CSVImporter::createActions() { m_action = actionCollection()->addAction("file_import_csv"); diff --git a/kmymoney/plugins/gnc/import/gncimporter.h b/kmymoney/plugins/gnc/import/gncimporter.h --- a/kmymoney/plugins/gnc/import/gncimporter.h +++ b/kmymoney/plugins/gnc/import/gncimporter.h @@ -39,8 +39,6 @@ QAction *m_action; - void injectExternalSettings(KMyMoneySettings* p) override; - private: MyMoneyGncReader *m_gncReader; diff --git a/kmymoney/plugins/gnc/import/gncimporter.cpp b/kmymoney/plugins/gnc/import/gncimporter.cpp --- a/kmymoney/plugins/gnc/import/gncimporter.cpp +++ b/kmymoney/plugins/gnc/import/gncimporter.cpp @@ -38,7 +38,6 @@ #include "mymoneyfile.h" #include "mymoneyexception.h" #include "mymoneyseqaccessmgr.h" -#include "kmymoneyglobalsettings.h" class MyMoneyStatement; @@ -58,11 +57,6 @@ qDebug("Plugins: gncimporter unloaded"); } -void GNCImporter::injectExternalSettings(KMyMoneySettings* p) -{ - KMyMoneyGlobalSettings::injectExternalSettings(p); -} - void GNCImporter::createActions() { m_action = actionCollection()->addAction("file_import_gnc"); diff --git a/kmymoney/plugins/icalendar/export/icalendarexporter.h b/kmymoney/plugins/icalendar/export/icalendarexporter.h --- a/kmymoney/plugins/icalendar/export/icalendarexporter.h +++ b/kmymoney/plugins/icalendar/export/icalendarexporter.h @@ -38,8 +38,6 @@ explicit iCalendarExporter(QObject *parent, const QVariantList &args); ~iCalendarExporter() override; - void injectExternalSettings(KMyMoneySettings* p) override; - protected Q_SLOTS: // this is the export function called when the user selects the interface menu void slotFirstExport(); diff --git a/kmymoney/plugins/icalendar/export/icalendarexporter.cpp b/kmymoney/plugins/icalendar/export/icalendarexporter.cpp --- a/kmymoney/plugins/icalendar/export/icalendarexporter.cpp +++ b/kmymoney/plugins/icalendar/export/icalendarexporter.cpp @@ -37,7 +37,6 @@ #include "schedulestoicalendar.h" #include "pluginsettings.h" -#include "kmymoneyglobalsettings.h" struct iCalendarExporter::Private { QAction* m_action; @@ -94,11 +93,6 @@ qDebug("Plugins: icalendarexporter unloaded"); } -void iCalendarExporter::injectExternalSettings(KMyMoneySettings* p) -{ - KMyMoneyGlobalSettings::injectExternalSettings(p); -} - void iCalendarExporter::slotFirstExport() { QPointer fileDialog = new QFileDialog(d->m_action->parentWidget(), QString(), QString(), QString("%1|%2\n").arg("*.ics").arg(i18nc("ICS (Filefilter)", "iCalendar files"))); diff --git a/kmymoney/plugins/kbanking/kbanking.h b/kmymoney/plugins/kbanking/kbanking.h --- a/kmymoney/plugins/kbanking/kbanking.h +++ b/kmymoney/plugins/kbanking/kbanking.h @@ -88,8 +88,6 @@ void plug() override; void unplug() override; - void injectExternalSettings(KMyMoneySettings* p) override; - private: /** * creates the action objects available through the application menus diff --git a/kmymoney/plugins/kbanking/kbanking.cpp b/kmymoney/plugins/kbanking/kbanking.cpp --- a/kmymoney/plugins/kbanking/kbanking.cpp +++ b/kmymoney/plugins/kbanking/kbanking.cpp @@ -89,7 +89,6 @@ #include "mymoneystatement.h" #include "statementinterface.h" #include "viewinterface.h" -#include "kmymoneyglobalsettings.h" #ifdef KMM_DEBUG // Added an option to open the chipTanDialog from the menu for debugging purposes @@ -174,11 +173,6 @@ qDebug("Plugins: kbanking unloaded"); } -void KBanking::injectExternalSettings(KMyMoneySettings* p) -{ - KMyMoneyGlobalSettings::injectExternalSettings(p); -} - void KBanking::plug() { m_kbanking = new KBankingExt(this, "KMyMoney"); diff --git a/kmymoney/plugins/kmymoneyplugin.h b/kmymoney/plugins/kmymoneyplugin.h --- a/kmymoney/plugins/kmymoneyplugin.h +++ b/kmymoney/plugins/kmymoneyplugin.h @@ -127,8 +127,6 @@ */ virtual void configurationChanged() ; - virtual void injectExternalSettings(KMyMoneySettings* p) = 0; - protected: /** See KMyMoneyApp::toggleAction() for a description */ KToggleAction* toggleAction(const QString& name) const; diff --git a/kmymoney/plugins/ofx/import/ofximporter.h b/kmymoney/plugins/ofx/import/ofximporter.h --- a/kmymoney/plugins/ofx/import/ofximporter.h +++ b/kmymoney/plugins/ofx/import/ofximporter.h @@ -115,8 +115,6 @@ bool mapAccount(const MyMoneyAccount& acc, MyMoneyKeyValueContainer& settings) override; bool updateAccount(const MyMoneyAccount& acc, bool moreAccounts) override; - void injectExternalSettings(KMyMoneySettings* p) override; - protected Q_SLOTS: void slotImportFile(); void slotImportFile(const QString& url); diff --git a/kmymoney/plugins/ofx/import/ofximporter.cpp b/kmymoney/plugins/ofx/import/ofximporter.cpp --- a/kmymoney/plugins/ofx/import/ofximporter.cpp +++ b/kmymoney/plugins/ofx/import/ofximporter.cpp @@ -49,7 +49,6 @@ #include "statementinterface.h" #include "importinterface.h" #include "ui_importoption.h" -#include "kmymoneyglobalsettings.h" //#define DEBUG_LIBOFX @@ -107,11 +106,6 @@ qDebug("Plugins: ofximporter unloaded"); } -void OFXImporter::injectExternalSettings(KMyMoneySettings* p) -{ - KMyMoneyGlobalSettings::injectExternalSettings(p); -} - void OFXImporter::createActions() { QAction *action = actionCollection()->addAction("file_import_ofx"); diff --git a/kmymoney/plugins/onlinetasks/sepa/CMakeLists.txt b/kmymoney/plugins/onlinetasks/sepa/CMakeLists.txt --- a/kmymoney/plugins/onlinetasks/sepa/CMakeLists.txt +++ b/kmymoney/plugins/onlinetasks/sepa/CMakeLists.txt @@ -42,7 +42,7 @@ PRIVATE KF5::I18n KF5::Service - kmm_config + kmm_settings kmm_utils_validators payeeidentifier_iban_bic_widgets KF5::ItemModels diff --git a/kmymoney/plugins/qif/export/qifexporter.h b/kmymoney/plugins/qif/export/qifexporter.h --- a/kmymoney/plugins/qif/export/qifexporter.h +++ b/kmymoney/plugins/qif/export/qifexporter.h @@ -41,8 +41,6 @@ MyMoneyQifReader *m_qifReader; - void injectExternalSettings(KMyMoneySettings* p) override; - public Q_SLOTS: /** * Called when the user wishes to export some transaction to a diff --git a/kmymoney/plugins/qif/export/qifexporter.cpp b/kmymoney/plugins/qif/export/qifexporter.cpp --- a/kmymoney/plugins/qif/export/qifexporter.cpp +++ b/kmymoney/plugins/qif/export/qifexporter.cpp @@ -33,7 +33,6 @@ #include "kexportdlg.h" #include "mymoneyqifwriter.h" -#include "kmymoneyglobalsettings.h" QIFExporter::QIFExporter(QObject *parent, const QVariantList &args) : KMyMoneyPlugin::Plugin(parent, "qifexporter"/*must be the same as X-KDE-PluginInfo-Name*/) @@ -51,11 +50,6 @@ qDebug("Plugins: qifexporter unloaded"); } -void QIFExporter::injectExternalSettings(KMyMoneySettings* p) -{ - KMyMoneyGlobalSettings::injectExternalSettings(p); -} - void QIFExporter::createActions() { diff --git a/kmymoney/plugins/qif/import/CMakeLists.txt b/kmymoney/plugins/qif/import/CMakeLists.txt --- a/kmymoney/plugins/qif/import/CMakeLists.txt +++ b/kmymoney/plugins/qif/import/CMakeLists.txt @@ -19,6 +19,7 @@ add_library(qifimporter MODULE ${qifimporter_PART_SRCS}) target_link_libraries(qifimporter + kmm_settings kmm_plugin Alkimia::alkimia ) diff --git a/kmymoney/plugins/qif/import/mymoneyqifreader.cpp b/kmymoney/plugins/qif/import/mymoneyqifreader.cpp --- a/kmymoney/plugins/qif/import/mymoneyqifreader.cpp +++ b/kmymoney/plugins/qif/import/mymoneyqifreader.cpp @@ -53,7 +53,7 @@ #include "mymoneysecurity.h" #include "mymoneysplit.h" #include "mymoneyexception.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "mymoneystatement.h" @@ -500,22 +500,22 @@ line = line.mid(5); // exportable accounts - if (line.toLower() == "ccard" || KMyMoneyGlobalSettings::qifCreditCard().toLower().contains(line.toLower())) { + if (line.toLower() == "ccard" || KMyMoneySettings::qifCreditCard().toLower().contains(line.toLower())) { d->accountType = eMyMoney::Account::Type::CreditCard; d->firstTransaction = true; d->transactionType = m_entryType = EntryTransaction; - } else if (line.toLower() == "bank" || KMyMoneyGlobalSettings::qifBank().toLower().contains(line.toLower())) { + } else if (line.toLower() == "bank" || KMyMoneySettings::qifBank().toLower().contains(line.toLower())) { d->accountType = eMyMoney::Account::Type::Checkings; d->firstTransaction = true; d->transactionType = m_entryType = EntryTransaction; - } else if (line.toLower() == "cash" || KMyMoneyGlobalSettings::qifCash().toLower().contains(line.toLower())) { + } else if (line.toLower() == "cash" || KMyMoneySettings::qifCash().toLower().contains(line.toLower())) { d->accountType = eMyMoney::Account::Type::Cash; d->firstTransaction = true; d->transactionType = m_entryType = EntryTransaction; - } else if (line.toLower() == "oth a" || KMyMoneyGlobalSettings::qifAsset().toLower().contains(line.toLower())) { + } else if (line.toLower() == "oth a" || KMyMoneySettings::qifAsset().toLower().contains(line.toLower())) { d->accountType = eMyMoney::Account::Type::Asset; d->firstTransaction = true; d->transactionType = m_entryType = EntryTransaction; @@ -529,7 +529,7 @@ d->accountType = eMyMoney::Account::Type::Investment; d->transactionType = m_entryType = EntryInvestmentTransaction; - } else if (line.toLower() == "invoice" || KMyMoneyGlobalSettings::qifInvoice().toLower().contains(line.toLower())) { + } else if (line.toLower() == "invoice" || KMyMoneySettings::qifInvoice().toLower().contains(line.toLower())) { m_entryType = EntrySkip; } else if (line.toLower() == "tax") { @@ -1045,7 +1045,7 @@ if (d->firstTransaction) { // check if this is an opening balance transaction and process it out of the statement - if (!payee.isEmpty() && ((payee.toLower() == "opening balance") || KMyMoneyGlobalSettings::qifOpeningBalance().toLower().contains(payee.toLower()))) { + if (!payee.isEmpty() && ((payee.toLower() == "opening balance") || KMyMoneySettings::qifOpeningBalance().toLower().contains(payee.toLower()))) { createOpeningBalance(d->accountType); d->firstTransaction = false; return; @@ -1541,7 +1541,7 @@ tr.m_strMemo = (QString("%1 %2").arg(extractLine('Y')).arg(d->typeToAccountName(action))).trimmed(); } else if (action == "xin" || action == "xout") { QString payee = extractLine('P'); - if (!payee.isEmpty() && ((payee.toLower() == "opening balance") || KMyMoneyGlobalSettings::qifOpeningBalance().toLower().contains(payee.toLower()))) { + if (!payee.isEmpty() && ((payee.toLower() == "opening balance") || KMyMoneySettings::qifOpeningBalance().toLower().contains(payee.toLower()))) { createOpeningBalance(eMyMoney::Account::Type::Investment); return; } diff --git a/kmymoney/plugins/qif/import/qifimporter.h b/kmymoney/plugins/qif/import/qifimporter.h --- a/kmymoney/plugins/qif/import/qifimporter.h +++ b/kmymoney/plugins/qif/import/qifimporter.h @@ -40,8 +40,6 @@ QAction *m_action; - void injectExternalSettings(KMyMoneySettings* p) override; - private: MyMoneyQifReader *m_qifReader; diff --git a/kmymoney/plugins/qif/import/qifimporter.cpp b/kmymoney/plugins/qif/import/qifimporter.cpp --- a/kmymoney/plugins/qif/import/qifimporter.cpp +++ b/kmymoney/plugins/qif/import/qifimporter.cpp @@ -33,7 +33,6 @@ #include "kimportdlg.h" #include "mymoneyqifreader.h" #include "statementinterface.h" -#include "kmymoneyglobalsettings.h" class MyMoneyStatement; @@ -53,11 +52,6 @@ qDebug("Plugins: qifimporter unloaded"); } -void QIFImporter::injectExternalSettings(KMyMoneySettings* p) -{ - KMyMoneyGlobalSettings::injectExternalSettings(p); -} - void QIFImporter::createActions() { m_action = actionCollection()->addAction("file_import_qif"); diff --git a/kmymoney/plugins/reconciliationreport/reconciliationreport.h b/kmymoney/plugins/reconciliationreport/reconciliationreport.h --- a/kmymoney/plugins/reconciliationreport/reconciliationreport.h +++ b/kmymoney/plugins/reconciliationreport/reconciliationreport.h @@ -36,8 +36,6 @@ explicit ReconciliationReport(QObject *parent, const QVariantList &args); ~ReconciliationReport() override; - void injectExternalSettings(KMyMoneySettings* p) override; - public Q_SLOTS: void plug() override; void unplug() override; diff --git a/kmymoney/plugins/reconciliationreport/reconciliationreport.cpp b/kmymoney/plugins/reconciliationreport/reconciliationreport.cpp --- a/kmymoney/plugins/reconciliationreport/reconciliationreport.cpp +++ b/kmymoney/plugins/reconciliationreport/reconciliationreport.cpp @@ -42,7 +42,6 @@ #include "mymoneyutils.h" #include "viewinterface.h" #include "mymoneyenums.h" -#include "kmymoneyglobalsettings.h" #include "kreconciliationreportdlg.h" @@ -58,11 +57,6 @@ qDebug("Plugins: reconciliation report unloaded"); } -void ReconciliationReport::injectExternalSettings(KMyMoneySettings* p) -{ - KMyMoneyGlobalSettings::injectExternalSettings(p); -} - void ReconciliationReport::plug() { connect(viewInterface(), &KMyMoneyPlugin::ViewInterface::accountReconciled, this, &ReconciliationReport::slotGenerateReconciliationReport); diff --git a/kmymoney/plugins/weboob/weboob.h b/kmymoney/plugins/weboob/weboob.h --- a/kmymoney/plugins/weboob/weboob.h +++ b/kmymoney/plugins/weboob/weboob.h @@ -54,8 +54,6 @@ bool updateAccount(const MyMoneyAccount& acc, bool moreAccounts = false) override; - void injectExternalSettings(KMyMoneySettings* p) override; - protected Q_SLOTS: void gotAccount(); diff --git a/kmymoney/plugins/weboob/weboob.cpp b/kmymoney/plugins/weboob/weboob.cpp --- a/kmymoney/plugins/weboob/weboob.cpp +++ b/kmymoney/plugins/weboob/weboob.cpp @@ -33,7 +33,6 @@ #include "mymoneystatement.h" #include "statementinterface.h" -#include "kmymoneyglobalsettings.h" struct Weboob::Private { @@ -58,11 +57,6 @@ qDebug("Plugins: weboob unloaded"); } -void Weboob::injectExternalSettings(KMyMoneySettings* p) -{ - KMyMoneyGlobalSettings::injectExternalSettings(p); -} - void Weboob::plug() { connect(&d->watcher, &QFutureWatcher::finished, this, &Weboob::gotAccount); diff --git a/kmymoney/reports/CMakeLists.txt b/kmymoney/reports/CMakeLists.txt --- a/kmymoney/reports/CMakeLists.txt +++ b/kmymoney/reports/CMakeLists.txt @@ -24,4 +24,4 @@ kmymoney_common ) -add_dependencies(reports kmm_config) +add_dependencies(reports kmm_settings) diff --git a/kmymoney/reports/kreportchartview.cpp b/kmymoney/reports/kreportchartview.cpp --- a/kmymoney/reports/kreportchartview.cpp +++ b/kmymoney/reports/kreportchartview.cpp @@ -43,7 +43,7 @@ #include #include #include -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include #include "mymoneyfile.h" #include "mymoneysecurity.h" @@ -513,14 +513,14 @@ } // the legend is needed only if at least two data sets are rendered - if (qMin(static_cast(KMyMoneyGlobalSettings::maximumLegendItems()), rowNum) > 1) { + if (qMin(static_cast(KMyMoneySettings::maximumLegendItems()), rowNum) > 1) { //the legend will be used later Legend* legend = new Legend(planeDiagram, this); legend->setTitleText(i18nc("Chart legend title", "Legend")); //set the legend basic attributes //this is done after adding the legend because the values are overridden when adding the legend to the chart - const auto maxLegendItems = KMyMoneyGlobalSettings::maximumLegendItems(); + const auto maxLegendItems = KMyMoneySettings::maximumLegendItems(); auto legendItems = legendNames.count(); auto i = 0; diff --git a/kmymoney/reports/listtable.cpp b/kmymoney/reports/listtable.cpp --- a/kmymoney/reports/listtable.cpp +++ b/kmymoney/reports/listtable.cpp @@ -42,7 +42,7 @@ #include "mymoneysplit.h" #include "mymoneytransaction.h" #include "mymoneyreport.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "mymoneyenums.h" namespace reports @@ -358,7 +358,7 @@ QString colorBegin; QString colorEnd; if ((rowRank == 4 || rowRank == 5) && value.isNegative()) { - colorBegin = QString::fromLatin1("").arg(KMyMoneyGlobalSettings::schemeColor(SchemeColor::Negative).name()); + colorBegin = QString::fromLatin1("").arg(KMyMoneySettings::schemeColor(SchemeColor::Negative).name()); colorEnd = QLatin1String(""); } @@ -382,13 +382,13 @@ QString colorBegin; QString colorEnd; if ((rowRank == 4 || rowRank == 5) && value.isNegative()) { - colorBegin = QString::fromLatin1("").arg(KMyMoneyGlobalSettings::schemeColor(SchemeColor::Negative).name()); + colorBegin = QString::fromLatin1("").arg(KMyMoneySettings::schemeColor(SchemeColor::Negative).name()); colorEnd = QLatin1String(""); } if ((rowRank == 4 || rowRank == 5) && value.isNegative()) valueStr = QString::fromLatin1("%2") - .arg(KMyMoneyGlobalSettings::schemeColor(SchemeColor::Negative).name(), valueStr); + .arg(KMyMoneySettings::schemeColor(SchemeColor::Negative).name(), valueStr); result.append(QString::fromLatin1("%2%4%1%%5%3").arg(valueStr, tlinkBegin, tlinkEnd, colorBegin, colorEnd)); } break; @@ -472,7 +472,7 @@ // that all stock accounts for the selected investment // account are also selected. // In case we get called for a non investment only report we quit - if (KMyMoneyGlobalSettings::expertMode() || !m_config.isInvestmentsOnly()) { + if (KMyMoneySettings::expertMode() || !m_config.isInvestmentsOnly()) { return; } diff --git a/kmymoney/reports/pivottable.cpp b/kmymoney/reports/pivottable.cpp --- a/kmymoney/reports/pivottable.cpp +++ b/kmymoney/reports/pivottable.cpp @@ -36,7 +36,7 @@ #include "pivotgrid.h" #include "reportdebug.h" #include "kreportchartview.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "kmymoneyutils.h" #include "mymoneyforecast.h" #include "mymoneyprice.h" @@ -1955,7 +1955,7 @@ const auto value = amount.formatMoney(currencySymbol, prec); if (amount.isNegative()) return QString::fromLatin1("%2") - .arg(KMyMoneyGlobalSettings::schemeColor(SchemeColor::Negative).name(), value); + .arg(KMyMoneySettings::schemeColor(SchemeColor::Negative).name(), value); else return value; } @@ -1999,7 +1999,7 @@ void PivotTable::calculateForecast() { //setup forecast - MyMoneyForecast forecast = KMyMoneyGlobalSettings::forecast(); + MyMoneyForecast forecast = KMyMoneyUtils::forecast(); //since this is a net worth forecast we want to include all account even those that are not in use forecast.setIncludeUnusedAccounts(true); @@ -2299,7 +2299,7 @@ // account are also selected QStringList accountList; if (m_config.accounts(accountList)) { - if (!KMyMoneyGlobalSettings::expertMode()) { + if (!KMyMoneySettings::expertMode()) { foreach (const auto sAccount, accountList) { auto acc = MyMoneyFile::instance()->account(sAccount); if (acc.accountType() == eMyMoney::Account::Type::Investment) { diff --git a/kmymoney/reports/reporttable.cpp b/kmymoney/reports/reporttable.cpp --- a/kmymoney/reports/reporttable.cpp +++ b/kmymoney/reports/reporttable.cpp @@ -30,7 +30,7 @@ // ---------------------------------------------------------------------------- // Project Includes -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "kmymoneyutils.h" #include "mymoneyfile.h" #include "mymoneysecurity.h" @@ -57,7 +57,7 @@ if (cssfilename.isEmpty() || !QFile::exists(cssfilename)) { // if no report specific stylesheet was found, try to use the configured one - cssfilename = KMyMoneyGlobalSettings::cssFileDefault(); + cssfilename = KMyMoneySettings::cssFileDefault(); } if (cssfilename.isEmpty() || !QFile::exists(cssfilename)) { diff --git a/kmymoney/settings/CMakeLists.txt b/kmymoney/settings/CMakeLists.txt new file mode 100644 --- /dev/null +++ b/kmymoney/settings/CMakeLists.txt @@ -0,0 +1,38 @@ + +kconfig_add_kcfg_files( kmm_settings_SRCS kmymoneysettings.kcfgc ) + +add_library(kmm_settings SHARED ${kmm_settings_SRCS}) + +target_compile_features(kmm_settings PUBLIC cxx_nullptr PRIVATE cxx_decltype cxx_lambdas cxx_constexpr cxx_range_for) + +set_target_properties(kmm_settings PROPERTIES + VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR} ) + +generate_export_header(kmm_settings BASE_NAME kmm_settings) + +target_link_libraries(kmm_settings + PUBLIC + KF5::WidgetsAddons + KF5::ConfigWidgets + Qt5::Sql + Alkimia::alkimia) + +set(kmm_settings_HEADERS + ${CMAKE_CURRENT_BINARY_DIR}/kmm_settings_export.h + ${CMAKE_CURRENT_BINARY_DIR}/kmymoneysettings.h + kmymoneysettings_addons.h) + + +install(TARGETS kmm_settings + ${KDE_INSTALL_TARGETS_DEFAULT_ARGS} ) + +install(FILES kmymoney.kcfg + DESTINATION ${KCFG_INSTALL_DIR} + ) +install(FILES kmymoney.upd + DESTINATION ${KCONF_UPDATE_INSTALL_DIR} + ) + +install(FILES ${kmm_settings_HEADERS} + DESTINATION ${INCLUDE_INSTALL_DIR}/kmymoney COMPONENT Devel) + diff --git a/kmymoney/kmymoney.kcfg b/kmymoney/settings/kmymoney.kcfg rename from kmymoney/kmymoney.kcfg rename to kmymoney/settings/kmymoney.kcfg diff --git a/kmymoney/kmymoney.upd b/kmymoney/settings/kmymoney.upd rename from kmymoney/kmymoney.upd rename to kmymoney/settings/kmymoney.upd diff --git a/kmymoney/settings/kmymoneysettings.kcfgc b/kmymoney/settings/kmymoneysettings.kcfgc new file mode 100644 --- /dev/null +++ b/kmymoney/settings/kmymoneysettings.kcfgc @@ -0,0 +1,9 @@ +File=kmymoney.kcfg +ClassName=KMyMoneySettings +Singleton=true +Mutators=true +MemberVariables=dpointer +IncludeFiles=\"kmm_settings_export.h\",\"kmymoneysettings_addon.h\" +SourceIncludeFiles=\"kmymoneysettings_addons.cpp\" +Visibility=KMM_SETTINGS_EXPORT +CustomAdditions=true diff --git a/kmymoney/kmymoneyglobalsettings.h b/kmymoney/settings/kmymoneysettings_addon.h rename from kmymoney/kmymoneyglobalsettings.h rename to kmymoney/settings/kmymoneysettings_addon.h --- a/kmymoney/kmymoneyglobalsettings.h +++ b/kmymoney/settings/kmymoneysettings_addon.h @@ -1,8 +1,8 @@ /*************************************************************************** - kmymoneyglobalsettings.h + kmymoneysettings_addon.h ------------------- - copyright : (C) 2006 by Thomas Baumgart - email : ipwizard@users.sourceforge.net + copyright : (C) 2018 by Thomas Baumgart + email : tbaumgart@kde.org ***************************************************************************/ /*************************************************************************** @@ -14,8 +14,8 @@ * * ***************************************************************************/ -#ifndef KMYMONEYGLOBALSETTINGS_H -#define KMYMONEYGLOBALSETTINGS_H +#ifndef KMYMONEYSETTINGS_ADDON_H +#define KMYMONEYSETTINGS_ADDON_H // ---------------------------------------------------------------------------- // QT Includes @@ -26,8 +26,6 @@ // ---------------------------------------------------------------------------- // Project Includes -#include "kmymoneysettings.h" - class MyMoneyForecast; enum class SchemeColor { @@ -48,35 +46,4 @@ MissingConversionRate }; -class KMyMoneyGlobalSettings : public KMyMoneySettings -{ -public: - static void injectExternalSettings(KMyMoneySettings* p); - - static QColor schemeColor(const SchemeColor color); - - static QFont listCellFont(); - static QFont listHeaderFont(); - static QStringList itemList(); - - /** - * returns the number of the first month in the fiscal year - */ - static int firstFiscalMonth(); - - /** - * returns the number of the first day of the fiscal year - */ - static int firstFiscalDay(); - - /** - * returns the date of the first day in the current fiscal year - */ - static QDate firstFiscalDate(); - - /** - * Construct a MyMoneyForecast object setup with all KMyMoneySettings - */ - static MyMoneyForecast forecast(); -}; #endif diff --git a/kmymoney/kmymoneyglobalsettings.h b/kmymoney/settings/kmymoneysettings_addons.h rename from kmymoney/kmymoneyglobalsettings.h rename to kmymoney/settings/kmymoneysettings_addons.h --- a/kmymoney/kmymoneyglobalsettings.h +++ b/kmymoney/settings/kmymoneysettings_addons.h @@ -1,8 +1,8 @@ /*************************************************************************** - kmymoneyglobalsettings.h + kmymoneysettings_addon.h ------------------- - copyright : (C) 2006 by Thomas Baumgart - email : ipwizard@users.sourceforge.net + copyright : (C) 2018 by Thomas Baumgart + email : tbaumgart@kde.org ***************************************************************************/ /*************************************************************************** @@ -14,8 +14,6 @@ * * ***************************************************************************/ -#ifndef KMYMONEYGLOBALSETTINGS_H -#define KMYMONEYGLOBALSETTINGS_H // ---------------------------------------------------------------------------- // QT Includes @@ -26,38 +24,14 @@ // ---------------------------------------------------------------------------- // Project Includes -#include "kmymoneysettings.h" -class MyMoneyForecast; - -enum class SchemeColor { - ListBackground1, - ListBackground2, - ListGrid, - ListHighlightText, - ListHighlight, - WindowText, - WindowBackground, - Positive, - Negative, - TransactionImported, - TransactionMatched, - TransactionErroneous, - FieldRequired, - GroupMarker, - MissingConversionRate -}; - -class KMyMoneyGlobalSettings : public KMyMoneySettings -{ public: - static void injectExternalSettings(KMyMoneySettings* p); static QColor schemeColor(const SchemeColor color); - static QFont listCellFont(); - static QFont listHeaderFont(); - static QStringList itemList(); + static QFont listCellFontEx(); + static QFont listHeaderFontEx(); + static QStringList listOfItems(); /** * returns the number of the first month in the fiscal year @@ -78,5 +52,5 @@ * Construct a MyMoneyForecast object setup with all KMyMoneySettings */ static MyMoneyForecast forecast(); -}; -#endif + + diff --git a/kmymoney/kmymoneyglobalsettings.cpp b/kmymoney/settings/kmymoneysettings_addons.cpp rename from kmymoney/kmymoneyglobalsettings.cpp rename to kmymoney/settings/kmymoneysettings_addons.cpp --- a/kmymoney/kmymoneyglobalsettings.cpp +++ b/kmymoney/settings/kmymoneysettings_addons.cpp @@ -1,8 +1,8 @@ /*************************************************************************** - kmymoneyglobalsettings.cpp + kmymoneysettings_addons.cpp ------------------- - copyright : (C) 2006 by Thomas Baumgart - email : ipwizard@users.sourceforge.net + copyright : (C) 2018 by Thomas Baumgart + email : tbaumgart@kde.org ***************************************************************************/ /*************************************************************************** @@ -14,8 +14,6 @@ * * ***************************************************************************/ -#include "kmymoneyglobalsettings.h" - // ---------------------------------------------------------------------------- // QT Includes @@ -30,37 +28,27 @@ // ---------------------------------------------------------------------------- // Project Includes -#include "mymoneyforecast.h" - -// include kmymoneysettings.cpp here to gain access to s_globalKMyMoneySettings -#include "kmymoneysettings.cpp" - -void KMyMoneyGlobalSettings::injectExternalSettings(KMyMoneySettings* p) -{ - s_globalKMyMoneySettings()->q = p; -} - -QFont KMyMoneyGlobalSettings::listCellFont() +QFont KMyMoneySettings::listCellFontEx() { if (useSystemFont()) { return QFontDatabase::systemFont(QFontDatabase::GeneralFont); } else { - return KMyMoneySettings::listCellFont(); + return listCellFont(); } } -QFont KMyMoneyGlobalSettings::listHeaderFont() +QFont KMyMoneySettings::listHeaderFontEx() { if (useSystemFont()) { QFont font = QFontDatabase::systemFont(QFontDatabase::GeneralFont); font.setBold(true); return font; } else { - return KMyMoneySettings::listHeaderFont(); + return listHeaderFont(); } } -QColor KMyMoneyGlobalSettings::schemeColor(const SchemeColor color) +QColor KMyMoneySettings::schemeColor(const SchemeColor color) { switch(color) { case SchemeColor::ListBackground1: @@ -83,46 +71,46 @@ return KColorScheme (QPalette::Active, KColorScheme::View).foreground(KColorScheme::NegativeText).color(); case SchemeColor::TransactionImported: if (useCustomColors()) - return KMyMoneySettings::transactionImportedColor(); + return transactionImportedColor(); else return KColorScheme (QPalette::Active, KColorScheme::Complementary).background(KColorScheme::NeutralBackground).color(); case SchemeColor::TransactionMatched: if (useCustomColors()) - return KMyMoneySettings::transactionMatchedColor(); + return transactionMatchedColor(); else return KColorScheme (QPalette::Active, KColorScheme::Complementary).background(KColorScheme::PositiveBackground).color(); case SchemeColor::TransactionErroneous: if (useCustomColors()) - return KMyMoneySettings::transactionErroneousColor(); + return transactionErroneousColor(); else return KColorScheme (QPalette::Active, KColorScheme::View).foreground(KColorScheme::NegativeText).color(); case SchemeColor::FieldRequired: if (useCustomColors()) - return KMyMoneySettings::fieldRequiredColor(); + return fieldRequiredColor(); else return KColorScheme (QPalette::Active, KColorScheme::View).background(KColorScheme::NeutralBackground).color(); case SchemeColor::GroupMarker: if (useCustomColors()) - return KMyMoneySettings::groupMarkerColor(); + return groupMarkerColor(); else return KColorScheme (QPalette::Active, KColorScheme::Selection).background(KColorScheme::LinkBackground).color(); case SchemeColor::MissingConversionRate: if (useCustomColors()) - return KMyMoneySettings::missingConversionRateColor(); + return missingConversionRateColor(); else return KColorScheme (QPalette::Active, KColorScheme::Complementary).foreground(KColorScheme::LinkText).color(); default: return QColor(); } } -QStringList KMyMoneyGlobalSettings::itemList() +QStringList KMyMoneySettings::listOfItems() { bool prevValue = self()->useDefaults(true); - QStringList all = KMyMoneySettings::itemList().split(',', QString::SkipEmptyParts); + QStringList all = itemList().split(',', QString::SkipEmptyParts); self()->useDefaults(prevValue); - QStringList list = KMyMoneySettings::itemList().split(',', QString::SkipEmptyParts); + QStringList list = itemList().split(',', QString::SkipEmptyParts); // now add all from 'all' that are missing in 'list' QRegExp exp("-?(\\d+)"); @@ -136,39 +124,21 @@ return list; } -int KMyMoneyGlobalSettings::firstFiscalMonth() +int KMyMoneySettings::firstFiscalMonth() { - return KMyMoneySettings::fiscalYearBegin() + 1; + return fiscalYearBegin() + 1; } -int KMyMoneyGlobalSettings::firstFiscalDay() +int KMyMoneySettings::firstFiscalDay() { - return KMyMoneySettings::fiscalYearBeginDay(); + return fiscalYearBeginDay(); } -QDate KMyMoneyGlobalSettings::firstFiscalDate() +QDate KMyMoneySettings::firstFiscalDate() { QDate date = QDate(QDate::currentDate().year(), firstFiscalMonth(), firstFiscalDay()); if (date > QDate::currentDate()) date = date.addYears(-1); return date; } -MyMoneyForecast KMyMoneyGlobalSettings::forecast() -{ - MyMoneyForecast forecast; - - // override object defaults with those of the application - forecast.setForecastCycles(KMyMoneyGlobalSettings::forecastCycles()); - forecast.setAccountsCycle(KMyMoneyGlobalSettings::forecastAccountCycle()); - forecast.setHistoryStartDate(QDate::currentDate().addDays(-forecast.forecastCycles()*forecast.accountsCycle())); - forecast.setHistoryEndDate(QDate::currentDate().addDays(-1)); - forecast.setForecastDays(KMyMoneyGlobalSettings::forecastDays()); - forecast.setBeginForecastDay(KMyMoneyGlobalSettings::beginForecastDay()); - forecast.setForecastMethod(KMyMoneyGlobalSettings::forecastMethod()); - forecast.setHistoryMethod(KMyMoneyGlobalSettings::historyMethod()); - forecast.setIncludeFutureTransactions(KMyMoneyGlobalSettings::includeFutureTransactions()); - forecast.setIncludeScheduledTransactions(KMyMoneyGlobalSettings::includeScheduledTransactions()); - - return forecast; -} diff --git a/kmymoney/views/kaccountsview.cpp b/kmymoney/views/kaccountsview.cpp --- a/kmymoney/views/kaccountsview.cpp +++ b/kmymoney/views/kaccountsview.cpp @@ -37,7 +37,7 @@ #include "knewaccountwizard.h" #include "kbalancechartdlg.h" #include "kmymoneyutils.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "storageenums.h" #include "menuenums.h" @@ -74,9 +74,9 @@ d->m_needsRefresh = false; // TODO: check why the invalidate is needed here d->m_proxyModel->invalidate(); - d->m_proxyModel->setHideClosedAccounts(KMyMoneyGlobalSettings::hideClosedAccounts()); - d->m_proxyModel->setHideEquityAccounts(!KMyMoneyGlobalSettings::expertMode()); - if (KMyMoneyGlobalSettings::showCategoriesInAccountsView()) { + d->m_proxyModel->setHideClosedAccounts(KMyMoneySettings::hideClosedAccounts()); + d->m_proxyModel->setHideEquityAccounts(!KMyMoneySettings::expertMode()); + if (KMyMoneySettings::showCategoriesInAccountsView()) { d->m_proxyModel->addAccountGroup(QVector {eMyMoney::Account::Type::Income, eMyMoney::Account::Type::Expense}); } else { d->m_proxyModel->removeAccountType(eMyMoney::Account::Type::Income); @@ -86,7 +86,7 @@ // reinitialize the default state of the hidden categories label d->m_haveUnusedCategories = false; d->ui->m_hiddenCategories->hide(); // hides label - d->m_proxyModel->setHideUnusedIncomeExpenseAccounts(KMyMoneyGlobalSettings::hideUnusedCategory()); + d->m_proxyModel->setHideUnusedIncomeExpenseAccounts(KMyMoneySettings::hideUnusedCategory()); } void KAccountsView::showEvent(QShowEvent * event) @@ -230,7 +230,7 @@ void KAccountsView::slotNewAccount() { MyMoneyAccount account; - account.setOpeningDate(KMyMoneyGlobalSettings::firstFiscalDate()); + account.setOpeningDate(KMyMoneySettings::firstFiscalDate()); NewAccountWizard::Wizard::newAccount(account); } @@ -300,7 +300,7 @@ MyMoneyFile::instance()->modifyAccount(d->m_currentAccount); emit objectSelected(d->m_currentAccount); ft.commit(); - if (KMyMoneyGlobalSettings::hideClosedAccounts()) + if (KMyMoneySettings::hideClosedAccounts()) KMessageBox::information(this, i18n("You have closed this account. It remains in the system because you have transactions which still refer to it, but it is not shown in the views. You can make it visible again by going to the View menu and selecting Show all accounts or by deselecting the Do not show closed accounts setting."), i18n("Information"), "CloseAccountInfo"); } catch (const MyMoneyException &) { } diff --git a/kmymoney/views/kbudgetview.cpp b/kmymoney/views/kbudgetview.cpp --- a/kmymoney/views/kbudgetview.cpp +++ b/kmymoney/views/kbudgetview.cpp @@ -93,7 +93,7 @@ Q_D(KBudgetView); d->askSave(); auto date = QDate::currentDate(); - date.setDate(date.year(), KMyMoneyGlobalSettings::firstFiscalMonth(), KMyMoneyGlobalSettings::firstFiscalDay()); + date.setDate(date.year(), KMyMoneySettings::firstFiscalMonth(), KMyMoneySettings::firstFiscalDay()); auto newname = i18n("Budget %1", date.year()); MyMoneyBudget budget; @@ -232,7 +232,7 @@ historyStart = budgetStart.addYears(-1); historyEnd = budgetEnd.addYears(-1); - MyMoneyForecast forecast = KMyMoneyGlobalSettings::forecast(); + MyMoneyForecast forecast = KMyMoneyUtils::forecast(); forecast.createBudget(budget, historyStart, historyEnd, budgetStart, budgetEnd, true); MyMoneyFile::instance()->modifyBudget(budget); diff --git a/kmymoney/views/kbudgetview_p.h b/kmymoney/views/kbudgetview_p.h --- a/kmymoney/views/kbudgetview_p.h +++ b/kmymoney/views/kbudgetview_p.h @@ -52,7 +52,7 @@ #include "kmymoneyutils.h" #include "budgetviewproxymodel.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "icons.h" #include "modelenums.h" #include "menuenums.h" diff --git a/kmymoney/views/kcategoriesview.cpp b/kmymoney/views/kcategoriesview.cpp --- a/kmymoney/views/kcategoriesview.cpp +++ b/kmymoney/views/kcategoriesview.cpp @@ -40,7 +40,7 @@ // Project Includes #include "mymoneyexception.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "knewaccountdlg.h" #include "kcategoryreassigndlg.h" #include "mymoneyschedule.h" @@ -81,12 +81,12 @@ d->m_needsRefresh = false; d->m_proxyModel->invalidate(); - d->m_proxyModel->setHideClosedAccounts(KMyMoneyGlobalSettings::hideClosedAccounts()); + d->m_proxyModel->setHideClosedAccounts(KMyMoneySettings::hideClosedAccounts()); // reinitialize the default state of the hidden categories label d->m_haveUnusedCategories = false; d->ui->m_hiddenCategories->hide(); - d->m_proxyModel->setHideUnusedIncomeExpenseAccounts(KMyMoneyGlobalSettings::hideUnusedCategory()); + d->m_proxyModel->setHideUnusedIncomeExpenseAccounts(KMyMoneySettings::hideUnusedCategory()); } void KCategoriesView::showEvent(QShowEvent * event) diff --git a/kmymoney/views/kforecastview_p.h b/kmymoney/views/kforecastview_p.h --- a/kmymoney/views/kforecastview_p.h +++ b/kmymoney/views/kforecastview_p.h @@ -51,14 +51,15 @@ #include "mymoneyaccount.h" #include "mymoneyexception.h" #include "mymoneysecurity.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "mymoneybudget.h" #include "pivottable.h" #include "fixedcolumntreeview.h" #include "kreportchartview.h" #include "reportaccount.h" #include "icons.h" #include "mymoneyenums.h" +#include "kmymoneyutils.h" using namespace reports; using namespace Icons; @@ -179,7 +180,7 @@ void loadListView() { - MyMoneyForecast forecast = KMyMoneyGlobalSettings::forecast(); + MyMoneyForecast forecast = KMyMoneyUtils::forecast(); const auto file = MyMoneyFile::instance(); //get the settings from current page @@ -287,7 +288,7 @@ void loadSummaryView() { - MyMoneyForecast forecast = KMyMoneyGlobalSettings::forecast(); + MyMoneyForecast forecast = KMyMoneyUtils::forecast(); QList accList; int dropMinimum; int dropZero; @@ -391,12 +392,12 @@ case -1: break; case 0: - msg = QString("").arg(KMyMoneyGlobalSettings::schemeColor(SchemeColor::Negative).name()); + msg = QString("").arg(KMyMoneySettings::schemeColor(SchemeColor::Negative).name()); msg += i18n("The balance of %1 is below the minimum balance %2 today.", acc.name(), MyMoneyUtils::formatMoney(minBalance, acc, currency)); msg += QString(""); break; default: - msg = QString("").arg(KMyMoneyGlobalSettings::schemeColor(SchemeColor::Negative).name()); + msg = QString("").arg(KMyMoneySettings::schemeColor(SchemeColor::Negative).name()); msg += i18np("The balance of %2 will drop below the minimum balance %3 in %1 day.", "The balance of %2 will drop below the minimum balance %3 in %1 days.", dropMinimum - 1, acc.name(), MyMoneyUtils::formatMoney(minBalance, acc, currency)); @@ -415,7 +416,7 @@ break; case 0: if (acc.accountGroup() == eMyMoney::Account::Type::Asset) { - msg = QString("").arg(KMyMoneyGlobalSettings::schemeColor(SchemeColor::Negative).name()); + msg = QString("").arg(KMyMoneySettings::schemeColor(SchemeColor::Negative).name()); msg += i18n("The balance of %1 is below %2 today.", acc.name(), MyMoneyUtils::formatMoney(MyMoneyMoney(), acc, currency)); msg += QString(""); break; @@ -427,7 +428,7 @@ break; default: if (acc.accountGroup() == eMyMoney::Account::Type::Asset) { - msg = QString("").arg(KMyMoneyGlobalSettings::schemeColor(SchemeColor::Negative).name()); + msg = QString("").arg(KMyMoneySettings::schemeColor(SchemeColor::Negative).name()); msg += i18np("The balance of %2 will drop below %3 in %1 day.", "The balance of %2 will drop below %3 in %1 days.", dropZero, acc.name(), MyMoneyUtils::formatMoney(MyMoneyMoney(), acc, currency)); @@ -449,7 +450,7 @@ msg.clear(); MyMoneyMoney accCycleVariation = forecast.accountCycleVariation(acc); if (accCycleVariation < MyMoneyMoney()) { - msg = QString("").arg(KMyMoneyGlobalSettings::schemeColor(SchemeColor::Negative).name()); + msg = QString("").arg(KMyMoneySettings::schemeColor(SchemeColor::Negative).name()); msg += i18n("The account %1 is decreasing %2 per cycle.", acc.name(), MyMoneyUtils::formatMoney(accCycleVariation, acc, currency)); msg += QString(""); } @@ -466,7 +467,7 @@ const auto file = MyMoneyFile::instance(); QList accList; MyMoneySecurity baseCurrency = file->baseCurrency(); - MyMoneyForecast forecast = KMyMoneyGlobalSettings::forecast(); + MyMoneyForecast forecast = KMyMoneyUtils::forecast(); int daysToBeginDay; //get the settings from current page @@ -551,15 +552,15 @@ advancedItem->setText(it_c, amount); advancedItem->setTextAlignment(it_c, Qt::AlignRight | Qt::AlignVCenter); if (amountMM.isNegative()) { - advancedItem->setForeground(it_c, KMyMoneyGlobalSettings::schemeColor(SchemeColor::Negative)); + advancedItem->setForeground(it_c, KMyMoneySettings::schemeColor(SchemeColor::Negative)); } it_c++; QString dateString = QLocale().toString(minDate, QLocale::ShortFormat); advancedItem->setText(it_c, dateString); advancedItem->setTextAlignment(it_c, Qt::AlignRight | Qt::AlignVCenter); if (amountMM.isNegative()) { - advancedItem->setForeground(it_c, KMyMoneyGlobalSettings::schemeColor(SchemeColor::Negative)); + advancedItem->setForeground(it_c, KMyMoneySettings::schemeColor(SchemeColor::Negative)); } it_c++; } @@ -575,15 +576,15 @@ advancedItem->setText(it_c, amount); advancedItem->setTextAlignment(it_c, Qt::AlignRight | Qt::AlignVCenter); if (amountMM.isNegative()) { - advancedItem->setForeground(it_c, KMyMoneyGlobalSettings::schemeColor(SchemeColor::Negative)); + advancedItem->setForeground(it_c, KMyMoneySettings::schemeColor(SchemeColor::Negative)); } it_c++; QString dateString = QLocale().toString(maxDate, QLocale::ShortFormat); advancedItem->setText(it_c, dateString); advancedItem->setTextAlignment(it_c, Qt::AlignRight | Qt::AlignVCenter); if (amountMM.isNegative()) { - advancedItem->setForeground(it_c, KMyMoneyGlobalSettings::schemeColor(SchemeColor::Negative)); + advancedItem->setForeground(it_c, KMyMoneySettings::schemeColor(SchemeColor::Negative)); } it_c++; } @@ -593,7 +594,7 @@ advancedItem->setText(it_c, amount); advancedItem->setTextAlignment(it_c, Qt::AlignRight | Qt::AlignVCenter); if (amountMM.isNegative()) { - advancedItem->setForeground(it_c, KMyMoneyGlobalSettings::schemeColor(SchemeColor::Negative)); + advancedItem->setForeground(it_c, KMyMoneySettings::schemeColor(SchemeColor::Negative)); } it_c++; } @@ -607,7 +608,7 @@ void loadBudgetView() { const auto file = MyMoneyFile::instance(); - MyMoneyForecast forecast = KMyMoneyGlobalSettings::forecast(); + MyMoneyForecast forecast = KMyMoneyUtils::forecast(); //get the settings from current page and calculate this year based on last year QDate historyEndDate = QDate(QDate::currentDate().year() - 1, 12, 31); @@ -692,15 +693,15 @@ void loadForecastSettings() { //fill the settings controls - ui->m_forecastDays->setValue(KMyMoneyGlobalSettings::forecastDays()); - ui->m_accountsCycle->setValue(KMyMoneyGlobalSettings::forecastAccountCycle()); - ui->m_beginDay->setValue(KMyMoneyGlobalSettings::beginForecastDay()); - ui->m_forecastCycles->setValue(KMyMoneyGlobalSettings::forecastCycles()); + ui->m_forecastDays->setValue(KMyMoneySettings::forecastDays()); + ui->m_accountsCycle->setValue(KMyMoneySettings::forecastAccountCycle()); + ui->m_beginDay->setValue(KMyMoneySettings::beginForecastDay()); + ui->m_forecastCycles->setValue(KMyMoneySettings::forecastCycles()); ui->m_historyMethod->setId(ui->radioButton11, 0); // simple moving avg ui->m_historyMethod->setId(ui->radioButton12, 1); // weighted moving avg ui->m_historyMethod->setId(ui->radioButton13, 2); // linear regression - ui->m_historyMethod->button(KMyMoneyGlobalSettings::historyMethod())->setChecked(true); - switch (KMyMoneyGlobalSettings::forecastMethod()) { + ui->m_historyMethod->button(KMyMoneySettings::historyMethod())->setChecked(true); + switch (KMyMoneySettings::forecastMethod()) { case 0: ui->m_forecastMethod->setText(i18nc("Scheduled method", "Scheduled")); ui->m_forecastCycles->setDisabled(true); @@ -805,7 +806,7 @@ { if (isNegative) { for (int i = 0; i < item->columnCount(); ++i) { - item->setForeground(i, KMyMoneyGlobalSettings::schemeColor(SchemeColor::Negative)); + item->setForeground(i, KMyMoneySettings::schemeColor(SchemeColor::Negative)); } } } @@ -816,7 +817,7 @@ item->setTextAlignment(column, Qt::AlignRight | Qt::AlignVCenter); item->setFont(column, item->font(0)); if (amount.isNegative()) { - item->setForeground(column, KMyMoneyGlobalSettings::schemeColor(SchemeColor::Negative)); + item->setForeground(column, KMyMoneySettings::schemeColor(SchemeColor::Negative)); } } diff --git a/kmymoney/views/kgloballedgerview.cpp b/kmymoney/views/kgloballedgerview.cpp --- a/kmymoney/views/kgloballedgerview.cpp +++ b/kmymoney/views/kgloballedgerview.cpp @@ -50,7 +50,7 @@ #include "register.h" #include "transactioneditor.h" #include "selectedtransactions.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "registersearchline.h" #include "kfindtransactiondlg.h" #include "kmymoneysettings.h" @@ -412,7 +412,7 @@ showNegative = !showNegative; if (showNegative) { QPalette palette = d->m_rightSummaryLabel->palette(); - palette.setColor(d->m_rightSummaryLabel->foregroundRole(), KMyMoneyGlobalSettings::schemeColor(SchemeColor::Negative)); + palette.setColor(d->m_rightSummaryLabel->foregroundRole(), KMyMoneySettings::schemeColor(SchemeColor::Negative)); d->m_rightSummaryLabel->setPalette(palette); } } else { @@ -508,7 +508,7 @@ if (account.isAssetLiability()) { if (d->m_endingBalanceDlg->exec() == QDialog::Accepted) { - if (KMyMoneyGlobalSettings::autoReconciliation()) { + if (KMyMoneySettings::autoReconciliation()) { MyMoneyMoney startBalance = d->m_endingBalanceDlg->previousBalance(); MyMoneyMoney endBalance = d->m_endingBalanceDlg->endingBalance(); QDate endDate = d->m_endingBalanceDlg->statementDate(); @@ -801,7 +801,7 @@ if (editor) { if (parent == d->m_register) { // make sure, the height of the table is correct - d->m_register->updateRegister(KMyMoneyGlobalSettings::ledgerLens() | !KMyMoneyGlobalSettings::transactionForm()); + d->m_register->updateRegister(KMyMoneySettings::ledgerLens() | !KMyMoneySettings::transactionForm()); } d->m_inEditMode = true; @@ -974,10 +974,10 @@ QString sortOrder, def; if (d->isReconciliationAccount()) { key = "kmm-sort-reconcile"; - def = KMyMoneyGlobalSettings::sortReconcileView(); + def = KMyMoneySettings::sortReconcileView(); } else { key = "kmm-sort-std"; - def = KMyMoneyGlobalSettings::sortNormalView(); + def = KMyMoneySettings::sortNormalView(); } // check if we have an account override of the sort order @@ -1279,7 +1279,7 @@ auto dontShowAgain = "CancelOrEditTransaction"; // qDebug("KMyMoneyApp::slotCancelOrEndEdit"); if (d->m_transactionEditor) { - if (KMyMoneyGlobalSettings::focusChangeIsEnter() && pActions[Action::EnterTransaction]->isEnabled()) { + if (KMyMoneySettings::focusChangeIsEnter() && pActions[Action::EnterTransaction]->isEnabled()) { slotEnterTransaction(); if (d->m_transactionEditor) { // if at this stage the editor is still there that means that entering the transaction was cancelled diff --git a/kmymoney/views/kgloballedgerview_p.h b/kmymoney/views/kgloballedgerview_p.h --- a/kmymoney/views/kgloballedgerview_p.h +++ b/kmymoney/views/kgloballedgerview_p.h @@ -61,7 +61,7 @@ #include "register.h" #include "transactioneditor.h" #include "selectedtransactions.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "registersearchline.h" #include "scheduledtransaction.h" #include "accountsmodel.h" @@ -395,8 +395,8 @@ // TODO: check why the invalidate is needed here m_filterProxyModel->invalidate(); m_filterProxyModel->sort((int)eAccountsModel::Column::Account); - m_filterProxyModel->setHideClosedAccounts(KMyMoneyGlobalSettings::hideClosedAccounts() && !KMyMoneyGlobalSettings::showAllAccounts()); - m_filterProxyModel->setHideEquityAccounts(!KMyMoneyGlobalSettings::expertMode()); + m_filterProxyModel->setHideClosedAccounts(KMyMoneySettings::hideClosedAccounts() && !KMyMoneySettings::showAllAccounts()); + m_filterProxyModel->setHideEquityAccounts(!KMyMoneySettings::expertMode()); m_accountComboBox->expandAll(); if (m_currentAccount.id().isEmpty()) { @@ -456,15 +456,15 @@ m_register->clear(); // setup header font - QFont font = KMyMoneyGlobalSettings::listHeaderFont(); + QFont font = KMyMoneySettings::listHeaderFontEx(); QFontMetrics fm(font); int height = fm.lineSpacing() + 6; m_register->horizontalHeader()->setMinimumHeight(height); m_register->horizontalHeader()->setMaximumHeight(height); m_register->horizontalHeader()->setFont(font); // setup cell font - font = KMyMoneyGlobalSettings::listCellFont(); + font = KMyMoneySettings::listCellFontEx(); m_register->setFont(font); // clear the form @@ -486,7 +486,7 @@ Q_Q(KGlobalLedgerView); // setup form visibility - m_formFrame->setVisible(KMyMoneyGlobalSettings::transactionForm()); + m_formFrame->setVisible(KMyMoneySettings::transactionForm()); // no account selected // emit q->objectSelected(MyMoneyAccount()); @@ -557,14 +557,14 @@ if (isReconciliationAccount()) { key = "kmm-sort-reconcile"; - sortOrder = KMyMoneyGlobalSettings::sortReconcileView(); + sortOrder = KMyMoneySettings::sortReconcileView(); filter.addState((int)eMyMoney::TransactionFilter::State::NotReconciled); filter.addState((int)eMyMoney::TransactionFilter::State::Cleared); } else { - filter.setDateFilter(KMyMoneyGlobalSettings::startDate().date(), QDate()); + filter.setDateFilter(KMyMoneySettings::startDate().date(), QDate()); key = "kmm-sort-std"; - sortOrder = KMyMoneyGlobalSettings::sortNormalView(); - if (KMyMoneyGlobalSettings::hideReconciledTransactions() + sortOrder = KMyMoneySettings::sortNormalView(); + if (KMyMoneySettings::hideReconciledTransactions() && !m_currentAccount.isIncomeExpense()) { filter.addState((int)eMyMoney::TransactionFilter::State::NotReconciled); filter.addState((int)eMyMoney::TransactionFilter::State::Cleared); @@ -602,7 +602,7 @@ } // create dummy entries for the scheduled transactions if sorted by postdate - int period = KMyMoneyGlobalSettings::schedulePreview(); + int period = KMyMoneySettings::schedulePreview(); if (m_register->primarySortKey() == eWidgets::SortField::PostDate) { // show scheduled transactions which have a scheduled postdate // within the next 'period' days. In reconciliation mode, the @@ -819,7 +819,7 @@ split.setReconcileFlag(eMyMoney::Split::State::NotReconciled); // make sure to use the value specified in the option during reconciliation if (isReconciliationAccount()) - split.setReconcileFlag(static_cast(KMyMoneyGlobalSettings::defaultReconciliationState())); + split.setReconcileFlag(static_cast(KMyMoneySettings::defaultReconciliationState())); KMyMoneyRegister::Register::transactionFactory(m_register, MyMoneyTransaction(), split, 0); m_register->updateRegister(true); @@ -848,7 +848,7 @@ clear(); } - m_showDetails = KMyMoneyGlobalSettings::showRegisterDetailed(); + m_showDetails = KMyMoneySettings::showRegisterDetailed(); // and tell everyone what's selected emit q->objectSelected(m_currentAccount); diff --git a/kmymoney/views/khomeview_p.h b/kmymoney/views/khomeview_p.h --- a/kmymoney/views/khomeview_p.h +++ b/kmymoney/views/khomeview_p.h @@ -62,7 +62,7 @@ #include "mymoneyutils.h" #include "kmymoneyutils.h" #include "kwelcomepage.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "mymoneyfile.h" #include "mymoneyaccount.h" #include "mymoneyprice.h" @@ -132,9 +132,9 @@ ~KHomeViewPrivate() { // if user wants to remember the font size, store it here - if (KMyMoneyGlobalSettings::rememberZoomFactor() && m_view) { - KMyMoneyGlobalSettings::setZoomFactor(m_view->zoomFactor()); - KMyMoneyGlobalSettings::self()->save(); + if (KMyMoneySettings::rememberZoomFactor() && m_view) { + KMyMoneySettings::setZoomFactor(m_view->zoomFactor()); + KMyMoneySettings::self()->save(); } } @@ -197,7 +197,7 @@ QString cellStatus, cellCounts, pathOK, pathTODO, pathNotOK; - if (KMyMoneyGlobalSettings::showBalanceStatusOfOnlineAccounts()) { + if (KMyMoneySettings::showBalanceStatusOfOnlineAccounts()) { //show account's online-status pathOK = QPixmapToDataUri(Icons::get(Icon::DialogOKApply).pixmap(QSize(16,16))); pathTODO = QPixmapToDataUri(Icons::get(Icon::MailReceive).pixmap(QSize(16,16))); @@ -222,32 +222,32 @@ int countNotMarked = 0, countCleared = 0, countNotReconciled = 0; QString countStr; - if (KMyMoneyGlobalSettings::showCountOfUnmarkedTransactions() || KMyMoneyGlobalSettings::showCountOfNotReconciledTransactions()) + if (KMyMoneySettings::showCountOfUnmarkedTransactions() || KMyMoneySettings::showCountOfNotReconciledTransactions()) countNotMarked = file->countTransactionsWithSpecificReconciliationState(acc.id(), TransactionFilter::State::NotReconciled); - if (KMyMoneyGlobalSettings::showCountOfClearedTransactions() || KMyMoneyGlobalSettings::showCountOfNotReconciledTransactions()) + if (KMyMoneySettings::showCountOfClearedTransactions() || KMyMoneySettings::showCountOfNotReconciledTransactions()) countCleared = file->countTransactionsWithSpecificReconciliationState(acc.id(), TransactionFilter::State::Cleared); - if (KMyMoneyGlobalSettings::showCountOfNotReconciledTransactions()) + if (KMyMoneySettings::showCountOfNotReconciledTransactions()) countNotReconciled = countNotMarked + countCleared; - if (KMyMoneyGlobalSettings::showCountOfUnmarkedTransactions()) { + if (KMyMoneySettings::showCountOfUnmarkedTransactions()) { if (countNotMarked) countStr = QString("%1").arg(countNotMarked); else countStr = '-'; tmp += QString("%1").arg(countStr); } - if (KMyMoneyGlobalSettings::showCountOfClearedTransactions()) { + if (KMyMoneySettings::showCountOfClearedTransactions()) { if (countCleared) countStr = QString("%1").arg(countCleared); else countStr = '-'; tmp += QString("%1").arg(countStr); } - if (KMyMoneyGlobalSettings::showCountOfNotReconciledTransactions()) { + if (KMyMoneySettings::showCountOfNotReconciledTransactions()) { if (countNotReconciled) countStr = QString("%1").arg(countNotReconciled); else @@ -278,7 +278,7 @@ MyMoneySecurity currency = file->currency(acc.currencyId()); MyMoneyMoney value; - bool showLimit = KMyMoneyGlobalSettings::showLimitInfo(); + bool showLimit = KMyMoneySettings::showLimitInfo(); if (acc.accountType() == Account::Type::Investment) { //investment accounts show the balances of all its subaccounts @@ -354,7 +354,7 @@ { if (isNegative) { //if negative, get the settings for negative numbers - return QString("%2").arg(KMyMoneyGlobalSettings::schemeColor(SchemeColor::Negative).name(), amount); + return QString("%2").arg(KMyMoneySettings::schemeColor(SchemeColor::Negative).name(), amount); } //if positive, return the same string @@ -370,7 +370,7 @@ m_accountList.clear(); //reinitialize the object - m_forecast = KMyMoneyGlobalSettings::forecast(); + m_forecast = KMyMoneyUtils::forecast(); //If forecastDays lower than accountsCycle, adjust to the first cycle if (m_forecast.accountsCycle() > m_forecast.forecastDays()) @@ -405,7 +405,7 @@ void loadView() { - m_view->setZoomFactor(KMyMoneyGlobalSettings::zoomFactor()); + m_view->setZoomFactor(KMyMoneySettings::zoomFactor()); QList list; MyMoneyFile::instance()->accountList(list); @@ -429,7 +429,7 @@ m_html += QString("
%1
").arg(i18n("Your Financial Summary")); - QStringList settings = KMyMoneyGlobalSettings::itemList(); + QStringList settings = KMyMoneySettings::listOfItems(); QStringList::ConstIterator it; @@ -933,30 +933,30 @@ m_html += ""; m_html += ""; - if (KMyMoneyGlobalSettings::showBalanceStatusOfOnlineAccounts()) { + if (KMyMoneySettings::showBalanceStatusOfOnlineAccounts()) { QString pathStatusHeader = QPixmapToDataUri(Icons::get(Icon::Download).pixmap(QSize(16,16))); m_html += QString("").arg(pathStatusHeader); } m_html += ""; - if (KMyMoneyGlobalSettings::showCountOfUnmarkedTransactions()) + if (KMyMoneySettings::showCountOfUnmarkedTransactions()) m_html += QString(""); - if (KMyMoneyGlobalSettings::showCountOfClearedTransactions()) + if (KMyMoneySettings::showCountOfClearedTransactions()) m_html += QString(""); - if (KMyMoneyGlobalSettings::showCountOfNotReconciledTransactions()) + if (KMyMoneySettings::showCountOfNotReconciledTransactions()) m_html += QString(""); m_html += ""; //only show limit info if user chose to do so - if (KMyMoneyGlobalSettings::showLimitInfo()) { + if (KMyMoneySettings::showLimitInfo()) { m_html += ""; @@ -972,11 +972,11 @@ } m_html += QString("").arg(i++ & 0x01 ? "even" : "odd"); QString amount = m_total.formatMoney(file->baseCurrency().tradingSymbol(), prec); - if (KMyMoneyGlobalSettings::showBalanceStatusOfOnlineAccounts()) m_html += ""; + if (KMyMoneySettings::showBalanceStatusOfOnlineAccounts()) m_html += ""; m_html += QString("").arg(i18n("Total")); - if (KMyMoneyGlobalSettings::showCountOfUnmarkedTransactions()) m_html += ""; - if (KMyMoneyGlobalSettings::showCountOfClearedTransactions()) m_html += ""; - if (KMyMoneyGlobalSettings::showCountOfNotReconciledTransactions()) m_html += ""; + if (KMyMoneySettings::showCountOfUnmarkedTransactions()) m_html += ""; + if (KMyMoneySettings::showCountOfClearedTransactions()) m_html += ""; + if (KMyMoneySettings::showCountOfNotReconciledTransactions()) m_html += ""; m_html += QString("").arg(showColoredAmount(amount, m_total.isNegative())); m_html += "
"; m_html += i18n("Account"); m_html += "!MC!R"; m_html += i18n("Current Balance"); m_html += ""; m_html += i18n("To Minimum Balance / Maximum Credit"); m_html += "
%1%1
"; } @@ -1246,7 +1246,7 @@ qStableSort(assets.begin(), assets.end(), accountNameLess); qStableSort(liabilities.begin(), liabilities.end(), accountNameLess); QString statusHeader; - if (KMyMoneyGlobalSettings::showBalanceStatusOfOnlineAccounts()) { + if (KMyMoneySettings::showBalanceStatusOfOnlineAccounts()) { QString pathStatusHeader; pathStatusHeader = QPixmapToDataUri(Icons::get(Icon::ViewOutbox).pixmap(QSize(16,16))); statusHeader = QString("").arg(pathStatusHeader); @@ -1260,7 +1260,7 @@ m_html += ""; - if (KMyMoneyGlobalSettings::showBalanceStatusOfOnlineAccounts()) { + if (KMyMoneySettings::showBalanceStatusOfOnlineAccounts()) { m_html += ""; m_html += statusHeader; m_html += ""; @@ -1270,13 +1270,13 @@ m_html += i18n("Asset Accounts"); m_html += ""; - if (KMyMoneyGlobalSettings::showCountOfUnmarkedTransactions()) + if (KMyMoneySettings::showCountOfUnmarkedTransactions()) m_html += "!M"; - if (KMyMoneyGlobalSettings::showCountOfClearedTransactions()) + if (KMyMoneySettings::showCountOfClearedTransactions()) m_html += "C"; - if (KMyMoneyGlobalSettings::showCountOfNotReconciledTransactions()) + if (KMyMoneySettings::showCountOfNotReconciledTransactions()) m_html += "!R"; m_html += ""; @@ -1286,7 +1286,7 @@ //intermediate row to separate both columns m_html += ""; - if (KMyMoneyGlobalSettings::showBalanceStatusOfOnlineAccounts()) { + if (KMyMoneySettings::showBalanceStatusOfOnlineAccounts()) { m_html += ""; m_html += statusHeader; m_html += ""; @@ -1296,24 +1296,24 @@ m_html += i18n("Liability Accounts"); m_html += ""; - if (KMyMoneyGlobalSettings::showCountOfUnmarkedTransactions()) + if (KMyMoneySettings::showCountOfUnmarkedTransactions()) m_html += "!M"; - if (KMyMoneyGlobalSettings::showCountOfClearedTransactions()) + if (KMyMoneySettings::showCountOfClearedTransactions()) m_html += "C"; - if (KMyMoneyGlobalSettings::showCountOfNotReconciledTransactions()) + if (KMyMoneySettings::showCountOfNotReconciledTransactions()) m_html += "!R"; m_html += ""; m_html += i18n("Current Balance"); m_html += ""; QString placeHolder_Status, placeHolder_Counts; - if (KMyMoneyGlobalSettings::showBalanceStatusOfOnlineAccounts()) placeHolder_Status = ""; - if (KMyMoneyGlobalSettings::showCountOfUnmarkedTransactions()) placeHolder_Counts = ""; - if (KMyMoneyGlobalSettings::showCountOfClearedTransactions()) placeHolder_Counts += ""; - if (KMyMoneyGlobalSettings::showCountOfNotReconciledTransactions()) placeHolder_Counts += ""; + if (KMyMoneySettings::showBalanceStatusOfOnlineAccounts()) placeHolder_Status = ""; + if (KMyMoneySettings::showCountOfUnmarkedTransactions()) placeHolder_Counts = ""; + if (KMyMoneySettings::showCountOfClearedTransactions()) placeHolder_Counts += ""; + if (KMyMoneySettings::showCountOfNotReconciledTransactions()) placeHolder_Counts += ""; //get asset and liability accounts QList::const_iterator asset_it = assets.constBegin(); diff --git a/kmymoney/views/kinstitutionsview.cpp b/kmymoney/views/kinstitutionsview.cpp --- a/kmymoney/views/kinstitutionsview.cpp +++ b/kmymoney/views/kinstitutionsview.cpp @@ -32,7 +32,7 @@ // ---------------------------------------------------------------------------- // Project Includes -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "mymoneyexception.h" #include "knewbankdlg.h" #include "menuenums.h" @@ -67,8 +67,8 @@ d->m_needsRefresh = false; d->m_proxyModel->invalidate(); - d->m_proxyModel->setHideEquityAccounts(!KMyMoneyGlobalSettings::expertMode()); - d->m_proxyModel->setHideClosedAccounts(KMyMoneyGlobalSettings::hideClosedAccounts()); + d->m_proxyModel->setHideEquityAccounts(!KMyMoneySettings::expertMode()); + d->m_proxyModel->setHideClosedAccounts(KMyMoneySettings::hideClosedAccounts()); } void KInstitutionsView::showEvent(QShowEvent * event) diff --git a/kmymoney/views/kinvestmentview_p.h b/kmymoney/views/kinvestmentview_p.h --- a/kmymoney/views/kinvestmentview_p.h +++ b/kmymoney/views/kinvestmentview_p.h @@ -41,7 +41,7 @@ #include "mymoneyfile.h" #include "mymoneysecurity.h" #include "mymoneyaccount.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "kmymoneyaccountcombo.h" #include "accountsmodel.h" #include "models.h" @@ -177,11 +177,11 @@ void loadInvestmentTab() { Q_Q(KInvestmentView); - m_equitiesProxyModel->setHideClosedAccounts(KMyMoneyGlobalSettings::hideClosedAccounts() && !KMyMoneyGlobalSettings::showAllAccounts()); - m_equitiesProxyModel->setHideZeroBalanceAccounts(KMyMoneyGlobalSettings::hideZeroBalanceEquities()); + m_equitiesProxyModel->setHideClosedAccounts(KMyMoneySettings::hideClosedAccounts() && !KMyMoneySettings::showAllAccounts()); + m_equitiesProxyModel->setHideZeroBalanceAccounts(KMyMoneySettings::hideZeroBalanceEquities()); m_equitiesProxyModel->invalidate(); - m_accountsProxyModel->setHideClosedAccounts(KMyMoneyGlobalSettings::hideClosedAccounts() && !KMyMoneyGlobalSettings::showAllAccounts()); + m_accountsProxyModel->setHideClosedAccounts(KMyMoneySettings::hideClosedAccounts() && !KMyMoneySettings::showAllAccounts()); m_accountsProxyModel->invalidate(); if (!m_idInvAcc.isEmpty()) { // check if account to be selected exist diff --git a/kmymoney/views/kmymoneyaccountsviewbase_p.h b/kmymoney/views/kmymoneyaccountsviewbase_p.h --- a/kmymoney/views/kmymoneyaccountsviewbase_p.h +++ b/kmymoney/views/kmymoneyaccountsviewbase_p.h @@ -34,7 +34,7 @@ #include "mymoneyutils.h" #include "kmymoneyviewbase_p.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "mymoneyfile.h" #include "mymoneymoney.h" #include "mymoneysecurity.h" @@ -91,7 +91,7 @@ if (isNegative) s.append(QLatin1String("
")); - label->setFont(KMyMoneyGlobalSettings::listCellFont()); + label->setFont(KMyMoneySettings::listCellFontEx()); label->setText(s); } diff --git a/kmymoney/views/kmymoneyview.cpp b/kmymoney/views/kmymoneyview.cpp --- a/kmymoney/views/kmymoneyview.cpp +++ b/kmymoney/views/kmymoneyview.cpp @@ -61,7 +61,7 @@ #include "simpleledgerview.h" #endif -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "kmymoneytitlelabel.h" #include #include "kcurrencyeditdlg.h" @@ -142,7 +142,7 @@ m_header->setObjectName("titleLabel"); m_header->setMinimumSize(QSize(100, 30)); m_header->setRightImageFile("pics/titlelabel_background.png"); - m_header->setVisible(KMyMoneyGlobalSettings::showTitleBar()); + m_header->setVisible(KMyMoneySettings::showTitleBar()); gridLayout->addWidget(m_header, 1, 1); } } @@ -314,7 +314,7 @@ KMyMoneyView::~KMyMoneyView() { - KMyMoneyGlobalSettings::setLastViewSelected(m_lastViewSelected); + KMyMoneySettings::setLastViewSelected(m_lastViewSelected); #ifdef KF5Activities_FOUND delete m_activityResourceInstance; #endif @@ -879,7 +879,7 @@ // make sure we setup the encryption key correctly if (isEncrypted && MyMoneyFile::instance()->value("kmm-encryption-key").isEmpty()) { - MyMoneyFile::instance()->setValue("kmm-encryption-key", KMyMoneyGlobalSettings::gpgRecipientList().join(",")); + MyMoneyFile::instance()->setValue("kmm-encryption-key", KMyMoneySettings::gpgRecipientList().join(",")); } // make sure we setup the name of the base accounts in translated form @@ -1043,8 +1043,8 @@ KPageWidgetItem* page; KConfigGroup grp = config->group("General Options"); - if (KMyMoneyGlobalSettings::startLastViewSelected() != 0) - page = viewFrames.value(static_cast(KMyMoneyGlobalSettings::lastViewSelected())); + if (KMyMoneySettings::startLastViewSelected() != 0) + page = viewFrames.value(static_cast(KMyMoneySettings::lastViewSelected())); else page = viewFrames[View::Home]; @@ -1173,7 +1173,7 @@ KMessageBox::sorry(this, i18n("GPG does not seem to be installed on your system. Please make sure that GPG can be found using the standard search path. This time, encryption is disabled."), i18n("GPG not found")); encryptFile = false; } else { - if (KMyMoneyGlobalSettings::encryptRecover()) { + if (KMyMoneySettings::encryptRecover()) { encryptRecover = true; if (!KGPGFile::keyAvailable(QString(recoveryKeyId))) { KMessageBox::sorry(this, i18n("

You have selected to encrypt your data also with the KMyMoney recover key, but the key with id

%1

has not been found in your keyring at this time. Please make sure to import this key into your keyring. You can find it on the KMyMoney web-site. This time your data will not be encrypted with the KMyMoney recover key.

", QString(recoveryKeyId)), i18n("GPG Key not found")); @@ -1308,7 +1308,7 @@ if (url.isLocalFile()) { filename = url.toLocalFile(); try { - const unsigned int nbak = KMyMoneyGlobalSettings::autoBackupCopies(); + const unsigned int nbak = KMyMoneySettings::autoBackupCopies(); if (nbak) { KBackup::numberedBackupFile(filename, QString(), QString::fromLatin1("~"), nbak); } @@ -1555,12 +1555,12 @@ // TODO turn sync between ledger and investment view if selected by user - if (KMyMoneyGlobalSettings::syncLedgerInvestment()) { + if (KMyMoneySettings::syncLedgerInvestment()) { connect(m_investmentView, &KInvestmentView::accountSelected, m_ledgerView, static_cast(&KGlobalLedgerView::slotSelectAccount)); connect(m_ledgerView, &KGlobalLedgerView::objectSelected, m_investmentView, static_cast(&KInvestmentView::slotSelectAccount)); } - showTitleBar(KMyMoneyGlobalSettings::showTitleBar()); + showTitleBar(KMyMoneySettings::showTitleBar()); m_accountsView->refresh(); m_institutionsView->refresh(); @@ -1580,7 +1580,7 @@ void KMyMoneyView::slotShowTransactionDetail(bool detailed) { - KMyMoneyGlobalSettings::setShowRegisterDetailed(detailed); + KMyMoneySettings::setShowRegisterDetailed(detailed); slotRefreshViews(); } @@ -1657,7 +1657,7 @@ // we need to fix reports. If the account filter list contains // investment accounts, we need to add the stock accounts to the list // as well if we don't have the expert mode enabled - if (!KMyMoneyGlobalSettings::expertMode()) { + if (!KMyMoneySettings::expertMode()) { try { QList reports = MyMoneyFile::instance()->reportList(); QList::iterator it_r; @@ -1696,7 +1696,7 @@ // if we're not in expert mode, we need to make sure // that all stock accounts for the selected investment // account are also selected - if (!KMyMoneyGlobalSettings::expertMode()) { + if (!KMyMoneySettings::expertMode()) { QStringList missing; QStringList::const_iterator it_a, it_b; for (it_a = list.begin(); it_a != list.end(); ++it_a) { diff --git a/kmymoney/views/kpayeesview.cpp b/kmymoney/views/kpayeesview.cpp --- a/kmymoney/views/kpayeesview.cpp +++ b/kmymoney/views/kpayeesview.cpp @@ -56,7 +56,7 @@ #include "mymoneyaccount.h" #include "mymoneymoney.h" #include "mymoneytransactionfilter.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "models.h" #include "accountsmodel.h" #include "mymoneysecurity.h" diff --git a/kmymoney/views/kpayeesview_p.h b/kmymoney/views/kpayeesview_p.h --- a/kmymoney/views/kpayeesview_p.h +++ b/kmymoney/views/kpayeesview_p.h @@ -58,7 +58,7 @@ #include "mymoneyaccount.h" #include "mymoneymoney.h" #include "mymoneytransactionfilter.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "kpayeereassigndlg.h" #include "models.h" #include "accountsmodel.h" @@ -149,7 +149,7 @@ m_contact = new MyMoneyContact(q); m_filterProxyModel = new AccountNamesFilterProxyModel(q); - m_filterProxyModel->setHideEquityAccounts(!KMyMoneyGlobalSettings::expertMode()); + m_filterProxyModel->setHideEquityAccounts(!KMyMoneySettings::expertMode()); m_filterProxyModel->addAccountGroup(QVector {eMyMoney::Account::Type::Asset, eMyMoney::Account::Type::Liability, eMyMoney::Account::Type::Income, eMyMoney::Account::Type::Expense, eMyMoney::Account::Type::Equity}); auto const model = Models::instance()->accountsModel(); @@ -374,7 +374,7 @@ MyMoneySecurity base = file->baseCurrency(); // setup sort order - ui->m_register->setSortOrder(KMyMoneyGlobalSettings::sortSearchView()); + ui->m_register->setSortOrder(KMyMoneySettings::sortSearchView()); // clear the register ui->m_register->clear(); @@ -392,7 +392,7 @@ ++it) filter.addPayee((*it).id()); - filter.setDateFilter(KMyMoneyGlobalSettings::startDate().date(), QDate()); + filter.setDateFilter(KMyMoneySettings::startDate().date(), QDate()); // retrieve the list from the engine file->transactionList(m_transactionList, filter); diff --git a/kmymoney/views/kreportsview.cpp b/kmymoney/views/kreportsview.cpp --- a/kmymoney/views/kreportsview.cpp +++ b/kmymoney/views/kreportsview.cpp @@ -66,7 +66,7 @@ #include "mymoneyfile.h" #include "mymoneyreport.h" #include "mymoneyexception.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "querytable.h" #include "objectinfotable.h" #include "kreportconfigurationfilterdlg.h" diff --git a/kmymoney/views/kreportsview_p.h b/kmymoney/views/kreportsview_p.h --- a/kmymoney/views/kreportsview_p.h +++ b/kmymoney/views/kreportsview_p.h @@ -72,7 +72,7 @@ #include "mymoneyfile.h" #include "mymoneyreport.h" #include "mymoneyexception.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "querytable.h" #include "objectinfotable.h" #include "icons/icons.h" @@ -208,7 +208,7 @@ { m_layout->setSpacing(6); m_tableView->setPage(new MyQWebEnginePage(m_tableView)); - m_tableView->setZoomFactor(KMyMoneyGlobalSettings::zoomFactor()); + m_tableView->setZoomFactor(KMyMoneySettings::zoomFactor()); //set button icons m_control->ui->buttonChart->setIcon(Icons::get(Icon::OfficeChartLine)); diff --git a/kmymoney/views/kscheduledview.cpp b/kmymoney/views/kscheduledview.cpp --- a/kmymoney/views/kscheduledview.cpp +++ b/kmymoney/views/kscheduledview.cpp @@ -50,7 +50,7 @@ #include "ui_kscheduledview.h" #include "keditloanwizard.h" #include "kmymoneyutils.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "mymoneyexception.h" #include "kscheduletreeitem.h" #include "keditscheduledlg.h" diff --git a/kmymoney/views/kscheduledview_p.h b/kmymoney/views/kscheduledview_p.h --- a/kmymoney/views/kscheduledview_p.h +++ b/kmymoney/views/kscheduledview_p.h @@ -57,7 +57,7 @@ #include "kconfirmmanualenterdlg.h" #include "kmymoneymvccombo.h" #include "kmymoneyutils.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "mymoneyexception.h" #include "kscheduletreeitem.h" #include "ktreewidgetfilterlinewidget.h" @@ -151,7 +151,7 @@ void refreshSchedule(bool full, const QString& schedId) { Q_Q(KScheduledView); - ui->m_scheduleTree->header()->setFont(KMyMoneyGlobalSettings::listHeaderFont()); + ui->m_scheduleTree->header()->setFont(KMyMoneySettings::listHeaderFontEx()); ui->m_scheduleTree->clear(); @@ -269,7 +269,7 @@ } if (parent) { - if (!KMyMoneyGlobalSettings::hideFinishedSchedules() || !schedData.isFinished()) { + if (!KMyMoneySettings::hideFinishedSchedules() || !schedData.isFinished()) { item = addScheduleItem(parent, schedData); if (schedData.id() == schedId) openItem = item; @@ -325,7 +325,7 @@ QByteArray columns; columns = grp.readEntry("KScheduleView_treeState", columns); ui->m_scheduleTree->header()->restoreState(columns); - ui->m_scheduleTree->header()->setFont(KMyMoneyGlobalSettings::listHeaderFont()); + ui->m_scheduleTree->header()->setFont(KMyMoneySettings::listHeaderFontEx()); } void writeConfig() diff --git a/kmymoney/views/ktagsview.cpp b/kmymoney/views/ktagsview.cpp --- a/kmymoney/views/ktagsview.cpp +++ b/kmymoney/views/ktagsview.cpp @@ -36,7 +36,7 @@ #include "mymoneyexception.h" #include "mymoneymoney.h" #include "mymoneyprice.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "ktagreassigndlg.h" #include "kmymoneyutils.h" #include "kmymoneymvccombo.h" @@ -277,7 +277,7 @@ MyMoneySecurity base = file->baseCurrency(); // setup sort order - d->ui->m_register->setSortOrder(KMyMoneyGlobalSettings::sortSearchView()); + d->ui->m_register->setSortOrder(KMyMoneySettings::sortSearchView()); // clear the register d->ui->m_register->clear(); @@ -290,7 +290,7 @@ // setup the list and the pointer vector MyMoneyTransactionFilter filter; filter.addTag(d->m_tag.id()); - filter.setDateFilter(KMyMoneyGlobalSettings::startDate().date(), QDate()); + filter.setDateFilter(KMyMoneySettings::startDate().date(), QDate()); // retrieve the list from the engine file->transactionList(d->m_transactionList, filter); diff --git a/kmymoney/widgets/CMakeLists.txt b/kmymoney/widgets/CMakeLists.txt --- a/kmymoney/widgets/CMakeLists.txt +++ b/kmymoney/widgets/CMakeLists.txt @@ -21,7 +21,6 @@ ########### Shared widget library ########### set(kmm_widgets_sources - widgets_config.cpp kmymoneydateinput.cpp kmymoneyvalidationfeedback.cpp styleditemdelegateforwarder.cpp @@ -61,6 +60,7 @@ add_library(kmm_widgets SHARED ${kmm_widgets_sources}) target_link_libraries(kmm_widgets PUBLIC + kmm_settings KF5::TextWidgets KF5::KIOWidgets KF5::Completion @@ -71,7 +71,6 @@ Qt5::Sql Qt5::Core Alkimia::alkimia - kmm_config kmm_mymoney ) @@ -152,9 +151,9 @@ # We can compile the uncritical sources without KMM_DESIGNER flags add_library(kmymoney_base STATIC ${_uncritial_common_sources}) # TODO: fix dependencies -target_link_libraries(kmymoney_base KF5::XmlGui KF5::TextWidgets KF5::IconThemes KF5::I18n KF5::ConfigWidgets KF5::ConfigCore KF5::Completion KF5::Service Qt5::Gui Qt5::Widgets Qt5::Sql Qt5::Xml Alkimia::alkimia) +target_link_libraries(kmymoney_base KF5::XmlGui KF5::TextWidgets KF5::IconThemes KF5::I18n KF5::ConfigWidgets KF5::ConfigCore KF5::Completion KF5::Service Qt5::Gui Qt5::Widgets Qt5::Sql Qt5::Xml kmm_settings Alkimia::alkimia) -add_dependencies(kmymoney_base kmm_config) +add_dependencies(kmymoney_base kmm_settings) ########### QtDesigner Widget Library (kmymoneywidgets) ################# # we never link against this library, @@ -181,7 +180,7 @@ # dialogs and converter libraries. If a widget references something # from one of these libraries it is most likely due to code that needs # to be excluded with a KMM_DESIGNER ifndef. - target_link_libraries(kmymoneywidgets kmymoney_base kmm_mymoney kmymoney_common kmm_config models) + target_link_libraries(kmymoneywidgets kmymoney_base kmm_mymoney kmymoney_common kmm_settings models) install(TARGETS kmymoneywidgets DESTINATION ${QT_PLUGINS_DIR}/designer ) endif( USE_QT_DESIGNER ) @@ -222,7 +221,7 @@ ) target_link_libraries(widgets KF5::XmlGui kmymoney_base) -add_dependencies(widgets kmm_config) +add_dependencies(widgets kmm_settings) ########### install files ############### diff --git a/kmymoney/widgets/fancydategroupmarkers.cpp b/kmymoney/widgets/fancydategroupmarkers.cpp --- a/kmymoney/widgets/fancydategroupmarkers.cpp +++ b/kmymoney/widgets/fancydategroupmarkers.cpp @@ -32,7 +32,7 @@ // ---------------------------------------------------------------------------- // Project Includes -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "widgetenums.h" using namespace KMyMoneyRegister; @@ -120,15 +120,15 @@ cellRect.setHeight(d->m_parent->rowHeight(index.row() + d->m_startRow)); if (d->m_alternate) - option.palette.setColor(QPalette::Base, KMyMoneyGlobalSettings::schemeColor(SchemeColor::ListBackground2)); + option.palette.setColor(QPalette::Base, KMyMoneySettings::schemeColor(SchemeColor::ListBackground2)); else - option.palette.setColor(QPalette::Base, KMyMoneyGlobalSettings::schemeColor(SchemeColor::ListBackground1)); + option.palette.setColor(QPalette::Base, KMyMoneySettings::schemeColor(SchemeColor::ListBackground1)); QBrush backgroundBrush(option.palette.color(QPalette::Base)); backgroundBrush.setStyle(Qt::Dense5Pattern); - backgroundBrush.setColor(KMyMoneyGlobalSettings::schemeColor(SchemeColor::ListGrid)); + backgroundBrush.setColor(KMyMoneySettings::schemeColor(SchemeColor::ListGrid)); painter->eraseRect(cellRect); painter->fillRect(cellRect, backgroundBrush); - painter->setPen(KMyMoneyGlobalSettings::schemeColor(SchemeColor::ListGrid)); + painter->setPen(KMyMoneySettings::schemeColor(SchemeColor::ListGrid)); painter->restore(); } diff --git a/kmymoney/widgets/groupmarker.cpp b/kmymoney/widgets/groupmarker.cpp --- a/kmymoney/widgets/groupmarker.cpp +++ b/kmymoney/widgets/groupmarker.cpp @@ -122,11 +122,11 @@ cellRect.setWidth(d->m_parent->viewport()->width()); cellRect.setHeight(d->m_parent->rowHeight(index.row())); - option.palette.setColor(QPalette::Base, isErroneous() ? KMyMoneyGlobalSettings::schemeColor(SchemeColor::TransactionErroneous) : KMyMoneyGlobalSettings::schemeColor(SchemeColor::GroupMarker)); + option.palette.setColor(QPalette::Base, isErroneous() ? KMyMoneySettings::schemeColor(SchemeColor::TransactionErroneous) : KMyMoneySettings::schemeColor(SchemeColor::GroupMarker)); QBrush backgroundBrush(option.palette.color(QPalette::Base)); painter->fillRect(cellRect, backgroundBrush); - painter->setPen(KMyMoneyGlobalSettings::schemeColor(SchemeColor::ListGrid)); + painter->setPen(KMyMoneySettings::schemeColor(SchemeColor::ListGrid)); painter->drawLine(cellRect.x(), cellRect.height() - 1, cellRect.width(), cellRect.height() - 1); // now write the text diff --git a/kmymoney/widgets/groupmarker_p.h b/kmymoney/widgets/groupmarker_p.h --- a/kmymoney/widgets/groupmarker_p.h +++ b/kmymoney/widgets/groupmarker_p.h @@ -32,7 +32,7 @@ // ---------------------------------------------------------------------------- // Project Includes -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "register.h" #include "registeritem_p.h" @@ -82,7 +82,7 @@ if (m_parent) { h = m_parent->rowHeightHint(); } else { - QFontMetrics fm(KMyMoneyGlobalSettings::listCellFont()); + QFontMetrics fm(KMyMoneySettings::listCellFontEx()); h = fm.lineSpacing() + 6; } diff --git a/kmymoney/widgets/investtransaction.cpp b/kmymoney/widgets/investtransaction.cpp --- a/kmymoney/widgets/investtransaction.cpp +++ b/kmymoney/widgets/investtransaction.cpp @@ -49,7 +49,7 @@ #include "investtransactioneditor.h" #include "kmymoneyutils.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "widgetenums.h" using namespace eWidgets; @@ -110,7 +110,7 @@ d->m_rowsForm = 7; // setup initial size - setNumRowsRegister(numRowsRegister(KMyMoneyGlobalSettings::showRegisterDetailed())); + setNumRowsRegister(numRowsRegister(KMyMoneySettings::showRegisterDetailed())); emit parent->itemAdded(this); } @@ -570,7 +570,7 @@ case PriceColumn: if (havePrice()) { - txt = (m_split.value() / m_split.shares()).formatMoney(QString(), KMyMoneyGlobalSettings::pricePrecision()); + txt = (m_split.value() / m_split.shares()).formatMoney(QString(), KMyMoneySettings::pricePrecision()); nw = cellFontMetrics.width(txt + " "); } break; diff --git a/kmymoney/widgets/kbudgetvalues.cpp b/kmymoney/widgets/kbudgetvalues.cpp --- a/kmymoney/widgets/kbudgetvalues.cpp +++ b/kmymoney/widgets/kbudgetvalues.cpp @@ -45,7 +45,7 @@ #include "mymoneybudget.h" #include "kmymoneyedit.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" class KBudgetValuesPrivate { @@ -93,7 +93,7 @@ Q_D(KBudgetValues); d->ui->setupUi(this); d->m_currentTab = d->ui->m_monthlyButton; - d->m_budgetDate = QDate(2007, KMyMoneyGlobalSettings::firstFiscalMonth(), KMyMoneyGlobalSettings::firstFiscalDay()); + d->m_budgetDate = QDate(2007, KMyMoneySettings::firstFiscalMonth(), KMyMoneySettings::firstFiscalDay()); d->m_field[0] = d->ui->m_amount1; d->m_field[1] = d->ui->m_amount2; diff --git a/kmymoney/widgets/kguiutils.cpp b/kmymoney/widgets/kguiutils.cpp --- a/kmymoney/widgets/kguiutils.cpp +++ b/kmymoney/widgets/kguiutils.cpp @@ -41,7 +41,7 @@ // ---------------------------------------------------------------------------- // Project Includes -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "onlinetasks/interfaces/ui/ionlinejobedit.h" #include "kmymoneytextedit.h" #include "kmymoneypayeecombo.h" @@ -158,7 +158,7 @@ } QPalette palette = widget->palette(); - palette.setColor(QPalette::Base, KMyMoneyGlobalSettings::schemeColor(SchemeColor::FieldRequired)); + palette.setColor(QPalette::Base, KMyMoneySettings::schemeColor(SchemeColor::FieldRequired)); widget->setPalette(palette); d->m_widgets.append(widget); changed(); diff --git a/kmymoney/widgets/kmymoneyaccountselector.cpp b/kmymoney/widgets/kmymoneyaccountselector.cpp --- a/kmymoney/widgets/kmymoneyaccountselector.cpp +++ b/kmymoney/widgets/kmymoneyaccountselector.cpp @@ -43,7 +43,7 @@ #include "mymoneyfile.h" #include "mymoneyaccount.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "icons/icons.h" #include "mymoneyenums.h" #include "dialogenums.h" @@ -533,7 +533,7 @@ for (it_l = list.constBegin(); it_l != list.constEnd(); ++it_l) { const MyMoneyAccount& acc = d->m_file->account(*it_l); // don't include stock accounts if not in expert mode - if (acc.isInvest() && !KMyMoneyGlobalSettings::expertMode()) + if (acc.isInvest() && !KMyMoneySettings::expertMode()) continue; //this will include an account if it matches the account type and diff --git a/kmymoney/widgets/kmymoneyselector.cpp b/kmymoney/widgets/kmymoneyselector.cpp --- a/kmymoney/widgets/kmymoneyselector.cpp +++ b/kmymoney/widgets/kmymoneyselector.cpp @@ -31,7 +31,7 @@ // ---------------------------------------------------------------------------- // Project Includes -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "widgetenums.h" using namespace eWidgets; @@ -409,7 +409,7 @@ int KMyMoneySelector::slotMakeCompletion(const QString& _txt) { QString txt(QRegExp::escape(_txt)); - if (KMyMoneyGlobalSettings::stringMatchFromStart() && QLatin1String(this->metaObject()->className()) == QLatin1String("KMyMoneySelector")) + if (KMyMoneySettings::stringMatchFromStart() && QLatin1String(this->metaObject()->className()) == QLatin1String("KMyMoneySelector")) txt.prepend('^'); return slotMakeCompletion(QRegExp(txt, Qt::CaseInsensitive)); } diff --git a/kmymoney/widgets/register.cpp b/kmymoney/widgets/register.cpp --- a/kmymoney/widgets/register.cpp +++ b/kmymoney/widgets/register.cpp @@ -51,7 +51,7 @@ #include "stdtransactionmatched.h" #include "selectedtransactions.h" #include "scheduledtransaction.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "mymoneymoney.h" #include "mymoneyfile.h" #include "groupmarkers.h" @@ -266,7 +266,7 @@ case Account::Type::Asset: case Account::Type::Liability: case Account::Type::Equity: - if (KMyMoneyGlobalSettings::alwaysShowNrField()) + if (KMyMoneySettings::alwaysShowNrField()) showColumn((int)eTransaction::Column::Number); break; @@ -442,7 +442,7 @@ #ifndef KMM_DESIGNER // recalculate row height hint - QFontMetrics fm(KMyMoneyGlobalSettings::listCellFont()); + QFontMetrics fm(KMyMoneySettings::listCellFontEx()); d->m_rowHeightHint = fm.lineSpacing() + 6; #endif @@ -822,7 +822,7 @@ // Resize the date and money fields to either // a) the size required by the input widget if no transaction form is shown and the register is used with an editor // b) the adjusted value for the input widget if the transaction form is visible or an editor is not used - if (d->m_usedWithEditor && !KMyMoneyGlobalSettings::transactionForm()) { + if (d->m_usedWithEditor && !KMyMoneySettings::transactionForm()) { QPushButton *pushButton = new QPushButton; const int pushButtonSpacing = pushButton->sizeHint().width() + 5; setColumnWidth((int)eTransaction::Column::Date, columnWidth((int)eTransaction::Column::Date) + pushButtonSpacing + 4/* space for the spinbox arrows */); @@ -893,7 +893,7 @@ #else int maxWidth = 0; int minWidth = 0; - QFontMetrics cellFontMetrics(KMyMoneyGlobalSettings::listCellFont()); + QFontMetrics cellFontMetrics(KMyMoneySettings::listCellFontEx()); switch (col) { case (int)eTransaction::Column::Date: minWidth = cellFontMetrics.width(QLocale().toString(QDate(6999, 12, 29), QLocale::ShortFormat) + " "); @@ -1163,7 +1163,7 @@ d->m_focusItem = focusItem; d->m_focusItem->setFocus(true); if (d->m_listsDirty) - updateRegister(KMyMoneyGlobalSettings::ledgerLens() | !KMyMoneyGlobalSettings::transactionForm()); + updateRegister(KMyMoneySettings::ledgerLens() | !KMyMoneySettings::transactionForm()); ensureItemVisible(d->m_focusItem); return true; } else @@ -1693,10 +1693,10 @@ thisWeek = today.addDays(-weekStartOfs); lastWeek = thisWeek.addDays(-7); thisYear.setDate(today.year(), 1, 1); - if (KMyMoneyGlobalSettings::startDate().date() != QDate(1900, 1, 1)) - new KMyMoneyRegister::FancyDateGroupMarker(this, KMyMoneyGlobalSettings::startDate().date(), i18n("Prior transactions possibly filtered")); + if (KMyMoneySettings::startDate().date() != QDate(1900, 1, 1)) + new KMyMoneyRegister::FancyDateGroupMarker(this, KMyMoneySettings::startDate().date(), i18n("Prior transactions possibly filtered")); - if (KMyMoneyGlobalSettings::showFancyMarker()) { + if (KMyMoneySettings::showFancyMarker()) { if (d->m_account.lastReconciliationDate().isValid()) new KMyMoneyRegister::StatementGroupMarker(this, eRegister::CashFlowDirection::Deposit, d->m_account.lastReconciliationDate(), i18n("Last reconciliation")); @@ -1726,32 +1726,32 @@ } else { new KMyMoneyRegister::SimpleDateGroupMarker(this, today.addDays(1), i18n("Future transactions")); } - if (KMyMoneyGlobalSettings::showFiscalMarker()) { - QDate currentFiscalYear = KMyMoneyGlobalSettings::firstFiscalDate(); + if (KMyMoneySettings::showFiscalMarker()) { + QDate currentFiscalYear = KMyMoneySettings::firstFiscalDate(); new KMyMoneyRegister::FiscalYearGroupMarker(this, currentFiscalYear, i18n("Current fiscal year")); new KMyMoneyRegister::FiscalYearGroupMarker(this, currentFiscalYear.addYears(-1), i18n("Previous fiscal year")); new KMyMoneyRegister::FiscalYearGroupMarker(this, currentFiscalYear.addYears(1), i18n("Next fiscal year")); } break; case SortField::Type: - if (KMyMoneyGlobalSettings::showFancyMarker()) { + if (KMyMoneySettings::showFancyMarker()) { new KMyMoneyRegister::TypeGroupMarker(this, eRegister::CashFlowDirection::Deposit, d->m_account.accountType()); new KMyMoneyRegister::TypeGroupMarker(this, eRegister::CashFlowDirection::Payment, d->m_account.accountType()); } break; case SortField::ReconcileState: - if (KMyMoneyGlobalSettings::showFancyMarker()) { + if (KMyMoneySettings::showFancyMarker()) { new KMyMoneyRegister::ReconcileGroupMarker(this, eMyMoney::Split::State::NotReconciled); new KMyMoneyRegister::ReconcileGroupMarker(this, eMyMoney::Split::State::Cleared); new KMyMoneyRegister::ReconcileGroupMarker(this, eMyMoney::Split::State::Reconciled); new KMyMoneyRegister::ReconcileGroupMarker(this, eMyMoney::Split::State::Frozen); } break; case SortField::Payee: - if (KMyMoneyGlobalSettings::showFancyMarker()) { + if (KMyMoneySettings::showFancyMarker()) { while (p) { t = dynamic_cast(p); if (t) { @@ -1770,7 +1770,7 @@ break; case SortField::Category: - if (KMyMoneyGlobalSettings::showFancyMarker()) { + if (KMyMoneySettings::showFancyMarker()) { while (p) { t = dynamic_cast(p); if (t) { @@ -1789,7 +1789,7 @@ break; case SortField::Security: - if (KMyMoneyGlobalSettings::showFancyMarker()) { + if (KMyMoneySettings::showFancyMarker()) { while (p) { t = dynamic_cast(p); if (t) { diff --git a/kmymoney/widgets/registeritem.cpp b/kmymoney/widgets/registeritem.cpp --- a/kmymoney/widgets/registeritem.cpp +++ b/kmymoney/widgets/registeritem.cpp @@ -29,7 +29,7 @@ // Project Includes #include "register.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "mymoneyobject.h" #include "mymoneymoney.h" #include "mymoneyenums.h" @@ -295,6 +295,6 @@ return d->m_parent->rowHeightHint(); } - QFontMetrics fm(KMyMoneyGlobalSettings::listCellFont()); + QFontMetrics fm(KMyMoneySettings::listCellFontEx()); return fm.lineSpacing() + 6; } diff --git a/kmymoney/widgets/scheduledtransaction.cpp b/kmymoney/widgets/scheduledtransaction.cpp --- a/kmymoney/widgets/scheduledtransaction.cpp +++ b/kmymoney/widgets/scheduledtransaction.cpp @@ -29,16 +29,16 @@ // ---------------------------------------------------------------------------- // Project Includes -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" using namespace KMyMoneyRegister; using namespace KMyMoneyTransactionForm; StdTransactionScheduled::StdTransactionScheduled(Register *parent, const MyMoneyTransaction& transaction, const MyMoneySplit& split, int uniqueId) : StdTransaction(parent, transaction, split, uniqueId) { // setup initial size - setNumRowsRegister(numRowsRegister(KMyMoneyGlobalSettings::showRegisterDetailed())); + setNumRowsRegister(numRowsRegister(KMyMoneySettings::showRegisterDetailed())); } StdTransactionScheduled::~StdTransactionScheduled() diff --git a/kmymoney/widgets/stdtransaction.cpp b/kmymoney/widgets/stdtransaction.cpp --- a/kmymoney/widgets/stdtransaction.cpp +++ b/kmymoney/widgets/stdtransaction.cpp @@ -53,7 +53,7 @@ #include "stdtransactioneditor.h" #endif -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "widgetenums.h" #include "mymoneyenums.h" @@ -111,7 +111,7 @@ } // setup initial size - setNumRowsRegister(numRowsRegister(KMyMoneyGlobalSettings::showRegisterDetailed())); + setNumRowsRegister(numRowsRegister(KMyMoneySettings::showRegisterDetailed())); emit parent->itemAdded(this); } @@ -391,7 +391,7 @@ if (txt.isEmpty() && !d->m_split.value().isZero()) { txt = i18n("*** UNASSIGNED ***"); if (painter) - painter->setPen(KMyMoneyGlobalSettings::schemeColor(SchemeColor::TransactionErroneous)); + painter->setPen(KMyMoneySettings::schemeColor(SchemeColor::TransactionErroneous)); } } } @@ -456,7 +456,7 @@ if (txt.isEmpty() && !d->m_split.value().isZero()) { txt = i18n("*** UNASSIGNED ***"); if (painter) - painter->setPen(KMyMoneyGlobalSettings::schemeColor(SchemeColor::TransactionErroneous)); + painter->setPen(KMyMoneySettings::schemeColor(SchemeColor::TransactionErroneous)); } break; @@ -553,7 +553,7 @@ void StdTransaction::tabOrderInForm(QWidgetList& tabOrderWidgets) const { Q_D(const StdTransaction); - QStringList taborder = KMyMoneyGlobalSettings::stdTransactionFormTabOrder().split(',', QString::SkipEmptyParts); + QStringList taborder = KMyMoneySettings::stdTransactionFormTabOrder().split(',', QString::SkipEmptyParts); QStringList::const_iterator it_s = taborder.constBegin(); QWidget* w; while (it_s != taborder.constEnd()) { @@ -619,7 +619,7 @@ void StdTransaction::tabOrderInRegister(QWidgetList& tabOrderWidgets) const { Q_D(const StdTransaction); - QStringList taborder = KMyMoneyGlobalSettings::stdTransactionRegisterTabOrder().split(',', QString::SkipEmptyParts); + QStringList taborder = KMyMoneySettings::stdTransactionRegisterTabOrder().split(',', QString::SkipEmptyParts); QStringList::const_iterator it_s = taborder.constBegin(); QWidget* w; while (it_s != taborder.constEnd()) { diff --git a/kmymoney/widgets/stdtransactiondownloaded.cpp b/kmymoney/widgets/stdtransactiondownloaded.cpp --- a/kmymoney/widgets/stdtransactiondownloaded.cpp +++ b/kmymoney/widgets/stdtransactiondownloaded.cpp @@ -29,7 +29,7 @@ // ---------------------------------------------------------------------------- // Project Includes -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" using namespace KMyMoneyRegister; using namespace KMyMoneyTransactionForm; @@ -54,8 +54,8 @@ auto rc = Transaction::paintRegisterCellSetup(painter, option, index); // if not selected paint in selected background color if (!isSelected()) { - option.palette.setColor(QPalette::Base, KMyMoneyGlobalSettings::schemeColor(SchemeColor::TransactionImported)); - option.palette.setColor(QPalette::AlternateBase, KMyMoneyGlobalSettings::schemeColor(SchemeColor::TransactionImported)); + option.palette.setColor(QPalette::Base, KMyMoneySettings::schemeColor(SchemeColor::TransactionImported)); + option.palette.setColor(QPalette::AlternateBase, KMyMoneySettings::schemeColor(SchemeColor::TransactionImported)); } return rc; } @@ -79,8 +79,8 @@ auto rc = Transaction::paintRegisterCellSetup(painter, option, index); // if not selected paint in selected background color if (!isSelected()) { - option.palette.setColor(QPalette::Base, KMyMoneyGlobalSettings::schemeColor(SchemeColor::TransactionImported)); - option.palette.setColor(QPalette::AlternateBase, KMyMoneyGlobalSettings::schemeColor(SchemeColor::TransactionImported)); + option.palette.setColor(QPalette::Base, KMyMoneySettings::schemeColor(SchemeColor::TransactionImported)); + option.palette.setColor(QPalette::AlternateBase, KMyMoneySettings::schemeColor(SchemeColor::TransactionImported)); } return rc; } diff --git a/kmymoney/widgets/stdtransactionmatched.cpp b/kmymoney/widgets/stdtransactionmatched.cpp --- a/kmymoney/widgets/stdtransactionmatched.cpp +++ b/kmymoney/widgets/stdtransactionmatched.cpp @@ -33,7 +33,7 @@ // ---------------------------------------------------------------------------- // Project Includes -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "mymoneyaccount.h" #include "mymoneymoney.h" #include "mymoneysplit.h" @@ -48,7 +48,7 @@ StdTransaction(parent, transaction, split, uniqueId) { // setup initial size - setNumRowsRegister(numRowsRegister(KMyMoneyGlobalSettings::showRegisterDetailed())); + setNumRowsRegister(numRowsRegister(KMyMoneySettings::showRegisterDetailed())); } StdTransactionMatched::~StdTransactionMatched() @@ -66,8 +66,8 @@ // if not selected paint in matched background color if (!isSelected()) { - option.palette.setColor(QPalette::Base, KMyMoneyGlobalSettings::schemeColor(SchemeColor::TransactionMatched)); - option.palette.setColor(QPalette::AlternateBase, KMyMoneyGlobalSettings::schemeColor(SchemeColor::TransactionMatched)); + option.palette.setColor(QPalette::Base, KMyMoneySettings::schemeColor(SchemeColor::TransactionMatched)); + option.palette.setColor(QPalette::AlternateBase, KMyMoneySettings::schemeColor(SchemeColor::TransactionMatched)); } //TODO: the first line needs to be painted across all columns return rc; diff --git a/kmymoney/widgets/transaction.cpp b/kmymoney/widgets/transaction.cpp --- a/kmymoney/widgets/transaction.cpp +++ b/kmymoney/widgets/transaction.cpp @@ -55,7 +55,7 @@ #include "registerfilter.h" #include "tabbar.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "widgetenums.h" #include "mymoneyenums.h" @@ -224,14 +224,14 @@ d->m_focus = focus; } if (updateLens) { - if (KMyMoneyGlobalSettings::ledgerLens() - || !KMyMoneyGlobalSettings::transactionForm() - || KMyMoneyGlobalSettings::showRegisterDetailed() + if (KMyMoneySettings::ledgerLens() + || !KMyMoneySettings::transactionForm() + || KMyMoneySettings::showRegisterDetailed() || d->m_parent->ledgerLens()) { if (focus) setNumRowsRegister(numRowsRegister(true)); else - setNumRowsRegister(numRowsRegister(KMyMoneyGlobalSettings::showRegisterDetailed())); + setNumRowsRegister(numRowsRegister(KMyMoneySettings::showRegisterDetailed())); } } } @@ -374,16 +374,16 @@ // do we need to switch to the error color? if (d->m_erroneous) { - option.palette.setColor(QPalette::Text, KMyMoneyGlobalSettings::schemeColor(SchemeColor::TransactionErroneous)); + option.palette.setColor(QPalette::Text, KMyMoneySettings::schemeColor(SchemeColor::TransactionErroneous)); } // do we need to switch to the negative balance color? if (index.column() == (int)eTransaction::Column::Balance) { bool showNegative = d->m_balance.isNegative(); if (d->m_account.accountGroup() == eMyMoney::Account::Type::Liability && !d->m_balance.isZero()) showNegative = !showNegative; if (showNegative) - option.palette.setColor(QPalette::Text, KMyMoneyGlobalSettings::schemeColor(SchemeColor::TransactionErroneous)); + option.palette.setColor(QPalette::Text, KMyMoneySettings::schemeColor(SchemeColor::TransactionErroneous)); } return true; } @@ -646,7 +646,7 @@ case eMyMoney::Account::Type::Asset: case eMyMoney::Account::Type::Liability: case eMyMoney::Account::Type::Equity: - rc = KMyMoneyGlobalSettings::alwaysShowNrField(); + rc = KMyMoneySettings::alwaysShowNrField(); break; case eMyMoney::Account::Type::Checkings: diff --git a/kmymoney/widgets/transactionform.cpp b/kmymoney/widgets/transactionform.cpp --- a/kmymoney/widgets/transactionform.cpp +++ b/kmymoney/widgets/transactionform.cpp @@ -45,7 +45,7 @@ #include "kmymoneycategory.h" #include "transaction.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "widgetenums.h" #include "mymoneyenums.h" @@ -328,7 +328,7 @@ if (d->m_transaction) { QString txt; - QFontMetrics fontMetrics(KMyMoneyGlobalSettings::listCellFont()); + QFontMetrics fontMetrics(KMyMoneySettings::listCellFontEx()); // scan through the rows for (int i = rowCount() - 1; i >= 0; --i) { diff --git a/kmymoney/widgets/widgets_config.h b/kmymoney/widgets/widgets_config.h deleted file mode 100644 --- a/kmymoney/widgets/widgets_config.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - This file is part of KMyMoney, A Personal Finance Manager by KDE - Copyright (C) 2018 Thomas Baumgart - - 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 . -*/ - -#ifndef WIDGETS_CONFIG_H -#define WIDGETS_CONFIG_H - -#include "kmm_widgets_export.h" - -class KMyMoneySettings; - -namespace Widgets -{ - KMM_WIDGETS_EXPORT void injectExternalSettings(KMyMoneySettings* p); -} -#endif // WIDGETS_CONFIG_H diff --git a/kmymoney/widgets/widgets_config.cpp b/kmymoney/widgets/widgets_config.cpp deleted file mode 100644 --- a/kmymoney/widgets/widgets_config.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/* - This file is part of KMyMoney, A Personal Finance Manager by KDE - Copyright (C) 2018 Thomas Baumgart - - 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 . -*/ - -#include "widgets_config.h" -#include "kmymoneyglobalsettings.h" - -namespace Widgets { - void injectExternalSettings(KMyMoneySettings* p) - { - KMyMoneyGlobalSettings::injectExternalSettings(p); - } -} diff --git a/kmymoney/wizards/newaccountwizard/kaccounttypepage.cpp b/kmymoney/wizards/newaccountwizard/kaccounttypepage.cpp --- a/kmymoney/wizards/newaccountwizard/kaccounttypepage.cpp +++ b/kmymoney/wizards/newaccountwizard/kaccounttypepage.cpp @@ -45,7 +45,7 @@ #include "kmymoneydateinput.h" #include "kmymoneyedit.h" #include "kmymoneygeneralcombo.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "kmymoneywizardpage.h" #include "knewaccountwizard.h" #include "knewaccountwizard_p.h" @@ -81,7 +81,7 @@ d->ui->m_typeSelection->insertItem(i18n("Investment"), (int)Account::Type::Investment); d->ui->m_typeSelection->insertItem(i18n("Asset"), (int)Account::Type::Asset); d->ui->m_typeSelection->insertItem(i18n("Liability"), (int)Account::Type::Liability); - if (KMyMoneyGlobalSettings::expertMode()) { + if (KMyMoneySettings::expertMode()) { d->ui->m_typeSelection->insertItem(i18n("Equity"), (int)Account::Type::Equity); } diff --git a/kmymoney/wizards/newaccountwizard/khierarchypage.cpp b/kmymoney/wizards/newaccountwizard/khierarchypage.cpp --- a/kmymoney/wizards/newaccountwizard/khierarchypage.cpp +++ b/kmymoney/wizards/newaccountwizard/khierarchypage.cpp @@ -37,7 +37,7 @@ #include "accountsmodel.h" #include "hierarchyfilterproxymodel.h" #include "kmymoneyaccounttreeview.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "knewaccountwizard.h" #include "knewaccountwizard_p.h" #include "kaccountsummarypage.h" @@ -62,7 +62,7 @@ // the proxy filter model d->m_filterProxyModel = new HierarchyFilterProxyModel(this); d->m_filterProxyModel->setHideClosedAccounts(true); - d->m_filterProxyModel->setHideEquityAccounts(!KMyMoneyGlobalSettings::expertMode()); + d->m_filterProxyModel->setHideEquityAccounts(!KMyMoneySettings::expertMode()); d->m_filterProxyModel->addAccountGroup(QVector {Account::Type::Asset, Account::Type::Liability}); auto const model = Models::instance()->accountsModel(); d->m_filterProxyModel->setSourceModel(model); diff --git a/kmymoney/wizards/newloanwizard/assetaccountwizardpage.cpp b/kmymoney/wizards/newloanwizard/assetaccountwizardpage.cpp --- a/kmymoney/wizards/newloanwizard/assetaccountwizardpage.cpp +++ b/kmymoney/wizards/newloanwizard/assetaccountwizardpage.cpp @@ -33,7 +33,7 @@ // ---------------------------------------------------------------------------- // Project Includes -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "mymoneyaccount.h" #include "wizards/newaccountwizard/knewaccountwizard.h" #include "icons/icons.h" @@ -97,6 +97,6 @@ void AssetAccountWizardPage::slotAccountNew() { MyMoneyAccount account; - account.setOpeningDate(KMyMoneyGlobalSettings::firstFiscalDate()); + account.setOpeningDate(KMyMoneySettings::firstFiscalDate()); NewAccountWizard::Wizard::newAccount(account); } diff --git a/kmymoney/wizards/newuserwizard/knewuserwizard.cpp b/kmymoney/wizards/newuserwizard/knewuserwizard.cpp --- a/kmymoney/wizards/newuserwizard/knewuserwizard.cpp +++ b/kmymoney/wizards/newuserwizard/knewuserwizard.cpp @@ -51,7 +51,7 @@ #include "mymoneyaccount.h" #include "kmymoneydateinput.h" #include "kmymoneyedit.h" -#include "kmymoneyglobalsettings.h" +#include "kmymoneysettings.h" #include "mymoneytemplate.h" #include "mymoneyenums.h" @@ -63,7 +63,7 @@ KMyMoneyWizard(*new WizardPrivate(this), parent, modal, flags) { Q_D(Wizard); - bool isFirstTime = KMyMoneyGlobalSettings::firstTimeRun(); + bool isFirstTime = KMyMoneySettings::firstTimeRun(); stepCount = 1;