Warning, /pim/itinerary/src/app/onlineimport/db.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2023 Volker Krause <vkrause@kde.org>
0003     SPDX-FileCopyrightText: 2023 Carl Schwan <carl@carlschwan.eu>
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 import QtQuick
0008 import QtQuick.Layouts
0009 import QtQuick.Controls as QQC2
0010 import org.kde.kirigami as Kirigami
0011 import org.kde.kirigamiaddons.formcard as FormCard
0012 import org.kde.itinerary
0013 
0014 ColumnLayout {
0015     id: root
0016 
0017     property var arguments: {
0018         if (nameInput.text === "" || (bookingReferenceInput.text.length !== 6 && bookingReferenceInput.text.length !== 12)) {
0019             return undefined;
0020         }
0021         return { name: nameInput.text, reference: bookingReferenceInput.text };
0022     }
0023 
0024     signal search()
0025 
0026     FormCard.FormTextFieldDelegate {
0027         id: nameInput
0028         label: i18n("Family name")
0029         // TODO can we prefill this with the user name
0030         text: Settings.read("OnlineImport/Name", "")
0031         onEditingFinished: Settings.write("OnlineImport/Name", nameInput.text)
0032         status: Kirigami.MessageType.Information
0033         statusMessage: (text.length > 2 && (text.toUpperCase() == text || text.toLowerCase() == text)) ? i18n("Name is case-sensitive.") : ""
0034     }
0035 
0036     FormCard.FormDelegateSeparator {}
0037 
0038     FormCard.FormTextFieldDelegate {
0039         id: bookingReferenceInput
0040         label: i18n("Order number or booking reference")
0041         placeholderText: "123456789123"
0042         onAccepted: root.search()
0043     }
0044 
0045     Component.onCompleted: {
0046         if (nameInput.text === "") {
0047             nameInput.forceActiveFocus();
0048         } else {
0049             bookingReferenceInput.forceActiveFocus();
0050         }
0051     }
0052 }