diff --git a/kmymoney/CMakeLists.txt b/kmymoney/CMakeLists.txt --- a/kmymoney/CMakeLists.txt +++ b/kmymoney/CMakeLists.txt @@ -25,6 +25,8 @@ ${CMAKE_CURRENT_SOURCE_DIR}/wizards/wizardpages/ ${CMAKE_CURRENT_SOURCE_DIR}/models/ ${CMAKE_CURRENT_BINARY_DIR}/models/ + ${CMAKE_CURRENT_SOURCE_DIR}/icons/ + ${CMAKE_CURRENT_BINARY_DIR}/icons/ ${CMAKE_CURRENT_BINARY_DIR}/payeeidentifier/ibanandbic/widgets/ # TODO: this line should be moved to the target it belongs ${CMAKE_CURRENT_BINARY_DIR}/payeeidentifier/ibanandbic/ ${CMAKE_CURRENT_BINARY_DIR}/payeeidentifier/nationalaccount/ diff --git a/kmymoney/dialogs/kaccountselectdlg.cpp b/kmymoney/dialogs/kaccountselectdlg.cpp --- a/kmymoney/dialogs/kaccountselectdlg.cpp +++ b/kmymoney/dialogs/kaccountselectdlg.cpp @@ -48,6 +48,9 @@ #include "kmymoneyaccountselector.h" #include <../kmymoney.h> +#include + +using namespace Icons; KAccountSelectDlg::KAccountSelectDlg(const KMyMoneyUtils::categoryTypeE accountType, const QString& purpose, QWidget *parent) : KAccountSelectDlgDecl(parent), @@ -62,20 +65,20 @@ slotReloadWidget(); KGuiItem skipButtonItem(i18n("&Skip"), - QIcon::fromTheme("media-skip-forward"), + QIcon::fromTheme(g_Icons[Icon::MediaSkipForward]), i18n("Skip this transaction"), i18n("Use this to skip importing this transaction and proceed with the next one.")); KGuiItem::assign(m_qbuttonCancel, skipButtonItem); KGuiItem createButtenItem(i18n("&Create..."), - QIcon::fromTheme("document-new"), + QIcon::fromTheme(g_Icons[Icon::DocumentNew]), i18n("Create a new account/category"), i18n("Use this to add a new account/category to the file")); KGuiItem::assign(m_createButton, createButtenItem); KGuiItem::assign(m_qbuttonOk, KStandardGuiItem::ok()); KGuiItem abortButtenItem(i18n("&Abort"), - QIcon::fromTheme("dialog-cancel"), + QIcon::fromTheme(g_Icons[Icon::DialogCancel]), i18n("Abort the import operation and dismiss all changes"), i18n("Use this to abort the import. Your financial data will be in the state before you started the QIF import.")); KGuiItem::assign(m_kButtonAbort, abortButtenItem); diff --git a/kmymoney/dialogs/kbackupdlg.cpp b/kmymoney/dialogs/kbackupdlg.cpp --- a/kmymoney/dialogs/kbackupdlg.cpp +++ b/kmymoney/dialogs/kbackupdlg.cpp @@ -42,6 +42,9 @@ // ---------------------------------------------------------------------------- // Project Includes +#include + +using namespace Icons; KBackupDlg::KBackupDlg(QWidget* parent) : kbackupdlgdecl(parent) @@ -49,7 +52,7 @@ readConfig(); KGuiItem chooseButtenItem(i18n("C&hoose..."), - QIcon::fromTheme("folder"), + QIcon::fromTheme(g_Icons[Icon::Folder]), i18n("Select mount point"), i18n("Use this to browse to the mount point.")); KGuiItem::assign(chooseButton, chooseButtenItem); diff --git a/kmymoney/dialogs/kcurrencyeditdlg.cpp b/kmymoney/dialogs/kcurrencyeditdlg.cpp --- a/kmymoney/dialogs/kcurrencyeditdlg.cpp +++ b/kmymoney/dialogs/kcurrencyeditdlg.cpp @@ -53,6 +53,9 @@ #include #include #include +#include + +using namespace Icons; // this delegate is needed to disable editing the currency id (column 1) // since QTreeWidgetItem has only one set of flags for the whole row @@ -85,11 +88,9 @@ m_searchWidget->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed)); ui->verticalLayout->insertWidget(0, m_searchWidget); ui->m_currencyList->setItemDelegate(new KCurrencyEditDelegate(ui->m_currencyList)); - ui->m_closeButton->setIcon(QIcon::fromTheme(QStringLiteral("dialog-close"), - QIcon::fromTheme(QStringLiteral("stop")))); - ui->m_editCurrencyButton->setIcon(QIcon::fromTheme(QStringLiteral("document-edit"), - QIcon::fromTheme(QStringLiteral("text-editor")))); - ui->m_selectBaseCurrencyButton->setIcon(QIcon::fromTheme(QStringLiteral("kmymoney"))); + ui->m_closeButton->setIcon(QIcon::fromTheme(g_Icons[Icon::DialogClose])); + ui->m_editCurrencyButton->setIcon(QIcon::fromTheme(g_Icons[Icon::DocumentEdit])); + ui->m_selectBaseCurrencyButton->setIcon(QIcon::fromTheme(g_Icons[Icon::KMyMoney])); connect(ui->m_currencyList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slotOpenContextMenu(QPoint))); connect(MyMoneyFile::instance(), SIGNAL(dataChanged()), this, SLOT(slotLoadCurrencies())); @@ -164,7 +165,7 @@ p->setText(2, (*it).tradingSymbol()); if ((*it).id() == baseCurrency) { - p->setData(0, Qt::DecorationRole, QIcon::fromTheme(QStringLiteral("kmymoney"))); + p->setData(0, Qt::DecorationRole, QIcon::fromTheme(g_Icons[Icon::KMyMoney])); if (m_currency.id().isEmpty()) first = p; } else { diff --git a/kmymoney/dialogs/kenterscheduledlg.cpp b/kmymoney/dialogs/kenterscheduledlg.cpp --- a/kmymoney/dialogs/kenterscheduledlg.cpp +++ b/kmymoney/dialogs/kenterscheduledlg.cpp @@ -52,8 +52,10 @@ #include #include #include - #include "kmymoney.h" +#include + +using namespace Icons; class KEnterScheduleDlg::Private { @@ -74,8 +76,8 @@ { d->m_schedule = schedule; d->m_extendedReturnCode = KMyMoneyUtils::Enter; - buttonOk->setIcon(QIcon::fromTheme("key-enter")); - buttonSkip->setIcon(QIcon::fromTheme("media-seek-forward")); + buttonOk->setIcon(QIcon::fromTheme(g_Icons[Icon::KeyEnter])); + buttonSkip->setIcon(QIcon::fromTheme(g_Icons[Icon::MediaSeekForward])); KGuiItem::assign(buttonCancel, KStandardGuiItem::cancel()); KGuiItem::assign(buttonHelp, KStandardGuiItem::help()); buttonIgnore->setHidden(true); diff --git a/kmymoney/dialogs/kexportdlg.cpp b/kmymoney/dialogs/kexportdlg.cpp --- a/kmymoney/dialogs/kexportdlg.cpp +++ b/kmymoney/dialogs/kexportdlg.cpp @@ -48,6 +48,9 @@ #include "kmymoneyaccountcombo.h" #include "kmymoneyutils.h" #include "models.h" +#include + +using namespace Icons; KExportDlg::KExportDlg(QWidget *parent) : KExportDlgDecl(parent) @@ -62,19 +65,19 @@ KGuiItem::assign(m_qbuttonCancel, KStandardGuiItem::cancel()); KGuiItem okButtenItem(i18n("&Export"), - QIcon::fromTheme("document-export"), + QIcon::fromTheme(g_Icons[Icon::DocumentExport]), i18n("Start operation"), i18n("Use this to start the export operation")); KGuiItem::assign(m_qbuttonOk, okButtenItem); KGuiItem browseButtenItem(i18n("&Browse..."), - QIcon::fromTheme("document-open"), + QIcon::fromTheme(g_Icons[Icon::DocumentOpen]), i18n("Select filename"), i18n("Use this to select a filename to export to")); KGuiItem::assign(m_qbuttonBrowse, browseButtenItem); KGuiItem newButtenItem(i18nc("New profile", "&New..."), - QIcon::fromTheme("document-new"), + QIcon::fromTheme(g_Icons[Icon::DocumentNew]), i18n("Create a new profile"), i18n("Use this to open the profile editor")); KGuiItem::assign(m_profileEditorButton, newButtenItem); diff --git a/kmymoney/dialogs/kimportdlg.cpp b/kmymoney/dialogs/kimportdlg.cpp --- a/kmymoney/dialogs/kimportdlg.cpp +++ b/kmymoney/dialogs/kimportdlg.cpp @@ -46,6 +46,9 @@ #include #include "mymoneyqifprofileeditor.h" #include "mymoneyqifprofile.h" +#include + +using namespace Icons; KImportDlg::KImportDlg(QWidget *parent) : KImportDlgDecl(parent) @@ -58,20 +61,19 @@ // load button icons KGuiItem okButtenItem(i18n("&Import"), - QIcon::fromTheme(QStringLiteral("document-import"), - QIcon::fromTheme(QStringLiteral("format-indent-less"))), + QIcon::fromTheme(g_Icons[Icon::DocumentImport]), i18n("Start operation"), i18n("Use this to start the import operation")); KGuiItem::assign(m_buttonBox->button(QDialogButtonBox::Ok), okButtenItem); KGuiItem browseButtenItem(i18n("&Browse..."), - QIcon::fromTheme("document-open"), + QIcon::fromTheme(g_Icons[Icon::DocumentOpen]), i18n("Select filename"), i18n("Use this to select a filename to export to")); KGuiItem::assign(m_qbuttonBrowse, browseButtenItem); KGuiItem newButtenItem(i18nc("New profile", "&New..."), - QIcon::fromTheme("document-new"), + QIcon::fromTheme(g_Icons[Icon::DocumentNew]), i18n("Create a new profile"), i18n("Use this to open the profile editor")); KGuiItem::assign(m_profileEditorButton, newButtenItem); diff --git a/kmymoney/dialogs/kmymoneypricedlg.cpp b/kmymoney/dialogs/kmymoneypricedlg.cpp --- a/kmymoney/dialogs/kmymoneypricedlg.cpp +++ b/kmymoney/dialogs/kmymoneypricedlg.cpp @@ -52,6 +52,9 @@ #include #include #include +#include + +using namespace Icons; KMyMoneyPriceDlg::KMyMoneyPriceDlg(QWidget* parent) : KMyMoneyPriceDlgDecl(parent) @@ -75,24 +78,24 @@ m_priceList->setContextMenuPolicy(Qt::CustomContextMenu); KGuiItem removeButtonItem(i18n("&Delete"), - QIcon::fromTheme("edit-delete"), + QIcon::fromTheme(g_Icons[Icon::EditDelete]), i18n("Delete this entry"), i18n("Remove this price item from the file")); KGuiItem::assign(m_deleteButton, removeButtonItem); KGuiItem newButtonItem(i18nc("New price entry", "&New"), - QIcon::fromTheme("document-new"), + QIcon::fromTheme(g_Icons[Icon::DocumentNew]), i18n("Add a new entry"), i18n("Create a new price entry.")); KGuiItem::assign(m_newButton, newButtonItem); KGuiItem editButtonItem(i18n("&Edit"), - QIcon::fromTheme("document-edit"), + QIcon::fromTheme(g_Icons[Icon::DocumentEdit]), i18n("Modify the selected entry"), i18n("Change the details of selected price information.")); KGuiItem::assign(m_editButton, editButtonItem); - m_onlineQuoteButton->setIcon(KMyMoneyUtils::overlayIcon("view-investment", "download")); + m_onlineQuoteButton->setIcon(KMyMoneyUtils::overlayIcon(g_Icons[Icon::ViewInvestment], g_Icons[Icon::Download])); connect(m_editButton, SIGNAL(clicked()), this, SLOT(slotEditPrice())); connect(m_deleteButton, SIGNAL(clicked()), this, SLOT(slotDeletePrice())); diff --git a/kmymoney/dialogs/kmymoneysplittable.cpp b/kmymoney/dialogs/kmymoneysplittable.cpp --- a/kmymoney/dialogs/kmymoneysplittable.cpp +++ b/kmymoney/dialogs/kmymoneysplittable.cpp @@ -61,10 +61,11 @@ #include "kmymoneylineedit.h" #include "mymoneysecurity.h" #include "kmymoneyglobalsettings.h" - #include "kcurrencycalculator.h" - #include "mymoneyutils.h" +#include + +using namespace Icons; kMyMoneySplitTable::kMyMoneySplitTable(QWidget *parent) : QTableWidget(parent), @@ -111,10 +112,10 @@ // setup the context menu m_contextMenu = new QMenu(this); m_contextMenu->setTitle(i18n("Split Options")); - m_contextMenu->setIcon(QIcon::fromTheme("view-financial-transfer")); - m_contextMenu->addAction(QIcon::fromTheme("document-edit"), i18n("Edit..."), this, SLOT(slotStartEdit())); - m_contextMenuDuplicate = m_contextMenu->addAction(QIcon::fromTheme("edit-copy"), i18nc("To duplicate a split", "Duplicate"), this, SLOT(slotDuplicateSplit())); - m_contextMenuDelete = m_contextMenu->addAction(QIcon::fromTheme("edit-delete"), + m_contextMenu->setIcon(QIcon::fromTheme(g_Icons[Icon::ViewFinancialTransfer])); + m_contextMenu->addAction(QIcon::fromTheme(g_Icons[Icon::DocumentEdit]), i18n("Edit..."), this, SLOT(slotStartEdit())); + m_contextMenuDuplicate = m_contextMenu->addAction(QIcon::fromTheme(g_Icons[Icon::EditCopy]), i18nc("To duplicate a split", "Duplicate"), this, SLOT(slotDuplicateSplit())); + m_contextMenuDelete = m_contextMenu->addAction(QIcon::fromTheme(g_Icons[Icon::EditDelete]), i18n("Delete..."), this, SLOT(slotDeleteSplit())); @@ -831,11 +832,9 @@ QHBoxLayout* l = new QHBoxLayout(m_registerButtonFrame); l->setContentsMargins(0, 0, 0, 0); l->setSpacing(0); - m_registerEnterButton = new QPushButton(QIcon::fromTheme(QStringLiteral("dialog-ok"), - QIcon::fromTheme(QStringLiteral("finish"))) + m_registerEnterButton = new QPushButton(QIcon::fromTheme(g_Icons[Icon::DialogOK]) , QString(), m_registerButtonFrame); - m_registerCancelButton = new QPushButton(QIcon::fromTheme(QStringLiteral("dialog-cancel"), - QIcon::fromTheme(QStringLiteral("stop"))) + m_registerCancelButton = new QPushButton(QIcon::fromTheme(g_Icons[Icon::DialogCancel]) , QString(), m_registerButtonFrame); l->addWidget(m_registerEnterButton); diff --git a/kmymoney/dialogs/konlinetransferform.cpp b/kmymoney/dialogs/konlinetransferform.cpp --- a/kmymoney/dialogs/konlinetransferform.cpp +++ b/kmymoney/dialogs/konlinetransferform.cpp @@ -39,6 +39,8 @@ #include "mymoney/onlinejobadministration.h" #include "models/models.h" +#include +using namespace Icons; kOnlineTransferForm::kOnlineTransferForm(QWidget *parent) : QDialog(parent), @@ -47,7 +49,7 @@ m_requiredFields(new kMandatoryFieldGroup(this)) { ui->setupUi(this); - ui->unsupportedIcon->setPixmap(QIcon::fromTheme("dialog-information").pixmap(style()->pixelMetric(QStyle::PM_MessageBoxIconSize))); + ui->unsupportedIcon->setPixmap(QIcon::fromTheme(g_Icons[Icon::DialogInformation]).pixmap(style()->pixelMetric(QStyle::PM_MessageBoxIconSize))); // The ui designer fills the QScrollArea with a QWidget. Remove it so we can simply check for .widget() == nullptr // if it contains a valid widget delete ui->creditTransferEdit->takeWidget(); diff --git a/kmymoney/dialogs/ksplittransactiondlg.cpp b/kmymoney/dialogs/ksplittransactiondlg.cpp --- a/kmymoney/dialogs/ksplittransactiondlg.cpp +++ b/kmymoney/dialogs/ksplittransactiondlg.cpp @@ -53,6 +53,9 @@ #include #include #include "kmymoneysplittable.h" +#include + +using namespace Icons; KSplitTransactionDlg::KSplitTransactionDlg(const MyMoneyTransaction& t, const MyMoneySplit& s, @@ -96,12 +99,12 @@ user1Button->setText(i18n("Clear &All")); user1Button->setToolTip(i18n("Clear all splits")); user1Button->setWhatsThis(i18n("Use this to clear all splits of this transaction")); - user1Button->setIcon(QIcon::fromTheme("edit-clear")); + user1Button->setIcon(QIcon::fromTheme(g_Icons[Icon::EditClear])); //clearZero button user2Button->setText(i18n("Clear &Zero")); user2Button->setToolTip(i18n("Removes all splits that have a value of zero")); - user2Button->setIcon(QIcon::fromTheme("edit-clear")); + user2Button->setIcon(QIcon::fromTheme(g_Icons[Icon::EditClear])); //merge button user3Button->setText(i18n("&Merge")); diff --git a/kmymoney/dialogs/mymoneyqifprofileeditor.cpp b/kmymoney/dialogs/mymoneyqifprofileeditor.cpp --- a/kmymoney/dialogs/mymoneyqifprofileeditor.cpp +++ b/kmymoney/dialogs/mymoneyqifprofileeditor.cpp @@ -44,6 +44,9 @@ // ---------------------------------------------------------------------------- // Project Includes +#include + +using namespace Icons; MyMoneyQifProfileNameValidator::MyMoneyQifProfileNameValidator(QObject *o) : QValidator(o) @@ -90,7 +93,7 @@ KGuiItem::assign(m_helpButton, KStandardGuiItem::help()); KGuiItem newButtenItem(i18nc("New profile", "&New"), - QIcon::fromTheme(QStringLiteral("document-new")), + QIcon::fromTheme(g_Icons[Icon::DocumentNew]), i18n("Create a new profile"), i18n("Use this to create a new QIF import/export profile")); KGuiItem::assign(m_newButton, newButtenItem); 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,6 +34,9 @@ #include "kmymoney/kmymoneyglobalsettings.h" #include "kmymoney/kmymoneyutils.h" +#include + +using namespace Icons; KSettingsHome::KSettingsHome(QWidget* parent) : KSettingsHomeDecl(parent), @@ -42,11 +45,11 @@ m_homePageList->setSortingEnabled(false); KGuiItem upButtonItem(i18nc("Move item up", "&Up"), - QIcon::fromTheme(QStringLiteral("go-up")), + QIcon::fromTheme(g_Icons[Icon::ArrowUp]), i18n("Move selected item up"), i18n("Use this to move the selected item up by one position in the list.")); KGuiItem downButtonItem(i18n("&Down"), - QIcon::fromTheme(QStringLiteral("go-down")), + QIcon::fromTheme(g_Icons[Icon::ArrowDown]), i18n("Move selected item down"), i18n("Use this to move the selected item down by one position in the list.")); diff --git a/kmymoney/dialogs/settings/ksettingsonlinequotes.cpp b/kmymoney/dialogs/settings/ksettingsonlinequotes.cpp --- a/kmymoney/dialogs/settings/ksettingsonlinequotes.cpp +++ b/kmymoney/dialogs/settings/ksettingsonlinequotes.cpp @@ -37,6 +37,9 @@ #include "kmymoney/converter/webpricequote.h" #include "mymoneyfile.h" +#include + +using namespace Icons; KSettingsOnlineQuotes::KSettingsOnlineQuotes(QWidget *parent) : KSettingsOnlineQuotesDecl(parent), @@ -49,20 +52,19 @@ m_updateButton->setEnabled(false); KGuiItem updateButtenItem(i18nc("Accepts the entered data and stores it", "&Update"), - QIcon::fromTheme(QStringLiteral("dialog-ok"), - QIcon::fromTheme(QStringLiteral("finish"))), + QIcon::fromTheme(g_Icons[Icon::DialogOK]), i18n("Accepts the entered data and stores it"), i18n("Use this to accept the modified data.")); KGuiItem::assign(m_updateButton, updateButtenItem); KGuiItem deleteButtenItem(i18n("&Delete"), - QIcon::fromTheme("edit-delete"), + QIcon::fromTheme(g_Icons[Icon::EditDelete]), i18n("Delete the selected source entry"), i18n("Use this to delete the selected online source entry")); KGuiItem::assign(m_deleteButton, deleteButtenItem); KGuiItem newButtenItem(i18nc("Create a new source entry for online quotes", "&New..."), - QIcon::fromTheme("document-new"), + QIcon::fromTheme(g_Icons[Icon::DocumentNew]), i18n("Create a new source entry for online quotes"), i18n("Use this to create a new entry for online quotes")); KGuiItem::assign(m_newButton, newButtenItem); diff --git a/kmymoney/dialogs/transactioneditor.cpp b/kmymoney/dialogs/transactioneditor.cpp --- a/kmymoney/dialogs/transactioneditor.cpp +++ b/kmymoney/dialogs/transactioneditor.cpp @@ -59,9 +59,11 @@ #include "ksplittransactiondlg.h" #include "kcurrencycalculator.h" #include "kselecttransactionsdlg.h" +#include using namespace KMyMoneyRegister; using namespace KMyMoneyTransactionForm; +using namespace Icons; TransactionEditor::TransactionEditor() : m_paymentMethod(MyMoneySchedule::STYPE_ANY), @@ -622,14 +624,12 @@ if ((*it_ts).id().isEmpty()) { bool enter = true; if (askForSchedule && (*it_ts).postDate() > QDate::currentDate()) { - KGuiItem enterItem; KGuiItem enterButton(i18n("&Enter"), - QIcon::fromTheme(QStringLiteral("dialog-ok"), - QIcon::fromTheme(QStringLiteral("finish"))), + QIcon::fromTheme(g_Icons[Icon::DialogOK]), i18n("Accepts the entered data and stores it"), i18n("Use this to enter the transaction into the ledger.")); KGuiItem scheduleButton(i18n("&Schedule"), - QIcon::fromTheme("appointment-new"), + QIcon::fromTheme(g_Icons[Icon::AppointmentNew]), i18n("Accepts the entered data and stores it as schedule"), i18n("Use this to schedule the transaction for later entry into the ledger.")); diff --git a/kmymoney/icons/CMakeLists.txt b/kmymoney/icons/CMakeLists.txt --- a/kmymoney/icons/CMakeLists.txt +++ b/kmymoney/icons/CMakeLists.txt @@ -26,3 +26,14 @@ ICONS ${KMYMONEY_ICONS} DESTINATION ${ICON_INSTALL_DIR} ) + +set (icons_SOURCES + icons.cpp +) + +add_library(kmm_icons SHARED ${icons_SOURCES}) +generate_export_header(kmm_icons) +target_link_libraries(kmm_icons PUBLIC Qt5::Core) + +install(TARGETS kmm_icons + ${INSTALL_TARGETS_DEFAULT_ARGS} ) diff --git a/kmymoney/icons/icons.h b/kmymoney/icons/icons.h new file mode 100644 --- /dev/null +++ b/kmymoney/icons/icons.h @@ -0,0 +1,105 @@ +/*************************************************************************** + icons.h + ------------------- + begin : Sun Jun 25 2017 + copyright : (C) 2017 by Łukasz Wojniłowicz + +***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef ICONS_H +#define ICONS_H + +// ---------------------------------------------------------------------------- +// QT Includes + +#include +#include + +// ---------------------------------------------------------------------------- +// Project Includes + +namespace Icons { + +enum class Icon { SVNUpdate, Merge, Reconcile, Split, Tip, Fork, + FileArchiver, AccessoriesCalculator, + UserProperties, DocumentProperties, + ZoomIn, ZoomOut, + MediaPlaybackPause, MediaSeekForward, + MediaSkipForward, + HideReconciled, HideCategories, + ViewHome, ViewInstitutions, + ViewAccounts, ViewCategories, + ViewSchedules, ViewTags, + ViewPayees, ViewLedgers, + ViewInvestment, ViewReports, + ViewBudgets, ViewForecast, + ViewOutbox, ViewFilter, + ViewLoan, ViewStock, + ViewChecking, + ViewSaving, + ViewLoanAsset, ViewCreditCard, + ViewCash, ViewEquity, + ViewIncome, ViewExpense, + ViewAsset, ViewLiability, + ViewUpcominEvents, ViewCalendarDay, + ViewFinancialList, ViewBankAccount, + ViewCurrencyList, ViewFinancialCategories, + ViewFinancialTransfer, ViewBank, + ViewTimeScheduleCalculus, ViewCalendar, + ViewTransactionDetail, ViewClose, + DialogOK, DialogClose, DialogCancel, + DialogOKApply, DialogError, DialogWarning, + DialogInformation, + ListExpand, ListCollapse, + ListAdd, ListAddUser, ListRemoveUser, + ListAddTag, ListRemoveTag, + GoJump, KeyEnter, Download, TagRename, + EditDelete, EditCopy, EditRename, + EditFind, EditUndo, EditClear, + DocumentEdit, + DocumentNew, DocumentSave, + DocumentClose, DocumentOpen, + DocumentImport, DocumentExport, + OfficeChartLine, + MailMessageNew, MailMessage, MailReceive, + NewsSubscribe, NewsUnsubscribe, + AppointmentNew, KMyMoney, + PayeeRename, PayeeMerge, + PathEnter, PathSkip, Configure, + FlagGreen, AccountClosed, Unknown, + Spreadsheet, Refresh, SystemRun, + SortAscending, SortDescending, + ArrowUp, ArrowDown, ArrowRight, ArrowLeft, + TaskAttention, TaskComplete, + TaskReject, TaskAccepted, TaskOngoing, + HelpContents, Folder, InvestApplet, + Empty + }; + +inline uint qHash(const Icon key, uint seed) +{ + return ::qHash(static_cast(key), seed); +} + +KMM_ICONS_EXPORT void setIconThemeNames(const QString &_themeName); + +namespace detail { +const QHash getCommonNames(); +const QHash getOxygenNames(); +const QHash getTangoNames(); +} + +} + +KMM_ICONS_EXPORT extern QHash g_Icons; + +#endif diff --git a/kmymoney/icons/icons.cpp b/kmymoney/icons/icons.cpp new file mode 100644 --- /dev/null +++ b/kmymoney/icons/icons.cpp @@ -0,0 +1,240 @@ +/*************************************************************************** + icons.cpp + ------------------- + begin : Sun Jun 25 2017 + copyright : (C) 2017 by Łukasz Wojniłowicz + +***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "icons.h" + +#include + +QHash g_Icons; + +namespace Icons { + +const QHash getCommonNames() +{ + return { + {Icon::ListCollapse, QStringLiteral("zoom-out")}, + {Icon::ListExpand, QStringLiteral("zoom-in")}, + {Icon::ListAdd, QStringLiteral("list-add")}, + {Icon::ListRemoveTag, QStringLiteral("list-remove-tag")}, + {Icon::ListAddTag, QStringLiteral("list-add-tag")}, + {Icon::ListRemoveUser, QStringLiteral("list-remove-user")}, + {Icon::ListAddUser, QStringLiteral("list-add-user")}, + {Icon::AppointmentNew, QStringLiteral("appointment-new")}, + {Icon::KeyEnter, QStringLiteral("input-keyboard")}, + {Icon::GoJump, QStringLiteral("go-jump")}, + {Icon::EditUndo, QStringLiteral("edit-undo")}, + {Icon::EditFind, QStringLiteral("edit-find")}, + {Icon::EditRename, QStringLiteral("edit-rename")}, + {Icon::EditCopy, QStringLiteral("edit-copy")}, + {Icon::EditDelete, QStringLiteral("edit-delete")}, + {Icon::EditClear, QStringLiteral("edit-clear")}, + {Icon::DialogClose, QStringLiteral("dialog-close")}, + {Icon::DialogCancel, QStringLiteral("dialog-cancel")}, + {Icon::DialogOK, QStringLiteral("dialog-ok")}, + {Icon::DialogOKApply, QStringLiteral("dialog-ok-apply")}, + {Icon::DialogWarning, QStringLiteral("dialog-warning")}, + {Icon::DialogError, QStringLiteral("dialog-error")}, + {Icon::DialogInformation, QStringLiteral("dialog-information")}, + {Icon::DocumentClose, QStringLiteral("document-close")}, + {Icon::DocumentOpen, QStringLiteral("document-open")}, + {Icon::DocumentSave, QStringLiteral("document-save")}, + {Icon::DocumentImport, QStringLiteral("format-indent-less")}, + {Icon::DocumentNew, QStringLiteral("document-new")}, + {Icon::DocumentEdit, QStringLiteral("document-edit")}, + {Icon::DocumentProperties, QStringLiteral("document-properties")}, + {Icon::DocumentImport, QStringLiteral("format-indent-less")}, + {Icon::DocumentExport, QStringLiteral("format-indent-more")}, + {Icon::NewsUnsubscribe, QStringLiteral("news-unsubscribe")}, + {Icon::NewsSubscribe, QStringLiteral("news-subscribe")}, + {Icon::OfficeChartLine, QStringLiteral("account-types-investments")}, + {Icon::MediaSkipForward, QStringLiteral("media-skip-forward")}, + {Icon::MediaSeekForward, QStringLiteral("media-seek-forward")}, + {Icon::MediaPlaybackPause, QStringLiteral("media-playback-pause")}, + {Icon::Reconcile, QStringLiteral("reconcile")}, + {Icon::Merge, QStringLiteral("reconcile")}, + {Icon::Fork, QStringLiteral("fork")}, + {Icon::ViewEquity, QStringLiteral("account")}, + {Icon::ViewExpense, QStringLiteral("account-types-expense")}, + {Icon::ViewIncome, QStringLiteral("account-types-income")}, + {Icon::ViewCash, QStringLiteral("account-types-cash")}, + {Icon::ViewCreditCard, QStringLiteral("account-types-credit-card")}, + {Icon::ViewLoan, QStringLiteral("account-types-loan")}, + {Icon::ViewLoanAsset, QStringLiteral("account-types-loan")}, + {Icon::ViewSaving, QStringLiteral("account-types-savings")}, + {Icon::ViewChecking, QStringLiteral("account-types-checking")}, + {Icon::ViewStock, QStringLiteral("account-types-investments")}, + {Icon::ViewLiability, QStringLiteral("account-types-liability")}, + {Icon::ViewAsset, QStringLiteral("account-types-asset")}, + {Icon::ViewOutbox, QStringLiteral("online-banking")}, + {Icon::ViewForecast, QStringLiteral("forecast")}, + {Icon::ViewBudgets, QStringLiteral("budget")}, + {Icon::ViewReports, QStringLiteral("report")}, + {Icon::ViewInvestment, QStringLiteral("investment")}, + {Icon::ViewLedgers, QStringLiteral("ledger")}, + {Icon::ViewPayees, QStringLiteral("payee")}, + {Icon::ViewTags, QStringLiteral("bookmark-new")}, + {Icon::ViewCategories, QStringLiteral("categories")}, + {Icon::ViewSchedules, QStringLiteral("schedule")}, + {Icon::ViewAccounts, QStringLiteral("account")}, + {Icon::ViewInstitutions, QStringLiteral("institution")}, + {Icon::ViewHome, QStringLiteral("home")}, + {Icon::ViewClose, QStringLiteral("view-close")}, + {Icon::ViewBank, QStringLiteral("bank")}, + {Icon::ViewBankAccount, QStringLiteral("account")}, + {Icon::ViewTimeScheduleCalculus, QStringLiteral("budget")}, + {Icon::ViewCalendar, QStringLiteral("view-calendar")}, + {Icon::ViewCurrencyList, QStringLiteral("view-currency-list")}, + {Icon::ViewUpcominEvents, QStringLiteral("view-calendar-upcoming-events")}, + {Icon::ViewCalendarDay, QStringLiteral("office-calendar")}, + {Icon::ViewFinancialTransfer, QStringLiteral("ledger")}, + {Icon::ViewFinancialCategories, QStringLiteral("categories")}, + {Icon::ViewFinancialList, QStringLiteral("ledger")}, + {Icon::ViewFilter, QStringLiteral("view-filter")}, + {Icon::SortAscending, QStringLiteral("go-up")}, + {Icon::SortDescending, QStringLiteral("go-down")}, + {Icon::HideCategories, QStringLiteral("hide-categories")}, + {Icon::HideReconciled, QStringLiteral("hide-reconciled")}, + {Icon::ViewTransactionDetail, QStringLiteral("edit-find")}, + {Icon::ZoomOut, QStringLiteral("zoom-out")}, + {Icon::ZoomIn, QStringLiteral("zoom-in")}, + {Icon::DocumentProperties, QStringLiteral("document-properties")}, + {Icon::TagRename, QStringLiteral("tag-rename")}, + {Icon::PayeeMerge, QStringLiteral("merge")}, + {Icon::PayeeRename, QStringLiteral("user-properties")}, + {Icon::UserProperties, QStringLiteral("system-users")}, + {Icon::FileArchiver, QStringLiteral("package")}, + {Icon::AccessoriesCalculator, QStringLiteral("accessories-calculator")}, + {Icon::MailReceive, QStringLiteral("mail-receive")}, + {Icon::MailMessageNew, QStringLiteral("mail-message-new")}, + {Icon::MailMessage, QStringLiteral("internet-mail")}, + {Icon::SVNUpdate, QStringLiteral("svn-update")}, + {Icon::Split, QStringLiteral("transaction-split")}, + {Icon::Download, QStringLiteral("go-down")}, + {Icon::Tip, QStringLiteral("info")}, + {Icon::KMyMoney, QStringLiteral("kmymoney")}, + {Icon::FlagGreen, QStringLiteral("reconciled")}, + {Icon::AccountClosed, QStringLiteral("account-types-closed")}, + {Icon::Unknown, QStringLiteral("unknown")}, + {Icon::Configure, QStringLiteral("configure")}, + {Icon::Spreadsheet, QStringLiteral("application-vnd.oasis.opendocument.spreadsheet")}, + {Icon::ArrowUp, QStringLiteral("arrow-up")}, + {Icon::ArrowDown, QStringLiteral("arrow-down")}, + {Icon::ArrowLeft, QStringLiteral("arrow-left")}, + {Icon::ArrowRight, QStringLiteral("arrow-right")}, + {Icon::SystemRun, QStringLiteral("system-run")}, + {Icon::TaskAttention, QStringLiteral("task-attention")}, + {Icon::TaskOngoing, QStringLiteral("task-ongoing")}, + {Icon::TaskComplete, QStringLiteral("task-complete")}, + {Icon::TaskReject, QStringLiteral("task-reject")}, + {Icon::TaskAccepted, QStringLiteral("task-accepted")}, + {Icon::HelpContents, QStringLiteral("help-contents")}, + {Icon::Folder, QStringLiteral("folder")} + }; +} + +const QHash getOxygenNames() +{ + return { + {Icon::Download, QStringLiteral("download")}, + {Icon::KeyEnter, QStringLiteral("key-enter")}, + {Icon::Split, QStringLiteral("split")}, + {Icon::Reconcile, QStringLiteral("merge")}, + {Icon::Tip, QStringLiteral("ktip")}, + {Icon::OfficeChartLine, QStringLiteral("office-chart-line")}, + {Icon::Merge, QStringLiteral("merge")}, + {Icon::ViewEquity, QStringLiteral("view-bank-account")}, + {Icon::ViewExpense, QStringLiteral("view-expenses-categories")}, + {Icon::ViewIncome, QStringLiteral("view-income-categories")}, + {Icon::ViewCreditCard, QStringLiteral("view-credit-card-account")}, + {Icon::ViewLoan, QStringLiteral("view-loan")}, + {Icon::ViewLoanAsset, QStringLiteral("view-loan-asset")}, + {Icon::ViewSaving, QStringLiteral("view-bank-account-savings")}, + {Icon::ViewChecking, QStringLiteral("view-bank-account-checking")}, + {Icon::ViewStock, QStringLiteral("view-stock-account")}, + {Icon::ViewLiability, QStringLiteral("view-loan")}, + {Icon::ViewAsset, QStringLiteral("view-bank-account")}, + {Icon::ViewBank, QStringLiteral("view-bank")}, + {Icon::ViewBankAccount, QStringLiteral("view-bank-account")}, + {Icon::ViewTimeScheduleCalculus, QStringLiteral("view-time-schedule-calculus")}, + {Icon::ViewForecast, QStringLiteral("view-financial-forecast")}, + {Icon::ViewBudgets, QStringLiteral("view-time-schedule-calculus")}, + {Icon::ViewReports, QStringLiteral("office-chart-bar")}, + {Icon::ViewInvestment, QStringLiteral("view-investment")}, + {Icon::ViewLedgers, QStringLiteral("view-financial-list")}, + {Icon::ViewPayees, QStringLiteral("system-users")}, + {Icon::ViewTags, QStringLiteral("mail-tagged")}, + {Icon::ViewCategories, QStringLiteral("view-financial-categories")}, + {Icon::ViewSchedules, QStringLiteral("view-pim-calendar")}, + {Icon::ViewAccounts, QStringLiteral("view-bank-account")}, + {Icon::ViewInstitutions, QStringLiteral("view-bank")}, + {Icon::ViewHome, QStringLiteral("go-home")}, + {Icon::ViewCalendarDay, QStringLiteral("view-calendar-day")}, + {Icon::ViewFinancialCategories, QStringLiteral("view-financial-categories")}, + {Icon::ViewFinancialTransfer, QStringLiteral("view-financial-transfer")}, + {Icon::ViewFinancialList, QStringLiteral("view-financial-list")}, + {Icon::ViewTransactionDetail, QStringLiteral("zoom-in")}, + {Icon::SortAscending, QStringLiteral("view-sort-ascending")}, + {Icon::SortDescending, QStringLiteral("view-sort-descending")}, + {Icon::UserProperties, QStringLiteral("user-properties")}, + {Icon::FileArchiver, QStringLiteral("utilities-file-archiver")}, + {Icon::FlagGreen, QStringLiteral("flag-green")}, + {Icon::AccountClosed, QStringLiteral("dialog-close")}, + {Icon::Refresh, QStringLiteral("refresh")}, + {Icon::MailMessage, QStringLiteral("mail-message")}, + {Icon::InvestApplet, QStringLiteral("invest-applet")}, + {Icon::DocumentImport, QStringLiteral("document-import")}, + {Icon::DocumentExport, QStringLiteral("document-export")} + }; +} + +const QHash getTangoNames() +{ + return { + {Icon::OfficeChartLine, QStringLiteral("report-line")}, + {Icon::ListCollapse, QStringLiteral("list-remove")}, + {Icon::ListExpand, QStringLiteral("list-add")}, + {Icon::DocumentEdit, QStringLiteral("text-editor")}, + {Icon::DialogCancel, QStringLiteral("stop")}, + {Icon::DialogOK, QStringLiteral("finish")}, + {Icon::EditRename, QStringLiteral("text-editor")}, + {Icon::DocumentClose, QStringLiteral("stop")}, + {Icon::Configure, QStringLiteral("preferences-system")}, + {Icon::ArrowUp, QStringLiteral("go-up")}, + {Icon::ArrowDown, QStringLiteral("go-down")}, + {Icon::ArrowLeft, QStringLiteral("go-previous")}, + {Icon::ArrowRight, QStringLiteral("go-next")}, + {Icon::SystemRun, QStringLiteral("media-playback-start")}, + {Icon::TaskAttention, QStringLiteral("dialog-warning")}, + }; +} + +KMM_ICONS_EXPORT void setIconThemeNames(const QString &_themeName) +{ + g_Icons = getCommonNames(); + QHash iconNames; + // get icon replacements for specific theme + if (_themeName == QLatin1String("oxygen")) + iconNames = getOxygenNames(); + else if (_themeName == QLatin1String("Tango")) + iconNames = getTangoNames(); + else + return; + + for (auto it = iconNames.cbegin(); it != iconNames.cend(); ++it) + g_Icons.insert(it.key(), it.value()); +} +} diff --git a/kmymoney/kmymoney.cpp b/kmymoney/kmymoney.cpp --- a/kmymoney/kmymoney.cpp +++ b/kmymoney/kmymoney.cpp @@ -161,6 +161,8 @@ #include "plugins/onlinepluginextended.h" #include "pluginloader.h" +#include "icons/icons.h" + #include #include @@ -170,6 +172,7 @@ #include "kmymoneyutils.h" +using namespace Icons; static constexpr char recoveryKeyId[] = "59B0F826D2B08440"; @@ -401,6 +404,7 @@ layout->setContentsMargins(2, 2, 2, 2); layout->setSpacing(6); + Icons::setIconThemeNames(KMyMoneySettings::iconsTheme()); if (KMyMoneySettings::iconsTheme().compare(QLatin1Literal("system")) != 0) QIcon::setThemeName(KMyMoneySettings::iconsTheme()); @@ -579,13 +583,12 @@ QAction *saveas_database = actionCollection()->addAction("saveas_database"); saveas_database->setText(i18n("Save as database...")); - saveas_database->setIcon(QIcon::fromTheme("svn-update")); + saveas_database->setIcon(QIcon::fromTheme(g_Icons[Icon::SVNUpdate])); connect(saveas_database, SIGNAL(triggered()), this, SLOT(slotSaveAsDatabase())); QAction *file_backup = actionCollection()->addAction("file_backup"); file_backup->setText(i18n("Backup...")); - file_backup->setIcon(QIcon::fromTheme(QStringLiteral("utilities-file-archiver"), - QIcon::fromTheme(QStringLiteral("package")))); + file_backup->setIcon(QIcon::fromTheme(g_Icons[Icon::FileArchiver])); connect(file_backup, SIGNAL(triggered()), this, SLOT(slotFileBackup())); QAction *file_import_qif = actionCollection()->addAction("file_import_qif"); @@ -614,8 +617,7 @@ QAction *view_personal_data = actionCollection()->addAction("view_personal_data"); view_personal_data->setText(i18n("Personal Data...")); - view_personal_data->setIcon(QIcon::fromTheme(QStringLiteral("user-properties"), - QIcon::fromTheme(QStringLiteral("system-users")))); + view_personal_data->setIcon(QIcon::fromTheme(g_Icons[Icon::UserProperties])); connect(view_personal_data, SIGNAL(triggered()), this, SLOT(slotFileViewPersonal())); #ifdef KMM_DEBUG @@ -626,7 +628,7 @@ QAction *view_file_info = actionCollection()->addAction("view_file_info"); view_file_info->setText(i18n("File-Information...")); - view_file_info->setIcon(QIcon::fromTheme("document-properties")); + view_file_info->setIcon(QIcon::fromTheme(g_Icons[Icon::DocumentProperties])); connect(view_file_info, SIGNAL(triggered()), this, SLOT(slotFileInfoDialog())); // ************* @@ -634,7 +636,7 @@ // ************* QAction *edit_find_transaction = actionCollection()->addAction("edit_find_transaction"); edit_find_transaction->setText(i18n("Find transaction...")); - edit_find_transaction->setIcon(KMyMoneyUtils::overlayIcon("view-financial-transfer", "edit-find")); + edit_find_transaction->setIcon(KMyMoneyUtils::overlayIcon(g_Icons[Icon::ViewFinancialTransfer], g_Icons[Icon::EditFind])); actionCollection()->setDefaultShortcut(edit_find_transaction, QKeySequence("Ctrl+F")); connect(edit_find_transaction, SIGNAL(triggered()), this, SLOT(slotFindTransaction())); @@ -642,26 +644,25 @@ // The View menu // ************* KToggleAction *view_show_transaction_detail = actionCollection()->add("view_show_transaction_detail"); - view_show_transaction_detail->setIcon(QIcon::fromTheme(QStringLiteral("zoom-in"), - QIcon::fromTheme(QStringLiteral("edit-find")))); + view_show_transaction_detail->setIcon(QIcon::fromTheme(g_Icons[Icon::ViewTransactionDetail])); view_show_transaction_detail->setText(i18n("Show Transaction Detail")); actionCollection()->setDefaultShortcut(view_show_transaction_detail, QKeySequence("Ctrl+T")); KToggleAction *view_hide_reconciled_transactions = actionCollection()->add("view_hide_reconciled_transactions"); view_hide_reconciled_transactions->setText(i18n("Hide reconciled transactions")); if (QIcon::hasThemeIcon(QStringLiteral("hide-reconciled"))) - view_hide_reconciled_transactions->setIcon(QIcon::fromTheme(QStringLiteral("hide-reconciled"))); + view_hide_reconciled_transactions->setIcon(QIcon::fromTheme(g_Icons[Icon::HideReconciled])); else - view_hide_reconciled_transactions->setIcon(KMyMoneyUtils::overlayIcon("merge", "view-close")); + view_hide_reconciled_transactions->setIcon(KMyMoneyUtils::overlayIcon(g_Icons[Icon::Merge], g_Icons[Icon::ViewClose])); actionCollection()->setDefaultShortcut(view_hide_reconciled_transactions, QKeySequence("Ctrl+R")); connect(view_hide_reconciled_transactions, SIGNAL(triggered()), this, SLOT(slotHideReconciledTransactions())); KToggleAction *view_hide_unused_categories = actionCollection()->add("view_hide_unused_categories"); view_hide_unused_categories->setText(i18n("Hide unused categories")); if (QIcon::hasThemeIcon(QStringLiteral("hide-categories"))) - view_hide_unused_categories->setIcon(QIcon::fromTheme(QStringLiteral("hide-categories"))); + view_hide_unused_categories->setIcon(QIcon::fromTheme(g_Icons[Icon::HideCategories])); else - view_hide_unused_categories->setIcon(KMyMoneyUtils::overlayIcon("view-financial-categories", "view-close")); + view_hide_unused_categories->setIcon(KMyMoneyUtils::overlayIcon(g_Icons[Icon::ViewFinancialCategories], g_Icons[Icon::ViewClose])); actionCollection()->setDefaultShortcut(view_hide_unused_categories, QKeySequence("Ctrl+U")); connect(view_hide_unused_categories, SIGNAL(triggered()), this, SLOT(slotHideUnusedCategories())); @@ -675,17 +676,17 @@ // ********************* QAction *institution_new = actionCollection()->addAction("institution_new"); institution_new->setText(i18n("New institution...")); - institution_new->setIcon(KMyMoneyUtils::overlayIcon("view-bank", "list-add", Qt::TopRightCorner)); + institution_new->setIcon(KMyMoneyUtils::overlayIcon(g_Icons[Icon::ViewBank], g_Icons[Icon::ListAdd], Qt::TopRightCorner)); connect(institution_new, SIGNAL(triggered()), this, SLOT(slotInstitutionNew())); QAction *institution_edit = actionCollection()->addAction("institution_edit"); institution_edit->setText(i18n("Edit institution...")); - institution_edit->setIcon(KMyMoneyUtils::overlayIcon("view-bank", "document-edit")); + institution_edit->setIcon(KMyMoneyUtils::overlayIcon(g_Icons[Icon::ViewBank], g_Icons[Icon::DocumentEdit])); connect(institution_edit, SIGNAL(triggered()), this, SLOT(slotInstitutionEdit())); QAction *institution_delete = actionCollection()->addAction("institution_delete"); institution_delete->setText(i18n("Delete institution...")); - institution_delete->setIcon(KMyMoneyUtils::overlayIcon("view-bank", "edit-delete")); + institution_delete->setIcon(KMyMoneyUtils::overlayIcon(g_Icons[Icon::ViewBank], g_Icons[Icon::EditDelete])); connect(institution_delete, SIGNAL(triggered()), this, SLOT(slotInstitutionDelete())); // ***************** @@ -693,77 +694,72 @@ // ***************** QAction *account_new = actionCollection()->addAction("account_new"); account_new->setText(i18n("New account...")); - account_new->setIcon(KMyMoneyUtils::overlayIcon("view-bank-account", "list-add", Qt::TopRightCorner)); + account_new->setIcon(KMyMoneyUtils::overlayIcon(g_Icons[Icon::ViewBankAccount], g_Icons[Icon::ListAdd], Qt::TopRightCorner)); connect(account_new, SIGNAL(triggered()), this, SLOT(slotAccountNew())); // note : action "category_new" is included in this menu but defined below QAction *account_open = actionCollection()->addAction("account_open"); account_open->setText(i18n("Open ledger")); - account_open->setIcon(QIcon::fromTheme("view-financial-list", - QIcon::fromTheme(QStringLiteral("ledger")))); + account_open->setIcon(QIcon::fromTheme(g_Icons[Icon::ViewFinancialList])); connect(account_open, SIGNAL(triggered()), this, SLOT(slotAccountOpen())); QAction *account_reconcile = actionCollection()->addAction("account_reconcile"); account_reconcile->setText(i18n("Reconcile...")); - account_reconcile->setIcon(QIcon::fromTheme(QStringLiteral("merge"), - QIcon::fromTheme(QStringLiteral("reconcile")))); + account_reconcile->setIcon(QIcon::fromTheme(g_Icons[Icon::Reconcile])); actionCollection()->setDefaultShortcut(account_reconcile, QKeySequence("Ctrl+Shift+R")); connect(account_reconcile, SIGNAL(triggered()), this, SLOT(slotAccountReconcileStart())); QAction *account_reconcile_finish = actionCollection()->addAction("account_reconcile_finish"); account_reconcile_finish->setText(i18nc("Finish reconciliation", "Finish")); - account_reconcile_finish->setIcon(KMyMoneyUtils::overlayIcon("merge", "dialog-ok")); + account_reconcile_finish->setIcon(KMyMoneyUtils::overlayIcon(g_Icons[Icon::Merge], g_Icons[Icon::DialogOK])); connect(account_reconcile_finish, SIGNAL(triggered()), this, SLOT(slotAccountReconcileFinish())); QAction *account_reconcile_postpone = actionCollection()->addAction("account_reconcile_postpone"); account_reconcile_postpone->setText(i18n("Postpone reconciliation")); - account_reconcile_postpone->setIcon(QIcon::fromTheme("media-playback-pause")); + account_reconcile_postpone->setIcon(QIcon::fromTheme(g_Icons[Icon::MediaPlaybackPause])); connect(account_reconcile_postpone, SIGNAL(triggered()), this, SLOT(slotAccountReconcilePostpone())); QAction *account_edit = actionCollection()->addAction("account_edit"); account_edit->setText(i18n("Edit account...")); - account_edit->setIcon(KMyMoneyUtils::overlayIcon("view-bank-account", "document-edit")); + account_edit->setIcon(KMyMoneyUtils::overlayIcon(g_Icons[Icon::ViewBankAccount], g_Icons[Icon::DocumentEdit])); connect(account_edit, SIGNAL(triggered()), this, SLOT(slotAccountEdit())); QAction *account_delete = actionCollection()->addAction("account_delete"); account_delete->setText(i18n("Delete account...")); - account_delete->setIcon(KMyMoneyUtils::overlayIcon("view-bank-account", "edit-delete")); + account_delete->setIcon(KMyMoneyUtils::overlayIcon(g_Icons[Icon::ViewBankAccount], g_Icons[Icon::EditDelete])); connect(account_delete, SIGNAL(triggered()), this, SLOT(slotAccountDelete())); QAction *account_close = actionCollection()->addAction("account_close"); account_close->setText(i18n("Close account")); - account_close->setIcon(KMyMoneyUtils::overlayIcon("view-bank-account", "dialog-close")); + account_close->setIcon(KMyMoneyUtils::overlayIcon(g_Icons[Icon::ViewBankAccount], g_Icons[Icon::DialogClose])); connect(account_close, SIGNAL(triggered()), this, SLOT(slotAccountClose())); QAction *account_reopen = actionCollection()->addAction("account_reopen"); account_reopen->setText(i18n("Reopen account")); - account_reopen->setIcon(KMyMoneyUtils::overlayIcon("view-bank-account", "dialog-ok")); + account_reopen->setIcon(KMyMoneyUtils::overlayIcon(g_Icons[Icon::ViewBankAccount], g_Icons[Icon::DialogOK])); connect(account_reopen, SIGNAL(triggered()), this, SLOT(slotAccountReopen())); QAction *account_transaction_report = actionCollection()->addAction("account_transaction_report"); account_transaction_report->setText(i18n("Transaction report")); - account_transaction_report->setIcon(QIcon::fromTheme(QStringLiteral("view-financial-list"), - QIcon::fromTheme(QStringLiteral("ledger")))); + account_transaction_report->setIcon(QIcon::fromTheme(g_Icons[Icon::ViewFinancialList])); connect(account_transaction_report, SIGNAL(triggered()), this, SLOT(slotAccountTransactionReport())); QAction *account_chart = actionCollection()->addAction("account_chart"); account_chart->setText(i18n("Show balance chart...")); - account_chart->setIcon(QIcon::fromTheme(QStringLiteral("office-chart-line"), - QIcon::fromTheme(QStringLiteral("report-line"), - QIcon::fromTheme(QStringLiteral("account-types-investments"))))); + account_chart->setIcon(QIcon::fromTheme(g_Icons[Icon::OfficeChartLine])); connect(account_chart, SIGNAL(triggered()), this, SLOT(slotAccountChart())); QAction *account_online_map = actionCollection()->addAction("account_online_map"); account_online_map->setText(i18n("Map to online account...")); - account_online_map->setIcon(QIcon::fromTheme("news-subscribe")); + account_online_map->setIcon(QIcon::fromTheme(g_Icons[Icon::NewsSubscribe])); connect(account_online_map, SIGNAL(triggered()), this, SLOT(slotAccountMapOnline())); QAction *account_online_unmap = actionCollection()->addAction("account_online_unmap"); account_online_unmap->setText(i18n("Unmap account...")); - account_online_unmap->setIcon(QIcon::fromTheme("news-unsubscribe")); + account_online_unmap->setIcon(QIcon::fromTheme(g_Icons[Icon::NewsUnsubscribe])); connect(account_online_unmap, SIGNAL(triggered()), this, SLOT(slotAccountUnmapOnline())); - KActionMenu* menu = new KActionMenu(KMyMoneyUtils::overlayIcon("view-bank-account", "download"), i18nc("Update online accounts menu", "Update"), this); + KActionMenu* menu = new KActionMenu(KMyMoneyUtils::overlayIcon(g_Icons[Icon::ViewBankAccount], g_Icons[Icon::Download]), i18nc("Update online accounts menu", "Update"), this); actionCollection()->addAction("account_online_update_menu", menu); // activating the menu button is the same as selecting the current account @@ -771,19 +767,19 @@ QAction *account_online_update = actionCollection()->addAction("account_online_update"); account_online_update->setText(i18n("Update account...")); - account_online_update->setIcon(KMyMoneyUtils::overlayIcon("view-bank-account", "download")); + account_online_update->setIcon(KMyMoneyUtils::overlayIcon(g_Icons[Icon::ViewBankAccount], g_Icons[Icon::Download])); connect(account_online_update, SIGNAL(triggered()), this, SLOT(slotAccountUpdateOnline())); menu->addAction(account_online_update); QAction *account_online_update_all = actionCollection()->addAction("account_online_update_all"); account_online_update_all->setText(i18n("Update all accounts...")); - account_online_update_all->setIcon(KMyMoneyUtils::overlayIcon("view-bank-account", "download")); + account_online_update_all->setIcon(KMyMoneyUtils::overlayIcon(g_Icons[Icon::ViewBankAccount], g_Icons[Icon::Download])); connect(account_online_update_all, SIGNAL(triggered()), this, SLOT(slotAccountUpdateOnlineAll())); menu->addAction(account_online_update_all); QAction *account_online_transfer = actionCollection()->addAction("account_online_new_credit_transfer"); account_online_transfer->setText(i18n("New credit transfer")); - account_online_transfer->setIcon(KMyMoneyUtils::overlayIcon("view-bank-account", "mail-message-new")); + account_online_transfer->setIcon(KMyMoneyUtils::overlayIcon(g_Icons[Icon::ViewBankAccount], g_Icons[Icon::MailMessageNew])); connect(account_online_transfer, SIGNAL(triggered()), this, SLOT(slotNewOnlineTransfer())); connect(onlineJobAdministration::instance(), SIGNAL(canSendCreditTransferChanged(bool)), account_online_transfer, SLOT(setEnabled(bool))); @@ -792,17 +788,17 @@ // ******************* QAction *category_new = actionCollection()->addAction("category_new"); category_new->setText(i18n("New category...")); - category_new->setIcon(KMyMoneyUtils::overlayIcon("view-financial-categories", "list-add", Qt::TopRightCorner)); + category_new->setIcon(KMyMoneyUtils::overlayIcon(g_Icons[Icon::ViewFinancialCategories], g_Icons[Icon::ListAdd], Qt::TopRightCorner)); connect(category_new, SIGNAL(triggered()), this, SLOT(slotCategoryNew())); QAction *category_edit = actionCollection()->addAction("category_edit"); category_edit->setText(i18n("Edit category...")); - category_edit->setIcon(KMyMoneyUtils::overlayIcon("view-financial-categories", "document-edit")); + category_edit->setIcon(KMyMoneyUtils::overlayIcon(g_Icons[Icon::ViewFinancialCategories], g_Icons[Icon::DocumentEdit])); connect(category_edit, SIGNAL(triggered()), this, SLOT(slotAccountEdit())); QAction *category_delete = actionCollection()->addAction("category_delete"); category_delete->setText(i18n("Delete category...")); - category_delete->setIcon(KMyMoneyUtils::overlayIcon("view-financial-categories", "edit-delete")); + category_delete->setIcon(KMyMoneyUtils::overlayIcon(g_Icons[Icon::ViewFinancialCategories], g_Icons[Icon::EditDelete])); connect(category_delete, SIGNAL(triggered()), this, SLOT(slotAccountDelete())); // ************** @@ -810,12 +806,12 @@ // ************** QAction *tools_qif_editor = actionCollection()->addAction("tools_qif_editor"); tools_qif_editor->setText(i18n("QIF Profile Editor...")); - tools_qif_editor->setIcon(QIcon::fromTheme("document-properties")); + tools_qif_editor->setIcon(QIcon::fromTheme(g_Icons[Icon::DocumentProperties])); connect(tools_qif_editor, SIGNAL(triggered()), this, SLOT(slotQifProfileEditor())); QAction *tools_currency_editor = actionCollection()->addAction("tools_currency_editor"); tools_currency_editor->setText(i18n("Currencies...")); - tools_currency_editor->setIcon(QIcon::fromTheme("view-currency-list")); + tools_currency_editor->setIcon(QIcon::fromTheme(g_Icons[Icon::ViewCurrencyList])); connect(tools_currency_editor, SIGNAL(triggered()), this, SLOT(slotCurrencyDialog())); QAction *tools_price_editor = actionCollection()->addAction("tools_price_editor"); @@ -824,7 +820,7 @@ QAction *tools_update_prices = actionCollection()->addAction("tools_update_prices"); tools_update_prices->setText(i18n("Update Stock and Currency Prices...")); - tools_update_prices->setIcon(KMyMoneyUtils::overlayIcon("view-investment", "download")); + tools_update_prices->setIcon(KMyMoneyUtils::overlayIcon(g_Icons[Icon::ViewInvestment], g_Icons[Icon::Download])); connect(tools_update_prices, SIGNAL(triggered()), this, SLOT(slotEquityPriceUpdate())); QAction *tools_consistency_check = actionCollection()->addAction("tools_consistency_check"); @@ -833,7 +829,7 @@ QAction *tools_performancetest = actionCollection()->addAction("tools_performancetest"); tools_performancetest->setText(i18n("Performance-Test")); - tools_performancetest->setIcon(QIcon::fromTheme("fork")); + tools_performancetest->setIcon(QIcon::fromTheme(g_Icons[Icon::Fork])); connect(tools_performancetest, SIGNAL(triggered()), this, SLOT(slotPerformanceTest())); QAction *tools_generate_sql = actionCollection()->addAction("tools_generate_sql"); @@ -842,7 +838,7 @@ QAction *tools_kcalc = actionCollection()->addAction("tools_kcalc"); tools_kcalc->setText(i18n("Calculator...")); - tools_kcalc->setIcon(QIcon::fromTheme("accessories-calculator")); + tools_kcalc->setIcon(QIcon::fromTheme(g_Icons[Icon::AccessoriesCalculator])); connect(tools_kcalc, SIGNAL(triggered()), this, SLOT(slotToolsStartKCalc())); // ***************** @@ -863,8 +859,7 @@ // ************* QAction *help_show_tip = actionCollection()->addAction("help_show_tip"); help_show_tip->setText(i18n("&Show tip of the day")); - help_show_tip->setIcon(QIcon::fromTheme(QStringLiteral("ktip"), - QIcon::fromTheme(QStringLiteral("info")))); + help_show_tip->setIcon(QIcon::fromTheme(g_Icons[Icon::Tip])); connect(help_show_tip, SIGNAL(triggered()), this, SLOT(slotShowTipOfTheDay())); // *************************** @@ -872,7 +867,7 @@ // *************************** QAction *transaction_new = actionCollection()->addAction("transaction_new"); transaction_new->setText(i18nc("New transaction button", "New")); - transaction_new->setIcon(KMyMoneyUtils::overlayIcon("view-financial-transfer", "list-add", Qt::TopRightCorner)); + transaction_new->setIcon(KMyMoneyUtils::overlayIcon(g_Icons[Icon::ViewFinancialTransfer], g_Icons[Icon::ListAdd], Qt::TopRightCorner)); actionCollection()->setDefaultShortcut(transaction_new, QKeySequence(Qt::CTRL | Qt::Key_Insert)); connect(transaction_new, SIGNAL(triggered()), this, SLOT(slotTransactionsNew())); @@ -882,45 +877,42 @@ // the same shortcut to two actions) QAction *transaction_edit = actionCollection()->addAction("transaction_edit"); transaction_edit->setText(i18nc("Edit transaction button", "Edit")); - transaction_edit->setIcon(KMyMoneyUtils::overlayIcon("view-financial-transfer", "document-edit")); + transaction_edit->setIcon(KMyMoneyUtils::overlayIcon(g_Icons[Icon::ViewFinancialTransfer], g_Icons[Icon::DocumentEdit])); connect(transaction_edit, SIGNAL(triggered()), this, SLOT(slotTransactionsEdit())); QAction *transaction_enter = actionCollection()->addAction("transaction_enter"); transaction_enter->setText(i18nc("Enter transaction", "Enter")); - transaction_enter->setIcon(QIcon::fromTheme(QStringLiteral("dialog-ok"), - QIcon::fromTheme(QStringLiteral("finish")))); + transaction_enter->setIcon(QIcon::fromTheme(g_Icons[Icon::DialogOK])); connect(transaction_enter, SIGNAL(triggered()), this, SLOT(slotTransactionsEnter())); QAction *transaction_editsplits = actionCollection()->addAction("transaction_editsplits"); transaction_editsplits->setText(i18nc("Edit split button", "Edit splits")); - transaction_editsplits->setIcon(QIcon::fromTheme(QStringLiteral("split"), - QIcon::fromTheme(QStringLiteral("transaction-split")))); + transaction_editsplits->setIcon(QIcon::fromTheme(g_Icons[Icon::Split])); connect(transaction_editsplits, SIGNAL(triggered()), this, SLOT(slotTransactionsEditSplits())); QAction *transaction_cancel = actionCollection()->addAction("transaction_cancel"); transaction_cancel->setText(i18nc("Cancel transaction edit", "Cancel")); - transaction_cancel->setIcon(QIcon::fromTheme(QStringLiteral("dialog-cancel"), - QIcon::fromTheme(QStringLiteral("stop")))); + transaction_cancel->setIcon(QIcon::fromTheme(g_Icons[Icon::DialogCancel])); connect(transaction_cancel, SIGNAL(triggered()), this, SLOT(slotTransactionsCancel())); QAction *transaction_delete = actionCollection()->addAction("transaction_delete"); transaction_delete->setText(i18nc("Delete transaction", "Delete")); - transaction_delete->setIcon(QIcon::fromTheme("edit-delete")); + transaction_delete->setIcon(QIcon::fromTheme(g_Icons[Icon::EditDelete])); connect(transaction_delete, SIGNAL(triggered()), this, SLOT(slotTransactionsDelete())); QAction *transaction_duplicate = actionCollection()->addAction("transaction_duplicate"); transaction_duplicate->setText(i18nc("Duplicate transaction", "Duplicate")); - transaction_duplicate->setIcon(QIcon::fromTheme("edit-copy")); + transaction_duplicate->setIcon(QIcon::fromTheme(g_Icons[Icon::EditCopy])); connect(transaction_duplicate, SIGNAL(triggered()), this, SLOT(slotTransactionDuplicate())); QAction *transaction_match = actionCollection()->addAction("transaction_match"); transaction_match->setText(i18nc("Button text for match transaction", "Match")); - transaction_match->setIcon(KMyMoneyUtils::overlayIcon("view-financial-transfer", "document-import")); + transaction_match->setIcon(KMyMoneyUtils::overlayIcon(g_Icons[Icon::ViewFinancialTransfer], g_Icons[Icon::DocumentImport])); connect(transaction_match, SIGNAL(triggered()), this, SLOT(slotTransactionMatch())); QAction *transaction_accept = actionCollection()->addAction("transaction_accept"); transaction_accept->setText(i18nc("Accept 'imported' and 'matched' transaction", "Accept")); - transaction_accept->setIcon(KMyMoneyUtils::overlayIcon("view-financial-transfer", "dialog-ok-apply")); + transaction_accept->setIcon(KMyMoneyUtils::overlayIcon(g_Icons[Icon::ViewFinancialTransfer], g_Icons[Icon::DialogOKApply])); connect(transaction_accept, SIGNAL(triggered()), this, SLOT(slotTransactionsAccept())); QAction *transaction_mark_toggle = actionCollection()->addAction("transaction_mark_toggle"); @@ -949,17 +941,17 @@ QAction *transaction_goto_account = actionCollection()->addAction("transaction_goto_account"); transaction_goto_account->setText(i18n("Go to account")); - transaction_goto_account->setIcon(QIcon::fromTheme("go-jump")); + transaction_goto_account->setIcon(QIcon::fromTheme(g_Icons[Icon::GoJump])); connect(transaction_goto_account, SIGNAL(triggered()), this, SLOT(slotTransactionGotoAccount())); QAction *transaction_goto_payee = actionCollection()->addAction("transaction_goto_payee"); transaction_goto_payee->setText(i18n("Go to payee")); - transaction_goto_payee->setIcon(QIcon::fromTheme("go-jump")); + transaction_goto_payee->setIcon(QIcon::fromTheme(g_Icons[Icon::GoJump])); connect(transaction_goto_payee, SIGNAL(triggered()), this, SLOT(slotTransactionGotoPayee())); QAction *transaction_create_schedule = actionCollection()->addAction("transaction_create_schedule"); transaction_create_schedule->setText(i18n("Create scheduled transaction...")); - transaction_create_schedule->setIcon(QIcon::fromTheme("appointment-new")); + transaction_create_schedule->setIcon(QIcon::fromTheme(g_Icons[Icon::AppointmentNew])); connect(transaction_create_schedule, SIGNAL(triggered()), this, SLOT(slotTransactionCreateSchedule())); QAction *transaction_assign_number = actionCollection()->addAction("transaction_assign_number"); @@ -978,22 +970,22 @@ //Investment QAction *investment_new = actionCollection()->addAction("investment_new"); investment_new->setText(i18n("New investment...")); - investment_new->setIcon(KMyMoneyUtils::overlayIcon("view-investment", "list-add", Qt::TopRightCorner)); + investment_new->setIcon(KMyMoneyUtils::overlayIcon(g_Icons[Icon::ViewInvestment], g_Icons[Icon::ListAdd], Qt::TopRightCorner)); connect(investment_new, SIGNAL(triggered()), this, SLOT(slotInvestmentNew())); QAction *investment_edit = actionCollection()->addAction("investment_edit"); investment_edit->setText(i18n("Edit investment...")); - investment_edit->setIcon(KMyMoneyUtils::overlayIcon("view-investment", "document-edit")); + investment_edit->setIcon(KMyMoneyUtils::overlayIcon(g_Icons[Icon::ViewInvestment], g_Icons[Icon::DocumentEdit])); connect(investment_edit, SIGNAL(triggered()), this, SLOT(slotInvestmentEdit())); QAction *investment_delete = actionCollection()->addAction("investment_delete"); investment_delete->setText(i18n("Delete investment...")); - investment_delete->setIcon(KMyMoneyUtils::overlayIcon("view-investment", "edit-delete")); + investment_delete->setIcon(KMyMoneyUtils::overlayIcon(g_Icons[Icon::ViewInvestment], g_Icons[Icon::EditDelete])); connect(investment_delete, SIGNAL(triggered()), this, SLOT(slotInvestmentDelete())); QAction *investment_online_price_update = actionCollection()->addAction("investment_online_price_update"); investment_online_price_update->setText(i18n("Online price update...")); - investment_online_price_update->setIcon(KMyMoneyUtils::overlayIcon("view-investment", "download")); + investment_online_price_update->setIcon(KMyMoneyUtils::overlayIcon(g_Icons[Icon::ViewInvestment], g_Icons[Icon::Download])); connect(investment_online_price_update, SIGNAL(triggered()), this, SLOT(slotOnlinePriceUpdate())); QAction *investment_manual_price_update = actionCollection()->addAction("investment_manual_price_update"); @@ -1003,143 +995,142 @@ //Schedule QAction *schedule_new = actionCollection()->addAction("schedule_new"); schedule_new->setText(i18n("New scheduled transaction")); - schedule_new->setIcon(QIcon::fromTheme("appointment-new")); + schedule_new->setIcon(QIcon::fromTheme(g_Icons[Icon::AppointmentNew])); connect(schedule_new, SIGNAL(triggered()), this, SLOT(slotScheduleNew())); QAction *schedule_edit = actionCollection()->addAction("schedule_edit"); schedule_edit->setText(i18n("Edit scheduled transaction")); - schedule_edit->setIcon(QIcon::fromTheme("document-edit")); + schedule_edit->setIcon(QIcon::fromTheme(g_Icons[Icon::DocumentEdit])); connect(schedule_edit, SIGNAL(triggered()), this, SLOT(slotScheduleEdit())); QAction *schedule_delete = actionCollection()->addAction("schedule_delete"); schedule_delete->setText(i18n("Delete scheduled transaction")); - schedule_delete->setIcon(QIcon::fromTheme("edit-delete")); + schedule_delete->setIcon(QIcon::fromTheme(g_Icons[Icon::EditDelete])); connect(schedule_delete, SIGNAL(triggered()), this, SLOT(slotScheduleDelete())); QAction *schedule_duplicate = actionCollection()->addAction("schedule_duplicate"); schedule_duplicate->setText(i18n("Duplicate scheduled transaction")); - schedule_duplicate->setIcon(QIcon::fromTheme("edit-copy")); + schedule_duplicate->setIcon(QIcon::fromTheme(g_Icons[Icon::EditCopy])); connect(schedule_duplicate, SIGNAL(triggered()), this, SLOT(slotScheduleDuplicate())); QAction *schedule_enter = actionCollection()->addAction("schedule_enter"); schedule_enter->setText(i18n("Enter next transaction...")); - schedule_enter->setIcon(QIcon::fromTheme("key-enter")); + schedule_enter->setIcon(QIcon::fromTheme(g_Icons[Icon::KeyEnter])); connect(schedule_enter, SIGNAL(triggered()), this, SLOT(slotScheduleEnter())); QAction *schedule_skip = actionCollection()->addAction("schedule_skip"); schedule_skip->setText(i18n("Skip next transaction...")); - schedule_skip->setIcon(QIcon::fromTheme("media-seek-forward")); + schedule_skip->setIcon(QIcon::fromTheme(g_Icons[Icon::MediaSeekForward])); connect(schedule_skip, SIGNAL(triggered()), this, SLOT(slotScheduleSkip())); //Payees QAction *payee_new = actionCollection()->addAction("payee_new"); payee_new->setText(i18n("New payee")); - payee_new->setIcon(QIcon::fromTheme("list-add-user")); + payee_new->setIcon(QIcon::fromTheme(g_Icons[Icon::ListAddUser])); connect(payee_new, SIGNAL(triggered()), this, SLOT(slotPayeeNew())); QAction *payee_rename = actionCollection()->addAction("payee_rename"); payee_rename->setText(i18n("Rename payee")); - payee_rename->setIcon(QIcon::fromTheme("user-properties")); + payee_rename->setIcon(QIcon::fromTheme(g_Icons[Icon::PayeeRename])); connect(payee_rename, SIGNAL(triggered()), this, SIGNAL(payeeRename())); QAction *payee_delete = actionCollection()->addAction("payee_delete"); payee_delete->setText(i18n("Delete payee")); - payee_delete->setIcon(QIcon::fromTheme("list-remove-user")); + payee_delete->setIcon(QIcon::fromTheme(g_Icons[Icon::ListRemoveUser])); connect(payee_delete, SIGNAL(triggered()), this, SLOT(slotPayeeDelete())); QAction *payee_merge = actionCollection()->addAction("payee_merge"); payee_merge->setText(i18n("Merge payees")); - payee_merge->setIcon(QIcon::fromTheme("merge")); + payee_merge->setIcon(QIcon::fromTheme(g_Icons[Icon::PayeeMerge])); connect(payee_merge, SIGNAL(triggered()), this, SLOT(slotPayeeMerge())); //Tags QAction *tag_new = actionCollection()->addAction("tag_new"); tag_new->setText(i18n("New tag")); - tag_new->setIcon(QIcon::fromTheme("list-add-tag")); + tag_new->setIcon(QIcon::fromTheme(g_Icons[Icon::ListAddTag])); connect(tag_new, SIGNAL(triggered()), this, SLOT(slotTagNew())); QAction *tag_rename = actionCollection()->addAction("tag_rename"); tag_rename->setText(i18n("Rename tag")); - tag_rename->setIcon(QIcon::fromTheme("tag-rename")); + tag_rename->setIcon(QIcon::fromTheme(g_Icons[Icon::TagRename])); connect(tag_rename, SIGNAL(triggered()), this, SIGNAL(tagRename())); QAction *tag_delete = actionCollection()->addAction("tag_delete"); tag_delete->setText(i18n("Delete tag")); - tag_delete->setIcon(QIcon::fromTheme("list-remove-tag")); + tag_delete->setIcon(QIcon::fromTheme(g_Icons[Icon::ListRemoveTag])); connect(tag_delete, SIGNAL(triggered()), this, SLOT(slotTagDelete())); //Budget QAction *budget_new = actionCollection()->addAction("budget_new"); budget_new->setText(i18n("New budget")); - budget_new->setIcon(KMyMoneyUtils::overlayIcon("view-time-schedule-calculus", "list-add", Qt::TopRightCorner)); + budget_new->setIcon(KMyMoneyUtils::overlayIcon(g_Icons[Icon::ViewTimeScheduleCalculus], g_Icons[Icon::ListAdd], Qt::TopRightCorner)); connect(budget_new, SIGNAL(triggered()), this, SLOT(slotBudgetNew())); QAction *budget_rename = actionCollection()->addAction("budget_rename"); budget_rename->setText(i18n("Rename budget")); - budget_rename->setIcon(KMyMoneyUtils::overlayIcon("view-time-schedule-calculus", "document-edit")); + budget_rename->setIcon(KMyMoneyUtils::overlayIcon(g_Icons[Icon::ViewTimeScheduleCalculus], g_Icons[Icon::DocumentEdit])); connect(budget_rename, SIGNAL(triggered()), this, SIGNAL(budgetRename())); QAction *budget_delete = actionCollection()->addAction("budget_delete"); budget_delete->setText(i18n("Delete budget")); - budget_delete->setIcon(KMyMoneyUtils::overlayIcon("view-time-schedule-calculus", "edit-delete")); + budget_delete->setIcon(KMyMoneyUtils::overlayIcon(g_Icons[Icon::ViewTimeScheduleCalculus], g_Icons[Icon::EditDelete])); connect(budget_delete, SIGNAL(triggered()), this, SLOT(slotBudgetDelete())); QAction *budget_copy = actionCollection()->addAction("budget_copy"); budget_copy->setText(i18n("Copy budget")); - budget_copy->setIcon(KMyMoneyUtils::overlayIcon("view-time-schedule-calculus", "edit-copy")); + budget_copy->setIcon(KMyMoneyUtils::overlayIcon(g_Icons[Icon::ViewTimeScheduleCalculus], g_Icons[Icon::EditCopy])); connect(budget_copy, SIGNAL(triggered()), this, SLOT(slotBudgetCopy())); QAction *budget_change_year = actionCollection()->addAction("budget_change_year"); budget_change_year->setText(i18n("Change budget year")); - budget_change_year->setIcon(QIcon::fromTheme("view-calendar")); + budget_change_year->setIcon(QIcon::fromTheme(g_Icons[Icon::ViewCalendar])); connect(budget_change_year, SIGNAL(triggered()), this, SLOT(slotBudgetChangeYear())); QAction *budget_forecast = actionCollection()->addAction("budget_forecast"); budget_forecast->setText(i18n("Budget based on forecast")); - budget_forecast->setIcon(QIcon::fromTheme("view-financial-forecast")); + budget_forecast->setIcon(QIcon::fromTheme(g_Icons[Icon::ViewForecast])); connect(budget_forecast, SIGNAL(triggered()), this, SLOT(slotBudgetForecast())); // Currency actions QAction *currency_new = actionCollection()->addAction("currency_new"); currency_new->setText(i18n("New currency")); - currency_new->setIcon(QIcon::fromTheme("document-new")); + currency_new->setIcon(QIcon::fromTheme(g_Icons[Icon::DocumentNew])); connect(currency_new, SIGNAL(triggered()), this, SLOT(slotCurrencyNew())); QAction *currency_rename = actionCollection()->addAction("currency_rename"); currency_rename->setText(i18n("Rename currency")); - currency_rename->setIcon(QIcon::fromTheme(QStringLiteral("edit-rename"), - QIcon::fromTheme(QStringLiteral("text-editor")))); + currency_rename->setIcon(QIcon::fromTheme(g_Icons[Icon::EditRename])); connect(currency_rename, SIGNAL(triggered()), this, SIGNAL(currencyRename())); QAction *currency_delete = actionCollection()->addAction("currency_delete"); currency_delete->setText(i18n("Delete currency")); - currency_delete->setIcon(QIcon::fromTheme("edit-delete")); + currency_delete->setIcon(QIcon::fromTheme(g_Icons[Icon::EditDelete])); connect(currency_delete, SIGNAL(triggered()), this, SLOT(slotCurrencyDelete())); QAction *currency_setbase = actionCollection()->addAction("currency_setbase"); currency_setbase->setText(i18n("Select as base currency")); - currency_setbase->setIcon(QIcon::fromTheme("kmymoney")); + currency_setbase->setIcon(QIcon::fromTheme(g_Icons[Icon::KMyMoney])); connect(currency_setbase, SIGNAL(triggered()), this, SLOT(slotCurrencySetBase())); //price actions QAction *price_new = actionCollection()->addAction("price_new"); price_new->setText(i18n("New price...")); - price_new->setIcon(QIcon::fromTheme("document-new")); + price_new->setIcon(QIcon::fromTheme(g_Icons[Icon::DocumentNew])); connect(price_new, SIGNAL(triggered()), this, SIGNAL(priceNew())); QAction *price_edit = actionCollection()->addAction("price_edit"); price_edit->setText(i18n("Edit price...")); - price_edit->setIcon(QIcon::fromTheme("document-edit")); + price_edit->setIcon(QIcon::fromTheme(g_Icons[Icon::DocumentEdit])); connect(price_edit, SIGNAL(triggered()), this, SIGNAL(priceEdit())); QAction *price_update = actionCollection()->addAction("price_update"); price_update->setText(i18n("Online Price Update...")); - price_update->setIcon(KMyMoneyUtils::overlayIcon("view-currency-list", "download")); + price_update->setIcon(KMyMoneyUtils::overlayIcon(g_Icons[Icon::ViewCurrencyList], g_Icons[Icon::Download])); connect(price_update, SIGNAL(triggered()), this, SIGNAL(priceOnlineUpdate())); QAction *price_delete = actionCollection()->addAction("price_delete"); price_delete->setText(i18n("Delete price...")); - price_delete->setIcon(QIcon::fromTheme("edit-delete")); + price_delete->setIcon(QIcon::fromTheme(g_Icons[Icon::EditDelete])); connect(price_delete, SIGNAL(triggered()), this, SIGNAL(priceDelete())); //debug actions @@ -1161,11 +1152,11 @@ // onlineJob actions QAction* onlineJob_delete = actionCollection()->addAction("onlinejob_delete"); onlineJob_delete->setText(i18n("Remove credit transfer")); - onlineJob_delete->setIcon(QIcon::fromTheme("edit-delete")); + onlineJob_delete->setIcon(QIcon::fromTheme(g_Icons[Icon::EditDelete])); QAction* onlineJob_edit = actionCollection()->addAction("onlinejob_edit"); onlineJob_edit->setText(i18n("Edit credit transfer")); - onlineJob_edit->setIcon(QIcon::fromTheme("document-edit")); + onlineJob_edit->setIcon(QIcon::fromTheme(g_Icons[Icon::DocumentEdit])); QAction* onlineJob_log = actionCollection()->addAction("onlinejob_log"); onlineJob_log->setText(i18n("Show log")); @@ -1193,16 +1184,10 @@ QMenu *menuContainer; menuContainer = static_cast(factory()->container("import", this)); - if (QIcon::hasThemeIcon(QStringLiteral("document-import"))) - menuContainer->setIcon(QIcon::fromTheme(QStringLiteral("document-import"))); - else - menuContainer->setIcon(QIcon::fromTheme(QStringLiteral("format-indent-less"))); + menuContainer->setIcon(QIcon::fromTheme(g_Icons[Icon::DocumentImport])); menuContainer = static_cast(factory()->container("export", this)); - if (QIcon::hasThemeIcon(QStringLiteral("document-export"))) - menuContainer->setIcon(QIcon::fromTheme(QStringLiteral("document-export"))); - else - menuContainer->setIcon(QIcon::fromTheme(QStringLiteral("format-indent-more"))); + menuContainer->setIcon(QIcon::fromTheme(g_Icons[Icon::DocumentExport])); } void KMyMoneyApp::connectActionsAndViews() diff --git a/kmymoney/kmymoneyutils.h b/kmymoney/kmymoneyutils.h --- a/kmymoney/kmymoneyutils.h +++ b/kmymoney/kmymoneyutils.h @@ -440,7 +440,7 @@ * This method overlays an icon over another one, to get a composite one * eg. an icon to add accounts */ - static QPixmap overlayIcon(const QString iconName, const QString overlayName, const Qt::Corner corner = Qt::BottomRightCorner, int size = 0); + static QPixmap overlayIcon(const QString &iconName, const QString &overlayName, const Qt::Corner corner = Qt::BottomRightCorner, const int size = 0); static void dissectTransaction(const MyMoneyTransaction& transaction, const MyMoneySplit& split, MyMoneySplit& assetAccountSplit, QList& feeSplits, QList& interestSplits, MyMoneySecurity& security, MyMoneySecurity& currency, MyMoneySplit::investTransactionTypeE& transactionType); diff --git a/kmymoney/kmymoneyutils.cpp b/kmymoney/kmymoneyutils.cpp --- a/kmymoney/kmymoneyutils.cpp +++ b/kmymoney/kmymoneyutils.cpp @@ -50,6 +50,9 @@ #include #include #include +#include + +using namespace Icons; KMyMoneyUtils::KMyMoneyUtils() { @@ -180,7 +183,7 @@ KGuiItem KMyMoneyUtils::scheduleNewGuiItem() { KGuiItem splitGuiItem(i18n("&New Schedule..."), - QIcon::fromTheme("document-new"), + QIcon::fromTheme(g_Icons[Icon::DocumentNew]), i18n("Create a new schedule."), i18n("Use this to create a new schedule.")); @@ -190,7 +193,7 @@ KGuiItem KMyMoneyUtils::accountsFilterGuiItem() { KGuiItem splitGuiItem(i18n("&Filter"), - QIcon::fromTheme("view-filter"), + QIcon::fromTheme(g_Icons[Icon::ViewFilter]), i18n("Filter out accounts"), i18n("Use this to filter out accounts")); @@ -563,97 +566,62 @@ wizard->button(QWizard::BackButton)->setIcon(KStandardGuiItem::back(KStandardGuiItem::UseRTL).icon()); } -QPixmap KMyMoneyUtils::overlayIcon(const QString iconName, const QString overlayName, const Qt::Corner corner, int size) +QPixmap KMyMoneyUtils::overlayIcon(const QString &iconName, const QString &overlayName, const Qt::Corner corner, const int size) { - int x, y; - QPixmap result; - QIcon icon; - QPixmap ovly; - QString overlaidIcon = iconName + '-' + overlayName; + QPixmap pxIcon; + QString kyIcon = iconName + overlayName; // If found in the cache, return quickly - if (QPixmapCache::find(overlaidIcon, result)) { - return result; - } + if (QPixmapCache::find(kyIcon, pxIcon)) + return pxIcon; // try to retrieve the main icon from cache - if (!QPixmapCache::find(iconName, result)) { - icon = QIcon::fromTheme(iconName); - if (icon.isNull()) { - QString iconReplacement; - if (iconName.compare(QLatin1String("view-bank-account")) == 0) - iconReplacement = "account"; - else if (iconName.compare(QLatin1String("view-investment")) == 0) - iconReplacement = "investment"; - else if (iconName.compare(QLatin1String("view-financial-categories")) == 0) - iconReplacement = "categories"; - else if (iconName.compare(QLatin1String("view-financial-transfer")) == 0) - iconReplacement = "ledger"; - else if (iconName.compare(QLatin1String("view-bank")) == 0) - iconReplacement = "bank"; - else if (iconName.compare(QLatin1String("view-time-schedule-calculus")) == 0) - iconReplacement = "budget"; - else if (iconName.compare(QLatin1String("merge")) == 0) - iconReplacement = "reconcile"; - else - iconReplacement = "unknown"; - icon = QIcon::fromTheme(iconReplacement); - if (icon.isNull()) - icon = QIcon::fromTheme("unknown"); - } - - if (!icon.availableSizes().isEmpty()) - result = icon.pixmap(size == 0 ? icon.availableSizes().first() : QSize(size, size)); - QPixmapCache::insert(iconName, result); + if (!QPixmapCache::find(iconName, pxIcon)) { + QIcon icon = QIcon::fromTheme(iconName); + QList sizes = icon.availableSizes(); + if (!sizes.isEmpty()) + pxIcon = icon.pixmap(size == 0 ? sizes.first() : QSize(size, size)); + QPixmapCache::insert(iconName, pxIcon); } - QPainter pixmapPainter(&result); - icon = QIcon::fromTheme(overlayName); - if (icon.isNull()) { - QString overlayReplacement; - if (overlayName.compare(QLatin1String("document-import")) == 0) - overlayReplacement = "format-indent-less"; - else if (overlayName.compare(QLatin1String("document-edit")) == 0) - overlayReplacement = "text-editor"; - else if (overlayName.compare(QLatin1String("dialog-ok-apply")) == 0) - overlayReplacement = "finish"; - else if (overlayName.compare(QLatin1String("download")) == 0) - overlayReplacement = "go-down"; - else - overlayReplacement = "unknown"; - icon = QIcon::fromTheme(overlayReplacement); - if (icon.isNull()) - icon = QIcon::fromTheme("unknown"); - } + if (overlayName.isEmpty()) // call from MyMoneyAccount::accountPixmap can have no overlay icon, so handle that appropriately + return pxIcon; - if (!icon.availableSizes().isEmpty()) - ovly = icon.pixmap(size == 0 ? icon.availableSizes().first() : QSize(size, size)); + QIcon overlay; + QPixmap pxOverlay; + QPainter pixmapPainter(&pxIcon); + overlay = QIcon::fromTheme(overlayName); + QList sizes = overlay.availableSizes(); + if (!sizes.isEmpty()) + pxOverlay = overlay.pixmap(size == 0 ? sizes.first() : QSize(size, size)); + + int x, y; switch (corner) { case Qt::TopLeftCorner: x = 0; y = 0; break; case Qt::TopRightCorner: - x = result.width() / 2; + x = pxIcon.width() / 2; y = 0; break; case Qt::BottomLeftCorner: x = 0; - y = result.height() / 2; + y = pxIcon.height() / 2; break; case Qt::BottomRightCorner: default: - x = result.width() / 2; - y = result.height() / 2; + x = pxIcon.width() / 2; + y = pxIcon.height() / 2; break; } - pixmapPainter.drawPixmap(x, y, result.width() / 2, result.height() / 2, ovly); + pixmapPainter.drawPixmap(x, y, pxIcon.width() / 2, pxIcon.height() / 2, pxOverlay); //save for later use - QPixmapCache::insert(overlaidIcon, result); + QPixmapCache::insert(kyIcon, pxIcon); - return result; + return pxIcon; } void KMyMoneyUtils::dissectTransaction(const MyMoneyTransaction& transaction, const MyMoneySplit& split, MyMoneySplit& assetAccountSplit, QList& feeSplits, QList& interestSplits, MyMoneySecurity& security, MyMoneySecurity& currency, MyMoneySplit::investTransactionTypeE& transactionType) diff --git a/kmymoney/models/accountsmodel.cpp b/kmymoney/models/accountsmodel.cpp --- a/kmymoney/models/accountsmodel.cpp +++ b/kmymoney/models/accountsmodel.cpp @@ -37,6 +37,9 @@ #include "mymoneyfile.h" #include "kmymoneyutils.h" #include "kmymoneyglobalsettings.h" +#include + +using namespace Icons; class AccountsModel::Private { @@ -125,8 +128,7 @@ model->setData(newIndex, KMyMoneyUtils::accountTypeToString(account.accountType()), Qt::DisplayRole); model->setData(newIndex, font, Qt::FontRole); - QIcon icon = QIcon::fromTheme(QStringLiteral("dialog-ok"), - QIcon::fromTheme(QStringLiteral("finish"))); + QIcon icon = QIcon::fromTheme(g_Icons[Icon::DialogOK]); QPixmap checkMark; if (!icon.availableSizes().isEmpty()) checkMark = icon.pixmap(icon.availableSizes().first()); @@ -469,8 +471,7 @@ setData(favoriteAccountsItem->index(), favoritesAccountId, AccountIdRole); setData(favoriteAccountsItem->index(), 0, DisplayOrderRole); favoriteAccountsItem->setColumnCount(columnCount()); - favoriteAccountsItem->setIcon(QIcon::fromTheme(QStringLiteral("view-bank-account"), - QIcon::fromTheme(QStringLiteral("account")))); + favoriteAccountsItem->setIcon(QIcon::fromTheme(g_Icons[Icon::ViewBankAccount])); favoriteAccountsItem->setEditable(false); favoriteAccountsItem->setFont(font); diff --git a/kmymoney/models/onlinejobmessagesmodel.cpp b/kmymoney/models/onlinejobmessagesmodel.cpp --- a/kmymoney/models/onlinejobmessagesmodel.cpp +++ b/kmymoney/models/onlinejobmessagesmodel.cpp @@ -21,6 +21,9 @@ #include #include +#include + +using namespace Icons; onlineJobMessagesModel::onlineJobMessagesModel(QObject* parent) : QAbstractTableModel(parent), @@ -41,9 +44,9 @@ case Qt::DecorationRole: switch (messages[index.row()].type()) { case onlineJobMessage::debug: case onlineJobMessage::log: - case onlineJobMessage::information: return QIcon::fromTheme("dialog-information"); - case onlineJobMessage::warning: return QIcon::fromTheme("dialog-warning"); - case onlineJobMessage::error: return QIcon::fromTheme("dialog-error"); + case onlineJobMessage::information: return QIcon::fromTheme(g_Icons[Icon::DialogInformation]); + case onlineJobMessage::warning: return QIcon::fromTheme(g_Icons[Icon::DialogWarning]); + case onlineJobMessage::error: return QIcon::fromTheme(g_Icons[Icon::DialogError]); } case Qt::ToolTipRole: switch (messages[index.row()].type()) { case onlineJobMessage::debug: return i18n("Information to find issues."); diff --git a/kmymoney/models/onlinejobmodel.cpp b/kmymoney/models/onlinejobmodel.cpp --- a/kmymoney/models/onlinejobmodel.cpp +++ b/kmymoney/models/onlinejobmodel.cpp @@ -28,7 +28,9 @@ #include "onlinetasks/interfaces/tasks/onlinetask.h" #include "onlinetasks/interfaces/tasks/credittransfer.h" #include "mymoney/onlinejobtyped.h" +#include +using namespace Icons; onlineJobModel::onlineJobModel(QObject *parent) : QAbstractTableModel(parent), @@ -133,19 +135,19 @@ return QVariant::fromValue(job.responsibleMyMoneyAccount().name()); } else if (role == Qt::DecorationRole) { if (job.isLocked()) - return QIcon::fromTheme("task-ongoing"); + return QIcon::fromTheme(g_Icons[Icon::TaskOngoing]); switch (job.bankAnswerState()) { - case onlineJob::acceptedByBank: return QIcon::fromTheme("task-complete"); + case onlineJob::acceptedByBank: return QIcon::fromTheme(g_Icons[Icon::TaskComplete]); case onlineJob::sendingError: case onlineJob::abortedByUser: - case onlineJob::rejectedByBank: return QIcon::fromTheme("task-reject"); + case onlineJob::rejectedByBank: return QIcon::fromTheme(g_Icons[Icon::TaskReject]); case onlineJob::noBankAnswer: break; } if (job.sendDate().isValid()) { - return QIcon::fromTheme("task-accepted"); + return QIcon::fromTheme(g_Icons[Icon::TaskAccepted]); } else if (!job.isValid()) { - return QIcon::fromTheme("task-attention"); + return QIcon::fromTheme(g_Icons[Icon::TaskAttention]); } } else if (role == Qt::ToolTipRole) { if (job.isLocked()) diff --git a/kmymoney/mymoney/CMakeLists.txt b/kmymoney/mymoney/CMakeLists.txt --- a/kmymoney/mymoney/CMakeLists.txt +++ b/kmymoney/mymoney/CMakeLists.txt @@ -56,6 +56,7 @@ target_link_libraries(kmm_mymoney PUBLIC + kmm_icons Qt5::Gui Qt5::Xml Qt5::Core diff --git a/kmymoney/mymoney/mymoneyaccount.h b/kmymoney/mymoney/mymoneyaccount.h --- a/kmymoney/mymoney/mymoneyaccount.h +++ b/kmymoney/mymoney/mymoneyaccount.h @@ -597,7 +597,7 @@ * @param size is a hint for the size of the icon * @return a pixmap using DesktopIcon for the account type */ - QPixmap accountPixmap(bool reconcileFlag = false, int size = 0) const; + QPixmap accountPixmap(const bool reconcileFlag = false, const int size = 0) const; /** * This method is used to convert the internal representation of diff --git a/kmymoney/mymoney/mymoneyaccount.cpp b/kmymoney/mymoney/mymoneyaccount.cpp --- a/kmymoney/mymoney/mymoneyaccount.cpp +++ b/kmymoney/mymoney/mymoneyaccount.cpp @@ -41,8 +41,10 @@ #include "payeeidentifier/ibanandbic/ibanbic.h" #include "payeeidentifier/nationalaccount/nationalaccount.h" #include "mymoneystoragenames.h" +#include using namespace MyMoneyStorageNodes; +using namespace Icons; MyMoneyAccount::MyMoneyAccount() : m_accountType(UnknownAccountType), @@ -660,110 +662,60 @@ } -QPixmap MyMoneyAccount::accountPixmap(bool reconcileFlag, int size) const -{ - QIcon icon; - switch (accountType()) { - default: - if (accountGroup() == MyMoneyAccount::Asset) - icon = QIcon::fromTheme(QStringLiteral("view-bank-account"), - QIcon::fromTheme(QStringLiteral("account-types-asset"))); - else - icon = QIcon::fromTheme(QStringLiteral("view-loan"), - QIcon::fromTheme(QStringLiteral("account-types-liability"))); - break; - - case MyMoneyAccount::Investment: - case MyMoneyAccount::Stock: - case MyMoneyAccount::MoneyMarket: - case MyMoneyAccount::CertificateDep: - icon = QIcon::fromTheme(QStringLiteral("view-stock-account"), - QIcon::fromTheme(QStringLiteral("account-types-investments"))); - break; - - case MyMoneyAccount::Checkings: - icon = QIcon::fromTheme(QStringLiteral("view-bank-account-checking"), - QIcon::fromTheme(QStringLiteral("account-types-checking"))); - break; - case MyMoneyAccount::Savings: - icon = QIcon::fromTheme(QStringLiteral("view-bank-account-savings"), - QIcon::fromTheme(QStringLiteral("account-types-savings"))); - break; - - case MyMoneyAccount::AssetLoan: - icon = QIcon::fromTheme(QStringLiteral("view-loan-asset"), - QIcon::fromTheme(QStringLiteral("account-types-loan"))); - break; - - case MyMoneyAccount::Loan: - icon = QIcon::fromTheme(QStringLiteral("view-loan"), - QIcon::fromTheme(QStringLiteral("account-types-loan"))); - break; - - case MyMoneyAccount::CreditCard: - icon = QIcon::fromTheme(QStringLiteral("view-credit-card-account"), - QIcon::fromTheme(QStringLiteral("account-types-credit-card"))); - break; - - case MyMoneyAccount::Asset: - icon = QIcon::fromTheme(QStringLiteral("view-bank-account"), - QIcon::fromTheme(QStringLiteral("account-types-asset"))); - break; - - case MyMoneyAccount::Cash: - icon = QIcon::fromTheme(QStringLiteral("account-types-cash")); - break; - - case MyMoneyAccount::Income: - icon = QIcon::fromTheme(QStringLiteral("view-income-categories"), - QIcon::fromTheme(QStringLiteral("account-types-income"))); - break; - - case MyMoneyAccount::Expense: - icon = QIcon::fromTheme(QStringLiteral("view-expenses-categories"), - QIcon::fromTheme(QStringLiteral("account-types-expense"))); - break; - - case MyMoneyAccount::Equity: - icon = QIcon::fromTheme(QStringLiteral("view-bank-account"), - QIcon::fromTheme(QStringLiteral("account"))); - break; - } - - if (icon.isNull()) - icon = QIcon::fromTheme(QStringLiteral("unknown")); +QPixmap MyMoneyAccount::accountPixmap(const bool reconcileFlag, const int size) const +{ + static const QHash accToIco { + {MyMoneyAccount::Asset, Icon::ViewAsset}, + {MyMoneyAccount::Investment, Icon::ViewStock}, + {MyMoneyAccount::Stock, Icon::ViewStock}, + {MyMoneyAccount::MoneyMarket, Icon::ViewStock}, + {MyMoneyAccount::Checkings, Icon::ViewChecking}, + {MyMoneyAccount::Savings, Icon::ViewSaving}, + {MyMoneyAccount::AssetLoan, Icon::ViewLoanAsset}, + {MyMoneyAccount::Loan, Icon::ViewLoan}, + {MyMoneyAccount::CreditCard, Icon::ViewCreditCard}, + {MyMoneyAccount::Asset, Icon::ViewAsset}, + {MyMoneyAccount::Cash, Icon::ViewCash}, + {MyMoneyAccount::Income, Icon::ViewIncome}, + {MyMoneyAccount::Expense, Icon::ViewExpense}, + {MyMoneyAccount::Equity, Icon::ViewEquity} + }; - QString iconKey = icon.name() + QString(size); - QPixmap result; + Icon ixIcon = accToIco.value(accountType(), Icon::ViewLiability); + QString kyIcon = g_Icons[ixIcon] + QString(size); + QPixmap pxIcon; - if (!QPixmapCache::find(iconKey, result)) { - if (!icon.availableSizes().isEmpty()) - result = icon.pixmap(size == 0 ? icon.availableSizes().first() : QSize(size, size)); // hack: Qt::AA_UseHighDpiPixmaps (in Qt 5.7) doesn't return highdpi pixmap so get it manually - QPixmapCache::insert(iconKey, result); + if (!QPixmapCache::find(kyIcon, pxIcon)) { + QIcon icon = QIcon::fromTheme(g_Icons[ixIcon]); + QList sizes = icon.availableSizes(); + if (!sizes.isEmpty()) + pxIcon = icon.pixmap(size == 0 ? sizes.first() : QSize(size, size)); // hack: Qt::AA_UseHighDpiPixmaps (in Qt 5.7) doesn't return highdpi pixmap so get it manually + else + return pxIcon; + QPixmapCache::insert(kyIcon, pxIcon); } - QPainter pixmapPainter(&result); - QPixmap ovly; - if (isClosed()) { - icon = QIcon::fromTheme(QStringLiteral("dialog-close"), - QIcon::fromTheme(QStringLiteral("account-types-closed"))); - if (!icon.availableSizes().isEmpty()) - ovly = icon.pixmap(size == 0 ? icon.availableSizes().first() : QSize(size, size)); - pixmapPainter.drawPixmap(ovly.width() / 2, ovly.height() / 2, ovly.width() / 2, ovly.height() / 2, ovly); - } else if (reconcileFlag) { - icon = QIcon::fromTheme(QStringLiteral("flag-green"), - QIcon::fromTheme(QStringLiteral("reconciled"))); - if (!icon.availableSizes().isEmpty()) - ovly = icon.pixmap(size == 0 ? icon.availableSizes().first() : QSize(size, size)); - pixmapPainter.drawPixmap(size / 2, size / 2, ovly.width() / 2, ovly.height() / 2, ovly); - } else if (!onlineBankingSettings().value("provider").isEmpty()) { - icon = QIcon::fromTheme(QStringLiteral("download"), - QIcon::fromTheme(QStringLiteral("go-down"))); - if (!icon.availableSizes().isEmpty()) - ovly = icon.pixmap(size == 0 ? icon.availableSizes().first() : QSize(size, size)); - pixmapPainter.drawPixmap(size / 2, size / 2, ovly.width() / 2, ovly.height() / 2, ovly); + if (isClosed()) + ixIcon = Icon::AccountClosed; + else if (reconcileFlag) + ixIcon = Icon::FlagGreen; + else if (!onlineBankingSettings().value("provider").isEmpty()) + ixIcon = Icon::Download; + else + return pxIcon; + + QPixmap pxOverlay; + QIcon overlay = QIcon::fromTheme(g_Icons[ixIcon]); + QList sizes = overlay.availableSizes(); + if (!sizes.isEmpty()) { + pxOverlay = overlay.pixmap(size == 0 ? sizes.first() : QSize(size, size)); + + QPainter pxPainter(&pxIcon); + const QSize szIcon = pxIcon.size(); + pxPainter.drawPixmap(szIcon.width() / 2, szIcon.height() / 2, + szIcon.width() / 2, szIcon.height() / 2, pxOverlay); } - return result; + return pxIcon; } QString MyMoneyAccount::accountTypeToString(const MyMoneyAccount::accountTypeE accountType) diff --git a/kmymoney/plugins/csvexport/csvexportdlg.cpp b/kmymoney/plugins/csvexport/csvexportdlg.cpp --- a/kmymoney/plugins/csvexport/csvexportdlg.cpp +++ b/kmymoney/plugins/csvexport/csvexportdlg.cpp @@ -50,6 +50,9 @@ #include "kmymoneyaccountcombo.h" #include "kmymoneyutils.h" #include "models.h" +#include + +using namespace Icons; CsvExportDlg::CsvExportDlg(QWidget *parent) : QDialog(parent), ui(new Ui::CsvExportDlg) { @@ -66,13 +69,13 @@ KGuiItem::assign(ui->m_qbuttonCancel, KStandardGuiItem::cancel()); KGuiItem okButtonItem(i18n("&Export"), - QIcon::fromTheme("document-export"), + QIcon::fromTheme(g_Icons[Icon::DocumentExport]), i18n("Start operation"), i18n("Use this to start the export operation")); KGuiItem::assign(ui->m_qbuttonOk, okButtonItem); KGuiItem browseButtonItem(i18n("&Browse..."), - QIcon::fromTheme("document-open"), + QIcon::fromTheme(g_Icons[Icon::DocumentOpen]), i18n("Select filename"), i18n("Use this to select a filename to export to")); KGuiItem::assign(ui->m_qbuttonBrowse, browseButtonItem); diff --git a/kmymoney/plugins/csvimport/csvwizard.cpp b/kmymoney/plugins/csvimport/csvwizard.cpp --- a/kmymoney/plugins/csvimport/csvwizard.cpp +++ b/kmymoney/plugins/csvimport/csvwizard.cpp @@ -40,6 +40,7 @@ #include "csvutil.h" #include "convdate.h" +#include #include "ui_csvwizard.h" #include "ui_introwizardpage.h" #include "ui_separatorwizardpage.h" @@ -52,6 +53,8 @@ #include "ui_securitiesdlg.h" #include "ui_securitydlg.h" +using namespace Icons; + CSVWizard::CSVWizard(CsvImporterPlugin* plugin, CSVImporter* importer) : ui(new Ui::CSVWizard), m_plugin(plugin), @@ -67,15 +70,13 @@ m_lastId = -1; m_wiz->installEventFilter(this); // event filter for escape key presses - m_wiz->button(QWizard::BackButton)->setIcon(QIcon::fromTheme(QStringLiteral("go-previous"))); - m_wiz->button(QWizard::CancelButton)->setIcon(QIcon::fromTheme(QStringLiteral("dialog-cancel"), - QIcon::fromTheme(QStringLiteral("stop")))); - m_wiz->button(QWizard::CustomButton2)->setIcon(QIcon::fromTheme(QStringLiteral("kmymoney"))); - m_wiz->button(QWizard::FinishButton)->setIcon(QIcon::fromTheme(QStringLiteral("dialog-ok-apply"), - QIcon::fromTheme(QStringLiteral("finish")))); - m_wiz->button(QWizard::CustomButton1)->setIcon(QIcon::fromTheme(QStringLiteral("system-file-manager"))); - m_wiz->button(QWizard::CustomButton3)->setIcon(QIcon::fromTheme(QStringLiteral("invest-applet"))); - m_wiz->button(QWizard::NextButton)->setIcon(QIcon::fromTheme(QStringLiteral("go-next"))); + m_wiz->button(QWizard::BackButton)->setIcon(QIcon::fromTheme(g_Icons[Icon::ArrowLeft])); + m_wiz->button(QWizard::CancelButton)->setIcon(QIcon::fromTheme(g_Icons[Icon::DialogCancel])); + m_wiz->button(QWizard::CustomButton2)->setIcon(QIcon::fromTheme(g_Icons[Icon::KMyMoney])); + m_wiz->button(QWizard::FinishButton)->setIcon(QIcon::fromTheme(g_Icons[Icon::DialogOKApply])); + m_wiz->button(QWizard::CustomButton1)->setIcon(QIcon::fromTheme(g_Icons[Icon::FileArchiver])); + m_wiz->button(QWizard::CustomButton3)->setIcon(QIcon::fromTheme(g_Icons[Icon::InvestApplet])); + m_wiz->button(QWizard::NextButton)->setIcon(QIcon::fromTheme(g_Icons[Icon::ArrowRight])); m_pageIntro = new IntroPage(this, m_imp); m_wiz->setPage(PageIntro, m_pageIntro); diff --git a/kmymoney/plugins/csvimport/transactiondlg.cpp b/kmymoney/plugins/csvimport/transactiondlg.cpp --- a/kmymoney/plugins/csvimport/transactiondlg.cpp +++ b/kmymoney/plugins/csvimport/transactiondlg.cpp @@ -30,6 +30,13 @@ #include #include +// ---------------------------------------------------------------------------- +// Project Includes + +#include + +using namespace Icons; + TransactionDlg::TransactionDlg(const QStringList& colList, const QStringList& colHeaders, const qint8& typeCol, const QList& validActionTypes) : ui(new Ui::TransactionDlg) { @@ -49,13 +56,13 @@ MyMoneyStatement::Transaction::eaShrsout << MyMoneyStatement::Transaction::eaInterest; - QIcon icon = QIcon::fromTheme(QStringLiteral("dialog-ok"), QIcon::fromTheme(QStringLiteral("finish"))); + QIcon icon = QIcon::fromTheme(g_Icons[Icon::DialogOK]); if (!icon.availableSizes().isEmpty()) m_iconYes = icon.pixmap(icon.availableSizes().first()); else m_iconYes = QPixmap(); - icon = QIcon::fromTheme(QStringLiteral("dialog-cancel"), QIcon::fromTheme(QStringLiteral("stop"))); + icon = QIcon::fromTheme(g_Icons[Icon::DialogCancel]); if (!icon.availableSizes().isEmpty()) m_iconNo = icon.pixmap(icon.availableSizes().first()); else diff --git a/kmymoney/views/kaccountsview.cpp b/kmymoney/views/kaccountsview.cpp --- a/kmymoney/views/kaccountsview.cpp +++ b/kmymoney/views/kaccountsview.cpp @@ -47,6 +47,9 @@ #include "kmymoney.h" #include "kmymoneyaccounttreeview.h" #include "models.h" +#include + +using namespace Icons; KAccountsView::KAccountsView(QWidget *parent) : QWidget(parent) @@ -54,14 +57,12 @@ setupUi(this); // setup icons for collapse and expand button - KGuiItem collapseGuiItem("", - QIcon::fromTheme(QStringLiteral("zoom-out"), - QIcon::fromTheme(QStringLiteral("list-remove"))), + KGuiItem collapseGuiItem(QString(), + QIcon::fromTheme(g_Icons[Icon::ListCollapse]), QString(), QString()); - KGuiItem expandGuiItem("", - QIcon::fromTheme(QStringLiteral("zoom-in"), - QIcon::fromTheme(QStringLiteral("list-add"))), + KGuiItem expandGuiItem(QString(), + QIcon::fromTheme(g_Icons[Icon::ListExpand]), QString(), QString()); KGuiItem::assign(m_collapseButton, collapseGuiItem); diff --git a/kmymoney/views/kbudgetview.cpp b/kmymoney/views/kbudgetview.cpp --- a/kmymoney/views/kbudgetview.cpp +++ b/kmymoney/views/kbudgetview.cpp @@ -57,6 +57,9 @@ #include "knewbudgetdlg.h" #include "kmymoney.h" #include "models.h" +#include + +using namespace Icons; /** * @author Darren Gould @@ -312,49 +315,47 @@ m_budgetList->setRootIsDecorated(false); m_budgetList->setContextMenuPolicy(Qt::CustomContextMenu); - KGuiItem newButtonItem(QString(""), - KMyMoneyUtils::overlayIcon("view-time-schedule-calculus", "list-add", Qt::TopRightCorner), + KGuiItem newButtonItem(QString(), + KMyMoneyUtils::overlayIcon(g_Icons[Icon::ViewTimeScheduleCalculus], g_Icons[Icon::ListAdd], Qt::TopRightCorner), i18n("Creates a new budget"), i18n("Use this to create a new empty budget.")); KGuiItem::assign(m_newButton, newButtonItem); m_newButton->setToolTip(newButtonItem.toolTip()); - KGuiItem renameButtonItem(QString(""), - KMyMoneyUtils::overlayIcon("view-time-schedule-calculus", "document-edit"), + KGuiItem renameButtonItem(QString(), + KMyMoneyUtils::overlayIcon(g_Icons[Icon::ViewTimeScheduleCalculus], g_Icons[Icon::DocumentEdit]), i18n("Rename the current selected budget"), i18n("Use this to start renaming the selected budget.")); KGuiItem::assign(m_renameButton, renameButtonItem); m_renameButton->setToolTip(renameButtonItem.toolTip()); - KGuiItem deleteButtonItem(QString(""), - KMyMoneyUtils::overlayIcon("view-time-schedule-calculus", "edit-delete"), + KGuiItem deleteButtonItem(QString(), + KMyMoneyUtils::overlayIcon(g_Icons[Icon::ViewTimeScheduleCalculus], g_Icons[Icon::EditDelete]), i18n("Delete the current selected budget"), i18n("Use this to delete the selected budget.")); KGuiItem::assign(m_deleteButton, deleteButtonItem); m_deleteButton->setToolTip(deleteButtonItem.toolTip()); - KGuiItem updateButtonItem(QString(""), - QIcon::fromTheme("document-save"), + KGuiItem updateButtonItem(QString(), + QIcon::fromTheme(g_Icons[Icon::DocumentSave]), i18n("Accepts the entered values and stores the budget"), i18n("Use this to store the modified data.")); KGuiItem::assign(m_updateButton, updateButtonItem); m_updateButton->setToolTip(updateButtonItem.toolTip()); - KGuiItem resetButtonItem(QString(""), - QIcon::fromTheme("edit-undo"), + KGuiItem resetButtonItem(QString(), + QIcon::fromTheme(g_Icons[Icon::EditUndo]), i18n("Revert budget to last saved state"), i18n("Use this to discard the modified data.")); KGuiItem::assign(m_resetButton, resetButtonItem); m_resetButton->setToolTip(resetButtonItem.toolTip()); - KGuiItem collapseGuiItem("", - QIcon::fromTheme(QStringLiteral("zoom-out"), - QIcon::fromTheme(QStringLiteral("list-remove"))), + KGuiItem collapseGuiItem(QString(), + QIcon::fromTheme(g_Icons[Icon::ListCollapse]), QString(), QString()); - KGuiItem expandGuiItem("", - QIcon::fromTheme(QStringLiteral("zoom-in"), - QIcon::fromTheme(QStringLiteral("list-add"))), + KGuiItem expandGuiItem(QString(), + QIcon::fromTheme(g_Icons[Icon::ListExpand]), QString(), QString()); KGuiItem::assign(m_collapseButton, collapseGuiItem); diff --git a/kmymoney/views/kcategoriesview.cpp b/kmymoney/views/kcategoriesview.cpp --- a/kmymoney/views/kcategoriesview.cpp +++ b/kmymoney/views/kcategoriesview.cpp @@ -45,6 +45,9 @@ #include "kmymoneyglobalsettings.h" #include "kmymoney.h" #include "models.h" +#include + +using namespace Icons; KCategoriesView::KCategoriesView(QWidget *parent) : QWidget(parent), @@ -54,14 +57,12 @@ setupUi(this); // setup icons for collapse and expand button - KGuiItem collapseGuiItem("", - QIcon::fromTheme(QStringLiteral("zoom-out"), - QIcon::fromTheme(QStringLiteral("list-remove"))), + KGuiItem collapseGuiItem(QString(), + QIcon::fromTheme(g_Icons[Icon::ListCollapse]), QString(), QString()); - KGuiItem expandGuiItem("", - QIcon::fromTheme(QStringLiteral("zoom-in"), - QIcon::fromTheme(QStringLiteral("list-add"))), + KGuiItem expandGuiItem(QString(), + QIcon::fromTheme(g_Icons[Icon::ListExpand]), QString(), QString()); KGuiItem::assign(m_collapseButton, collapseGuiItem); diff --git a/kmymoney/views/kforecastview.cpp b/kmymoney/views/kforecastview.cpp --- a/kmymoney/views/kforecastview.cpp +++ b/kmymoney/views/kforecastview.cpp @@ -44,8 +44,10 @@ #include "pivotgrid.h" #include "fixedcolumntreeview.h" #include "kreportchartview.h" +#include using namespace reports; +using namespace Icons; KForecastView::KForecastView(QWidget *parent) : QWidget(parent), @@ -68,8 +70,7 @@ KConfigGroup grp = config->group("Last Use Settings"); m_tab->setCurrentIndex(grp.readEntry("KForecastView_LastType", 0)); - m_forecastButton->setIcon(QIcon::fromTheme(QStringLiteral("view-financial-forecast"), - QIcon::fromTheme(QStringLiteral("forecast")))); + m_forecastButton->setIcon(QIcon::fromTheme(g_Icons[Icon::ViewForecast])); connect(m_tab, SIGNAL(currentChanged(int)), this, SLOT(slotTabChanged(int))); diff --git a/kmymoney/views/khomeview.cpp b/kmymoney/views/khomeview.cpp --- a/kmymoney/views/khomeview.cpp +++ b/kmymoney/views/khomeview.cpp @@ -69,6 +69,7 @@ #include "pivottable.h" #include "pivotgrid.h" #include "reportaccount.h" +#include #define VIEW_LEDGER "ledger" #define VIEW_SCHEDULE "schedule" @@ -76,6 +77,8 @@ #define VIEW_HOME "home" #define VIEW_REPORTS "reports" +using namespace Icons; + bool accountNameLess(const MyMoneyAccount &acc1, const MyMoneyAccount &acc2) { return acc1.name().localeAwareCompare(acc2.name()) < 0; @@ -610,9 +613,8 @@ if (!sched.isFinished()) { MyMoneySplit sp = t.splitByAccount(acc.id(), true); - QString pathEnter = QPixmapToDataUri(QIcon::fromTheme(QStringLiteral("key-enter"), - QIcon::fromTheme(QStringLiteral("input-keyboard"))).pixmap(QSize(16,16))); - QString pathSkip = QPixmapToDataUri(QIcon::fromTheme(QStringLiteral("media-skip-forward")).pixmap(QSize(16,16))); + QString pathEnter = QPixmapToDataUri(QIcon::fromTheme(g_Icons[Icon::KeyEnter]).pixmap(QSize(16,16))); + QString pathSkip = QPixmapToDataUri(QIcon::fromTheme(g_Icons[Icon::MediaSkipForward]).pixmap(QSize(16,16))); //show payment date tmp = QString("") + @@ -750,8 +752,7 @@ d->m_html += ""; if (KMyMoneyGlobalSettings::showBalanceStatusOfOnlineAccounts()) { - QString pathStatusHeader = QPixmapToDataUri(QIcon::fromTheme(QStringLiteral("download"), - QIcon::fromTheme(QStringLiteral("go-down"))).pixmap(QSize(16,16))); + QString pathStatusHeader = QPixmapToDataUri(QIcon::fromTheme(g_Icons[Icon::Download]).pixmap(QSize(16,16))); d->m_html += QString("").arg(pathStatusHeader); } @@ -863,12 +864,9 @@ if (KMyMoneyGlobalSettings::showBalanceStatusOfOnlineAccounts()) { //show account's online-status - pathOK = QPixmapToDataUri(QIcon::fromTheme(QStringLiteral("dialog-ok-apply"), - QIcon::fromTheme(QStringLiteral("go-down"))).pixmap(QSize(16,16))); - pathTODO = QPixmapToDataUri(QIcon::fromTheme(QStringLiteral("dialog-ok-apply"), - QIcon::fromTheme(QStringLiteral("finish"))).pixmap(QSize(16,16))); - pathNotOK = QPixmapToDataUri(QIcon::fromTheme(QStringLiteral("dialog-cancel"), - QIcon::fromTheme(QStringLiteral("stop"))).pixmap(QSize(16,16))); + pathOK = QPixmapToDataUri(QIcon::fromTheme(g_Icons[Icon::DialogOKApply]).pixmap(QSize(16,16))); + pathTODO = QPixmapToDataUri(QIcon::fromTheme(g_Icons[Icon::MailReceive]).pixmap(QSize(16,16))); + pathNotOK = QPixmapToDataUri(QIcon::fromTheme(g_Icons[Icon::DialogCancel]).pixmap(QSize(16,16))); if (acc.value("lastImportedTransactionDate").isEmpty() || acc.value("lastStatementBalance").isEmpty()) cellStatus = '-'; @@ -1295,7 +1293,7 @@ QString statusHeader; if (KMyMoneyGlobalSettings::showBalanceStatusOfOnlineAccounts()) { QString pathStatusHeader; - pathStatusHeader = QPixmapToDataUri(QIcon::fromTheme(QStringLiteral("online-banking")).pixmap(QSize(16,16))); + pathStatusHeader = QPixmapToDataUri(QIcon::fromTheme(g_Icons[Icon::ViewOutbox]).pixmap(QSize(16,16))); statusHeader = QString("").arg(pathStatusHeader); } diff --git a/kmymoney/views/kinstitutionsview.cpp b/kmymoney/views/kinstitutionsview.cpp --- a/kmymoney/views/kinstitutionsview.cpp +++ b/kmymoney/views/kinstitutionsview.cpp @@ -37,6 +37,9 @@ #include "models.h" #include "kmymoneyglobalsettings.h" #include "kmymoney.h" +#include + +using namespace Icons; KInstitutionsView::KInstitutionsView(QWidget *parent) : QWidget(parent), @@ -45,14 +48,12 @@ setupUi(this); // setup icons for collapse and expand button - KGuiItem collapseGuiItem("", - QIcon::fromTheme(QStringLiteral("zoom-out"), - QIcon::fromTheme(QStringLiteral("list-remove"))), + KGuiItem collapseGuiItem(QString(), + QIcon::fromTheme(g_Icons[Icon::ListCollapse]), QString(), QString()); - KGuiItem expandGuiItem("", - QIcon::fromTheme(QStringLiteral("zoom-in"), - QIcon::fromTheme(QStringLiteral("list-add"))), + KGuiItem expandGuiItem(QString(), + QIcon::fromTheme(g_Icons[Icon::ListExpand]), QString(), QString()); KGuiItem::assign(m_collapseButton, collapseGuiItem); diff --git a/kmymoney/views/kinvestmentview.cpp b/kmymoney/views/kinvestmentview.cpp --- a/kmymoney/views/kinvestmentview.cpp +++ b/kmymoney/views/kinvestmentview.cpp @@ -47,6 +47,9 @@ #include #include "kmymoney.h" #include "models.h" +#include + +using namespace Icons; /** * This class is only needed to implement proper sorting. @@ -138,13 +141,13 @@ m_securitiesLayout->insertWidget(0, m_searchSecuritiesWidget); KGuiItem removeButtonItem(i18n("&Delete"), - QIcon::fromTheme("edit-delete"), + QIcon::fromTheme(g_Icons[Icon::EditDelete]), i18n("Delete this entry"), i18n("Remove this security item from the file")); KGuiItem::assign(m_deleteSecurityButton, removeButtonItem); KGuiItem editButtonItem(i18n("&Edit"), - QIcon::fromTheme("document-edit"), + QIcon::fromTheme(g_Icons[Icon::DocumentEdit]), i18n("Modify the selected entry"), i18n("Change the security information of the selected entry.")); KGuiItem::assign(m_editSecurityButton, editButtonItem); diff --git a/kmymoney/views/kmymoneyview.cpp b/kmymoney/views/kmymoneyview.cpp --- a/kmymoney/views/kmymoneyview.cpp +++ b/kmymoney/views/kmymoneyview.cpp @@ -101,6 +101,9 @@ #include "kmymoney.h" #include "kmymoneyutils.h" #include "models.h" +#include + +using namespace Icons; static constexpr KCompressionDevice::CompressionType COMPRESSION_TYPE = KCompressionDevice::GZip; static constexpr char recoveryKeyId[] = "0xD2B08440"; @@ -152,8 +155,7 @@ // Page 0 m_homeView = new KHomeView(); m_homeViewFrame = m_model->addPage(m_homeView, i18n("Home")); - m_homeViewFrame->setIcon(QIcon::fromTheme(QStringLiteral("go-home"), - QIcon::fromTheme(QStringLiteral("home")))); + m_homeViewFrame->setIcon(QIcon::fromTheme(g_Icons[Icon::ViewHome])); connect(m_homeView, SIGNAL(ledgerSelected(QString,QString)), this, SLOT(slotLedgerSelected(QString,QString))); connect(m_homeView, SIGNAL(scheduleSelected(QString)), @@ -165,8 +167,7 @@ // Page 1 m_institutionsView = new KInstitutionsView(); m_institutionsViewFrame = m_model->addPage(m_institutionsView, i18n("Institutions")); - m_institutionsViewFrame->setIcon(QIcon::fromTheme(QStringLiteral("view-bank"), - QIcon::fromTheme(QStringLiteral("institution")))); + m_institutionsViewFrame->setIcon(QIcon::fromTheme(g_Icons[Icon::ViewInstitutions])); connect(m_institutionsView, SIGNAL(selectObject(MyMoneyObject)), kmymoney, SLOT(slotSelectAccount(MyMoneyObject))); connect(m_institutionsView, SIGNAL(selectObject(MyMoneyObject)), kmymoney, SLOT(slotSelectInstitution(MyMoneyObject))); @@ -179,8 +180,7 @@ // Page 2 m_accountsView = new KAccountsView(); m_accountsViewFrame = m_model->addPage(m_accountsView, i18n("Accounts")); - m_accountsViewFrame->setIcon(QIcon::fromTheme(QStringLiteral("view-bank-account"), - QIcon::fromTheme(QStringLiteral("account")))); + m_accountsViewFrame->setIcon(QIcon::fromTheme(g_Icons[Icon::ViewAccounts])); connect(m_accountsView, SIGNAL(selectObject(MyMoneyObject)), kmymoney, SLOT(slotSelectAccount(MyMoneyObject))); connect(m_accountsView, SIGNAL(selectObject(MyMoneyObject)), kmymoney, SLOT(slotSelectInstitution(MyMoneyObject))); @@ -193,8 +193,7 @@ m_scheduledView = new KScheduledView(); //this is to solve the way long strings are handled differently among versions of KPageWidget m_scheduleViewFrame = m_model->addPage(m_scheduledView, i18n("Scheduled transactions")); - m_scheduleViewFrame->setIcon(QIcon::fromTheme(QStringLiteral("view-pim-calendar"), - QIcon::fromTheme(QStringLiteral("schedule")))); + m_scheduleViewFrame->setIcon(QIcon::fromTheme(g_Icons[Icon::ViewSchedules])); connect(m_scheduledView, SIGNAL(scheduleSelected(MyMoneySchedule)), kmymoney, SLOT(slotSelectSchedule(MyMoneySchedule))); connect(m_scheduledView, SIGNAL(openContextMenu()), kmymoney, SLOT(slotShowScheduleContextMenu())); @@ -206,8 +205,7 @@ // Page 4 m_categoriesView = new KCategoriesView(); m_categoriesViewFrame = m_model->addPage(m_categoriesView, i18n("Categories")); - m_categoriesViewFrame->setIcon(QIcon::fromTheme(QStringLiteral("view-financial-categories"), - QIcon::fromTheme(QStringLiteral("categories")))); + m_categoriesViewFrame->setIcon(QIcon::fromTheme(g_Icons[Icon::ViewCategories])); connect(m_categoriesView, SIGNAL(selectObject(MyMoneyObject)), kmymoney, SLOT(slotSelectAccount(MyMoneyObject))); connect(m_categoriesView, SIGNAL(selectObject(MyMoneyObject)), kmymoney, SLOT(slotSelectInstitution(MyMoneyObject))); @@ -219,8 +217,7 @@ // Page 5 m_tagsView = new KTagsView(); m_tagsViewFrame = m_model->addPage(m_tagsView, i18n("Tags")); - m_tagsViewFrame->setIcon(QIcon::fromTheme(QStringLiteral("mail-tagged"), - QIcon::fromTheme(QStringLiteral("bookmark-new")))); + m_tagsViewFrame->setIcon(QIcon::fromTheme(g_Icons[Icon::ViewTags])); connect(kmymoney, SIGNAL(tagCreated(QString)), m_tagsView, SLOT(slotSelectTagAndTransaction(QString))); connect(kmymoney, SIGNAL(tagRename()), m_tagsView, SLOT(slotRenameButtonCliked())); @@ -233,8 +230,7 @@ // Page 6 m_payeesView = new KPayeesView(); m_payeesViewFrame = m_model->addPage(m_payeesView, i18n("Payees")); - m_payeesViewFrame->setIcon(QIcon::fromTheme(QStringLiteral("system-users"), - QIcon::fromTheme(QStringLiteral("payee")))); + m_payeesViewFrame->setIcon(QIcon::fromTheme(g_Icons[Icon::ViewPayees])); connect(kmymoney, SIGNAL(payeeCreated(QString)), m_payeesView, SLOT(slotSelectPayeeAndTransaction(QString))); connect(kmymoney, SIGNAL(payeeRename()), m_payeesView, SLOT(slotRenameButtonCliked())); @@ -247,8 +243,7 @@ // Page 7 m_ledgerView = new KGlobalLedgerView(); m_ledgerViewFrame = m_model->addPage(m_ledgerView, i18n("Ledgers")); - m_ledgerViewFrame->setIcon(QIcon::fromTheme(QStringLiteral("view-financial-list"), - QIcon::fromTheme(QStringLiteral("ledger")))); + m_ledgerViewFrame->setIcon(QIcon::fromTheme(g_Icons[Icon::ViewLedgers])); connect(m_ledgerView, SIGNAL(accountSelected(MyMoneyObject)), kmymoney, SLOT(slotSelectAccount(MyMoneyObject))); connect(m_ledgerView, SIGNAL(openContextMenu()), kmymoney, SLOT(slotShowTransactionContextMenu())); @@ -266,8 +261,7 @@ // Page 8 m_investmentView = new KInvestmentView(); m_investmentViewFrame = m_model->addPage(m_investmentView, i18n("Investments")); - m_investmentViewFrame->setIcon(QIcon::fromTheme(QStringLiteral("view-investment"), - QIcon::fromTheme(QStringLiteral("investment")))); + m_investmentViewFrame->setIcon(QIcon::fromTheme(g_Icons[Icon::ViewInvestment])); connect(m_investmentView, SIGNAL(accountSelected(QString,QString)), this, SLOT(slotLedgerSelected(QString,QString))); @@ -278,8 +272,7 @@ // Page 9 m_reportsView = new KReportsView(); m_reportsViewFrame = m_model->addPage(m_reportsView, i18n("Reports")); - m_reportsViewFrame->setIcon(QIcon::fromTheme(QStringLiteral("office-chart-bar"), - QIcon::fromTheme(QStringLiteral("report")))); + m_reportsViewFrame->setIcon(QIcon::fromTheme(g_Icons[Icon::ViewReports])); connect(m_reportsView, SIGNAL(ledgerSelected(QString,QString)), this, SLOT(slotLedgerSelected(QString,QString))); connect(m_reportsView, SIGNAL(aboutToShow()), this, SIGNAL(aboutToChangeView())); @@ -287,8 +280,7 @@ // Page 10 m_budgetView = new KBudgetView(); m_budgetViewFrame = m_model->addPage(m_budgetView, i18n("Budgets")); - m_budgetViewFrame->setIcon(QIcon::fromTheme(QStringLiteral("view-time-schedule-calculus"), - QIcon::fromTheme(QStringLiteral("budget")))); + m_budgetViewFrame->setIcon(QIcon::fromTheme(g_Icons[Icon::ViewBudgets])); connect(m_budgetView, SIGNAL(openContextMenu(MyMoneyObject)), kmymoney, SLOT(slotShowBudgetContextMenu())); connect(m_budgetView, SIGNAL(selectObjects(QList)), kmymoney, SLOT(slotSelectBudget(QList))); @@ -298,14 +290,13 @@ // Page 11 m_forecastView = new KForecastView(); m_forecastViewFrame = m_model->addPage(m_forecastView, i18n("Forecast")); - m_forecastViewFrame->setIcon(QIcon::fromTheme(QStringLiteral("view-financial-forecast"), - QIcon::fromTheme(QStringLiteral("forecast")))); + m_forecastViewFrame->setIcon(QIcon::fromTheme(g_Icons[Icon::ViewForecast])); connect(m_forecastView, SIGNAL(aboutToShow()), this, SIGNAL(aboutToChangeView())); // Page 12 m_onlineJobOutboxView = new KOnlineJobOutbox(); m_onlineJobOutboxViewFrame = m_model->addPage(m_onlineJobOutboxView, i18n("Outbox")); - m_onlineJobOutboxViewFrame->setIcon(QIcon::fromTheme(QStringLiteral("online-banking"))); + m_onlineJobOutboxViewFrame->setIcon(QIcon::fromTheme(g_Icons[Icon::ViewOutbox])); connect(m_onlineJobOutboxView, SIGNAL(sendJobs(QList)), kmymoney, SLOT(slotOnlineJobSend(QList))); connect(m_onlineJobOutboxView, SIGNAL(editJob(QString)), kmymoney, SLOT(slotEditOnlineJob(QString))); connect(m_onlineJobOutboxView, SIGNAL(newCreditTransfer()), kmymoney, SLOT(slotNewOnlineTransfer())); @@ -314,7 +305,7 @@ SimpleLedgerView* view = new SimpleLedgerView; KPageWidgetItem* frame = m_model->addPage(view, i18n("New ledger")); - frame->setIcon(QIcon::fromTheme("document-properties")); + frame->setIcon(QIcon::fromTheme(g_Icons[Icon::DocumentProperties])); connect(this, SIGNAL(fileClosed()), view, SLOT(closeLedgers())); connect(this, SIGNAL(fileOpened()), view, SLOT(openFavoriteLedgers())); diff --git a/kmymoney/views/kpayeesview.cpp b/kmymoney/views/kpayeesview.cpp --- a/kmymoney/views/kpayeesview.cpp +++ b/kmymoney/views/kpayeesview.cpp @@ -61,6 +61,9 @@ #include "kmymoney.h" #include "models.h" #include "mymoneysecurity.h" +#include + +using namespace Icons; // *** KPayeeListItem Implementation *** @@ -118,52 +121,49 @@ m_filterBox->addItem(i18nc("@item Show only unused payees", "Unused")); m_filterBox->setSizeAdjustPolicy(QComboBox::AdjustToContents); - KGuiItem newButtonItem(QString(""), - QIcon::fromTheme(QStringLiteral("list-add-user")), + KGuiItem newButtonItem(QString(), + QIcon::fromTheme(g_Icons[Icon::ListAddUser]), i18n("Creates a new payee"), i18n("Use this to create a new payee.")); KGuiItem::assign(m_newButton, newButtonItem); m_newButton->setToolTip(newButtonItem.toolTip()); - KGuiItem renameButtonItem(QString(""), - QIcon::fromTheme(QStringLiteral("user-properties"), - QIcon::fromTheme(QStringLiteral("text-editor"))), + KGuiItem renameButtonItem(QString(), + QIcon::fromTheme(g_Icons[Icon::UserProperties]), i18n("Rename the current selected payee"), i18n("Use this to start renaming the selected payee.")); KGuiItem::assign(m_renameButton, renameButtonItem); m_renameButton->setToolTip(renameButtonItem.toolTip()); - KGuiItem deleteButtonItem(QString(""), - QIcon::fromTheme(QStringLiteral("list-remove-user")), + KGuiItem deleteButtonItem(QString(), + QIcon::fromTheme(g_Icons[Icon::ListRemoveUser]), i18n("Delete selected payee(s)"), i18n("Use this to delete the selected payee. You can also select " "multiple payees to be deleted.")); KGuiItem::assign(m_deleteButton, deleteButtonItem); m_deleteButton->setToolTip(deleteButtonItem.toolTip()); - KGuiItem mergeButtonItem(QString(""), - QIcon::fromTheme(QStringLiteral("merge")), + KGuiItem mergeButtonItem(QString(), + QIcon::fromTheme(g_Icons[Icon::Merge]), i18n("Merge multiple selected payees"), i18n("Use this to merge multiple selected payees.")); KGuiItem::assign(m_mergeButton, mergeButtonItem); m_mergeButton->setToolTip(mergeButtonItem.toolTip()); KGuiItem updateButtonItem(i18nc("Update payee", "Update"), - QIcon::fromTheme(QStringLiteral("dialog-ok"), - QIcon::fromTheme(QStringLiteral("finish"))), + QIcon::fromTheme(g_Icons[Icon::DialogOK]), i18n("Accepts the entered data and stores it"), i18n("Use this to accept the modified data.")); KGuiItem::assign(m_updateButton, updateButtonItem); KGuiItem syncButtonItem(i18nc("Sync payee", "Sync"), - QIcon::fromTheme(QStringLiteral("view-refresh")), + QIcon::fromTheme(g_Icons[Icon::Refresh]), i18n("Fetches the payee's data from your addressbook."), i18n("Use this to fetch payee's data.")); KGuiItem::assign(m_syncAddressbook, syncButtonItem); KGuiItem sendMailButtonItem(i18nc("Send mail", "Send"), - QIcon::fromTheme(QStringLiteral("mail-message"), - QIcon::fromTheme(QStringLiteral("internet-mail"))), + QIcon::fromTheme(g_Icons[Icon::MailMessage]), i18n("Creates new e-mail to your payee."), i18n("Use this to create new e-mail to your payee.")); KGuiItem::assign(m_sendMail, sendMailButtonItem); diff --git a/kmymoney/views/kreportsview.cpp b/kmymoney/views/kreportsview.cpp --- a/kmymoney/views/kreportsview.cpp +++ b/kmymoney/views/kreportsview.cpp @@ -64,8 +64,10 @@ #include "querytable.h" #include "objectinfotable.h" #include "kreportconfigurationfilterdlg.h" +#include using namespace reports; +using namespace Icons; #define VIEW_LEDGER "ledger" #define VIEW_SCHEDULE "schedule" @@ -94,21 +96,13 @@ m_tableView->setZoomFactor(KMyMoneyGlobalSettings::zoomFactor()); //set button icons - m_control->ui->buttonChart->setIcon(QIcon::fromTheme(QStringLiteral("office-chart-line"), - QIcon::fromTheme(QStringLiteral("report-line")))); - if (QIcon::hasThemeIcon(QStringLiteral("document-close"))) - m_control->ui->buttonClose->setIcon(QIcon::fromTheme(QStringLiteral("document-close"))); - else - m_control->ui->buttonClose->setIcon(QIcon::fromTheme(QStringLiteral("stop"))); - m_control->ui->buttonConfigure->setIcon(QIcon::fromTheme(QStringLiteral("configure"), - QIcon::fromTheme(QStringLiteral("preferences-system")))); - m_control->ui->buttonCopy->setIcon(QIcon::fromTheme(QStringLiteral("edit-copy"))); - m_control->ui->buttonDelete->setIcon(QIcon::fromTheme(QStringLiteral("edit-delete"))); - if (QIcon::hasThemeIcon(QStringLiteral("document-export"))) - m_control->ui->buttonExport->setIcon(QIcon::fromTheme(QStringLiteral("document-export"))); - else - m_control->ui->buttonExport->setIcon(QIcon::fromTheme(QStringLiteral("format-indent-more"))); - m_control->ui->buttonNew->setIcon(QIcon::fromTheme(QStringLiteral("document-new"))); + m_control->ui->buttonChart->setIcon(QIcon::fromTheme(g_Icons[Icon::OfficeChartLine])); + m_control->ui->buttonClose->setIcon(QIcon::fromTheme(g_Icons[Icon::DocumentClose])); + m_control->ui->buttonConfigure->setIcon(QIcon::fromTheme(g_Icons[Icon::Configure])); + m_control->ui->buttonCopy->setIcon(QIcon::fromTheme(g_Icons[Icon::EditCopy])); + m_control->ui->buttonDelete->setIcon(QIcon::fromTheme(g_Icons[Icon::EditDelete])); + m_control->ui->buttonExport->setIcon(QIcon::fromTheme(g_Icons[Icon::DocumentExport])); + m_control->ui->buttonNew->setIcon(QIcon::fromTheme(g_Icons[Icon::DocumentNew])); m_chartView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); m_chartView->hide(); @@ -145,7 +139,7 @@ m_control->ui->buttonDelete->setEnabled(false); int tabNr = parent->addTab(this, - QIcon::fromTheme(QStringLiteral("application-vnd.oasis.opendocument.spreadsheet")), + QIcon::fromTheme(g_Icons[Icon::Spreadsheet]), report.name()); parent->setTabEnabled(tabNr, true); parent->setCurrentIndex(tabNr); @@ -275,8 +269,7 @@ m_control->ui->buttonChart->setText(i18n("Chart")); m_control->ui->buttonChart->setToolTip(i18n("Show the chart version of this report")); - m_control->ui->buttonChart->setIcon(QIcon::fromTheme(QStringLiteral("office-chart-line"), - QIcon::fromTheme(QStringLiteral("report-line")))); + m_control->ui->buttonChart->setIcon(QIcon::fromTheme(g_Icons[Icon::OfficeChartLine])); } else { if (!m_isChartViewValid) m_table->drawChart(*m_chartView); @@ -286,8 +279,7 @@ m_control->ui->buttonChart->setText(i18n("Report")); m_control->ui->buttonChart->setToolTip(i18n("Show the report version of this chart")); - m_control->ui->buttonChart->setIcon(QIcon::fromTheme(QStringLiteral("view-financial-list"), - QIcon::fromTheme(QStringLiteral("ledger")))); + m_control->ui->buttonChart->setIcon(QIcon::fromTheme(g_Icons[Icon::ViewFinancialList])); } m_showingChart = ! m_showingChart; } diff --git a/kmymoney/views/kscheduledview.cpp b/kmymoney/views/kscheduledview.cpp --- a/kmymoney/views/kscheduledview.cpp +++ b/kmymoney/views/kscheduledview.cpp @@ -52,8 +52,10 @@ #include "kmymoneyglobalsettings.h" #include "kscheduletreeitem.h" #include "ktreewidgetfilterlinewidget.h" - #include "kmymoney.h" +#include + +using namespace Icons; KScheduledView::KScheduledView(QWidget *parent) : QWidget(parent), @@ -155,8 +157,7 @@ m_scheduleTree->setSortingEnabled(false); KScheduleTreeItem *itemBills = new KScheduleTreeItem(m_scheduleTree); - itemBills->setIcon(0, QIcon::fromTheme(QStringLiteral("view-expenses-categories"), - QIcon::fromTheme(QStringLiteral("account-types-expense")))); + itemBills->setIcon(0, QIcon::fromTheme(g_Icons[Icon::ViewExpense])); itemBills->setText(0, i18n("Bills")); itemBills->setData(0, KScheduleTreeItem::OrderRole, QVariant("0")); itemBills->setFirstColumnSpanned(true); @@ -165,23 +166,21 @@ bold.setBold(true); itemBills->setFont(0, bold); KScheduleTreeItem *itemDeposits = new KScheduleTreeItem(m_scheduleTree); - itemDeposits->setIcon(0, QIcon::fromTheme(QStringLiteral("view-income-categories"), - QIcon::fromTheme(QStringLiteral("account-types-income")))); + itemDeposits->setIcon(0, QIcon::fromTheme(g_Icons[Icon::ViewIncome])); itemDeposits->setText(0, i18n("Deposits")); itemDeposits->setData(0, KScheduleTreeItem::OrderRole, QVariant("1")); itemDeposits->setFirstColumnSpanned(true); itemDeposits->setFlags(Qt::ItemIsEnabled); itemDeposits->setFont(0, bold); KScheduleTreeItem *itemLoans = new KScheduleTreeItem(m_scheduleTree); - itemLoans->setIcon(0, QIcon::fromTheme(QStringLiteral("view-loan"), - QIcon::fromTheme(QStringLiteral("account-types-loan")))); + itemLoans->setIcon(0, QIcon::fromTheme(g_Icons[Icon::ViewLoan])); itemLoans->setText(0, i18n("Loans")); itemLoans->setData(0, KScheduleTreeItem::OrderRole, QVariant("2")); itemLoans->setFirstColumnSpanned(true); itemLoans->setFlags(Qt::ItemIsEnabled); itemLoans->setFont(0, bold); KScheduleTreeItem *itemTransfers = new KScheduleTreeItem(m_scheduleTree); - itemTransfers->setIcon(0, QIcon::fromTheme("view-financial-transfer")); + itemTransfers->setIcon(0, QIcon::fromTheme(g_Icons[Icon::ViewFinancialTransfer])); itemTransfers->setText(0, i18n("Transfers")); itemTransfers->setData(0, KScheduleTreeItem::OrderRole, QVariant("3")); itemTransfers->setFirstColumnSpanned(true); @@ -284,18 +283,17 @@ item->setData(0, KScheduleTreeItem::OrderRole, schedule.name()); if (!schedule.isFinished()) { if (schedule.isOverdue()) { - item->setIcon(0, QIcon::fromTheme("view-calendar-upcoming-events")); + item->setIcon(0, QIcon::fromTheme(g_Icons[Icon::ViewUpcominEvents])); QBrush brush = item->foreground(0); brush.setColor(Qt::red); for (int i = 0; i < m_scheduleTree->columnCount(); ++i) { item->setForeground(i, brush); } } else { - item->setIcon(0, QIcon::fromTheme(QStringLiteral("view-calendar-day"), - QIcon::fromTheme(QStringLiteral("office-calendar")))); + item->setIcon(0, QIcon::fromTheme(g_Icons[Icon::ViewCalendarDay])); } } else { - item->setIcon(0, QIcon::fromTheme("dialog-close")); + item->setIcon(0, QIcon::fromTheme(g_Icons[Icon::DialogClose])); QBrush brush = item->foreground(0); brush.setColor(Qt::darkGreen); for (int i = 0; i < m_scheduleTree->columnCount(); ++i) { diff --git a/kmymoney/views/ktagsview.cpp b/kmymoney/views/ktagsview.cpp --- a/kmymoney/views/ktagsview.cpp +++ b/kmymoney/views/ktagsview.cpp @@ -53,6 +53,9 @@ #include "kmymoney.h" #include "models.h" #include "mymoneysecurity.h" +#include + +using namespace Icons; /* -------------------------------------------------------------------------*/ /* KTransactionPtrVector */ @@ -107,31 +110,29 @@ m_filterBox->addItem(i18nc("@item Show only closed tags", "Closed")); m_filterBox->setSizeAdjustPolicy(QComboBox::AdjustToContents); - KGuiItem newButtonItem(QString(""), - QIcon::fromTheme(QStringLiteral("list-add-tag")), + KGuiItem newButtonItem(QString(), + QIcon::fromTheme(g_Icons[Icon::ListAddTag]), i18n("Creates a new tag"), i18n("Use this to create a new tag.")); KGuiItem::assign(m_newButton, newButtonItem); m_newButton->setToolTip(newButtonItem.toolTip()); - KGuiItem renameButtonItem(QString(""), - QIcon::fromTheme(QStringLiteral("edit-rename"), - QIcon::fromTheme(QStringLiteral("text-editor"))), + KGuiItem renameButtonItem(QString(), + QIcon::fromTheme(g_Icons[Icon::EditRename]), i18n("Rename the current selected tag"), i18n("Use this to start renaming the selected tag.")); KGuiItem::assign(m_renameButton, renameButtonItem); m_renameButton->setToolTip(renameButtonItem.toolTip()); - KGuiItem deleteButtonItem(QString(""), - QIcon::fromTheme(QStringLiteral("list-remove-tag")), + KGuiItem deleteButtonItem(QString(), + QIcon::fromTheme(g_Icons[Icon::ListRemoveTag]), i18n("Delete the current selected tag"), i18n("Use this to delete the selected tag.")); KGuiItem::assign(m_deleteButton, deleteButtonItem); m_deleteButton->setToolTip(deleteButtonItem.toolTip()); KGuiItem updateButtonItem(i18nc("Update tag", "Update"), - QIcon::fromTheme(QStringLiteral("dialog-ok"), - QIcon::fromTheme(QStringLiteral("finish"))), + QIcon::fromTheme(g_Icons[Icon::DialogOK]), i18n("Accepts the entered data and stores it"), i18n("Use this to accept the modified data.")); KGuiItem::assign(m_updateButton, updateButtonItem); diff --git a/kmymoney/views/newspliteditor.cpp b/kmymoney/views/newspliteditor.cpp --- a/kmymoney/views/newspliteditor.cpp +++ b/kmymoney/views/newspliteditor.cpp @@ -42,6 +42,9 @@ #include "ui_newspliteditor.h" #include "widgethintframe.h" #include "ledgerview.h" +#include + +using namespace Icons; struct NewSplitEditor::Private { @@ -192,10 +195,8 @@ d->counterAccount = Models::instance()->accountsModel()->data(index, AccountsModel::AccountRole).value(); d->ui->setupUi(this); - d->ui->enterButton->setIcon(QIcon::fromTheme(QStringLiteral("dialog-ok"), - QIcon::fromTheme(QStringLiteral("finish")))); - d->ui->cancelButton->setIcon(QIcon::fromTheme(QStringLiteral("dialog-cancel"), - QIcon::fromTheme(QStringLiteral("stop")))); + d->ui->enterButton->setIcon(QIcon::fromTheme(g_Icons[Icon::DialogOK])); + d->ui->cancelButton->setIcon(QIcon::fromTheme(g_Icons[Icon::DialogCancel])); d->accountsModel->addAccountGroup(MyMoneyAccount::Asset); d->accountsModel->addAccountGroup(MyMoneyAccount::Liability); d->accountsModel->addAccountGroup(MyMoneyAccount::Income); diff --git a/kmymoney/views/newtransactioneditor.cpp b/kmymoney/views/newtransactioneditor.cpp --- a/kmymoney/views/newtransactioneditor.cpp +++ b/kmymoney/views/newtransactioneditor.cpp @@ -43,6 +43,9 @@ #include "ui_newtransactioneditor.h" #include "splitdialog.h" #include "widgethintframe.h" +#include + +using namespace Icons; Q_GLOBAL_STATIC(QDate, lastUsedPostDate); @@ -371,8 +374,8 @@ d->ui->payeeEdit->setModelColumn(0); d->ui->payeeEdit->completer()->setFilterMode(Qt::MatchContains); - d->ui->enterButton->setIcon(QIcon::fromTheme("dialog-ok")); - d->ui->cancelButton->setIcon(QIcon::fromTheme("dialog-cancel")); + d->ui->enterButton->setIcon(QIcon::fromTheme(g_Icons[Icon::DialogOK])); + d->ui->cancelButton->setIcon(QIcon::fromTheme(g_Icons[Icon::DialogCancel])); d->ui->statusCombo->setModel(&d->statusModel); diff --git a/kmymoney/views/simpleledgerview.cpp b/kmymoney/views/simpleledgerview.cpp --- a/kmymoney/views/simpleledgerview.cpp +++ b/kmymoney/views/simpleledgerview.cpp @@ -37,6 +37,9 @@ #include "ledgermodel.h" #include "kmymoneyaccountcombo.h" #include "ui_simpleledgerview.h" +#include + +using namespace Icons; class SimpleLedgerView::Private { @@ -64,7 +67,7 @@ , d(new Private(this)) { d->ui->setupUi(this); - d->ui->ledgerTab->setTabIcon(0, QIcon::fromTheme("list-add")); + d->ui->ledgerTab->setTabIcon(0, QIcon::fromTheme(g_Icons[Icon::ListAdd])); d->ui->ledgerTab->setTabText(0, QString()); d->newTabWidget = d->ui->ledgerTab->widget(0); diff --git a/kmymoney/views/splitdialog.cpp b/kmymoney/views/splitdialog.cpp --- a/kmymoney/views/splitdialog.cpp +++ b/kmymoney/views/splitdialog.cpp @@ -40,6 +40,9 @@ #include "splitdelegate.h" #include "newtransactioneditor.h" #include "splitadjustdialog.h" +#include + +using namespace Icons; class SplitDialog::Private { @@ -112,10 +115,8 @@ d->splitDelegate = new SplitDelegate(d->ui->splitView); d->ui->splitView->setItemDelegate(d->splitDelegate); - d->ui->okButton->setIcon(QIcon::fromTheme(QStringLiteral("dialog-ok"), - QIcon::fromTheme(QStringLiteral("finish")))); - d->ui->cancelButton->setIcon(QIcon::fromTheme(QStringLiteral("dialog-cancel"), - QIcon::fromTheme(QStringLiteral("stop")))); + d->ui->okButton->setIcon(QIcon::fromTheme(g_Icons[Icon::DialogOK])); + d->ui->cancelButton->setIcon(QIcon::fromTheme(g_Icons[Icon::DialogCancel])); // setup some connections connect(d->ui->splitView, SIGNAL(aboutToStartEdit()), this, SLOT(disableButtons())); diff --git a/kmymoney/widgets/amountedit.cpp b/kmymoney/widgets/amountedit.cpp --- a/kmymoney/widgets/amountedit.cpp +++ b/kmymoney/widgets/amountedit.cpp @@ -41,6 +41,9 @@ #include "kmymoneycalculator.h" #include "mymoneymoney.h" +#include + +using namespace Icons; AmountValidator::AmountValidator(QObject * parent) : QDoubleValidator(parent) @@ -232,7 +235,7 @@ int btnSize = sizeHint().height() - 5; d->m_calculatorButton = new QToolButton(this); - d->m_calculatorButton->setIcon(QIcon::fromTheme(QStringLiteral("accessories-calculator"))); + d->m_calculatorButton->setIcon(QIcon::fromTheme(g_Icons[Icon::AccessoriesCalculator])); d->m_calculatorButton->setCursor(Qt::ArrowCursor); d->m_calculatorButton->setStyleSheet("QToolButton { border: none; padding: 2px}"); d->m_calculatorButton->setFixedSize(btnSize, btnSize); diff --git a/kmymoney/widgets/kmymoneyaccountselector.cpp b/kmymoney/widgets/kmymoneyaccountselector.cpp --- a/kmymoney/widgets/kmymoneyaccountselector.cpp +++ b/kmymoney/widgets/kmymoneyaccountselector.cpp @@ -49,6 +49,9 @@ #include #include "kmymoneyutils.h" #include "kmymoneyglobalsettings.h" +#include + +using namespace Icons; kMyMoneyAccountSelector::kMyMoneyAccountSelector(QWidget *parent, Qt::WindowFlags flags, const bool createButtons) : KMyMoneySelector(parent, flags), @@ -278,9 +281,7 @@ //get the account icon from cache or insert it if it is not there QPixmap accountPixmap; if (!QPixmapCache::find("account", accountPixmap)) { - QIcon icon = QIcon::fromTheme(QStringLiteral("view-bank-account"), - QIcon::fromTheme(QStringLiteral("account"), - QIcon::fromTheme(QStringLiteral("unknown")))); + QIcon icon = QIcon::fromTheme(g_Icons[Icon::ViewBankAccount]); if (!icon.availableSizes().isEmpty()) accountPixmap = icon.pixmap(icon.availableSizes().first()); QPixmapCache::insert("account", accountPixmap); diff --git a/kmymoney/widgets/kmymoneybriefschedule.cpp b/kmymoney/widgets/kmymoneybriefschedule.cpp --- a/kmymoney/widgets/kmymoneybriefschedule.cpp +++ b/kmymoney/widgets/kmymoneybriefschedule.cpp @@ -41,13 +41,16 @@ #include "mymoneyschedule.h" #include "kmymoneyutils.h" +#include + +using namespace Icons; KMyMoneyBriefSchedule::KMyMoneyBriefSchedule(QWidget *parent) : kScheduleBriefWidget(parent/*,name, Qt::WStyle_Customize | Qt::WStyle_NoBorder*/), m_index(0) { - m_nextButton->setIcon(QIcon::fromTheme(QString::fromLatin1("arrow-right"))); - m_prevButton->setIcon(QIcon::fromTheme(QString::fromLatin1("arrow-left"))); + m_nextButton->setIcon(QIcon::fromTheme(g_Icons[Icon::ArrowRight])); + m_prevButton->setIcon(QIcon::fromTheme(g_Icons[Icon::ArrowLeft])); connect(m_prevButton, SIGNAL(clicked()), this, SLOT(slotPrevClicked())); connect(m_nextButton, SIGNAL(clicked()), this, SLOT(slotNextClicked())); @@ -56,13 +59,13 @@ connect(m_buttonEnter, SIGNAL(clicked()), this, SLOT(slotEnterClicked())); KGuiItem skipGuiItem(i18n("&Skip"), - QIcon::fromTheme("media-seek-forward"), + QIcon::fromTheme(g_Icons[Icon::MediaSeekForward]), i18n("Skip this transaction"), i18n("Use this button to skip this transaction")); KGuiItem::assign(m_skipButton, skipGuiItem); KGuiItem enterGuiItem(i18n("&Enter"), - QIcon::fromTheme(QLatin1String("key-enter")), + QIcon::fromTheme(g_Icons[Icon::KeyEnter]), i18n("Record this transaction into the register"), i18n("Use this button to record this transaction")); KGuiItem::assign(m_buttonEnter, enterGuiItem); diff --git a/kmymoney/widgets/kmymoneycategory.cpp b/kmymoney/widgets/kmymoneycategory.cpp --- a/kmymoney/widgets/kmymoneycategory.cpp +++ b/kmymoney/widgets/kmymoneycategory.cpp @@ -42,6 +42,9 @@ #include #include "kmymoneyaccountcompletion.h" +#include + +using namespace Icons; class KMyMoneyCategory::Private { @@ -79,9 +82,8 @@ } // create button - KGuiItem splitButtonItem("", - QIcon::fromTheme(QStringLiteral("split"), - QIcon::fromTheme(QStringLiteral("transaction-split"))), "", ""); + KGuiItem splitButtonItem(QString(), + QIcon::fromTheme(g_Icons[Icon::Split]), QString(), QString()); d->splitButton = new QPushButton(d->frame); d->splitButton->setObjectName("splitButton"); KGuiItem::assign(d->splitButton, splitButtonItem); diff --git a/kmymoney/widgets/kmymoneycurrencyselector.cpp b/kmymoney/widgets/kmymoneycurrencyselector.cpp --- a/kmymoney/widgets/kmymoneycurrencyselector.cpp +++ b/kmymoney/widgets/kmymoneycurrencyselector.cpp @@ -36,6 +36,10 @@ // ---------------------------------------------------------------------------- // Project Includes +#include + +using namespace Icons; + KMyMoneySecuritySelector::KMyMoneySecuritySelector(QWidget *parent) : KComboBox(parent), m_displayItem(FullName), @@ -130,9 +134,7 @@ break; } if ((*it).id() == baseCurrency) { - insertItem(itemId, QIcon::fromTheme(QStringLiteral("view-bank-account"), - QIcon::fromTheme(QStringLiteral("account"), - QIcon::fromTheme(QStringLiteral("unknown")))), display); + insertItem(itemId, QIcon::fromTheme(g_Icons[Icon::ViewBankAccount]), display); } else { insertItem(itemId, emptyIcon, display); } diff --git a/kmymoney/widgets/kmymoneydateinput.cpp b/kmymoney/widgets/kmymoneydateinput.cpp --- a/kmymoney/widgets/kmymoneydateinput.cpp +++ b/kmymoney/widgets/kmymoneydateinput.cpp @@ -51,6 +51,10 @@ // ---------------------------------------------------------------------------- // Project Includes +#include + +using namespace Icons; + namespace { const int DATE_POPUP_TIMEOUT = 1500; @@ -151,8 +155,7 @@ d->m_datePicker->setCloseButton(true); // the next line is a try to add an icon to the button - d->m_dateButton = new QPushButton(QIcon::fromTheme(QStringLiteral("view-calendar-day"), - QIcon::fromTheme(QStringLiteral("office-calendar"))), QString(""), this); + d->m_dateButton = new QPushButton(QIcon::fromTheme(g_Icons[Icon::ViewCalendarDay]), QString(), this); dateInputLayout->addWidget(d->m_dateButton); connect(d->m_dateButton, SIGNAL(clicked()), SLOT(toggleDatePicker())); diff --git a/kmymoney/widgets/kmymoneyedit.cpp b/kmymoney/widgets/kmymoneyedit.cpp --- a/kmymoney/widgets/kmymoneyedit.cpp +++ b/kmymoney/widgets/kmymoneyedit.cpp @@ -46,6 +46,9 @@ #include "kmymoneylineedit.h" #include "kmymoneycalculator.h" #include "mymoneymoney.h" +#include + +using namespace Icons; kMyMoneyMoneyValidator::kMyMoneyMoneyValidator(QObject * parent) : QDoubleValidator(parent) @@ -241,7 +244,7 @@ calculatorFrameVBoxLayout->addWidget(m_calculator); m_calculatorFrame->hide(); - m_calcButton = new QPushButton(QIcon::fromTheme("accessories-calculator"), QString(""), this); + m_calcButton = new QPushButton(QIcon::fromTheme(g_Icons[Icon::AccessoriesCalculator]), QString(), this); m_calcButton->setFocusProxy(m_edit); editLayout->addWidget(m_calcButton); diff --git a/kmymoney/widgets/kmymoneymvccombo.cpp b/kmymoney/widgets/kmymoneymvccombo.cpp --- a/kmymoney/widgets/kmymoneymvccombo.cpp +++ b/kmymoney/widgets/kmymoneymvccombo.cpp @@ -43,6 +43,9 @@ // Project Includes #include "kmymoneysettings.h" +#include + +using namespace Icons; class KMyMoneyMVCCombo::Private { @@ -390,7 +393,7 @@ QFrame(parent) { QToolButton *t = new QToolButton(this); - t->setIcon(QIcon::fromTheme(QStringLiteral("dialog-close"))); + t->setIcon(QIcon::fromTheme(g_Icons[Icon::DialogClose])); t->setAutoRaise(true); QLabel *l = new QLabel(name, this); m_tagId = id; diff --git a/kmymoney/widgets/kmymoneyvalidationfeedback.cpp b/kmymoney/widgets/kmymoneyvalidationfeedback.cpp --- a/kmymoney/widgets/kmymoneyvalidationfeedback.cpp +++ b/kmymoney/widgets/kmymoneyvalidationfeedback.cpp @@ -20,6 +20,9 @@ #include "ui_kmymoneyvalidationfeedback.h" #include +#include + +using namespace Icons; class KMyMoneyValidationFeedback::Private { @@ -67,15 +70,15 @@ QIcon icon; switch (type) { case Error: - icon = QIcon::fromTheme("dialog-error"); + icon = QIcon::fromTheme(g_Icons[Icon::DialogError]); break; case Positive: case Information: - icon = QIcon::fromTheme("dialog-information"); + icon = QIcon::fromTheme(g_Icons[Icon::DialogInformation]); break; case Warning: default: - icon = QIcon::fromTheme("dialog-warning"); + icon = QIcon::fromTheme(g_Icons[Icon::DialogWarning]); } ui->icon->setPixmap(icon.pixmap(24)); } diff --git a/kmymoney/widgets/kmymoneywizard.cpp b/kmymoney/widgets/kmymoneywizard.cpp --- a/kmymoney/widgets/kmymoneywizard.cpp +++ b/kmymoney/widgets/kmymoneywizard.cpp @@ -43,6 +43,9 @@ #include "kmymoneytitlelabel.h" #include "kguiutils.h" +#include + +using namespace Icons; KMyMoneyWizardPagePrivate::KMyMoneyWizardPagePrivate(QObject* parent) : QObject(parent) @@ -130,9 +133,9 @@ if (style()->styleHint(QStyle::SH_DialogButtonBox_ButtonsHaveIcons, 0, this)) { m_backButton->setIcon(KStandardGuiItem::back(KStandardGuiItem::UseRTL).icon()); m_nextButton->setIcon(KStandardGuiItem::forward(KStandardGuiItem::UseRTL).icon()); - m_finishButton->setIcon(QIcon::fromTheme("dialog-ok-apply")); - m_cancelButton->setIcon(QIcon::fromTheme("dialog-cancel")); - m_helpButton->setIcon(QIcon::fromTheme("help-contents")); + m_finishButton->setIcon(QIcon::fromTheme(g_Icons[Icon::DialogOKApply])); + m_cancelButton->setIcon(QIcon::fromTheme(g_Icons[Icon::DialogCancel])); + m_helpButton->setIcon(QIcon::fromTheme(g_Icons[Icon::HelpContents])); } // create button layout diff --git a/kmymoney/widgets/registersearchline.cpp b/kmymoney/widgets/registersearchline.cpp --- a/kmymoney/widgets/registersearchline.cpp +++ b/kmymoney/widgets/registersearchline.cpp @@ -37,8 +37,10 @@ // Project Includes #include +#include using namespace KMyMoneyRegister; +using namespace Icons; class RegisterSearchLine::RegisterSearchLinePrivate { @@ -78,13 +80,10 @@ parentWidget()->layout()->addWidget(d->combo); // don't change the order of the following lines unless updating // the case labels in RegisterSearchLine::itemMatches() at the same time - d->combo->insertItem(RegisterFilter::Any, QIcon::fromTheme(QStringLiteral("system-run"), - QIcon::fromTheme(QStringLiteral("media-playback-start"))), i18n("Any status")); - d->combo->insertItem(RegisterFilter::Imported, QIcon::fromTheme(QStringLiteral("document-import"), - QIcon::fromTheme(QStringLiteral("format-indent-less"))), i18n("Imported")); - d->combo->insertItem(RegisterFilter::Matched, KMyMoneyUtils::overlayIcon("view-financial-transfer", "document-import"), i18n("Matched")); - d->combo->insertItem(RegisterFilter::Erroneous, QIcon::fromTheme(QStringLiteral("task-attention"), - QIcon::fromTheme(QStringLiteral("dialog-warning"))), i18n("Erroneous")); + d->combo->insertItem(RegisterFilter::Any, QIcon::fromTheme(g_Icons[Icon::SystemRun]), i18n("Any status")); + d->combo->insertItem(RegisterFilter::Imported, QIcon::fromTheme(g_Icons[Icon::DocumentImport]), i18n("Imported")); + d->combo->insertItem(RegisterFilter::Matched, KMyMoneyUtils::overlayIcon(g_Icons[Icon::ViewFinancialTransfer], g_Icons[Icon::DocumentImport]), i18n("Matched")); + d->combo->insertItem(RegisterFilter::Erroneous, QIcon::fromTheme(g_Icons[Icon::TaskAttention]), i18n("Erroneous")); d->combo->insertItem(RegisterFilter::NotMarked, i18n("Not marked")); d->combo->insertItem(RegisterFilter::NotReconciled, i18n("Not reconciled")); d->combo->insertItem(RegisterFilter::Cleared, i18nc("Reconciliation state 'Cleared'", "Cleared")); diff --git a/kmymoney/widgets/transactionsortoptionimpl.cpp b/kmymoney/widgets/transactionsortoptionimpl.cpp --- a/kmymoney/widgets/transactionsortoptionimpl.cpp +++ b/kmymoney/widgets/transactionsortoptionimpl.cpp @@ -31,9 +31,12 @@ // Project Includes #include "register.h" +#include #include "ui_transactionsortoptiondecl.h" +using namespace Icons; + TransactionSortOption::TransactionSortOption(QWidget *parent) : QWidget(parent) { @@ -49,14 +52,10 @@ void TransactionSortOption::init() { - ui->m_addButton->setIcon(QIcon::fromTheme(QStringLiteral("arrow-right"), - QIcon::fromTheme(QStringLiteral("go-next")))); - ui->m_removeButton->setIcon(QIcon::fromTheme(QStringLiteral("arrow-left"), - QIcon::fromTheme(QStringLiteral("go-previous")))); - ui->m_upButton->setIcon(QIcon::fromTheme(QStringLiteral("arrow-up"), - QIcon::fromTheme(QStringLiteral("go-up")))); - ui->m_downButton->setIcon(QIcon::fromTheme(QStringLiteral("arrow-down"), - QIcon::fromTheme(QStringLiteral("go-down")))); + ui->m_addButton->setIcon(QIcon::fromTheme(g_Icons[Icon::ArrowRight])); + ui->m_removeButton->setIcon(QIcon::fromTheme(g_Icons[Icon::ArrowLeft])); + ui->m_upButton->setIcon(QIcon::fromTheme(g_Icons[Icon::ArrowUp])); + ui->m_downButton->setIcon(QIcon::fromTheme(g_Icons[Icon::ArrowDown])); // don't allow sorting of the selected entries ui->m_selectedList->setSortingEnabled(false); @@ -172,11 +171,9 @@ void TransactionSortOption::setDirectionIcon(QListWidgetItem* item) { if (item->data(Qt::UserRole).toInt() > 0) { - item->setIcon(QIcon::fromTheme(QStringLiteral("view-sort-ascending"), - QIcon::fromTheme(QStringLiteral("go-up")))); + item->setIcon(QIcon::fromTheme(g_Icons[Icon::SortAscending])); } else { - item->setIcon(QIcon::fromTheme(QStringLiteral("view-sort-descending"), - QIcon::fromTheme(QStringLiteral("go-down")))); + item->setIcon(QIcon::fromTheme(g_Icons[Icon::SortDescending])); } } diff --git a/kmymoney/wizards/newaccountwizard/knewaccountwizard.cpp b/kmymoney/wizards/newaccountwizard/knewaccountwizard.cpp --- a/kmymoney/wizards/newaccountwizard/knewaccountwizard.cpp +++ b/kmymoney/wizards/newaccountwizard/knewaccountwizard.cpp @@ -51,8 +51,10 @@ #include "kequitypriceupdatedlg.h" #include "kmymoney.h" #include "models.h" +#include using namespace NewAccountWizard; +using namespace Icons; namespace NewAccountWizard { @@ -1372,7 +1374,7 @@ m_mandatoryGroup->add(m_loanAccount->lineEdit()); KGuiItem createAssetButtenItem(i18n("&Create..."), - QIcon::fromTheme("document-new"), + QIcon::fromTheme(g_Icons[Icon::DocumentNew]), i18n("Create a new asset account"), i18n("If the asset account does not yet exist, press this button to create it.")); KGuiItem::assign(m_createAssetButton, createAssetButtenItem); 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 @@ -31,6 +31,9 @@ // Project Includes #include "kmymoney.h" +#include + +using namespace Icons; AssetAccountWizardPage::AssetAccountWizardPage(QWidget *parent) : AssetAccountWizardPageDecl(parent) @@ -46,7 +49,7 @@ // load button icons KGuiItem createAssetButtonItem(i18n("&Create..."), - QIcon::fromTheme("document-new"), + QIcon::fromTheme(g_Icons[Icon::DocumentNew]), i18n("Create a new asset account"), i18n("Use this to create a new account to which the initial payment should be made")); KGuiItem::assign(m_createNewAssetButton, createAssetButtonItem); diff --git a/kmymoney/wizards/newloanwizard/interestcategorywizardpage.cpp b/kmymoney/wizards/newloanwizard/interestcategorywizardpage.cpp --- a/kmymoney/wizards/newloanwizard/interestcategorywizardpage.cpp +++ b/kmymoney/wizards/newloanwizard/interestcategorywizardpage.cpp @@ -34,6 +34,9 @@ #include "knewaccountdlg.h" #include "mymoneyfile.h" +#include + +using namespace Icons; InterestCategoryWizardPage::InterestCategoryWizardPage(QWidget *parent) : InterestCategoryWizardPageDecl(parent) @@ -47,7 +50,7 @@ // load button icons KGuiItem createCategoryButtonItem(i18n("&Create..."), - QIcon::fromTheme("document-new"), + QIcon::fromTheme(g_Icons[Icon::DocumentNew]), i18n("Create a new category"), i18n("Use this to open the new account editor")); KGuiItem::assign(m_createCategoryButton, createCategoryButtonItem); 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 @@ -53,8 +53,10 @@ #include #include #include - #include "kmymoneyglobalsettings.h" +#include + +using namespace Icons; namespace NewUserWizard { @@ -226,9 +228,7 @@ QTreeWidgetItem* p = insertCurrency(*it); if ((*it).id() == baseCurrency) { first = p; - QIcon icon = QIcon::fromTheme(QStringLiteral("view-bank-account"), - QIcon::fromTheme(QStringLiteral("account"), - QIcon::fromTheme(QStringLiteral("unknown")))); + QIcon icon = QIcon::fromTheme(g_Icons[Icon::ViewBankAccount]); p->setIcon(0, icon); } else { p->setIcon(0, QIcon());