Dekko
Loading...
Searching...
No Matches
LinkDialog.qml
1/* Copyright (C) 2025 CIT-Services <info@cit-services.eu>
2
3 This file is part of Dekko email client for Ubuntu devices
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License as
7 published by the Free Software Foundation; either version 2 of
8 the License or (at your option) version 3
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18import QtQuick 2.4
19import Lomiri.Components 1.3
20import Lomiri.Components.Popups 1.3
22Dialog {
23 id: linkDialog
24 title: qsTr("Insert Link")
25
26 property string linkUrl: ""
27 property string linkText: ""
28
29 signal linkInserted(string url, string text)
30
31 Column {
32 width: parent.width
33 spacing: units.gu(1)
34
35 TextField {
36 id: urlField
37 width: parent.width
38 placeholderText: qsTr("URL (e.g., https://example.com)")
39 text: linkDialog.linkUrl
40 inputMethodHints: Qt.ImhUrlCharactersOnly
41 focus: true
42 }
43
44 TextField {
45 id: textField
46 width: parent.width
47 placeholderText: qsTr("Link text (optional)")
48 text: linkDialog.linkText
49 }
50 }
51
52 Button {
53 text: qsTr("Cancel")
54 onClicked: PopupUtils.close(linkDialog)
55 }
56
57 Button {
58 text: qsTr("Insert")
59 color: theme.palette.normal.positive
60 enabled: urlField.text.trim().length > 0
61 onClicked: {
62 linkDialog.linkInserted(urlField.text.trim(), textField.text.trim())
63 PopupUtils.close(linkDialog)
64 }
65 }
66}