Port to FormCard
This is the successor for MobileForm
This commit is contained in:
parent
07a4b30576
commit
85897fcdc3
5 changed files with 50 additions and 38 deletions
|
@ -21,6 +21,7 @@ Dependencies:
|
|||
'frameworks/kpeople': '@stable'
|
||||
'frameworks/kwindowsystem': '@stable'
|
||||
'frameworks/qqc2-desktop-style': '@stable'
|
||||
'libraries/kirigami-addons': '@latest'
|
||||
- 'on': ['Linux/Qt5', 'FreeBSD/Qt5']
|
||||
'require':
|
||||
'frameworks/kpackage': '@stable'
|
||||
|
@ -49,6 +50,7 @@ Dependencies:
|
|||
'frameworks/kpeople': '@latest-kf6'
|
||||
'frameworks/kwindowsystem': '@latest-kf6'
|
||||
'frameworks/qqc2-desktop-style': '@latest-kf6'
|
||||
'libraries/kirigami-addons': '@latest-kf6'
|
||||
- 'on': ['Linux/Qt6', 'FreeBSD/Qt6']
|
||||
'require':
|
||||
'frameworks/kpackage': '@latest-kf6'
|
||||
|
|
|
@ -66,6 +66,12 @@ set_package_properties(KF${QT_MAJOR_VERSION}Kirigami2 PROPERTIES
|
|||
TYPE RUNTIME
|
||||
)
|
||||
|
||||
find_package(KF${QT_MAJOR_VERSION}KirigamiAddons 0.11 REQUIRED)
|
||||
set_package_properties(KF${QT_MAJOR_VERSION}KirigamiAddons PROPERTIES
|
||||
TYPE REQUIRED
|
||||
PURPOSE "Required runtime dependency (all the modules are required)"
|
||||
)
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
option(WITH_X11 "Build with X11 support" ON)
|
||||
option(WITH_PULSEAUDIO "Build with Pulseaudio support" ON)
|
||||
|
|
|
@ -5,22 +5,20 @@ import QtQuick 2.15
|
|||
import QtQuick.Controls 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import org.kde.kirigami 2.20 as Kirigami
|
||||
import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm
|
||||
import org.kde.kirigamiaddons.formcard 1.0 as FormCard
|
||||
import org.kde.kdeconnect 1.0
|
||||
import org.kde.kdeconnect.app 1.0
|
||||
|
||||
Kirigami.ScrollablePage {
|
||||
FormCard.FormCardPage {
|
||||
title: i18nc("@title:window", "Settings")
|
||||
|
||||
leftPadding: 0
|
||||
rightPadding: 0
|
||||
FormCard.FormCard {
|
||||
Layout.topMargin: Kirigami.Units.gridUnit
|
||||
|
||||
ColumnLayout {
|
||||
MobileForm.FormCard {
|
||||
Layout.topMargin: Kirigami.Units.largeSpacing
|
||||
Layout.fillWidth: true
|
||||
contentItem: ColumnLayout {
|
||||
spacing: 0
|
||||
FormCard.FormTextFieldDelegate {
|
||||
text: announcedNameProperty.value
|
||||
onAccepted: DaemonDbusInterface.setAnnouncedName(text);
|
||||
label: i18n("Device name")
|
||||
|
||||
DBusProperty {
|
||||
id: announcedNameProperty
|
||||
|
@ -28,30 +26,30 @@ Kirigami.ScrollablePage {
|
|||
read: "announcedName"
|
||||
defaultValue: ""
|
||||
}
|
||||
|
||||
MobileForm.FormTextFieldDelegate {
|
||||
text: announcedNameProperty.value
|
||||
onAccepted: DaemonDbusInterface.setAnnouncedName(text);
|
||||
label: i18n("Device name")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MobileForm.FormCard {
|
||||
Layout.topMargin: Kirigami.Units.largeSpacing
|
||||
Layout.fillWidth: true
|
||||
contentItem: ColumnLayout {
|
||||
spacing: 0
|
||||
FormCard.FormCard {
|
||||
Layout.topMargin: Kirigami.Units.gridUnit
|
||||
|
||||
FormCard.FormButtonDelegate {
|
||||
text: i18n("About KDE Connect")
|
||||
onClicked: applicationWindow().pageStack.layers.push(aboutPage)
|
||||
Component {
|
||||
id: aboutPage
|
||||
MobileForm.AboutPage {
|
||||
FormCard.AboutPage {
|
||||
aboutData: About
|
||||
}
|
||||
}
|
||||
MobileForm.FormButtonDelegate {
|
||||
text: i18n("About KDE Connect")
|
||||
onClicked: applicationWindow().pageStack.layers.push(aboutPage)
|
||||
}
|
||||
|
||||
FormCard.FormButtonDelegate {
|
||||
text: i18n("About KDE")
|
||||
onClicked: applicationWindow().pageStack.layers.push(aboutKDE)
|
||||
|
||||
Component {
|
||||
id: aboutKDE
|
||||
FormCard.AboutKDE {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,10 +101,13 @@ int main(int argc, char *argv[])
|
|||
|
||||
qmlRegisterSingletonInstance<AppData>("org.kde.kdeconnect.sms", 1, 0, "AppData", &data);
|
||||
|
||||
qmlRegisterSingletonType("org.kde.kdeconnect.sms", 1, 0, "About", [](QQmlEngine *engine, QJSEngine *) -> QJSValue {
|
||||
return engine->toScriptValue(KAboutData::applicationData());
|
||||
});
|
||||
|
||||
QQmlApplicationEngine engine;
|
||||
engine.rootContext()->setContextObject(new KLocalizedContext(&engine));
|
||||
engine.addImageProvider(QStringLiteral("thumbnailsProvider"), new ThumbnailsProvider);
|
||||
engine.rootContext()->setContextProperties({{QStringLiteral("aboutData"), QVariant::fromValue(KAboutData::applicationData())}});
|
||||
engine.load(QUrl(QStringLiteral("qrc:/qml/main.qml")));
|
||||
|
||||
return app.exec();
|
||||
|
|
|
@ -10,6 +10,7 @@ import QtQuick 2.1
|
|||
import org.kde.kirigami 2.6 as Kirigami
|
||||
import org.kde.kdeconnect 1.0
|
||||
import org.kde.kdeconnect.sms 1.0
|
||||
import org.kde.kirigamiaddons.formcard 1.0 as FormCard
|
||||
|
||||
Kirigami.ApplicationWindow
|
||||
{
|
||||
|
@ -70,7 +71,9 @@ Kirigami.ApplicationWindow
|
|||
|
||||
Component {
|
||||
id: aboutPageComponent
|
||||
Kirigami.AboutPage {}
|
||||
FormCard.AboutPage {
|
||||
aboutData: About
|
||||
}
|
||||
}
|
||||
|
||||
globalDrawer: Kirigami.GlobalDrawer {
|
||||
|
@ -96,7 +99,7 @@ Kirigami.ApplicationWindow
|
|||
icon.name: "help-about"
|
||||
onTriggered: {
|
||||
if (applicationWindow().pageStack.layers.depth < 2) {
|
||||
applicationWindow().pageStack.layers.push(aboutPageComponent, { aboutData: aboutData })
|
||||
applicationWindow().pageStack.layers.push(aboutPageComponent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue