Warning, /maui/fiery/src/views/browser/BrowserLayout.qml is written in an unsupported language. File is not indexed.
0001 import QtQuick 2.14 0002 import QtQuick.Controls 2.14 0003 0004 import org.mauikit.controls 1.3 as Maui 0005 import org.mauikit.filebrowsing 1.3 as FB 0006 0007 Item 0008 { 0009 id: control 0010 0011 Maui.TabViewInfo.tabTitle: title 0012 Maui.TabViewInfo.tabToolTipText: currentItem.url 0013 0014 property url url 0015 0016 property alias currentIndex : _splitView.currentIndex 0017 property alias orientation : _splitView.orientation 0018 0019 readonly property alias count : _splitView.count 0020 readonly property alias currentItem : _splitView.currentItem 0021 readonly property alias model : _splitView.contentModel 0022 readonly property string title : count === 2 ? model.get(0).title + " - " + model.get(1).title : currentItem.title 0023 readonly property var urls : count === 2 ? [model.get(0).url, model.get(1).url] : [currentItem.url] 0024 0025 readonly property alias browser : _splitView.currentItem 0026 0027 Keys.enabled: true 0028 Keys.onPressed: 0029 { 0030 if(event.key === Qt.Key_F3) 0031 { 0032 if(control.count === 2) 0033 { 0034 pop() 0035 return 0036 }//close the inactive split 0037 0038 split("") 0039 event.accepted = true 0040 } 0041 0042 if((event.key === Qt.Key_Space) && (event.modifiers & Qt.ControlModifier)) 0043 { 0044 tabView.findTab() 0045 event.accepted = true 0046 } 0047 0048 0049 if(event.key === Qt.Key_F4) 0050 { 0051 control.terminalVisible = !control.terminalVisible 0052 event.accepted = true 0053 } 0054 } 0055 0056 Maui.SplitView 0057 { 0058 id: _splitView 0059 0060 anchors.fill: parent 0061 orientation: Qt.Horizontal 0062 0063 Component.onCompleted: split(control.url) 0064 } 0065 0066 Component 0067 { 0068 id: _browserComponent 0069 Browser 0070 { 0071 0072 } 0073 } 0074 0075 function split(path) 0076 { 0077 if(_splitView.count === 2) 0078 { 0079 return 0080 } 0081 0082 _splitView.addSplit(_browserComponent, {'url': path}) 0083 } 0084 0085 function pop() 0086 { 0087 if(_splitView.count === 1) 0088 { 0089 return //can not pop all the browsers, leave at leats 1 0090 } 0091 0092 closeSplit(_splitView.currentIndex === 1 ? 0 : 1) 0093 } 0094 0095 function closeSplit(index) //closes a split but triggering a warning before 0096 { 0097 if(index >= _splitView.count) 0098 { 0099 return 0100 } 0101 0102 const item = _splitView.itemAt(index) 0103 if( item.editor.document.modified) 0104 { 0105 _dialogLoader.sourceComponent = _unsavedDialogComponent 0106 dialog.callback = function () { destroyItem(index) } 0107 dialog.open() 0108 return 0109 } else 0110 { 0111 destroyItem(index) 0112 } 0113 } 0114 0115 function destroyItem(index) //deestroys a split view withouth warning 0116 { 0117 _splitView.closeSplit(index) 0118 } 0119 } 0120 0121