Warning, /maui/index-fm/src/widgets/views/ActionBar.qml is written in an unsupported language. File is not indexed.

0001 import QtQuick 2.15
0002 import QtQuick.Controls 2.15
0003 import QtQuick.Layouts 1.3
0004 
0005 import org.mauikit.controls 1.3 as Maui
0006 
0007 import org.mauikit.filebrowsing 1.3 as FB
0008 
0009 Maui.ToolBar
0010 {
0011     id: control
0012     position: ToolBar.Footer
0013     leftContent:  [
0014 
0015         Maui.ToolActions
0016         {
0017             autoExclusive: false
0018             checkable: false
0019             display: ToolButton.IconOnly
0020 
0021             Action
0022             {
0023                 icon.name: "go-previous"
0024                 onTriggered : currentBrowser.goBack()
0025             }
0026 
0027             Action
0028             {
0029                 icon.name: "go-next"
0030                 onTriggered : currentBrowser.goForward()
0031             }
0032         },
0033 
0034         Maui.ToolActions
0035         {
0036             autoExclusive: true
0037             expanded: root.isWide
0038             cyclic: true
0039             display: ToolButton.IconOnly
0040 
0041             Action
0042             {
0043                 text: i18n("List")
0044                 icon.name: "view-list-details"
0045                 checked: currentBrowser.viewType === FB.FMList.LIST_VIEW
0046                 checkable: true
0047                 onTriggered:
0048                 {
0049                     if(currentBrowser)
0050                     {
0051                         currentBrowser.viewType = FB.FMList.LIST_VIEW
0052                     }
0053                 }
0054             }
0055 
0056             Action
0057             {
0058                 text: i18n("Grid")
0059                 icon.name: "view-list-icons"
0060                 checked:  currentBrowser.viewType === FB.FMList.ICON_VIEW
0061                 checkable: true
0062 
0063                 onTriggered:
0064                 {
0065                     if(currentBrowser)
0066                     {
0067                         currentBrowser.viewType = FB.FMList.ICON_VIEW
0068                     }
0069                 }
0070             }
0071         }
0072 
0073     ]
0074 
0075     rightContent: [
0076 
0077         ToolButton
0078         {
0079             icon.name: "edit-find"
0080             checked: currentBrowser.headBar.visible
0081             checkable: true
0082             onClicked: currentBrowser.toggleSearchBar()
0083         },
0084 
0085         Maui.ToolButtonMenu
0086         {
0087             icon.name: "view-sort"
0088 
0089             MenuItem
0090             {
0091                 text: i18n("Type")
0092                 checked: currentBrowser.sortBy === FB.FMList.MIME
0093                 checkable: true
0094                 autoExclusive: true
0095                 onTriggered:
0096                 {
0097                     currentBrowser.sortBy = FB.FMList.MIME
0098                 }
0099             }
0100 
0101             MenuItem
0102             {
0103                 text: i18n("Date")
0104                 checked: currentBrowser.sortBy === FB.FMList.DATE
0105                 checkable: true
0106                 autoExclusive: true
0107 
0108                 onTriggered:
0109                 {
0110                     currentBrowser.sortBy = FB.FMList.DATE
0111                 }
0112             }
0113 
0114             MenuItem
0115             {
0116                 text: i18n("Modified")
0117                 checked: currentBrowser.sortBy === FB.FMList.MODIFIED
0118                 checkable: true
0119                 autoExclusive: true
0120 
0121                 onTriggered:
0122                 {
0123                     currentBrowser.sortBy = FB.FMList.MODIFIED
0124                 }
0125             }
0126 
0127             MenuItem
0128             {
0129                 text: i18n("Size")
0130                 checked: currentBrowser.sortBy === FB.FMList.SIZE
0131                 checkable: true
0132                 autoExclusive: true
0133 
0134                 onTriggered:
0135                 {
0136                     currentBrowser.sortBy = FB.FMList.SIZE
0137                 }
0138             }
0139 
0140             MenuItem
0141             {
0142                 text: i18n("Name")
0143                 checked:  currentBrowser.sortBy === FB.FMList.LABEL
0144                 checkable: true
0145                 autoExclusive: true
0146 
0147                 onTriggered:
0148                 {
0149                     currentBrowser.sortBy = FB.FMList.LABEL
0150                 }
0151             }
0152         },
0153 
0154         Loader
0155         {
0156             id: _mainMenuLoader
0157             asynchronous: true
0158             sourceComponent: Maui.ToolButtonMenu
0159             {
0160                 id: _mainMenu
0161                 icon.name:  "overflow-menu"
0162 
0163                 property bool canPaste: false
0164                 menu.onOpened: canPaste = currentBrowser.currentFMList.clipboardHasContent()
0165 
0166                 MenuItem
0167                 {
0168                     text: i18n("Paste")
0169                     enabled: _mainMenu.canPaste
0170 
0171                     icon.name: "edit-paste"
0172                     onTriggered: currentBrowser.paste()
0173                 }
0174 
0175                 MenuItem
0176                 {
0177                     text: i18n("Select All")
0178                     icon.name: "edit-select-all"
0179                     onTriggered: currentBrowser.selectAll()
0180                 }
0181 
0182                 MenuItem
0183                 {
0184                     text: i18n("New Item")
0185                     icon.name: "folder-new"
0186                     onTriggered: currentBrowser.newItem()
0187                 }
0188 
0189                 MenuSeparator {}
0190 
0191                 Maui.MenuItemActionRow
0192                 {
0193 
0194                     Action
0195                     {
0196                         icon.name: "tab-new"
0197                         text: i18n("New tab")
0198                         onTriggered: root.openTab(currentBrowser.currentPath)
0199                     }
0200 
0201                     Action
0202                     {
0203                         icon.name: "view-hidden"
0204                         text: i18n("View Hidden")
0205                         checkable: true
0206                         checked: settings.showHiddenFiles
0207                         onTriggered: settings.showHiddenFiles = !settings.showHiddenFiles
0208                     }
0209 
0210                     Action
0211                     {
0212                         text: i18n("Split View")
0213                         icon.name: currentTab.orientation === Qt.Horizontal ? "view-split-left-right" : "view-split-top-bottom"
0214                         checked: currentTab.count === 2
0215                         checkable: true
0216                         onTriggered: toogleSplitView()
0217                     }
0218 
0219                     Action
0220                     {
0221                         text: i18n("Terminal")
0222                         enabled: !Maui.Handy.isAndroid && currentTab && currentTab.currentItem ? currentTab.currentItem.supportsTerminal : false
0223                         icon.name: "dialog-scripts"
0224                         checked : currentTab && currentBrowser ? currentTab.currentItem.terminalVisible : false
0225                         checkable: true
0226 
0227                         onTriggered: currentTab.currentItem.toogleTerminal()
0228                     }
0229                 }
0230 
0231                 MenuItem
0232                 {
0233                     enabled: Maui.Handy.isLinux && !Maui.Handy.isMobile
0234                     text: i18n("Open Terminal Here")
0235                     id: openTerminal
0236                     icon.name: "dialog-scripts"
0237                     onTriggered:
0238                     {
0239                         inx.openTerminal(currentBrowser.currentPath)
0240                     }
0241                 }
0242 
0243                 MenuSeparator {}
0244 
0245                 MenuItem
0246                 {
0247                     text: i18n("Shortcuts")
0248                     icon.name: "configure-shortcuts"
0249                     onTriggered:
0250                     {
0251                         dialogLoader.sourceComponent = _shortcutsDialogComponent
0252                         dialog.open()
0253                     }
0254                 }
0255 
0256                 MenuItem
0257                 {
0258                     text: i18n("Settings")
0259                     icon.name: "settings-configure"
0260                     onTriggered: openConfigDialog()
0261                 }
0262 
0263                 MenuItem
0264                 {
0265                     text: i18n("About")
0266                     icon.name: "documentinfo"
0267                     onTriggered: root.about()
0268                 }
0269             }
0270         }
0271     ]
0272 
0273     function openMainMenu()
0274     {
0275         _mainMenuLoader.item.open()
0276     }
0277 
0278     function popupMainMenu()
0279     {
0280         _mainMenuLoader.item.popup()
0281     }
0282 }