Warning, /education/kstars/kstars/kstarslite/qml/dialogs/menus/DetailsLinkMenu.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-FileCopyrightText: 2016 Artem Fedoskin <afedoskin3@gmail.com>
0002 // SPDX-License-Identifier: GPL-2.0-or-later
0003
0004 import QtQuick.Controls 2.0
0005 import QtQuick 2.7
0006 import QtQuick.Layouts 1.1
0007 import "../../constants" 1.0
0008 import "../../modules/"
0009 import "../../modules/helpers"
0010
0011 Menu {
0012 modal: true
0013 transformOrigin: Menu.Center
0014 padding: 5
0015 property int itemIndex: -1
0016 property bool isImage: false
0017 background: Rectangle {
0018 implicitWidth: 200
0019 color: Num.sysPalette.base
0020 radius: 5
0021 }
0022
0023 function openForImage(index) {
0024 isImage = true
0025 itemIndex = index
0026 open();
0027 }
0028
0029 function openForInfo(index) {
0030 isImage = false
0031 itemIndex = index
0032 open();
0033 }
0034
0035 KSMenuItem {
0036 text: xi18n("View resource")
0037 onTriggered: {
0038 if(isImage) {
0039 Qt.openUrlExternally(DetailDialogLite.getImageURL(itemIndex));
0040 } else {
0041 Qt.openUrlExternally(DetailDialogLite.getInfoURL(itemIndex));
0042 }
0043 }
0044 }
0045
0046 KSMenuItem {
0047 text: xi18n("Edit")
0048 onTriggered: {
0049 detailsAddLink.openEdit(itemIndex, isImage)
0050 }
0051 }
0052
0053 KSMenuItem {
0054 text: xi18n("Delete")
0055 onTriggered: {
0056 DetailDialogLite.removeLink(itemIndex, isImage)
0057 }
0058 }
0059 }
0060