Commit b87c5d57 authored by Dan Leinir Turthra Jensen's avatar Dan Leinir Turthra Jensen 🌈
Browse files

Switch to NewStuff.Action

This removes the custom action for opening a NewStuff dialog, and
further switches the logic to use the page stack, instead of opening a
new dialog.

This increases the Frameworks requirement to 5.81 (and removes the
hard dependency on NewStuff in favour of NewStuffQuick)
parent 33111a9f
......@@ -6,7 +6,7 @@ set(PROJECT_VERSION "5.21.80")
set(PROJECT_VERSION_MAJOR 5)
set(QT_MIN_VERSION "5.15.0")
set(KF5_MIN_VERSION "5.78")
set(KF5_MIN_VERSION "5.81")
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
......@@ -23,7 +23,7 @@ if(ECM_VERSION VERSION_GREATER_EQUAL 5.79)
endif()
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Quick Widgets DBus)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS I18n Config Declarative Service GlobalAccel KIO DBusAddons NewStuff ItemModels)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS I18n Config Declarative Service GlobalAccel KIO DBusAddons NewStuffQuick ItemModels)
find_package(KSysGuard ${PROJECT_VERSION} REQUIRED)
find_package(Qt5QuickControls2 ${QT_MIN_VERSION})
set_package_properties(Qt5QuickControls2 PROPERTIES
......
......@@ -11,7 +11,7 @@ import QtQuick.Layouts 1.12
import QtQuick.Window 2.12
import org.kde.kirigami 2.11 as Kirigami
import org.kde.newstuff 1.62 as NewStuff
import org.kde.newstuff 1.81 as NewStuff
import org.kde.systemmonitor 1.0
import org.kde.ksysguard.page 1.0 as Page
......@@ -81,11 +81,14 @@ Kirigami.ApplicationWindow {
text: i18nc("@action", "Import Page...")
onTriggered: importDialog.open()
},
Kirigami.Action {
NewStuff.Action {
id: ghnsAction
icon.name: "get-hot-new-stuff"
text: i18nc("@action:inmenu", "Get New Pages...")
onTriggered: getNewPageDialog.open()
configFile: "plasma-systemmonitor.knsrc"
pageStack: app.pageStack
function onChangedEntriesChanged() {
pagesModel.ghnsEntriesChanged(downloadDialog.engine.changedEntries)
}
},
Kirigami.Action {
id: collapseAction
......@@ -203,22 +206,6 @@ Kirigami.ApplicationWindow {
model: pagesModel
}
}
Page.DialogLoader {
id: getNewPageDialog
sourceComponent: NewStuff.Dialog {
id: downloadDialog
configFile: "plasma-systemmonitor.knsrc"
// I have a weird bug on my machine where getNewPageDialog.changedEntries is not an alias
// engine.changedEntries but for the engine itself, so I directly use the property of the engine
Connections {
target: downloadDialog.engine
function onChangedEntriesChanged() {
pagesModel.ghnsEntriesChanged(downloadDialog.engine.changedEntries)
}
}
}
}
Page.DialogLoader {
......
......@@ -31,7 +31,7 @@ set(page_QML
)
add_library(PagePlugin SHARED ${page_SRCS})
target_link_libraries(PagePlugin Qt::DBus Qt::Quick KF5::ConfigCore KF5::I18n KF5::NewStuff KSysGuard::Sensors KSysGuard::SensorFaces)
target_link_libraries(PagePlugin Qt::DBus Qt::Quick KF5::ConfigCore KF5::I18n KF5::NewStuffCore KSysGuard::Sensors KSysGuard::SensorFaces)
install(TARGETS PagePlugin DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/ksysguard/page)
install(FILES qmldir ${page_QML} DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/ksysguard/page)
......@@ -11,7 +11,7 @@ import QtQuick.Layouts 1.14
import Qt.labs.platform 1.1 as Platform
import org.kde.kirigami 2.12 as Kirigami
import org.kde.newstuff 1.62 as NewStuff
import org.kde.newstuff 1.81 as NewStuff
import org.kde.ksysguard.faces 1.0 as Faces
import org.kde.ksysguard.page 1.0
......@@ -39,10 +39,11 @@ Kirigami.ScrollablePage {
icon.name: "document-new-from-template"
onTriggered: loadPresetDialog.open()
},
Kirigami.Action {
NewStuff.Action {
text: i18nc("@action", "Get new presets...")
icon.name: "get-hot-new-stuff"
onTriggered: newPresetDialog.open()
configFile: "systemmonitor-presets.knsrc"
pageStack: applicationWindow().pageStack
onChangedEntriesChanged: loader.controller.availablePresetsModel.reload();
},
Kirigami.Action {
text: i18nc("@action", "Save Settings as Preset")
......@@ -62,10 +63,11 @@ Kirigami.ScrollablePage {
}
},
Kirigami.Action { separator: true },
Kirigami.Action {
NewStuff.Action {
text: i18nc("@action", "Get new display styles...")
icon.name: "get-hot-new-stuff"
onTriggered: newFaceDialog.open()
configFile: "systemmonitor-faces.knsrc"
pageStack: applicationWindow().pageStack
onChangedEntriesChanged: loader.controller.availableFacesModel.reload();
}
]
......@@ -87,25 +89,6 @@ Kirigami.ScrollablePage {
}
}
DialogLoader {
id: newPresetDialog
sourceComponent: NewStuff.Dialog {
downloadNewWhat: i18nc("@title:window", "Presets")
configFile: "systemmonitor-presets.knsrc"
onChangedEntriesChanged: loader.controller.availablePresetsModel.reload();
}
}
DialogLoader {
id: newFaceDialog
sourceComponent: NewStuff.Dialog {
id: newFaceDialog
downloadNewWhat: i18nc("@title:window", "Display Styles")
configFile: "systemmonitor-faces.knsrc"
onChangedEntriesChanged: loader.controller.availableFacesModel.reload();
}
}
ColumnLayout {
id: layout
......
Supports Markdown
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