Advertisement
nopcodex90

QTWebengine_Profile

Nov 14th, 2024
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QML 1.77 KB | None | 0 0
  1. import QtQuick
  2. import QtQuick.Layouts 2.15
  3. import QtWebEngine
  4. import org.kde.kirigami 2.20 as Kirigami
  5. import org.kde.plasma.components 3.0 as PlasmaComponents3
  6. import org.kde.plasma.extras 2.0 as PlasmaExtras
  7. import org.kde.plasma.plasmoid 2.0
  8.  
  9. Item {
  10.     Layout.fillWidth: true
  11.     Layout.fillHeight: true
  12.  
  13.     WebEngineView {
  14.         id: webView
  15.  
  16.         anchors.fill: parent
  17.         url: plasmoid.configuration.grammarlyUrl
  18.         settings.javascriptCanAccessClipboard: true
  19.         settings.javascriptEnabled: true
  20.         settings.localContentCanAccessRemoteUrls: true
  21.         settings.localContentCanAccessFileUrls: true
  22.         settings.screenCaptureEnabled: true
  23.         profile: grammarlyProfile
  24.         onLinkHovered: (hoveredUrl) => {
  25.             if (hoveredUrl.toString() !== "")
  26.                 mouseArea.cursorShape = Qt.PointingHandCursor;
  27.             else
  28.                 mouseArea.cursorShape = Qt.ArrowCursor;
  29.         }
  30.  
  31.         WebEngineProfile {
  32.             id: grammarlyProfile
  33.  
  34.             httpUserAgent: getUserAgent()
  35.             storageName: "grammarly"
  36.             offTheRecord: false
  37.             httpCacheType: WebEngineProfile.DiskHttpCache
  38.             persistentCookiesPolicy: WebEngineProfile.ForcePersistentCookies
  39.             persistentPermissionsPolicy: WebEngineProfile.StoreOnDisk
  40.             httpCacheMaximumSize: 2.14748e+09
  41.         }
  42.  
  43.     }
  44.  
  45.     MouseArea {
  46.         id: mouseArea
  47.  
  48.         anchors.fill: parent
  49.         acceptedButtons: Qt.BackButton | Qt.ForwardButton
  50.         onPressed: (mouse) => {
  51.             if (mouse.button === Qt.BackButton)
  52.                 grammarlyWebview.goBack();
  53.             else if (mouse.button === Qt.ForwardButton)
  54.                 grammarlyWebview.goForward();
  55.         }
  56.     }
  57.  
  58. }
  59.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement