Warning, /maui/nota/src/views/widgets/ItemMenu.qml is written in an unsupported language. File is not indexed.

0001 import QtQuick 2.14
0002 import QtQuick.Controls 2.14
0003 import QtQuick.Layouts 1.3
0004 
0005 import org.mauikit.controls 1.3 as Maui
0006 import org.mauikit.filebrowsing 1.3 as FB
0007 
0008 Maui.ContextualMenu
0009 {
0010     id: control
0011 
0012     property bool isFav : false
0013     property int index : -1
0014     property Maui.BaseModel model : null
0015 
0016     onOpened: isFav = FB.Tagging.isFav(control.model.get(index).path)
0017 
0018     Maui.MenuItemActionRow
0019     {
0020         Action
0021         {
0022 //            text: i18n(isFav ? "UnFav it": "Fav it")
0023             checked: isFav
0024             checkable: true
0025             icon.name: "love"
0026             onTriggered: FB.Tagging.toggleFav(control.model.get(index).path)
0027         }
0028 
0029         Action
0030         {
0031 //            text: i18n("Tags")
0032             icon.name: "tag"
0033             onTriggered:
0034             {
0035                 _dialogLoader.sourceComponent = _tagsDialogComponent
0036                 dialog.composerList.urls = [control.model.get(index).path]
0037                 dialog.open()
0038             }
0039         }
0040 
0041         Action
0042         {
0043 //            text: i18n("Share")
0044             icon.name: "document-share"
0045             onTriggered: Maui.Platform.shareFiles([control.model.get(index).path])
0046         }
0047     }
0048 
0049     MenuSeparator{}
0050 
0051     MenuItem
0052     {
0053         text: i18n("Select")
0054         icon.name: "item-select"
0055         onTriggered:
0056         {
0057             if(Maui.Handy.isMobile)
0058                 root.selectionMode = true
0059 
0060             addToSelection(control.model.get(index))
0061         }
0062     }
0063 
0064     MenuSeparator{}
0065 
0066     MenuItem
0067     {
0068         text: i18n("Export")
0069         icon.name: "document-save-as"
0070         onTriggered:
0071         {
0072             var pic = control.model.get(index).path
0073             _dialogLoader.sourceComponent= _fileDialogComponent
0074             dialog.mode = dialog.modes.SAVE
0075             dialog.suggestedFileName= FB.FM.getFileInfo(control.model.get(index).path).label
0076             dialog.show(function(paths)
0077             {
0078                 for(var i in paths)
0079                     FB.FM.copy(pic, paths[i])
0080             });
0081             close()
0082         }
0083     }
0084 
0085     MenuItem
0086     {
0087         enabled: !Maui.Handy.isAndroid
0088         text: i18n("Show in Folder")
0089         icon.name: "folder-open"
0090         onTriggered:
0091         {
0092             FB.FM.openLocation([control.model.get(index).path])
0093         }
0094     }
0095 
0096     MenuItem
0097     {
0098         text: i18n("Info")
0099         icon.name: "documentinfo"
0100         onTriggered:
0101         {
0102 //            getFileInfo(control.model.get(index).url)
0103         }
0104     }
0105 
0106     MenuSeparator{}
0107 
0108     MenuItem
0109     {
0110         text: i18n("Copy")
0111         icon.name: "edit-copy"
0112         onTriggered:
0113         {
0114             Maui.Handy.copyToClipboard({"urls": [control.model.get(index).path]}, false)
0115         }
0116     }
0117 
0118     MenuItem
0119     {
0120         text: i18n("Remove")
0121         icon.name: "edit-delete"
0122         Maui.Theme.textColor: Maui.Theme.negativeTextColor
0123         onTriggered:
0124         {
0125             removeDialog.open()
0126         }
0127 
0128         Maui.InfoDialog
0129         {
0130             id: removeDialog
0131 
0132             title: i18n("Delete File?")
0133 //            acceptButton.text: i18n("Accept")
0134 //            rejectButton.text: i18n("Cancel")
0135             message: i18n("Are sure you want to delete \n%1", control.model.get(index).path)
0136 
0137             template.iconSource: "emblem-warning"
0138 
0139             onRejected: close()
0140             onAccepted:
0141             {
0142                 control.model.list.deleteAt(control.index)
0143             }
0144         }
0145     }
0146 }