From 7ba8f7bbfe27f6606d1710f85d21ec75e6facc47 Mon Sep 17 00:00:00 2001 From: Lana Black Date: Wed, 12 Jun 2024 22:54:08 +0000 Subject: [PATCH] More fixes. --- app/CMakeLists.txt | 1 + app/data/genericbasictable.h | 1 - app/data/genericdata.h | 3 ++- app/settings/detailsdialog/detailshandler.cpp | 24 ++++++++++++------- app/settings/detailsdialog/patternwidget.cpp | 2 +- .../exporttemplatehandler.cpp | 11 +++++---- app/settings/screensdialog/screenshandler.cpp | 13 +++++----- 7 files changed, 32 insertions(+), 23 deletions(-) diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 3b7862d33..408d908c6 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -70,6 +70,7 @@ target_link_libraries(latte-dock KF6::GlobalAccel KF6::I18n KF6::IconThemes + KF6::IconWidgets KF6::KIOWidgets KF6::Notifications KF6::NewStuffWidgets diff --git a/app/data/genericbasictable.h b/app/data/genericbasictable.h index 8e00211b3..6920eed4a 100644 --- a/app/data/genericbasictable.h +++ b/app/data/genericbasictable.h @@ -27,7 +27,6 @@ public: } } -Q_DECLARE_METATYPE(Latte::Data::Generic) Q_DECLARE_METATYPE(Latte::Data::GenericBasicTable) #endif diff --git a/app/data/genericdata.h b/app/data/genericdata.h index f4d24c6a0..8427c054a 100644 --- a/app/data/genericdata.h +++ b/app/data/genericdata.h @@ -10,6 +10,7 @@ #include "generictable.h" // Qt +#include #include namespace Latte { @@ -37,6 +38,6 @@ public: } } - +Q_DECLARE_METATYPE(Latte::Data::Generic) #endif diff --git a/app/settings/detailsdialog/detailshandler.cpp b/app/settings/detailsdialog/detailshandler.cpp index b31cdbaea..7c3582e37 100644 --- a/app/settings/detailsdialog/detailshandler.cpp +++ b/app/settings/detailsdialog/detailshandler.cpp @@ -26,6 +26,8 @@ // KDE #include +#include +#include namespace Latte { namespace Settings { @@ -73,13 +75,17 @@ void DetailsHandler::init() m_ui->patternClearBtn->setFixedHeight(m_ui->backgroundBtn->height()+2); - connect(m_backButtonsGroup, static_cast(&QButtonGroup::buttonToggled), - [ = ](int id, bool checked) { - - if (checked) { - setBackgroundStyle(static_cast(id)); - } - }); + connect(m_backButtonsGroup, &QButtonGroup::buttonToggled, + [ this ](QAbstractButton *id, bool checked) { + if (checked) { + // FIXME: + // I've no idea wtf was going on here. This code was likely incorrect to begin with. + Latte::Layout::BackgroundStyle style = id + ? Latte::Layout::PatternBackgroundStyle + : Latte::Layout::ColorBackgroundStyle; + setBackgroundStyle(static_cast(style)); + } + }); connect(m_ui->backgroundBtn, &QPushButton::pressed, this, &DetailsHandler::selectBackground); connect(m_ui->iconBtn, &QPushButton::pressed, this, &DetailsHandler::selectIcon); @@ -264,11 +270,11 @@ void DetailsHandler::onCurrentLayoutIndexChanged(int row) if (hasChangedData()) { //new layout was chosen but there are changes KMessageBox::ButtonCode result = saveChangesConfirmation(); - if (result == KMessageBox::Yes) { + if (result == KMessageBox::PrimaryAction) { switchtonewlayout = true; m_lastConfirmedLayoutIndex = row; save(); - } else if (result == KMessageBox::No) { + } else if (result == KMessageBox::SecondaryAction) { switchtonewlayout = true; m_lastConfirmedLayoutIndex = row; } else if (result == KMessageBox::Cancel) { diff --git a/app/settings/detailsdialog/patternwidget.cpp b/app/settings/detailsdialog/patternwidget.cpp index 38172b1cb..eb374d280 100644 --- a/app/settings/detailsdialog/patternwidget.cpp +++ b/app/settings/detailsdialog/patternwidget.cpp @@ -141,7 +141,7 @@ void PatternWidget::paintEvent(QPaintEvent *event) //! it is needed from Qt, otherwise QWidget is not updated //! https://wiki.qt.io/How_to_Change_the_Background_Color_of_QWidget QStyleOption opt; - opt.init(this); + opt.initFrom(this); QPainter p(this); p.setRenderHint(QPainter::Antialiasing, true); diff --git a/app/settings/exporttemplatedialog/exporttemplatehandler.cpp b/app/settings/exporttemplatedialog/exporttemplatehandler.cpp index 9c5f8240c..867fd0b5b 100644 --- a/app/settings/exporttemplatedialog/exporttemplatehandler.cpp +++ b/app/settings/exporttemplatedialog/exporttemplatehandler.cpp @@ -33,6 +33,7 @@ // Plasma #include +#include namespace Latte { namespace Settings { @@ -294,11 +295,11 @@ void ExportTemplateHandler::save() bool ExportTemplateHandler::overwriteConfirmation(const QString &fileName) { - return (KMessageBox::warningYesNo(m_dialog, - i18n("The file \"%1\" already exists. Do you wish to overwrite it?", fileName), - i18n("Overwrite File?"), - KStandardGuiItem::overwrite(), - KStandardGuiItem::cancel()) == KMessageBox::Yes); + return (KMessageBox::warningTwoActions(m_dialog, + i18n("The file \"%1\" already exists. Do you wish to overwrite it?", fileName), + i18n("Overwrite File?"), + KStandardGuiItem::overwrite(), + KStandardGuiItem::cancel()) == KMessageBox::PrimaryAction); } } diff --git a/app/settings/screensdialog/screenshandler.cpp b/app/settings/screensdialog/screenshandler.cpp index 517e9f5f9..5967e0c96 100644 --- a/app/settings/screensdialog/screenshandler.cpp +++ b/app/settings/screensdialog/screenshandler.cpp @@ -16,6 +16,7 @@ // KDE #include +#include namespace Latte { namespace Settings { @@ -129,12 +130,12 @@ void ScreensHandler::save() bool ScreensHandler::removalConfirmation(const QStringList &screens) const { - return (KMessageBox::warningYesNo(m_dialog, - i18np("You are going to remove %2 reference completely.
Would you like to continue?", - "You are going to remove %2 references completely.
Would you like to continue?", - screens.count(), - screens.join(", ")), - i18n("Approve Removal")) == KMessageBox::Yes); + return (KMessageBox::warningContinueCancel(m_dialog, + i18np("You are going to remove %2 reference completely.
Would you like to continue?", + "You are going to remove %2 references completely.
Would you like to continue?", + screens.count(), + screens.join(", ")), + i18n("Approve Removal")) == KMessageBox::PrimaryAction); } }