Kstars

DetailsLinkMenu.qml
1 // SPDX-FileCopyrightText: 2016 Artem Fedoskin <[email protected]>
2 // SPDX-License-Identifier: GPL-2.0-or-later
3 
4 import QtQuick.Controls 2.0
5 import QtQuick 2.7
6 import QtQuick.Layouts 1.1
7 import "../../constants" 1.0
8 import "../../modules/"
9 import "../../modules/helpers"
10 
11 Menu {
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 
QAction * open(const QObject *recvr, const char *slot, QObject *parent)
QString xi18n(const char *text, const TYPE &arg...)
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Fri Aug 12 2022 04:00:53 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.