forked from Silverfish/proton-bridge
GODT-1455 Adding links to setup guide.
This commit is contained in:
@ -300,10 +300,11 @@ ColumnLayout {
|
|||||||
Button { colorScheme: root.colorScheme; text: "Toggle Finished"; onClicked: {user.toggleSplitModeFinished()}}
|
Button { colorScheme: root.colorScheme; text: "Toggle Finished"; onClicked: {user.toggleSplitModeFinished()}}
|
||||||
}
|
}
|
||||||
|
|
||||||
TextArea {
|
TextArea { // TODO: this is causing binding loop on imlicitWidth
|
||||||
colorScheme: root.colorScheme
|
colorScheme: root.colorScheme
|
||||||
text: user && user.addresses ? user.addresses.join("\n") : "user@protonmail.com"
|
text: user && user.addresses ? user.addresses.join("\n") : "user@protonmail.com"
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
onEditingFinished: {
|
onEditingFinished: {
|
||||||
user.addresses = text.split("\n")
|
user.addresses = text.split("\n")
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,7 +38,7 @@ Window {
|
|||||||
x: 10
|
x: 10
|
||||||
y: 10
|
y: 10
|
||||||
width: 800
|
width: 800
|
||||||
height: 600
|
height: 800
|
||||||
|
|
||||||
property ColorScheme colorScheme: ProtonStyle.darkStyle
|
property ColorScheme colorScheme: ProtonStyle.darkStyle
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ Window {
|
|||||||
|
|
||||||
property string password: "SMj975NnEYYsqu55GGmlpv"
|
property string password: "SMj975NnEYYsqu55GGmlpv"
|
||||||
property var addresses: [
|
property var addresses: [
|
||||||
"janedoe@protonmail.com",
|
"jaanedoe@protonmail.com",
|
||||||
"jane@pm.me",
|
"jane@pm.me",
|
||||||
"jdoe@pm.me"
|
"jdoe@pm.me"
|
||||||
]
|
]
|
||||||
@ -363,6 +363,15 @@ Window {
|
|||||||
enabled: bridge === undefined || bridge === null
|
enabled: bridge === undefined || bridge === null
|
||||||
onClicked: {
|
onClicked: {
|
||||||
bridge = bridgeComponent.createObject()
|
bridge = bridgeComponent.createObject()
|
||||||
|
var showSetupGuide = false
|
||||||
|
if (showSetupGuide) {
|
||||||
|
var newUserObject = root.userComponent.createObject(root)
|
||||||
|
newUserObject.username = "LerooooyJenkins@protonmail.com"
|
||||||
|
newUserObject.loggedIn = true
|
||||||
|
newUserObject.setupGuideSeen = false
|
||||||
|
root.users.append( { object: newUserObject } )
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -656,7 +665,7 @@ Window {
|
|||||||
|
|
||||||
property Bridge bridge
|
property Bridge bridge
|
||||||
|
|
||||||
property string goos: "linux"
|
property string goos: "darwin"
|
||||||
|
|
||||||
property bool showOnStartup: true // this actually needs to be false, but since we use Bridge_test for testing purpose - lets default this to true just for convenience
|
property bool showOnStartup: true // this actually needs to be false, but since we use Bridge_test for testing purpose - lets default this to true just for convenience
|
||||||
property bool dockIconVisible: false
|
property bool dockIconVisible: false
|
||||||
|
|||||||
@ -155,6 +155,13 @@ ApplicationWindow {
|
|||||||
onDismissed: {
|
onDismissed: {
|
||||||
root.showSetup(null,"")
|
root.showSetup(null,"")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onFinished: {
|
||||||
|
// TODO: Do not close window. Trigger backend to check that
|
||||||
|
// there is a successfully connected client. Then backend
|
||||||
|
// should send another signal to close the setup guide.
|
||||||
|
root.showSetup(null,"")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,6 +183,7 @@ ApplicationWindow {
|
|||||||
function showSetup(user, address) {
|
function showSetup(user, address) {
|
||||||
setupGuide.user = user
|
setupGuide.user = user
|
||||||
setupGuide.address = address
|
setupGuide.address = address
|
||||||
|
setupGuide.reset()
|
||||||
if (setupGuide.user) {
|
if (setupGuide.user) {
|
||||||
contentLayout._showSetup = true
|
contentLayout._showSetup = true
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -23,7 +23,7 @@ import QtQuick.Controls.impl 2.12
|
|||||||
|
|
||||||
import Proton 4.0
|
import Proton 4.0
|
||||||
|
|
||||||
Rectangle {
|
Item {
|
||||||
id:root
|
id:root
|
||||||
|
|
||||||
property ColorScheme colorScheme
|
property ColorScheme colorScheme
|
||||||
@ -32,27 +32,85 @@ Rectangle {
|
|||||||
property string address
|
property string address
|
||||||
|
|
||||||
signal dismissed()
|
signal dismissed()
|
||||||
|
signal finished()
|
||||||
|
|
||||||
implicitHeight: children[0].implicitHeight
|
implicitHeight: children[0].implicitHeight
|
||||||
implicitWidth: children[0].implicitWidth
|
implicitWidth: children[0].implicitWidth
|
||||||
|
|
||||||
|
|
||||||
|
ListModel {
|
||||||
|
id: clients
|
||||||
|
property string name : "Apple Mail"
|
||||||
|
property string iconSource : "./icons/ic-apple-mail.svg"
|
||||||
|
property bool haveAutoSetup: true
|
||||||
|
property string link: "https://protonmail.com/bridge/applemail"
|
||||||
|
|
||||||
|
Component.onCompleted : {
|
||||||
|
if (root.backend.goos == "darwin") {
|
||||||
|
append({
|
||||||
|
"name" : "Apple Mail",
|
||||||
|
"iconSource" : "./icons/ic-apple-mail.svg",
|
||||||
|
"haveAutoSetup" : true,
|
||||||
|
"link" : "https://protonmail.com/bridge/applemail"
|
||||||
|
})
|
||||||
|
append({
|
||||||
|
"name" : "Microsoft Outlook",
|
||||||
|
"iconSource" : "./icons/ic-microsoft-outlook.svg",
|
||||||
|
"haveAutoSetup" : false,
|
||||||
|
"link" : "https://protonmail.com/bridge/outlook2019-mac"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (root.backend.goos == "windows") {
|
||||||
|
append({
|
||||||
|
"name" : "Microsoft Outlook",
|
||||||
|
"iconSource" : "./icons/ic-microsoft-outlook.svg",
|
||||||
|
"haveAutoSetup" : false,
|
||||||
|
"link" : "https://protonmail.com/bridge/outlook2019"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
append({
|
||||||
|
"name" : "Mozilla Thunderbird",
|
||||||
|
"iconSource" : "./icons/ic-mozilla-thunderbird.svg",
|
||||||
|
"haveAutoSetup" : false,
|
||||||
|
"link" : "https://protonmail.com/bridge/thunderbird"
|
||||||
|
})
|
||||||
|
|
||||||
|
append({
|
||||||
|
"name" : "Other",
|
||||||
|
"iconSource" : "./icons/ic-other-mail-clients.svg",
|
||||||
|
"haveAutoSetup" : false,
|
||||||
|
"link" : "https://protonmail.com/bridge/clients"
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: root
|
||||||
color: root.colorScheme.background_norm
|
color: root.colorScheme.background_norm
|
||||||
|
}
|
||||||
|
|
||||||
RowLayout {
|
StackLayout {
|
||||||
|
id: guidePages
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
spacing: 0
|
anchors.leftMargin: 80
|
||||||
|
anchors.rightMargin: 80
|
||||||
|
anchors.topMargin: 30
|
||||||
|
anchors.bottomMargin: 70
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
|
ColumnLayout { // 0: Client selection
|
||||||
|
id: clientView
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.leftMargin: 80
|
|
||||||
Layout.rightMargin: 80
|
property int columnWidth: 268
|
||||||
Layout.topMargin: 30
|
|
||||||
Layout.bottomMargin: 70
|
spacing: 8
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
colorScheme: root.colorScheme
|
colorScheme: root.colorScheme
|
||||||
text: qsTr("Set up email client")
|
text: qsTr("Setting up email client")
|
||||||
type: Label.LabelType.Heading
|
type: Label.LabelType.Heading
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,31 +121,40 @@ Rectangle {
|
|||||||
type: Label.LabelType.Lead
|
type: Label.LabelType.Lead
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
Layout.topMargin: 32-clientView.spacing
|
||||||
|
spacing: 24
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: clientColumn
|
||||||
|
Layout.alignment: Qt.AlignTop
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
|
id: labelA
|
||||||
colorScheme: root.colorScheme
|
colorScheme: root.colorScheme
|
||||||
Layout.topMargin: 32
|
|
||||||
text: qsTr("Choose an email client")
|
text: qsTr("Choose an email client")
|
||||||
type: Label.LabelType.Body_semibold
|
type: Label.LabelType.Body_semibold
|
||||||
}
|
}
|
||||||
|
|
||||||
ListModel {
|
ListView {
|
||||||
id: clients
|
id: clientList
|
||||||
ListElement{name : "Apple Mail" ; iconSource : "./icons/ic-apple-mail.svg" }
|
Layout.fillHeight: true
|
||||||
ListElement{name : "Microsoft Outlook" ; iconSource : "./icons/ic-microsoft-outlook.svg" }
|
width: clientView.columnWidth
|
||||||
ListElement{name : "Mozilla Thunderbird" ; iconSource : "./icons/ic-mozilla-thunderbird.svg" }
|
|
||||||
ListElement{name : "Other" ; iconSource : "./icons/ic-other-mail-clients.svg" }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Repeater {
|
|
||||||
model: clients
|
model: clients
|
||||||
|
|
||||||
Rectangle {
|
highlight: Rectangle {
|
||||||
|
color: root.colorScheme.interaction_default_active
|
||||||
|
radius: 4
|
||||||
|
}
|
||||||
|
|
||||||
|
delegate: Item {
|
||||||
implicitWidth: clientRow.width
|
implicitWidth: clientRow.width
|
||||||
implicitHeight: clientRow.height
|
implicitHeight: clientRow.height
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: clientRow
|
id: clientRow
|
||||||
|
width: clientList.width
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.topMargin: 12
|
Layout.topMargin: 12
|
||||||
@ -116,18 +183,78 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: {
|
||||||
|
clientList.currentIndex = index
|
||||||
|
if (!model.haveAutoSetup) {
|
||||||
|
root.setupAction(1,index)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: actionColumn
|
||||||
|
visible: clientList.currentIndex >= 0 && clients.get(clientList.currentIndex).haveAutoSetup
|
||||||
|
Layout.alignment: Qt.AlignTop
|
||||||
|
|
||||||
|
Label {
|
||||||
|
colorScheme: root.colorScheme
|
||||||
|
text: qsTr("Choose configuration mode")
|
||||||
|
type: Label.LabelType.Body_semibold
|
||||||
|
}
|
||||||
|
|
||||||
|
ListView {
|
||||||
|
id: actionList
|
||||||
|
Layout.fillHeight: true
|
||||||
|
width: clientView.columnWidth
|
||||||
|
|
||||||
|
model: [
|
||||||
|
qsTr("Configure automatically"),
|
||||||
|
qsTr("Configure manually"),
|
||||||
|
]
|
||||||
|
|
||||||
|
highlight: Rectangle {
|
||||||
|
color: root.colorScheme.interaction_default_active
|
||||||
|
radius: 4
|
||||||
|
}
|
||||||
|
|
||||||
|
delegate: Item {
|
||||||
|
implicitWidth: children[0].width
|
||||||
|
implicitHeight: children[0].height
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
width: actionList.width
|
||||||
|
|
||||||
|
Label {
|
||||||
|
Layout.topMargin: 20
|
||||||
|
Layout.bottomMargin: 20
|
||||||
|
Layout.leftMargin: 16
|
||||||
|
Layout.rightMargin: 16
|
||||||
|
colorScheme: root.colorScheme
|
||||||
|
text: modelData
|
||||||
|
type: Label.LabelType.Body
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: 1
|
||||||
|
color: root.colorScheme.border_weak
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (model.name != "Apple Mail") {
|
actionList.currentIndex = index
|
||||||
console.log(" TODO configure ", model.name)
|
root.setupAction(index,clientList.currentIndex)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
if (user) {
|
|
||||||
root.user.configureAppleMail(root.address)
|
|
||||||
}
|
}
|
||||||
root.dismissed()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -141,6 +268,7 @@ Rectangle {
|
|||||||
flat: true
|
flat: true
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
root.setupAction(-1,-1)
|
||||||
if (user) {
|
if (user) {
|
||||||
user.setupGuideSeen = true
|
user.setupGuideSeen = true
|
||||||
}
|
}
|
||||||
@ -149,4 +277,41 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setupAction(actionID,clientID){
|
||||||
|
if (user) {
|
||||||
|
user.setupGuideSeen = true
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (actionID) {
|
||||||
|
case -1: root.dismissed(); break; // dismiss
|
||||||
|
case 0: // automatic
|
||||||
|
if (user) {
|
||||||
|
switch (clientID) {
|
||||||
|
case 0:
|
||||||
|
root.user.configureAppleMail(root.address)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
root.finished()
|
||||||
|
break;
|
||||||
|
case 1: // manual
|
||||||
|
var clientObj = clients.get(clientID)
|
||||||
|
if (clientObj != undefined && clientObj.link != "" ) {
|
||||||
|
Qt.openUrlExternally(clientObj.link)
|
||||||
|
} else {
|
||||||
|
console.log("unexpected client index", actionID, clientID)
|
||||||
|
}
|
||||||
|
root.finished();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
console.log("unexpected client setup action", actionID, clientID)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function reset(){
|
||||||
|
guidePages.currentIndex = 0
|
||||||
|
clientList.currentIndex = -1
|
||||||
|
actionList.currentIndex = -1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user