2022-04-05 13:50:21 +00:00
// Copyright (c) 2022 Proton AG
2021-05-28 10:12:57 +00:00
//
2022-04-05 13:50:21 +00:00
// This file is part of Proton Mail Bridge.
2021-05-28 10:12:57 +00:00
//
2022-04-05 13:50:21 +00:00
// Proton Mail Bridge is free software: you can redistribute it and/or modify
2021-05-28 10:12:57 +00:00
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
2022-04-05 13:50:21 +00:00
// Proton Mail Bridge is distributed in the hope that it will be useful,
2021-05-28 10:12:57 +00:00
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
2022-04-05 13:50:21 +00:00
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
2021-05-28 10:12:57 +00:00
2021-06-06 21:57:59 +00:00
import QtQml 2.12
2021-05-28 10:12:57 +00:00
import QtQuick 2.13
import QtQuick . Window 2.13
2021-06-06 21:57:59 +00:00
import QtQuick . Layouts 1.12
2021-05-28 10:12:57 +00:00
import QtQuick . Controls 2.13
2021-06-06 21:57:59 +00:00
import QtQml . Models 2.12
2021-11-19 09:40:02 +00:00
import Qt . labs . platform 1.1
2021-06-06 21:57:59 +00:00
import Proton 4.0
import "./BridgeTest"
2021-08-04 12:00:31 +00:00
import BridgePreview 1.0
import Notifications 1.0
2021-06-06 21:57:59 +00:00
2021-05-28 10:12:57 +00:00
Window {
2021-06-06 21:57:59 +00:00
id: root
2021-08-09 12:40:56 +00:00
x: 10
y: 10
width: 800
2021-12-06 13:06:08 +00:00
height: 800
2021-06-06 21:57:59 +00:00
2021-08-04 12:00:31 +00:00
property ColorScheme colorScheme: ProtonStyle . darkStyle
2021-06-06 21:57:59 +00:00
flags : Qt . Window | Qt . Dialog
2021-05-28 10:12:57 +00:00
visible : true
2021-06-06 21:57:59 +00:00
title : "Bridge Test GUI"
2021-10-11 14:37:15 +00:00
// This is needed because on MacOS if first window shown is not transparent -
// all other windows of application will not have transparent background (black
// instead of transparency). In our case that mean that if BridgeTest will be
// shown before StatusWindow - StatusWindow will not have transparent corners.
color: "transparent"
2021-06-06 21:57:59 +00:00
2021-08-04 12:00:31 +00:00
function getCursorPos ( ) {
return BridgePreview . getCursorPos ( )
}
2022-02-23 11:00:20 +00:00
function restart ( ) {
root . quit ( )
console . log ( "Restarting...." )
root . openBridge ( )
}
function openBridge ( ) {
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 } )
}
}
2021-08-04 12:00:31 +00:00
function quit ( ) {
if ( bridge !== undefined && bridge !== null ) {
bridge . destroy ( )
}
}
2021-09-13 15:22:53 +00:00
function guiReady ( ) {
console . log ( "Gui Ready" )
}
2021-06-06 21:57:59 +00:00
function _log ( msg , color ) {
logTextArea . text += "<p style='color: " + color + ";'>" + msg + "</p>"
logTextArea . text += "\n"
}
2021-05-28 10:12:57 +00:00
2021-06-06 21:57:59 +00:00
function log ( msg ) {
console . log ( msg )
_log ( msg , root . colorScheme . signal_info )
}
function error ( msg ) {
console . error ( msg )
_log ( msg , root . colorScheme . signal_danger )
}
// No user object should be put in this list until a successful login
property var users: UserModel {
id: _users
onRowsInserted: {
for ( var i = first ; i <= last ; i ++ ) {
_usersTest . insert ( i + 1 , { object: get ( i ) } )
2021-05-28 10:12:57 +00:00
}
}
2021-06-06 21:57:59 +00:00
onRowsRemoved: {
_usersTest . remove ( first + 1 , first - last + 1 )
}
onRowsMoved: {
_usersTest . move ( start + 1 , row + 1 , end - start + 1 )
}
onDataChanged: {
for ( var i = topLeft . row ; i <= bottomRight . row ; i ++ ) {
_usersTest . set ( i + 1 , { object: get ( i ) } )
}
}
}
// this list is used on test gui: it contains same users list as users above + fake user to represent login request of new user on pos 0
property var usersTest: UserModel {
id: _usersTest
}
property var userComponent: Component {
id: _userComponent
QtObject {
property string username: ""
property bool loggedIn: false
2021-08-09 12:40:56 +00:00
property bool splitMode: false
2021-06-06 21:57:59 +00:00
2021-08-04 12:00:31 +00:00
property bool setupGuideSeen: true
2021-08-09 12:40:56 +00:00
property var usedBytes: 5350 * 1024 * 1024
property var totalBytes: 20 * 1024 * 1024 * 1024
2021-08-04 12:00:31 +00:00
property string avatarText: "jd"
2021-08-09 12:40:56 +00:00
property string password: "SMj975NnEYYsqu55GGmlpv"
property var addresses: [
2021-12-06 13:06:08 +00:00
"jaanedoe@protonmail.com" ,
2021-08-09 12:40:56 +00:00
"jane@pm.me" ,
"jdoe@pm.me"
]
2021-06-06 21:57:59 +00:00
signal loginUsernamePasswordError ( )
signal loginFreeUserError ( )
signal loginConnectionError ( )
signal login2FARequested ( )
signal login2FAError ( )
signal login2FAErrorAbort ( )
signal login2PasswordRequested ( )
signal login2PasswordError ( )
signal login2PasswordErrorAbort ( )
// Test purpose only:
property bool isFakeUser: this === root . loginUser
function userSignal ( msg ) {
if ( isFakeUser ) {
return
}
root . log ( "<- User (" + username + "): " + msg )
}
2021-08-09 12:40:56 +00:00
function toggleSplitMode ( makeActive ) {
userSignal ( "toggle split mode " + makeActive )
}
signal toggleSplitModeFinished ( )
function configureAppleMail ( address ) {
userSignal ( "confugure apple mail " + address )
}
function logout ( ) {
userSignal ( "logout" )
loggedIn = false
}
function remove ( ) {
console . log ( "remove this" , users . count )
for ( var i = 0 ; i < users . count ; i ++ ) {
if ( users . get ( i ) === this ) {
users . remove ( i , 1 )
return
}
}
}
2021-06-06 21:57:59 +00:00
onLoginUsernamePasswordError: {
userSignal ( "loginUsernamePasswordError" )
}
onLoginFreeUserError: {
userSignal ( "loginFreeUserError" )
}
onLoginConnectionError: {
userSignal ( "loginConnectionError" )
2021-05-28 10:12:57 +00:00
}
2021-06-06 21:57:59 +00:00
onLogin2FARequested: {
userSignal ( "login2FARequested" )
}
onLogin2FAError: {
userSignal ( "login2FAError" )
}
onLogin2FAErrorAbort: {
userSignal ( "login2FAErrorAbort" )
}
onLogin2PasswordRequested: {
userSignal ( "login2PasswordRequested" )
}
onLogin2PasswordError: {
userSignal ( "login2PasswordError" )
}
onLogin2PasswordErrorAbort: {
userSignal ( "login2PasswordErrorAbort" )
}
function resetLoginRequests ( ) {
isLoginRequested = false
isLogin2FARequested = false
isLogin2FAProvided = false
isLogin2PasswordRequested = false
isLogin2PasswordProvided = false
}
property bool isLoginRequested: false
property bool isLogin2FARequested: false
property bool isLogin2FAProvided: false
property bool isLogin2PasswordRequested: false
property bool isLogin2PasswordProvided: false
2021-05-28 10:12:57 +00:00
}
}
2021-06-06 21:57:59 +00:00
// this it fake user used only for representing first login request
property var loginUser
Component.onCompleted: {
var newLoginUser = _userComponent . createObject ( )
root . loginUser = newLoginUser
2021-08-04 12:00:31 +00:00
root . loginUser . setupGuideSeen = false
2021-06-06 21:57:59 +00:00
_usersTest . append ( { object: newLoginUser } )
newLoginUser . loginUsernamePasswordError . connect ( root . loginUsernamePasswordError )
newLoginUser . loginFreeUserError . connect ( root . loginFreeUserError )
newLoginUser . loginConnectionError . connect ( root . loginConnectionError )
newLoginUser . login2FARequested . connect ( root . login2FARequested )
newLoginUser . login2FAError . connect ( root . login2FAError )
newLoginUser . login2FAErrorAbort . connect ( root . login2FAErrorAbort )
newLoginUser . login2PasswordRequested . connect ( root . login2PasswordRequested )
newLoginUser . login2PasswordError . connect ( root . login2PasswordError )
newLoginUser . login2PasswordErrorAbort . connect ( root . login2PasswordErrorAbort )
2021-08-09 12:40:56 +00:00
// add one user on start
2022-01-10 13:57:13 +00:00
var hasUserOnStart = true
if ( hasUserOnStart ) {
2021-08-09 12:40:56 +00:00
var newUserObject = root . userComponent . createObject ( root )
newUserObject . username = "LerooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooyJenkins@protonmail.com"
newUserObject . loggedIn = true
newUserObject . setupGuideSeen = true
root . users . append ( { object: newUserObject } )
}
2021-05-28 10:12:57 +00:00
}
2021-06-06 21:57:59 +00:00
TabBar {
id: tabBar
anchors.left: parent . left
anchors.right: parent . right
TabButton {
text: "Global settings"
}
TabButton {
text: "User control"
}
TabButton {
2021-08-04 12:00:31 +00:00
text: "Notifications"
2021-06-06 21:57:59 +00:00
}
TabButton {
text: "Log"
}
2021-08-09 12:40:56 +00:00
TabButton {
text: "Settings signals"
}
2021-06-06 21:57:59 +00:00
}
2021-10-11 14:37:15 +00:00
Rectangle {
color: root . colorScheme . background_norm
2021-06-06 21:57:59 +00:00
anchors.top: tabBar . bottom
anchors.left: parent . left
anchors.right: parent . right
anchors.bottom: parent . bottom
2021-10-11 14:37:15 +00:00
implicitHeight: children [ 0 ] . contentHeight + children [ 0 ] . anchors . topMargin + children [ 0 ] . anchors . bottomMargin
implicitWidth: children [ 0 ] . contentWidth + children [ 0 ] . anchors . leftMargin + children [ 0 ] . anchors . rightMargin
2021-06-06 21:57:59 +00:00
2021-10-11 14:37:15 +00:00
StackLayout {
anchors.fill: parent
currentIndex: tabBar . currentIndex
anchors.margins: 10
RowLayout {
id: globalTab
2021-06-06 21:57:59 +00:00
spacing : 5
2021-10-11 14:37:15 +00:00
ColumnLayout {
spacing : 5
2021-06-06 21:57:59 +00:00
2021-10-11 14:37:15 +00:00
Label {
colorScheme: root . colorScheme
text: "Global settings"
}
2021-06-06 21:57:59 +00:00
2021-10-11 14:37:15 +00:00
ButtonGroup {
id: styleRadioGroup
}
RadioButton {
colorScheme: root . colorScheme
Layout.fillWidth: true
2021-06-06 21:57:59 +00:00
2021-10-11 14:37:15 +00:00
text: "Light UI"
checked: ProtonStyle . currentStyle === ProtonStyle . lightStyle
ButtonGroup.group: styleRadioGroup
2021-06-06 21:57:59 +00:00
2021-10-11 14:37:15 +00:00
onCheckedChanged: {
if ( checked && ProtonStyle . currentStyle !== ProtonStyle . lightStyle ) {
2021-12-14 15:27:55 +00:00
root . colorSchemeName = "light"
2021-10-11 14:37:15 +00:00
}
2021-06-06 21:57:59 +00:00
}
}
2021-10-11 14:37:15 +00:00
RadioButton {
colorScheme: root . colorScheme
Layout.fillWidth: true
2021-06-06 21:57:59 +00:00
2021-10-11 14:37:15 +00:00
text: "Dark UI"
checked: ProtonStyle . currentStyle === ProtonStyle . darkStyle
ButtonGroup.group: styleRadioGroup
2021-06-06 21:57:59 +00:00
2021-10-11 14:37:15 +00:00
onCheckedChanged: {
if ( checked && ProtonStyle . currentStyle !== ProtonStyle . darkStyle ) {
2021-12-14 15:27:55 +00:00
root . colorSchemeName = "dark"
2021-10-11 14:37:15 +00:00
}
2021-06-06 21:57:59 +00:00
}
2021-10-11 14:37:15 +00:00
}
2021-06-06 21:57:59 +00:00
2021-10-11 14:37:15 +00:00
CheckBox {
id: showOnStartupCheckbox
colorScheme: root . colorScheme
text: "Show on startup"
checked: root . showOnStartup
onCheckedChanged: {
root . showOnStartup = checked
}
2021-10-11 12:15:12 +00:00
}
2021-12-09 10:50:42 +00:00
CheckBox {
id: showSplashScreen
colorScheme: root . colorScheme
text: "Show splash screen"
checked: root . showSplashScreen
onCheckedChanged: {
root . showSplashScreen = checked
}
}
2021-10-11 14:37:15 +00:00
Button {
colorScheme: root . colorScheme
//Layout.fillWidth: true
2021-06-06 21:57:59 +00:00
2021-10-11 14:37:15 +00:00
text: "Open Bridge"
enabled: bridge === undefined || bridge === null
2022-02-23 11:00:20 +00:00
onClicked: root . openBridge ( )
2021-06-06 21:57:59 +00:00
}
2021-10-11 14:37:15 +00:00
Button {
colorScheme: root . colorScheme
//Layout.fillWidth: true
2021-06-06 21:57:59 +00:00
2021-10-11 14:37:15 +00:00
text: "Close Bridge"
enabled: bridge !== undefined && bridge !== null
onClicked: {
bridge . destroy ( )
}
2021-06-06 21:57:59 +00:00
}
2021-10-11 14:37:15 +00:00
Item {
Layout.fillHeight: true
}
2021-06-06 21:57:59 +00:00
}
2021-10-11 14:37:15 +00:00
ColumnLayout {
spacing : 5
2021-06-06 21:57:59 +00:00
2021-10-11 14:37:15 +00:00
Label {
colorScheme: root . colorScheme
text: "Notifications"
}
2021-06-06 21:57:59 +00:00
2021-10-11 14:37:15 +00:00
Button {
colorScheme: root . colorScheme
text: "Notify: danger"
enabled: bridge !== undefined && bridge !== null
onClicked: {
bridge . mainWindow . notifyOnlyPaidUsers ( )
}
2021-06-06 21:57:59 +00:00
}
2021-10-11 14:37:15 +00:00
Button {
colorScheme: root . colorScheme
text: "Notify: warning"
enabled: bridge !== undefined && bridge !== null
onClicked: {
bridge . mainWindow . notifyUpdateManually ( )
}
2021-06-06 21:57:59 +00:00
}
2021-10-11 14:37:15 +00:00
Button {
colorScheme: root . colorScheme
text: "Notify: success"
enabled: bridge !== undefined && bridge !== null
onClicked: {
bridge . mainWindow . notifyUserAdded ( )
}
2021-06-06 21:57:59 +00:00
}
2021-10-11 14:37:15 +00:00
Item {
Layout.fillHeight: true
}
2021-06-06 21:57:59 +00:00
}
}
2021-10-11 14:37:15 +00:00
RowLayout {
id: usersTab
UserList {
id: usersListView
Layout.fillHeight: true
colorScheme: root . colorScheme
backend: root
}
2021-06-06 21:57:59 +00:00
2021-10-11 14:37:15 +00:00
UserControl {
colorScheme: root . colorScheme
backend: root
user: ( ( root . usersTest . count > usersListView . currentIndex ) && usersListView . currentIndex != - 1 ) ? root . usersTest . get ( usersListView . currentIndex ) : undefined
2021-11-22 23:27:16 +00:00
userIndex: usersListView . currentIndex - 1 // -1 because 0 index is fake user
2021-10-11 14:37:15 +00:00
}
2021-06-06 21:57:59 +00:00
}
2021-10-11 14:37:15 +00:00
RowLayout {
id: notificationsTab
2021-08-04 12:00:31 +00:00
spacing: 5
2021-10-11 14:37:15 +00:00
ColumnLayout {
spacing: 5
Switch {
text: "Internet connection"
colorScheme: root . colorScheme
checked: true
onCheckedChanged: {
checked ? root . internetOn ( ) : root . internetOff ( )
}
2021-08-04 12:00:31 +00:00
}
2021-10-11 14:37:15 +00:00
Button {
text: "Update manual ready"
colorScheme: root . colorScheme
onClicked: {
root . updateManualReady ( "3.14.1592" )
}
2021-08-04 12:00:31 +00:00
}
2021-10-11 14:37:15 +00:00
Button {
text: "Update manual done"
colorScheme: root . colorScheme
onClicked: {
root . updateManualRestartNeeded ( )
}
2021-08-04 12:00:31 +00:00
}
2021-10-11 14:37:15 +00:00
Button {
text: "Update manual error"
colorScheme: root . colorScheme
onClicked: {
root . updateManualError ( )
}
2021-08-04 12:00:31 +00:00
}
2021-10-11 14:37:15 +00:00
Button {
text: "Update force"
colorScheme: root . colorScheme
onClicked: {
root . updateForce ( "3.14.1592" )
}
2021-08-04 12:00:31 +00:00
}
2021-10-11 14:37:15 +00:00
Button {
text: "Update force error"
colorScheme: root . colorScheme
onClicked: {
root . updateForceError ( )
}
2021-08-04 12:00:31 +00:00
}
2021-10-11 14:37:15 +00:00
Button {
text: "Update silent done"
colorScheme: root . colorScheme
onClicked: {
root . updateSilentRestartNeeded ( )
}
2021-08-04 12:00:31 +00:00
}
2021-10-11 14:37:15 +00:00
Button {
text: "Update silent error"
colorScheme: root . colorScheme
onClicked: {
root . updateSilentError ( )
}
2021-08-04 12:00:31 +00:00
}
2021-10-11 14:37:15 +00:00
Button {
text: "Update is latest version"
colorScheme: root . colorScheme
onClicked: {
root . updateIsLatestVersion ( )
}
2021-08-09 12:40:56 +00:00
}
2021-08-04 12:00:31 +00:00
2021-10-11 14:37:15 +00:00
Button {
text: "Bug report send OK"
colorScheme: root . colorScheme
onClicked: {
root . reportBugFinished ( )
root . bugReportSendSuccess ( )
}
2022-05-11 07:47:09 +00:00
2021-08-04 12:00:31 +00:00
}
2022-05-11 07:47:09 +00:00
}
ColumnLayout {
spacing: 5
2021-08-04 12:00:31 +00:00
2021-10-11 14:37:15 +00:00
Button {
text: "Bug report send error"
colorScheme: root . colorScheme
onClicked: {
root . reportBugFinished ( )
root . bugReportSendError ( )
}
2021-08-04 12:00:31 +00:00
}
2021-06-06 21:57:59 +00:00
2021-10-11 14:37:15 +00:00
Button {
text: "Cache anavailable"
colorScheme: root . colorScheme
onClicked: {
root . cacheUnavailable ( )
}
2021-08-04 12:00:31 +00:00
}
2021-10-11 14:37:15 +00:00
Button {
text: "Cache can't move"
colorScheme: root . colorScheme
onClicked: {
root . cacheCantMove ( )
}
2021-08-04 12:00:31 +00:00
}
2021-10-11 14:37:15 +00:00
Button {
text: "Cache location change success"
onClicked: {
root . cacheLocationChangeSuccess ( )
}
colorScheme: root . colorScheme
2021-08-09 12:40:56 +00:00
}
2021-08-04 12:00:31 +00:00
2021-10-11 14:37:15 +00:00
Button {
text: "Disk full"
colorScheme: root . colorScheme
onClicked: {
root . diskFull ( )
}
2021-08-04 12:00:31 +00:00
}
2022-01-10 13:57:13 +00:00
Button {
text: "No keychain"
colorScheme: root . colorScheme
onClicked: {
2022-02-23 11:00:20 +00:00
root . notifyHasNoKeychain ( )
2022-01-10 13:57:13 +00:00
}
}
2022-03-17 09:57:51 +00:00
Button {
text: "Rebuild keychain"
colorScheme: root . colorScheme
onClicked: {
root . notifyRebuildKeychain ( )
}
}
2022-05-11 07:47:09 +00:00
Button {
text: "Address changed"
colorScheme: root . colorScheme
onClicked: {
root . addressChanged ( "p@v.el" )
}
}
Button {
text: "Address changed + Logout"
colorScheme: root . colorScheme
onClicked: {
root . addressChangedLogout ( "p@v.el" )
}
}
2021-08-04 12:00:31 +00:00
}
}
2021-06-06 21:57:59 +00:00
2021-10-11 14:37:15 +00:00
TextArea {
id: logTextArea
colorScheme: root . colorScheme
Layout.fillHeight: true
Layout.fillWidth: true
2021-06-06 21:57:59 +00:00
2021-10-11 14:37:15 +00:00
Layout.preferredWidth: 400
Layout.preferredHeight: 200
2021-06-06 21:57:59 +00:00
2021-10-11 14:37:15 +00:00
textFormat: TextEdit . RichText
//readOnly: true
}
2021-08-09 12:40:56 +00:00
2021-10-11 14:37:15 +00:00
ScrollView {
id: settingsTab
ColumnLayout {
RowLayout {
Label { colorScheme: root . colorScheme ; text: "Automatic updates:" }
Toggle { colorScheme: root . colorScheme ; checked: root . isAutomaticUpdateOn ; onClicked: root . isAutomaticUpdateOn = ! root . isAutomaticUpdateOn }
}
RowLayout {
Label { colorScheme: root . colorScheme ; text: "Autostart:" }
Toggle { colorScheme: root . colorScheme ; checked: root . isAutostartOn ; onClicked: root . isAutostartOn = ! root . isAutostartOn }
Button { colorScheme: root . colorScheme ; text: "Toggle finished" ; onClicked: root . toggleAutostartFinished ( ) }
}
RowLayout {
Label { colorScheme: root . colorScheme ; text: "Beta:" }
Toggle { colorScheme: root . colorScheme ; checked: root . isBetaEnabled ; onClicked: root . isBetaEnabled = ! root . isBetaEnabled }
}
RowLayout {
Label { colorScheme: root . colorScheme ; text: "DoH:" }
Toggle { colorScheme: root . colorScheme ; checked: root . isDoHEnabled ; onClicked: root . isDoHEnabled = ! root . isDoHEnabled }
}
RowLayout {
Label { colorScheme: root . colorScheme ; text: "Ports:" }
TextField {
colorScheme: root . colorScheme
label: "IMAP"
text: root . portIMAP
onEditingFinished: root . portIMAP = this . text * 1
validator: IntValidator { bottom: 1 ; top: 65536 }
}
TextField {
colorScheme: root . colorScheme
label: "SMTP"
text: root . portSMTP
onEditingFinished: root . portSMTP = this . text * 1
validator: IntValidator { bottom: 1 ; top: 65536 }
}
Button { colorScheme: root . colorScheme ; text: "Change finished" ; onClicked: root . changePortFinished ( ) }
}
RowLayout {
Label { colorScheme: root . colorScheme ; text: "SMTP using SSL:" }
Toggle { colorScheme: root . colorScheme ; checked: root . useSSLforSMTP ; onClicked: root . useSSLforSMTP = ! root . useSSLforSMTP }
}
RowLayout {
Label { colorScheme: root . colorScheme ; text: "Local cache:" }
Toggle { colorScheme: root . colorScheme ; checked: root . isDiskCacheEnabled ; onClicked: root . isDiskCacheEnabled = ! root . isDiskCacheEnabled }
TextField {
colorScheme: root . colorScheme
label: "Path"
2021-11-19 09:40:02 +00:00
text: root . diskCachePath . toString ( ) . replace ( "file://" , "" )
2021-10-11 14:37:15 +00:00
implicitWidth: 160
2021-11-19 09:40:02 +00:00
onEditingFinished: {
root . diskCachePath = Qt . resolvedUrl ( "file://" + text )
}
2021-10-11 14:37:15 +00:00
}
2021-11-19 09:40:02 +00:00
Button { colorScheme: root . colorScheme ; text: "Change finished" ; onClicked: root . changeLocalCacheFinished ( ) }
2021-10-11 14:37:15 +00:00
}
RowLayout {
Label { colorScheme: root . colorScheme ; text: "Reset:" }
Button { colorScheme: root . colorScheme ; text: "Finished" ; onClicked: root . resetFinished ( ) }
}
RowLayout {
Label { colorScheme: root . colorScheme ; text: "Check update:" }
Button { colorScheme: root . colorScheme ; text: "Finished" ; onClicked: root . checkUpdatesFinished ( ) }
}
2021-08-09 12:40:56 +00:00
}
}
}
2021-06-06 21:57:59 +00:00
}
2021-08-04 12:00:31 +00:00
property Bridge bridge
2021-06-06 21:57:59 +00:00
2021-12-06 13:06:08 +00:00
property string goos: "darwin"
2021-08-09 12:40:56 +00:00
2021-10-11 12:15:12 +00:00
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
2021-08-09 12:40:56 +00:00
property bool dockIconVisible: false
2021-06-06 21:57:59 +00:00
// this signals are used only when trying to login with new user (i.e. not in users model)
2021-08-09 12:40:56 +00:00
signal loginUsernamePasswordError ( string errorMsg )
2021-10-07 09:28:20 +00:00
signal loginFreeUserError ( )
2021-08-09 12:40:56 +00:00
signal loginConnectionError ( string errorMsg )
2021-10-07 11:18:40 +00:00
signal login2FARequested ( string username )
2021-08-09 12:40:56 +00:00
signal login2FAError ( string errorMsg )
signal login2FAErrorAbort ( string errorMsg )
2021-06-06 21:57:59 +00:00
signal login2PasswordRequested ( )
2021-08-09 12:40:56 +00:00
signal login2PasswordError ( string errorMsg )
signal login2PasswordErrorAbort ( string errorMsg )
2021-11-05 11:31:32 +00:00
signal loginFinished ( int index )
2021-11-22 23:27:16 +00:00
signal loginAlreadyLoggedIn ( int index )
2021-06-06 21:57:59 +00:00
2021-08-04 12:00:31 +00:00
signal internetOff ( )
signal internetOn ( )
signal updateManualReady ( var version )
signal updateManualRestartNeeded ( )
signal updateManualError ( )
signal updateForce ( var version )
signal updateForceError ( )
signal updateSilentRestartNeeded ( )
signal updateSilentError ( )
2021-08-09 12:40:56 +00:00
signal updateIsLatestVersion ( )
function checkUpdates ( ) {
console . log ( "check updates" )
}
signal checkUpdatesFinished ( )
2022-03-30 12:34:58 +00:00
function installUpdate ( ) {
console . log ( "manuall install update triggered" )
}
2021-08-09 12:40:56 +00:00
property bool isDiskCacheEnabled: true
2021-11-19 09:40:02 +00:00
// Qt.resolvedUrl("file:///C:/Users/user/AppData/Roaming/protonmail/bridge/cache/c11/messages")
property url diskCachePath: StandardPaths . standardLocations ( StandardPaths . HomeLocation ) [ 0 ]
2021-08-09 12:40:56 +00:00
signal cacheUnavailable ( )
signal cacheCantMove ( )
signal cacheLocationChangeSuccess ( )
signal diskFull ( )
function changeLocalCache ( enableDiskCache , diskCachePath ) {
console . debug ( "-> disk cache" , enableDiskCache , diskCachePath )
}
signal changeLocalCacheFinished ( )
// Settings
property bool isAutomaticUpdateOn : true
function toggleAutomaticUpdate ( makeItActive ) {
console . debug ( "-> silent updates" , makeItActive , root . isAutomaticUpdateOn )
2022-03-30 12:34:58 +00:00
var callback = function ( ) {
root . isAutomaticUpdateOn = makeItActive ;
console . debug ( "-> CHANGED silent updates" , makeItActive , root . isAutomaticUpdateOn )
}
atimer . onTriggered . connect ( callback )
atimer . restart ( )
}
Timer {
id: atimer
interval: 2000
running: false
repeat: false
2021-08-09 12:40:56 +00:00
}
property bool isAutostartOn : true // Example of settings with loading state
function toggleAutostart ( makeItActive ) {
2021-10-27 15:16:48 +00:00
console . debug ( "-> autostart" , makeItActive , root . isAutostartOn )
2021-08-09 12:40:56 +00:00
}
signal toggleAutostartFinished ( )
property bool isBetaEnabled : false
function toggleBeta ( makeItActive ) {
console . debug ( "-> beta" , makeItActive , root . isBetaEnabled )
root . isBetaEnabled = makeItActive
}
property bool isDoHEnabled : true
function toggleDoH ( makeItActive ) {
console . debug ( "-> DoH" , makeItActive , root . isDoHEnabled )
root . isDoHEnabled = makeItActive
}
property bool useSSLforSMTP: false
function toggleUseSSLforSMTP ( makeItActive ) {
console . debug ( "-> SMTP SSL" , makeItActive , root . useSSLforSMTP )
}
signal toggleUseSSLFinished ( )
property string hostname: "127.0.0.1"
property int portIMAP: 1143
property int portSMTP: 1025
function changePorts ( imapPort , smtpPort ) {
console . debug ( "-> ports" , imapPort , smtpPort )
}
function isPortFree ( port ) {
if ( port == portIMAP ) return false
if ( port == portSMTP ) return false
if ( port == 12345 ) return false
return true
}
signal changePortFinished ( )
signal portIssueIMAP ( )
signal portIssueSMTP ( )
function triggerReset ( ) {
console . debug ( "-> trigger reset" )
}
signal resetFinished ( )
2021-08-04 12:00:31 +00:00
2021-10-04 17:36:32 +00:00
property string version: "2.0.X-BridePreview"
2021-11-19 09:40:02 +00:00
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" )
2022-05-16 14:42:21 +00:00
property url dependencyLicensesLink: Qt . resolvedUrl ( "https://github.com/ProtonMail/proton-bridge/blob/master/COPYING_NOTES.md#dependencies" )
2021-11-19 09:40:02 +00:00
property url landingPageLink: Qt . resolvedUrl ( "https://protonmail.com/bridge" )
2021-08-09 12:40:56 +00:00
2021-12-14 15:27:55 +00:00
property string colorSchemeName: "light"
function changeColorScheme ( newScheme ) {
root . colorSchemeName = newScheme
}
2021-08-09 12:40:56 +00:00
property string currentEmailClient: "" // "Apple Mail 14.0"
function updateCurrentMailClient ( ) {
currentEmailClient = "Apple Mail 14.0"
}
function reportBug ( description , address , emailClient , includeLogs ) {
console . log ( "report bug" )
console . log ( " description" , description )
console . log ( " address" , address )
console . log ( " emailClient" , emailClient )
console . log ( " includeLogs" , includeLogs )
}
signal reportBugFinished ( )
2021-08-04 12:00:31 +00:00
signal bugReportSendSuccess ( )
signal bugReportSendError ( )
2022-01-10 13:57:13 +00:00
property var availableKeychain: [ "gnome-keyring" , "pass" , "macos-keychain" , "windows-credentials" ]
property string currentKeychain: availableKeychain [ 0 ]
function changeKeychain ( wantedKeychain ) {
console . log ( "Changing keychain from" , root . currentKeychain , "to" , wantedKeychain )
root . currentKeychain = wantedKeychain
root . changeKeychainFinished ( )
2021-08-09 12:40:56 +00:00
}
2022-01-10 13:57:13 +00:00
signal changeKeychainFinished ( )
2022-02-23 11:00:20 +00:00
signal notifyHasNoKeychain ( )
2022-03-17 09:57:51 +00:00
signal notifyRebuildKeychain ( )
2021-08-09 12:40:56 +00:00
signal noActiveKeyForRecipient ( string email )
signal showMainWindow ( )
signal addressChanged ( string address )
signal addressChangedLogout ( string address )
signal userDisconnected ( string username )
signal apiCertIssue ( )
2021-12-13 11:29:49 +00:00
property bool showSplashScreen: false
2021-08-09 12:40:56 +00:00
function login ( username , password ) {
root . log ( "-> login(" + username + ", " + password + ")" )
loginUser . username = username
loginUser . isLoginRequested = true
}
function login2FA ( username , code ) {
root . log ( "-> login2FA(" + username + ", " + code + ")" )
loginUser . isLogin2FAProvided = true
}
function login2Password ( username , password ) {
root . log ( "-> login2FA(" + username + ", " + password + ")" )
loginUser . isLogin2PasswordProvided = true
}
function loginAbort ( username ) {
root . log ( "-> loginAbort(" + username + ")" )
loginUser . resetLoginRequests ( )
}
2021-08-04 12:00:31 +00:00
2021-06-06 21:57:59 +00:00
onLoginUsernamePasswordError: {
console . debug ( "<- loginUsernamePasswordError" )
}
onLoginFreeUserError: {
console . debug ( "<- loginFreeUserError" )
}
onLoginConnectionError: {
console . debug ( "<- loginConnectionError" )
}
onLogin2FARequested: {
2021-10-07 11:18:40 +00:00
console . debug ( "<- login2FARequested" , username )
2021-06-06 21:57:59 +00:00
}
onLogin2FAError: {
console . debug ( "<- login2FAError" )
}
onLogin2FAErrorAbort: {
console . debug ( "<- login2FAErrorAbort" )
}
onLogin2PasswordRequested: {
console . debug ( "<- login2PasswordRequested" )
}
onLogin2PasswordError: {
console . debug ( "<- login2PasswordError" )
}
onLogin2PasswordErrorAbort: {
console . debug ( "<- login2PasswordErrorAbort" )
}
2021-08-09 12:40:56 +00:00
onLoginFinished: {
2021-11-05 11:31:32 +00:00
console . debug ( "<- loginFinished" , index )
2021-08-09 12:40:56 +00:00
}
2021-11-22 23:27:16 +00:00
onLoginAlreadyLoggedIn: {
console . debug ( "<- loginAlreadyLoggedIn" , index )
}
2021-06-06 21:57:59 +00:00
2021-08-04 12:00:31 +00:00
onInternetOff: {
console . debug ( "<- internetOff" )
}
onInternetOn: {
console . debug ( "<- internetOn" )
}
2021-06-06 21:57:59 +00:00
Component {
id: bridgeComponent
Bridge {
backend: root
}
}
onClosing: {
Qt . quit ( )
}
2021-05-28 10:12:57 +00:00
}