Warning, /maui/fiery/src/main.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 import QtWebEngine 1.9
0005 import Qt.labs.settings 1.0
0006 
0007 import org.mauikit.controls 1.3 as Maui
0008 
0009 import org.maui.fiery 1.0 as Fiery
0010 
0011 import "views"
0012 import "views/widgets"
0013 
0014 Maui.ApplicationWindow
0015 {
0016     id: root
0017     title: browserView.currentTab.title
0018 
0019     readonly property var views : ({browser: 0, tabs: 1, history: 2})
0020 
0021     readonly property alias currentBrowser : _appView.currentBrowser
0022     readonly property alias browserView : _appView.browserView
0023 
0024     Settings
0025     {
0026         id: appSettings
0027         category: "Browser"
0028 
0029         property url homePage: "https://duckduckgo.com"
0030         property url searchEnginePage: "https://duckduckgo.com/?q="
0031         property color backgroundColor : root.Maui.Theme.backgroundColor
0032 
0033         property bool accelerated2dCanvasEnabled : true
0034         property bool allowGeolocationOnInsecureOrigins : false
0035         property bool allowRunningInsecureContent : false
0036         property bool allowWindowActivationFromJavaScript : false
0037         property bool autoLoadIconsForPage : true
0038         property bool autoLoadImages : true
0039         //        property bool defaultTextEncoding : string
0040         property bool dnsPrefetchEnabled : false
0041         property bool errorPageEnabled : true
0042         property bool focusOnNavigationEnabled : false
0043         property bool fullscreenSupportEnabled : false
0044         property bool hyperlinkAuditingEnabled : false
0045         property bool javascriptCanAccessClipboard : true
0046         property bool javascriptCanOpenWindows : true
0047         property bool javascriptCanPaste : true
0048         property bool javascriptEnabled : true
0049         property bool linksIncludedInFocusChain : true
0050         property bool localContentCanAccessFileUrls : true
0051         property bool localContentCanAccessRemoteUrls : false
0052         property bool localStorageEnabled : true
0053         property bool pdfViewerEnabled : true
0054         property bool playbackRequiresUserGesture : true
0055         property bool pluginsEnabled : false
0056         property bool printElementBackgrounds : true
0057         property bool screenCaptureEnabled : true
0058         property bool showScrollBars : true
0059         property bool spatialNavigationEnabled : false
0060         property bool touchIconsEnabled : false
0061         //        property bool unknownUrlSchemePolicy : WebEngineSettings::UnknownUrlSchemePolicy
0062         property bool webGLEnabled : true
0063         property bool  webRTCPublicInterfacesOnly : false
0064 
0065         property string downloadsPath : browserView.profile.downloadPath
0066 
0067         property bool restoreSession: true
0068         property bool switchToTab: false
0069         property double zoomFactor
0070 
0071         property bool autoSave: false
0072     }
0073 
0074     Fiery.Surf
0075     {
0076         id: _surf
0077     }
0078 
0079     SettingsDialog
0080     {
0081         id: _settingsDialog
0082     }
0083 
0084     AppView
0085     {
0086         id: _appView
0087         anchors.fill: parent
0088     }
0089 
0090 
0091     property WebEngineProfile profile: Fiery.FieryWebProfile
0092     {
0093         //            httpUserAgent: tabs.currentItem.userAgent.userAgent
0094         //            offTheRecord: tabs.privateTabsMode
0095         //            storageName: tabs.privateTabsMode ? "Private" : Settings.profile
0096 
0097         //            questionLoader: rootPage.questionLoader
0098         //            urlInterceptor: typeof AdblockUrlInterceptor !== "undefined" && AdblockUrlInterceptor
0099 
0100         onDownloadFinished:
0101         {
0102             switch(download.state)
0103             {
0104             case WebEngineDownloadItem.DownloadCompleted: notify("dialog-warning", i18n("Download Finished"), i18n("File has been saved."), ()=> {console.log(download.downloadFileName)}, i18n("Open"))
0105             }
0106         }
0107 
0108 //        onPresentNotification:
0109 //        {
0110 //            root.notify("dialog-question", notification.title, notification.message,  () =>{ notification.click() }, i18n("Accept"))
0111 //            notification.show()
0112 //        }
0113     }
0114 
0115     Connections
0116     {
0117         target: Fiery.DownloadsManager
0118         function onNewDownload(download)
0119         {
0120      root.notify("dialog-question", download.downloadFileName, i18n("Do you want to download and save this file?"),  () =>{ download.resume() }, i18n("Accept"))
0121         }
0122     }
0123 
0124     property Component windowComponent: Maui.ApplicationWindow
0125     {
0126         // Destroy on close to release the Window's QML resources.
0127         // Because it was created with a parent, it won't be garbage-collected.
0128         onClosing:
0129         {
0130             console.log("Closing new window")
0131             destroy()
0132         }
0133 
0134         visible: true
0135 
0136         property WebEngineView webView: _delegate.currentBrowser
0137         property alias appView : _delegate
0138 
0139         AppView
0140         {
0141             id: _delegate
0142             anchors.fill: parent
0143         }
0144     }
0145 
0146     //The urls represent the split view, so it might be one or two.
0147     function newWindow(urls)
0148     {
0149         console.log("GOT", urls, urls[0])
0150         var newWindow = windowComponent.createObject(root)
0151         newWindow.webView.url = urls[0]
0152 
0153         if(urls[1])
0154         {
0155             newWindow.appView.browserView.openSplit(urls[1])
0156         }
0157     }
0158 
0159 }