mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-11-29 20:06:38 -05:00
android notification service stub, improve login
Added retroshare-android-notify-service a stub will handle notifications to android system, at the moment it only attempt autologin if default password is used retroshare-android-service quit QCoreApplication gracefully Android Studio update has changed some android build files Create BusyOverlay.qml componet so it is reusable accross the qml app Contacts.qml create a pseudonimous GXS identity as needed without prompting the user RsLoginPassView.qml nicer look, on mobile phone password usage is not common so do not use password by default QML app main view handle correctly +waiting_startup+ runstate QML app main view use BusyOverlay as initial item
This commit is contained in:
parent
70e91f7164
commit
bcbd5230eb
24 changed files with 562 additions and 94 deletions
44
retroshare-qml-app/src/qml/BusyOverlay.qml
Normal file
44
retroshare-qml-app/src/qml/BusyOverlay.qml
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* RetroShare Android QML App
|
||||
* Copyright (C) 2017 Gioacchino Mazzurco <gio@eigenlab.org>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 2.0
|
||||
|
||||
Rectangle
|
||||
{
|
||||
id: busyOverlay
|
||||
|
||||
property string message
|
||||
|
||||
enabled: false
|
||||
anchors.fill: parent
|
||||
|
||||
BusyIndicator
|
||||
{
|
||||
running: true
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
text: busyOverlay.message
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.bottom: parent.bottom
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -76,7 +76,14 @@ Item
|
|||
contactsView.own_gxs_id = json.data[0].gxs_id
|
||||
contactsView.own_nick = json.data[0].name
|
||||
}
|
||||
else createIdentityDialog.visible = true
|
||||
else
|
||||
{
|
||||
var jsonData = { "name": mainWindow.pgp_name, "pgp_linked": false }
|
||||
rsApi.request(
|
||||
"/identity/create_identity",
|
||||
JSON.stringify(jsonData),
|
||||
refreshOwn)
|
||||
}
|
||||
}
|
||||
function refreshOwn()
|
||||
{
|
||||
|
|
@ -170,29 +177,6 @@ Item
|
|||
text: "Open Chat as: " + contactsView.own_nick + " " + contactsView.own_gxs_id
|
||||
}
|
||||
|
||||
Dialog
|
||||
{
|
||||
id: createIdentityDialog
|
||||
visible: false
|
||||
title: "You need to create a GXS identity to chat!"
|
||||
standardButtons: StandardButton.Save
|
||||
|
||||
onAccepted: rsApi.request("/identity/create_identity", JSON.stringify({"name":identityNameTE.text, "pgp_linked": !psdnmCheckBox.checked }))
|
||||
|
||||
TextField
|
||||
{
|
||||
id: identityNameTE
|
||||
width: 300
|
||||
}
|
||||
|
||||
Row
|
||||
{
|
||||
anchors.top: identityNameTE.bottom
|
||||
Text { text: "Pseudonymous: " }
|
||||
CheckBox { id: psdnmCheckBox; checked: true; enabled: false }
|
||||
}
|
||||
}
|
||||
|
||||
Popup
|
||||
{
|
||||
id: fingerPrintDialog
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ Item
|
|||
{
|
||||
id: locationView
|
||||
state: "selectLocation"
|
||||
property var qParent
|
||||
property bool attemptLogin: false
|
||||
property string password
|
||||
property string sslid
|
||||
|
|
@ -42,19 +41,26 @@ Item
|
|||
{
|
||||
name: "createLocation"
|
||||
PropertyChanges { target: locationsListView; visible: false }
|
||||
PropertyChanges { target: bottomButton; visible: false }
|
||||
PropertyChanges { target: bottomButton; visible: false }
|
||||
PropertyChanges
|
||||
{
|
||||
target: loginView
|
||||
visible: true
|
||||
buttonText: "Save"
|
||||
buttonText: qsTr("Save")
|
||||
iconUrl: "qrc:/qml/icons/edit-image-face-detect.png"
|
||||
suggestionText: qsTr("Create your profile")
|
||||
onSubmit:
|
||||
{
|
||||
busyIndicator.running = true
|
||||
var jsonData = { pgp_name: login, ssl_name: login,
|
||||
pgp_password: password }
|
||||
rsApi.request("/control/create_location/",
|
||||
JSON.stringify(jsonData))
|
||||
rsApi.request(
|
||||
"/control/create_location/",
|
||||
JSON.stringify(jsonData))
|
||||
mainWindow.pgp_name = login
|
||||
locationView.state = "selectLocation"
|
||||
bottomButton.enabled = false
|
||||
bottomButton.text = "Creating profile..."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -62,11 +68,12 @@ Item
|
|||
{
|
||||
name: "login"
|
||||
PropertyChanges { target: locationsListView; visible: false }
|
||||
PropertyChanges { target: bottomButton; visible: false }
|
||||
PropertyChanges { target: bottomButton; visible: false }
|
||||
PropertyChanges
|
||||
{
|
||||
target: loginView
|
||||
visible: true
|
||||
advancedMode: true
|
||||
onSubmit:
|
||||
{
|
||||
locationView.password = password
|
||||
|
|
@ -88,9 +95,15 @@ Item
|
|||
// There is only one location so we can jump selecting location
|
||||
var location = jsonData[0]
|
||||
loginView.login = location.name
|
||||
mainWindow.pgp_name = location.name
|
||||
locationView.sslid = location.peer_id
|
||||
locationView.state = "login"
|
||||
}
|
||||
else if (jsonData.length === 0)
|
||||
{
|
||||
// The user haven't created a location yet
|
||||
locationView.state = "createLocation"
|
||||
}
|
||||
else
|
||||
{
|
||||
// There is more then one location to choose from
|
||||
|
|
@ -123,6 +136,7 @@ Item
|
|||
loginView.login = text
|
||||
locationView.sslid = model.id
|
||||
locationView.state = "login"
|
||||
mainWindow.pgp_name = model.name
|
||||
}
|
||||
}
|
||||
visible: false
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* RetroShare Android QML App
|
||||
* Copyright (C) 2016 Gioacchino Mazzurco <gio@eigenlab.org>
|
||||
* Copyright (C) 2016-2017 Gioacchino Mazzurco <gio@eigenlab.org>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
|
|
@ -19,49 +19,75 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick.Layouts 1.3
|
||||
import QtQuick.Controls 2.0
|
||||
//import QtQml 2.2
|
||||
|
||||
Item
|
||||
{
|
||||
id: loginView
|
||||
property string buttonText: "Unlock"
|
||||
property string buttonText: qsTr("Unlock")
|
||||
property string iconUrl: "qrc:/qml/icons/emblem-locked.png"
|
||||
property string login
|
||||
property string password
|
||||
property bool loginPreset: false
|
||||
property bool advancedMode: false
|
||||
property string hardcodedPassword: "hardcoded default password"
|
||||
property string password: advancedMode ? "" : hardcodedPassword
|
||||
property string suggestionText
|
||||
signal submit(string login, string password)
|
||||
|
||||
Component.onCompleted: loginPreset = login.length > 0
|
||||
|
||||
ColumnLayout
|
||||
{
|
||||
id: inputView
|
||||
width: parent.width
|
||||
anchors.centerIn: parent
|
||||
|
||||
Text
|
||||
{
|
||||
text: loginView.suggestionText
|
||||
visible: loginView.suggestionText.length > 0
|
||||
font.bold: true
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
}
|
||||
|
||||
Image
|
||||
{
|
||||
source: "qrc:/qml/icons/emblem-locked.png"
|
||||
source: loginView.iconUrl
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
}
|
||||
|
||||
Text
|
||||
{
|
||||
text: "Login"
|
||||
visible: loginView.login.length === 0
|
||||
text: qsTr("Name")
|
||||
visible: !loginView.loginPreset
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
anchors.bottom: nameField.top
|
||||
anchors.bottomMargin: 5
|
||||
}
|
||||
TextField
|
||||
{
|
||||
id: nameField;
|
||||
id: nameField
|
||||
text: loginView.login
|
||||
visible: loginView.login.length === 0
|
||||
visible: !loginView.loginPreset
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
|
||||
ToolTip
|
||||
{
|
||||
text: qsTr("Choose a descriptive name, one<br/>" +
|
||||
"that your friends can recognize.",
|
||||
"The linebreak is to make the text fit better in " +
|
||||
"tooltip")
|
||||
visible: nameField.activeFocus
|
||||
timeout: 5000
|
||||
}
|
||||
}
|
||||
|
||||
Text
|
||||
{
|
||||
id: passLabel
|
||||
visible: loginView.advancedMode || loginView.loginPreset
|
||||
text: nameField.visible ?
|
||||
"Passphrase" : "Enter passphrase for " + loginView.login
|
||||
qsTr("Password") :
|
||||
qsTr("Enter password for %1").arg(loginView.login)
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
anchors.bottom: passwordField.top
|
||||
anchors.bottomMargin: 5
|
||||
|
|
@ -69,18 +95,40 @@ Item
|
|||
TextField
|
||||
{
|
||||
id: passwordField
|
||||
visible: loginView.advancedMode || loginView.loginPreset
|
||||
text: loginView.password
|
||||
width: passLabel.width
|
||||
echoMode: TextInput.Password
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
|
||||
ToolTip
|
||||
{
|
||||
visible: passwordField.activeFocus
|
||||
timeout: 5000
|
||||
text: qsTr("Choose a strong password and don't forget it,<br/>"+
|
||||
"there is no way to recover lost password.",
|
||||
"The linebreak is to make the text fit better in " +
|
||||
"tooltip")
|
||||
}
|
||||
}
|
||||
|
||||
Button
|
||||
Row
|
||||
{
|
||||
id: bottomButton
|
||||
text: loginView.buttonText
|
||||
onClicked: loginView.submit(nameField.text, passwordField.text)
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
|
||||
spacing: 3
|
||||
|
||||
Button
|
||||
{
|
||||
text: qsTr("Advanced...")
|
||||
visible: !loginView.loginPreset
|
||||
onClicked: loginView.advancedMode = !loginView.advancedMode
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
id: bottomButton
|
||||
text: loginView.buttonText
|
||||
onClicked: loginView.submit(nameField.text, passwordField.text)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ ApplicationWindow
|
|||
width: 400
|
||||
height: 400
|
||||
|
||||
property string pgp_name
|
||||
|
||||
property var tokens: ({})
|
||||
function registerToken(token, callback)
|
||||
{
|
||||
|
|
@ -131,6 +133,8 @@ ApplicationWindow
|
|||
}
|
||||
|
||||
state: "core_down"
|
||||
initialItem: BusyOverlay { message: qsTr("Connecting to core...") }
|
||||
|
||||
states: [
|
||||
State
|
||||
{
|
||||
|
|
@ -152,6 +156,21 @@ ApplicationWindow
|
|||
}
|
||||
},
|
||||
State
|
||||
{
|
||||
name: "waiting_startup"
|
||||
PropertyChanges { target: stackView; enabled: false }
|
||||
StateChangeScript
|
||||
{
|
||||
script:
|
||||
{
|
||||
console.log("StateChangeScript waiting_startup")
|
||||
stackView.clear()
|
||||
stackView.push("qrc:/qml/BusyOverlay.qml",
|
||||
{ message: "Core initializing..."})
|
||||
}
|
||||
}
|
||||
},
|
||||
State
|
||||
{
|
||||
name: "running_ok"
|
||||
PropertyChanges { target: stackView; enabled: true }
|
||||
|
|
@ -172,16 +191,6 @@ ApplicationWindow
|
|||
PropertyChanges { target: stackView; state: "running_ok" }
|
||||
}
|
||||
]
|
||||
|
||||
initialItem: Rectangle
|
||||
{
|
||||
color: "green"
|
||||
Text
|
||||
{
|
||||
text: "Connecting to core..."
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LibresapiLocalClient
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue