Warning, /maui/arca/src/controls/main.qml is written in an unsupported language. File is not indexed.
0001 import QtQuick 2.15 0002 import QtQml 2.15 0003 import QtQuick.Controls 2.15 0004 import QtQuick.Layouts 1.12 0005 0006 import org.mauikit.controls 1.3 as Maui 0007 import org.mauikit.filebrowsing 1.3 as FM 0008 0009 import org.kde.arca 1.0 as Arca 0010 0011 import "previewer" 0012 0013 Maui.ApplicationWindow 0014 { 0015 id: root 0016 title: qsTr("Arca") 0017 0018 property alias dialog : _dialogLoader.item 0019 property alias currentTab: _tabView.currentItem 0020 0021 Loader 0022 { 0023 id: _dialogLoader 0024 } 0025 0026 Component 0027 { 0028 id: _fileDialogComponent 0029 0030 FM.FileDialog {} 0031 } 0032 0033 Component 0034 { 0035 id: _previewComponent 0036 0037 FilePreviewer 0038 { 0039 id: _previewer 0040 } 0041 } 0042 0043 NewArchiveDialog 0044 { 0045 id: _newArchiveDialog 0046 onDone: 0047 { 0048 var tab = _tabView.addTab(_archivePageComponent, ({})) 0049 tab.create(files, path, name, type) 0050 _newArchiveDialog.close() 0051 } 0052 } 0053 0054 Maui.TabView 0055 { 0056 id: _tabView 0057 anchors.fill: parent 0058 tabBar.visible: true 0059 0060 tabBar.showNewTabButton: false 0061 holder.visible: count === 0 0062 holder.emoji: "archive-insert" 0063 holder.title: i18n("Compress") 0064 holder.body: "Drop files in here to compress them." 0065 0066 0067 onCloseTabClicked: _tabView.closeTab(index) 0068 0069 holder.actions: [ 0070 0071 Action 0072 { 0073 id: _openArchiveAction 0074 icon.name: "folder-open" 0075 text: i18n("Open archive") 0076 onTriggered: root.openFileDialog() 0077 }, 0078 0079 Action 0080 { 0081 id: _createArchiveAction 0082 text: i18n("Compress files") 0083 icon.name: "archive-insert" 0084 onTriggered: 0085 { 0086 _dialogLoader.sourceComponent = _fileDialogComponent 0087 dialog.mode = dialog.modes.OPEN 0088 dialog.settings.filterType = FM.FMList.NONE 0089 dialog.callback = (paths) => { 0090 0091 _newArchiveDialog.urls = paths 0092 _newArchiveDialog.open() 0093 } 0094 0095 dialog.open() 0096 } 0097 } 0098 0099 ] 0100 0101 tabBar.rightContent: [ 0102 0103 Maui.ToolButtonMenu 0104 { 0105 icon.name: "list-add" 0106 0107 MenuItem 0108 { 0109 action: _openArchiveAction 0110 } 0111 0112 MenuItem 0113 { 0114 action:_createArchiveAction 0115 } 0116 0117 MenuSeparator{} 0118 0119 MenuItem 0120 { 0121 text: i18n("About") 0122 icon.name: "documentinfo" 0123 onTriggered: root.about() 0124 } 0125 }, 0126 0127 Maui.WindowControls {} 0128 0129 ] 0130 } 0131 0132 Component 0133 { 0134 id: _archivePageComponent 0135 0136 ArchivePage 0137 { 0138 Maui.TabViewInfo.tabTitle: title 0139 Maui.TabViewInfo.tabToolTipText: url 0140 } 0141 } 0142 0143 function openArchive(url) 0144 { 0145 _tabView.addTab(_archivePageComponent, {'url': url}) 0146 } 0147 0148 function previewFile(url) 0149 { 0150 _dialogLoader.sourceComponent = _previewComponent 0151 dialog.currentUrl = url 0152 dialog.open() 0153 } 0154 0155 function openFileDialog() 0156 { 0157 _dialogLoader.sourceComponent = _fileDialogComponent 0158 dialog.mode = dialog.modes.OPEN 0159 dialog.settings.filterType = FM.FMList.COMPRESSED 0160 dialog.callback = (paths) => { 0161 0162 for(var path of paths) 0163 { 0164 openArchive(path) 0165 } 0166 } 0167 0168 dialog.open() 0169 } 0170 0171 }