Commit 2d066127 authored by Stephane Mankowski's avatar Stephane Mankowski

Remove color of hyperlinks in dashboard for a better rendering in dark theme

parent 71b3f9dd
......@@ -6,6 +6,7 @@ skrooge (2.20.0)
*Correction bug 407279: Skrooge flatpak needs later libofx
*Correction bug 407257: Importing GNUcash (Account name instead of AccountID)
*Correction: getNetWorth (used to compute PFS) is now computed by using all accounts
*Correction: Remove color of hyperlinks in dashboard for a better rendering in dark theme
*Feature: New REGEXPCAPTURE operator in "Search & Process" to capture a value by regular expression
*Feature: Import backend aqbanking allows to import accounts without an IBAN. (See https://phabricator.kde.org/D20875)
......
......@@ -24,6 +24,7 @@
#include <qfileinfo.h>
#include <klocalizedstring.h>
#include <kcolorscheme.h>
#include "skgmainpanel.h"
#include "skgservices.h"
......@@ -57,5 +58,12 @@ SKGTipOfDayBoardWidget::~SKGTipOfDayBoardWidget()
void SKGTipOfDayBoardWidget::onModified()
{
ui.kText->setText(SKGMainPanel::getMainPanel()->getTipOfDay());
auto text = SKGMainPanel::getMainPanel()->getTipOfDay();
// Remove color of hyperlinks
KColorScheme scheme(QPalette::Normal, KColorScheme::Window);
auto color = scheme.foreground(KColorScheme::NormalText).color().name().right(6);
text = text.replace(QStringLiteral("<a href"), QStringLiteral("<a style=\"color: #") + color + ";\" href");
ui.kText->setText(text);
}
......@@ -22,9 +22,10 @@
#include "skgaccountboardwidget.h"
#include <qaction.h>
#include <qdom.h>
#include <kcolorscheme.h>
#include "skgaccountobject.h"
#include "skgdocumentbank.h"
#include "skgmainpanel.h"
......@@ -324,7 +325,10 @@ void SKGAccountBoardWidget::dataModified(const QString& iTableName, int iIdTrans
QStringLiteral("SELECT t_name, t_TYPENLS, t_UNIT, ") % ((m_menuPastOperations != nullptr) && m_menuPastOperations->isChecked() ? "f_TODAYAMOUNT" : "f_CURRENTAMOUNT") % ", t_close from v_account_display WHERE (" % wc % ") ORDER BY t_TYPENLS, t_name",
listTmp);
IFOK(err) {
html += QStringLiteral("<html><body><table>");
KColorScheme scheme(QPalette::Normal, KColorScheme::Window);
auto color = scheme.foreground(KColorScheme::NormalText).color().name().right(6);
html += QStringLiteral("<html><head><style>a {color: #") + color + ";}</style></head><body><table>";
double sumTypeV1 = 0;
double sumV1 = 0;
QString currentType;
......
......@@ -24,10 +24,11 @@
#include <qdom.h>
#include <qparallelanimationgroup.h>
#include <qpropertyanimation.h>
#include <qaction.h>
#include <qwidgetaction.h>
#include <kcolorscheme.h>
#include "skgdocumentbank.h"
#include "skgmainpanel.h"
#include "skgobjectbase.h"
......@@ -53,13 +54,15 @@ SKGOperationBoardWidget::SKGOperationBoardWidget(QWidget* iParent, SKGDocument*
auto f = new QFrame();
ui.setupUi(f);
setMainWidget(f);
ui.kIncomeLabel->setText("<a href=\"IC\">" % ui.kIncomeLabel->text() % "</a>");
ui.kExpenseLabel->setText("<a href=\"EC\">" % ui.kExpenseLabel->text() % "</a>");
ui.kSavingLabel->setText("<a href=\"SC\">" % ui.kSavingLabel->text() % "</a>");
ui.kIncome_previousLabel->setText("<a href=\"IP\">" % ui.kIncome_previousLabel->text() % "</a>");
ui.kExpense_previousLabel->setText("<a href=\"EP\">" % ui.kExpense_previousLabel->text() % "</a>");
ui.kSaving_previousLabel->setText("<a href=\"SP\">" % ui.kSaving_previousLabel->text() % "</a>");
KColorScheme scheme(QPalette::Normal, KColorScheme::Window);
auto color = scheme.foreground(KColorScheme::NormalText).color().name().right(6);
ui.kIncomeLabel->setText("<a href=\"IC\" style=\"color: #" % color % "\">" % ui.kIncomeLabel->text() % "</a>");
ui.kExpenseLabel->setText("<a href=\"EC\" style=\"color: #" % color % "\">" % ui.kExpenseLabel->text() % "</a>");
ui.kSavingLabel->setText("<a href=\"SC\" style=\"color: #" % color % "\">" % ui.kSavingLabel->text() % "</a>");
ui.kIncome_previousLabel->setText("<a href=\"IP\" style=\"color: #" % color % "\">" % ui.kIncome_previousLabel->text() % "</a>");
ui.kExpense_previousLabel->setText("<a href=\"EP\" style=\"color: #" % color % "\">" % ui.kExpense_previousLabel->text() % "</a>");
ui.kSaving_previousLabel->setText("<a href=\"SP\" style=\"color: #" % color % "\">" % ui.kSaving_previousLabel->text() % "</a>");
connect(ui.kIncomeLabel, &QLabel::linkActivated, this, &SKGOperationBoardWidget::onOpen);
connect(ui.kExpenseLabel, &QLabel::linkActivated, this, &SKGOperationBoardWidget::onOpen);
......
......@@ -23,6 +23,8 @@
#include <qdom.h>
#include <kcolorscheme.h>
#include "skgdocumentbank.h"
#include "skgmainpanel.h"
#include "skgtraces.h"
......@@ -211,8 +213,9 @@ void SKGUnitBoardWidget::dataModified(const QString& iTableName, int iIdTransact
SKGObjectBase::SKGListSKGObjectBase objs;
SKGError err = getDocument()->getObjects(QStringLiteral("v_unit_display"), wc % " ORDER BY t_type DESC, t_name ASC", objs);
IFOK(err) {
QString html;
html += QStringLiteral("<html><body>");
KColorScheme scheme(QPalette::Normal, KColorScheme::Window);
auto color = scheme.foreground(KColorScheme::NormalText).color().name().right(6);
QString html = QStringLiteral("<html><head><style>a {color: #") + color + ";}</style></head><body>";
int nb = objs.count();
if (nb != 0) {
html += QStringLiteral("<table>");
......
......@@ -31,6 +31,7 @@
#include <qwidgetaction.h>
#include <klocalizedstring.h>
#include <kcolorscheme.h>
#include "skgdocument.h"
#include "skgmainpanel.h"
......@@ -239,6 +240,12 @@ void SKGHtmlBoardWidget::dataModified(const QString& iTableName, int iIdTransact
SKGError err = SKGReport::getReportFromTemplate(m_Report, m_Template, stream);
IFKO(err) stream = err.getFullMessage();
stream = stream.remove(QRegExp(QStringLiteral("<img[^>]*/>")));
// Remove color of hyperlinks
KColorScheme scheme(QPalette::Normal, KColorScheme::Window);
auto color = scheme.foreground(KColorScheme::NormalText).color().name().right(6);
stream = stream.replace(QStringLiteral("<a href"), QStringLiteral("<a style=\"color: #") + color + ";\" href");
m_Text->setText(stream);
m_refreshNeeded = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment