mirror of
https://invent.kde.org/plasma/plasma-desktop.git
synced 2026-11-03 22:59:45 -09:00
emojier/app: merge CategoryAction into Emoijier.qml
The delegate for creating category actions is its own small qml file. Some parts of the action require access to data from the caller, which means unqualified lookups or passing lots of extra information to the delegate. Some of what is there is also essentially duplicated (such as setting a string property category that is exactly the same as the already existing property modelData. It's easier, clearer, and less code to just merge the delegate into the single place where it's used.
This commit is contained in:
parent
128455fb60
commit
b6645205f5
3 changed files with 12 additions and 27 deletions
|
|
@ -4,7 +4,6 @@ ecm_add_qml_module(plasma-emojier URI org.kde.plasma.emoji.app)
|
|||
|
||||
ecm_target_qml_sources(plasma-emojier SOURCES
|
||||
ui/Emojier.qml
|
||||
ui/CategoryAction.qml
|
||||
ui/CategoryPage.qml
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,23 +0,0 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2019 Aleix Pol Gonzalez <aleixpol@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||
*/
|
||||
|
||||
import QtQml
|
||||
import org.kde.kirigami as Kirigami
|
||||
|
||||
Kirigami.Action {
|
||||
required property string category
|
||||
|
||||
checked: window.pageStack.get(0).title === text
|
||||
text: i18ndc("org.kde.plasma.emojier", "Emoji Category", category)
|
||||
|
||||
onTriggered: {
|
||||
window.pageStack.replace(Qt.resolvedUrl("CategoryPage.qml"), {
|
||||
title: text,
|
||||
category,
|
||||
model: emoji,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -130,11 +130,20 @@ Kirigami.ApplicationWindow {
|
|||
id: instantiator
|
||||
|
||||
model: emoji.categories
|
||||
delegate: CategoryAction {
|
||||
delegate: Kirigami.Action {
|
||||
required property string modelData
|
||||
|
||||
category: modelData
|
||||
icon.name: drawer.getIcon(category)
|
||||
checked: window.pageStack.get(0).title === text
|
||||
icon.name: drawer.getIcon(modelData)
|
||||
text: i18ndc("org.kde.plasma.emojier", "Emoji Category", modelData)
|
||||
|
||||
onTriggered: {
|
||||
window.pageStack.replace(Qt.resolvedUrl("CategoryPage.qml"), {
|
||||
title: text,
|
||||
category: modelData,
|
||||
model: emoji,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
onObjectAdded: (index, object) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue