Kstars

DetailsLinkMenu.qml
1// SPDX-FileCopyrightText: 2016 Artem Fedoskin <afedoskin3@gmail.com>
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4import QtQuick.Controls 2.0
5import QtQuick 2.7
6import QtQuick.Layouts 1.1
7import "../../constants" 1.0
8import "../../modules/"
9import "../../modules/helpers"
10
11Menu {
12 modal: true
13 transformOrigin: Menu.Center
14 padding: 5
15 property int itemIndex: -1
16 property bool isImage: false
17 background: Rectangle {
18 implicitWidth: 200
19 color: Num.sysPalette.base
20 radius: 5
21 }
22
23 function openForImage(index) {
24 isImage = true
25 itemIndex = index
26 open();
27 }
28
29 function openForInfo(index) {
30 isImage = false
31 itemIndex = index
32 open();
33 }
34
35 KSMenuItem {
36 text: xi18n("View resource")
37 onTriggered: {
38 if(isImage) {
39 Qt.openUrlExternally(DetailDialogLite.getImageURL(itemIndex));
40 } else {
41 Qt.openUrlExternally(DetailDialogLite.getInfoURL(itemIndex));
42 }
43 }
44 }
45
46 KSMenuItem {
47 text: xi18n("Edit")
48 onTriggered: {
49 detailsAddLink.openEdit(itemIndex, isImage)
50 }
51 }
52
53 KSMenuItem {
54 text: xi18n("Delete")
55 onTriggered: {
56 DetailDialogLite.removeLink(itemIndex, isImage)
57 }
58 }
59}
60
QString xi18n(const char *text, const TYPE &arg...)
const QList< QKeySequence > & open()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:04:46 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.