forked from Silverfish/proton-bridge
GODT-1412: Refactor paths and links
This commit is contained in:
@ -23,6 +23,8 @@ import QtQuick.Controls 2.13
|
||||
|
||||
import QtQml.Models 2.12
|
||||
|
||||
import Qt.labs.platform 1.1
|
||||
|
||||
import Proton 4.0
|
||||
|
||||
import "./BridgeTest"
|
||||
@ -630,11 +632,13 @@ Window {
|
||||
TextField {
|
||||
colorScheme:root.colorScheme
|
||||
label: "Path"
|
||||
text: root.diskCachePath
|
||||
text: root.diskCachePath.toString().replace("file://", "")
|
||||
implicitWidth: 160
|
||||
onEditingFinished: root.diskCachePath = this.text
|
||||
onEditingFinished: {
|
||||
root.diskCachePath = Qt.resolvedUrl("file://"+text)
|
||||
}
|
||||
}
|
||||
Button {colorScheme: root.colorScheme; text: "Change finished:"; onClicked: root.changeLocalCacheFinished()}
|
||||
Button {colorScheme: root.colorScheme; text: "Change finished"; onClicked: root.changeLocalCacheFinished()}
|
||||
}
|
||||
RowLayout {
|
||||
Label {colorScheme: root.colorScheme; text: "Reset:"}
|
||||
@ -686,7 +690,8 @@ Window {
|
||||
|
||||
|
||||
property bool isDiskCacheEnabled: true
|
||||
property string diskCachePath: "/home/bridge"
|
||||
// Qt.resolvedUrl("file:///C:/Users/user/AppData/Roaming/protonmail/bridge/cache/c11/messages")
|
||||
property url diskCachePath: StandardPaths.standardLocations(StandardPaths.HomeLocation)[0]
|
||||
signal cacheUnavailable()
|
||||
signal cacheCantMove()
|
||||
signal cacheLocationChangeSuccess()
|
||||
@ -749,10 +754,11 @@ Window {
|
||||
}
|
||||
signal resetFinished()
|
||||
|
||||
property string logsPath: "/home/cuto" // StandardPaths.locate(StandardPaths.DesktopLocation)
|
||||
property string version: "2.0.X-BridePreview"
|
||||
property string licensePath: "/home/cuto" // StandardPaths.locate(StandardPaths.DesktopLocation)
|
||||
property string releaseNotesLink: "https://protonmail.com/download/bridge/early_releases.html"
|
||||
property url logsPath: StandardPaths.standardLocations(StandardPaths.HomeLocation)[0]
|
||||
property url licensePath: StandardPaths.standardLocations(StandardPaths.HomeLocation)[0]
|
||||
property url releaseNotesLink: Qt.resolvedUrl("https://protonmail.com/download/bridge/early_releases.html")
|
||||
property url landingPageLink: Qt.resolvedUrl("https://protonmail.com/bridge")
|
||||
|
||||
property string currentEmailClient: "" // "Apple Mail 14.0"
|
||||
function updateCurrentMailClient(){
|
||||
|
||||
@ -122,7 +122,7 @@ SettingsView {
|
||||
text: qsTr("View logs")
|
||||
secondary: true
|
||||
colorScheme: root.colorScheme
|
||||
onClicked: Qt.openUrlExternally("file://"+root.backend.logsPath)
|
||||
onClicked: Qt.openUrlExternally(root.backend.logsPath)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -70,7 +70,7 @@ SettingsView {
|
||||
actionText: qsTr("View logs")
|
||||
description: qsTr("Open and review logs to troubleshoot.")
|
||||
type: SettingsItem.Button
|
||||
onClicked: {Qt.openUrlExternally("file://"+root.backend.logsPath)}
|
||||
onClicked: Qt.openUrlExternally(root.backend.logsPath)
|
||||
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
@ -108,7 +108,7 @@ SettingsView {
|
||||
|
||||
text: qsTr("Proton Mail Bridge v%1<br>© 2021 Proton AG<br>%2 %3").
|
||||
arg(root.backend.version).
|
||||
arg(link("file://"+root.backend.licensePath, qsTr("License"))).
|
||||
arg(link(root.backend.licensePath, qsTr("License"))).
|
||||
arg(link(root.backend.releaseNotesLink, qsTr("Release notes")))
|
||||
|
||||
onLinkActivated: Qt.openUrlExternally(link)
|
||||
|
||||
@ -30,7 +30,7 @@ SettingsView {
|
||||
|
||||
property var notifications
|
||||
property bool _diskCacheEnabled: true
|
||||
property string _diskCachePath: "/home"
|
||||
property url _diskCachePath: pathDialog.shortcuts.home
|
||||
|
||||
Label {
|
||||
colorScheme: root.colorScheme
|
||||
@ -64,7 +64,10 @@ SettingsView {
|
||||
colorScheme: root.colorScheme
|
||||
text: qsTr("Current cache location")
|
||||
actionText: qsTr("Change location")
|
||||
description: root._diskCachePath
|
||||
description: root.backend.goos === "windows" ?
|
||||
root._diskCachePath.toString().replace("file:///", "").replace(new RegExp("/", 'g'), "\\") + "\\" :
|
||||
root._diskCachePath.toString().replace("file://", "") + "/"
|
||||
descriptionWrap: Text.WrapAnywhere
|
||||
type: SettingsItem.Button
|
||||
enabled: root._diskCacheEnabled
|
||||
onClicked: {
|
||||
@ -76,8 +79,8 @@ SettingsView {
|
||||
FileDialog {
|
||||
id: pathDialog
|
||||
title: qsTr("Select cache location")
|
||||
folder: shortcuts.home
|
||||
onAccepted: root.sanitizePath(pathDialog.fileUrl.toString())
|
||||
folder: root._diskCachePath
|
||||
onAccepted: root._diskCachePath = pathDialog.fileUrl
|
||||
selectFolder: true
|
||||
}
|
||||
}
|
||||
@ -120,7 +123,6 @@ SettingsView {
|
||||
}
|
||||
|
||||
function submit(){
|
||||
console.log("submit")
|
||||
if (!root._diskCacheEnabled && root.backend.isDiskCacheEnabled) {
|
||||
root.notifications.askDisableLocalCache()
|
||||
return
|
||||
@ -141,12 +143,6 @@ SettingsView {
|
||||
root._diskCachePath = root.backend.diskCachePath
|
||||
}
|
||||
|
||||
function sanitizePath(path) {
|
||||
var pattern = "file://"
|
||||
if (root.backend.goos=="windows") pattern+="/"
|
||||
root._diskCachePath = path.replace(pattern, "")
|
||||
}
|
||||
|
||||
onVisibleChanged: {
|
||||
root.setDefaultValues()
|
||||
}
|
||||
|
||||
@ -689,7 +689,7 @@ QtObject {
|
||||
type: Notification.NotificationType.Warning
|
||||
group: Notifications.Group.Configuration | Notifications.Group.Dialogs
|
||||
|
||||
property var path
|
||||
property url path
|
||||
|
||||
Connections {
|
||||
target: root
|
||||
|
||||
@ -29,6 +29,7 @@ Item {
|
||||
property string actionText: "Action"
|
||||
property string actionIcon: ""
|
||||
property string description: "Lorem ipsum dolor sit amet"
|
||||
property alias descriptionWrap: descriptionLabel.wrapMode
|
||||
property var type: SettingsItem.ActionType.Toggle
|
||||
|
||||
property bool checked: true
|
||||
@ -67,6 +68,7 @@ Item {
|
||||
}
|
||||
|
||||
Label {
|
||||
id: descriptionLabel
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
|
||||
|
||||
Reference in New Issue
Block a user