mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-18 05:44:14 -05:00
Added view to show/edit contact details
Split ColorHash.qml in a new file so it is reusable ContactSort.js preferred contacts goes before non preferred Contacts.qml use proper id for listview Contacts.qml removed fingerprint popup GxsIdentityDelegate.qml simplified, move link generation to ContactDetails.qml
This commit is contained in:
parent
ccaf4881a8
commit
d0b881f5e0
67
retroshare-qml-app/src/ColorHash.qml
Normal file
67
retroshare-qml-app/src/ColorHash.qml
Normal file
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* 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.7
|
||||
|
||||
Rectangle
|
||||
{
|
||||
property string hash
|
||||
|
||||
width: height
|
||||
property int childHeight : height/2
|
||||
color: "white"
|
||||
|
||||
Image
|
||||
{
|
||||
source: "qrc:/icons/edit-image-face-detect.png"
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
Rectangle
|
||||
{
|
||||
color: '#' + hash.substring(1, 9)
|
||||
height: parent.childHeight
|
||||
width: height
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
}
|
||||
Rectangle
|
||||
{
|
||||
color: '#' + hash.substring(9, 17)
|
||||
height: parent.childHeight
|
||||
width: height
|
||||
anchors.top: parent.top
|
||||
anchors.right: parent.right
|
||||
}
|
||||
Rectangle
|
||||
{
|
||||
color: '#' + hash.substring(17, 25)
|
||||
height: parent.childHeight
|
||||
width: height
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.left: parent.left
|
||||
}
|
||||
Rectangle
|
||||
{
|
||||
color: '#' + hash.slice(-8)
|
||||
height: parent.childHeight
|
||||
width: height
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.right: parent.right
|
||||
}
|
||||
}
|
142
retroshare-qml-app/src/ContactDetails.qml
Normal file
142
retroshare-qml-app/src/ContactDetails.qml
Normal file
@ -0,0 +1,142 @@
|
||||
/*
|
||||
* 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.7
|
||||
import QtQuick.Controls 2.0
|
||||
import "." //Needed for ClipboardWrapper singleton
|
||||
import "URI.js" as UriJs
|
||||
|
||||
Item
|
||||
{
|
||||
id: cntDt
|
||||
property var md
|
||||
property bool is_contact: cntDt.md.is_contact
|
||||
|
||||
ColorHash
|
||||
{
|
||||
id: colorHash
|
||||
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 6
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
height: 150
|
||||
hash: cntDt.md.gxs_id
|
||||
}
|
||||
|
||||
Column
|
||||
{
|
||||
anchors.top: colorHash.bottom
|
||||
anchors.topMargin: 6
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
spacing: 6
|
||||
|
||||
Row
|
||||
{
|
||||
height: 50
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
spacing: 6
|
||||
|
||||
Text
|
||||
{
|
||||
text: cntDt.md.name
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
Image
|
||||
{
|
||||
|
||||
source: cntDt.is_contact ?
|
||||
"qrc:/icons/rating.png" :
|
||||
"qrc:/icons/rating-unrated.png"
|
||||
height: parent.height - 4
|
||||
fillMode: Image.PreserveAspectFit
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
MouseArea
|
||||
{
|
||||
anchors.fill: parent
|
||||
|
||||
onClicked:
|
||||
{
|
||||
var jDt = JSON.stringify({gxs_id: cntDt.md.gxs_id})
|
||||
if(cntDt.is_contact)
|
||||
rsApi.request("/identity/remove_contact", jDt, tgCt)
|
||||
else rsApi.request("/identity/add_contact", jDt, tgCt)
|
||||
}
|
||||
|
||||
function tgCt() { cntDt.is_contact = !cntDt.is_contact }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Text
|
||||
{
|
||||
text: "<pre>"+cntDt.md.gxs_id+"</pre>"
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
Text
|
||||
{
|
||||
visible: cntDt.md.pgp_linked
|
||||
text: qsTr("Owned by: %1").arg(cntDt.md.pgp_id)
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
}
|
||||
|
||||
Row
|
||||
{
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
spacing: 6
|
||||
|
||||
Button
|
||||
{
|
||||
text: qsTr("Contact full link")
|
||||
onClicked:
|
||||
{
|
||||
rsApi.request(
|
||||
"/identity/export_key",
|
||||
JSON.stringify({ gxs_id: cntDt.md.gxs_id }),
|
||||
function(par)
|
||||
{
|
||||
var jD = JSON.parse(par.response).data
|
||||
ClipboardWrapper.postToClipBoard(
|
||||
"retroshare://" +
|
||||
"identity?gxsid=" +
|
||||
cntDt.md.gxs_id +
|
||||
"&name=" +
|
||||
UriJs.URI.encode(cntDt.md.name) +
|
||||
"&groupdata=" +
|
||||
UriJs.URI.encode(jD.radix))
|
||||
linkCopiedPopup.itemName = cntDt.md.name
|
||||
linkCopiedPopup.visible = true
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
text: qsTr("Contact short link")
|
||||
enabled: false
|
||||
}
|
||||
}
|
||||
}
|
@ -42,6 +42,9 @@ function cntcmp(left, right, searchText)
|
||||
var lfun = left.hasOwnProperty("unread_count") ? left.unread_count : 0
|
||||
var rgun = right.hasOwnProperty("unread_count") ? right.unread_count : 0
|
||||
if( lfun !== rgun ) return rgun - lfun
|
||||
var lcon = left.is_contact
|
||||
var rcon = right.is_contact
|
||||
if( lcon !== rcon ) return rcon - lcon
|
||||
if(left.name !== right.name) return strcmp(left.name, right.name)
|
||||
return strcmp(left.gxs_id, right.gxs_id)
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ Item
|
||||
|
||||
ListView
|
||||
{
|
||||
id: locationsListView
|
||||
id: contactsListView
|
||||
width: parent.width
|
||||
height: contactsView.searching ?
|
||||
parent.height - searchBox.height : parent.height
|
||||
@ -182,30 +182,6 @@ Item
|
||||
text: "Open Chat as: " + contactsView.own_nick + " " + contactsView.own_gxs_id
|
||||
}
|
||||
|
||||
Popup
|
||||
{
|
||||
id: fingerPrintDialog
|
||||
visible: false
|
||||
property string nick
|
||||
property string gxs_id
|
||||
width: fingerPrintText.contentWidth + 20
|
||||
height: fingerPrintText.contentHeight + 20
|
||||
x: parent.x + parent.width/2 - width/2
|
||||
y: parent.y + parent.height/2 - height/2
|
||||
|
||||
Text
|
||||
{
|
||||
id: fingerPrintText
|
||||
anchors.centerIn: parent
|
||||
text: "<pre>" +
|
||||
fingerPrintDialog.gxs_id.substring(1, 9) + "<br/>" +
|
||||
fingerPrintDialog.gxs_id.substring(9, 17) + "<br/>" +
|
||||
fingerPrintDialog.gxs_id.substring(17, 25) + "<br/>" +
|
||||
fingerPrintDialog.gxs_id.slice(-8) + "<br/>" +
|
||||
"</pre>"
|
||||
}
|
||||
}
|
||||
|
||||
Settings
|
||||
{
|
||||
id: settings
|
||||
|
@ -18,8 +18,6 @@
|
||||
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 2.0
|
||||
import "." //Needed for ClipboardWrapper singleton
|
||||
import "URI.js" as UriJs
|
||||
|
||||
Item
|
||||
{
|
||||
@ -31,7 +29,7 @@ Item
|
||||
anchors.fill: parent
|
||||
onClicked:
|
||||
{
|
||||
console.log("Contacts view onclicked:", model.name,
|
||||
console.log("GxsIntentityDelegate onclicked:", model.name,
|
||||
model.gxs_id)
|
||||
contactsView.searching = false
|
||||
if(model.own) contactsView.own_gxs_id = model.gxs_id
|
||||
@ -44,67 +42,28 @@ Item
|
||||
contactsView.startChatCallback)
|
||||
}
|
||||
}
|
||||
Rectangle
|
||||
|
||||
onPressAndHold:
|
||||
{
|
||||
console.log("GxsIntentityDelegate onPressAndHold:", model.name,
|
||||
model.gxs_id)
|
||||
contactsView.searching = false
|
||||
stackView.push(
|
||||
"qrc:/ContactDetails.qml",
|
||||
{md: contactsListView.model.get(index)})
|
||||
}
|
||||
|
||||
ColorHash
|
||||
{
|
||||
id: colorHash
|
||||
|
||||
hash: model.gxs_id
|
||||
height: parent.height - 4
|
||||
width: height
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 2
|
||||
color: "white"
|
||||
property int childHeight : height/2
|
||||
|
||||
Image
|
||||
{
|
||||
source: "qrc:/icons/edit-image-face-detect.png"
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
Rectangle
|
||||
{
|
||||
color: '#' + model.gxs_id.substring(1, 9)
|
||||
height: parent.childHeight
|
||||
width: height
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
}
|
||||
Rectangle
|
||||
{
|
||||
color: '#' + model.gxs_id.substring(9, 17)
|
||||
height: parent.childHeight
|
||||
width: height
|
||||
anchors.top: parent.top
|
||||
anchors.right: parent.right
|
||||
}
|
||||
Rectangle
|
||||
{
|
||||
color: '#' + model.gxs_id.substring(17, 25)
|
||||
height: parent.childHeight
|
||||
width: height
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.left: parent.left
|
||||
}
|
||||
Rectangle
|
||||
{
|
||||
color: '#' + model.gxs_id.slice(-8)
|
||||
height: parent.childHeight
|
||||
width: height
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.right: parent.right
|
||||
}
|
||||
|
||||
MouseArea
|
||||
{
|
||||
anchors.fill: parent
|
||||
onPressAndHold:
|
||||
{
|
||||
fingerPrintDialog.nick = model.name
|
||||
fingerPrintDialog.gxs_id = model.gxs_id
|
||||
fingerPrintDialog.visible = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Text
|
||||
{
|
||||
id: nickText
|
||||
@ -122,40 +81,6 @@ Item
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
height: parent.height - 10
|
||||
|
||||
Image
|
||||
{
|
||||
source: "qrc:/icons/document-share.png"
|
||||
|
||||
height: parent.height
|
||||
width: height
|
||||
|
||||
MouseArea
|
||||
{
|
||||
anchors.fill: parent
|
||||
onClicked:
|
||||
{
|
||||
rsApi.request(
|
||||
"/identity/export_key",
|
||||
JSON.stringify({ gxs_id: model.gxs_id }),
|
||||
function(par)
|
||||
{
|
||||
var jD = JSON.parse(par.response).data
|
||||
ClipboardWrapper.postToClipBoard(
|
||||
"retroshare://" +
|
||||
"identity?gxsid=" +
|
||||
model.gxs_id +
|
||||
"&name=" +
|
||||
UriJs.URI.encode(model.name) +
|
||||
"&groupdata=" +
|
||||
UriJs.URI.encode(jD.radix))
|
||||
linkCopiedPopup.itemName = model.name
|
||||
linkCopiedPopup.visible = true
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle
|
||||
{
|
||||
visible: model.unread_count > 0
|
||||
@ -176,6 +101,16 @@ Item
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
}
|
||||
|
||||
Image
|
||||
{
|
||||
source: model.is_contact ?
|
||||
"qrc:/icons/rating.png" :
|
||||
"qrc:/icons/rating-unrated.png"
|
||||
height: parent.height - 4
|
||||
fillMode: Image.PreserveAspectFit
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
BIN
retroshare-qml-app/src/icons/rating-unrated.png
Normal file
BIN
retroshare-qml-app/src/icons/rating-unrated.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.3 KiB |
BIN
retroshare-qml-app/src/icons/rating.png
Normal file
BIN
retroshare-qml-app/src/icons/rating.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
@ -25,5 +25,9 @@
|
||||
<file>TrustedNodeDetails.qml</file>
|
||||
<file>icons/document-share.png</file>
|
||||
<file>ClipboardWrapper.qml</file>
|
||||
<file>ContactDetails.qml</file>
|
||||
<file>ColorHash.qml</file>
|
||||
<file>icons/rating-unrated.png</file>
|
||||
<file>icons/rating.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
Loading…
x
Reference in New Issue
Block a user