Purpose

JobDialog.qml
1/*
2 SPDX-FileCopyrightText: 2015 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
3 SPDX-FileCopyrightText: 2024 ivan tkachenko <me@ratijas.tk>
4
5 SPDX-License-Identifier: LGPL-2.1-or-later
6*/
7
8pragma ComponentBehavior: Bound
9
10import QtQuick
11import QtQuick.Controls as QQC2
12import QtQuick.Layouts
13
14import org.kde.kirigami as Kirigami
15import org.kde.purpose as Purpose
16import org.kde.purpose.private.widgets as PurposeWidgets
17
18QQC2.ApplicationWindow {
19 id: window
20
21 flags: Qt.Dialog
22 title: i18n("Send File")
23 visible: true
24
25 width: Math.max(screen.width / 6, Kirigami.Units.gridUnit * 16)
26 height: Math.max(screen.height / 4, Kirigami.Units.gridUnit * 20)
27
28 minimumWidth: Kirigami.Units.gridUnit * 16
29 minimumHeight: Kirigami.Units.gridUnit * 10
30
31 property PurposeWidgets.Menu menu
32 property Purpose.PurposeAlternativesModel model
33 property int index
34
35 function start(): void {
36 jobView.start();
37 }
38
39 Purpose.JobView {
40 id: jobView
41
42 anchors.fill: parent
43
44 model: window.model
45 index: window.index
46
47 onStateChanged: {
48 switch (state) {
49 case Purpose.PurposeJobController.Finished:
50 case Purpose.PurposeJobController.Error:
51 console.log(job.errorString);
52 window.menu.finished(job.output, job.error, job.errorString);
53 window.close();
54 break;
55 case Purpose.PurposeJobController.Cancelled:
56 window.menu.finished({}, 1 /* KIO::ERR_USER_CANCELED */, i18nd("libpurpose6_widgets", "Configuration cancelled"));
57 window.close();
58 break;
59 default:
60 break;
61 }
62 }
63 }
64}
Q_SCRIPTABLE Q_NOREPLY void start()
QString i18nd(const char *domain, const char *text, const TYPE &arg...)
KGUIADDONS_EXPORT QWindow * window(QObject *job)
bool close()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:03:06 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.