1
0
mirror of https://github.com/QRouland/UTPass.git synced 2025-06-24 22:42:28 +00:00

Initial Commit : 0.0.1

This commit is contained in:
2019-09-20 21:29:39 +02:00
commit 2a8c72f8d0
65 changed files with 3486 additions and 0 deletions

116
qml/pages/Info.qml Normal file
View File

@ -0,0 +1,116 @@
import QtQuick 2.4
import Ubuntu.Components 1.3
import "headers"
import "../components"
Page {
id: infoPage
header: StackHeader {
id: infoHeader
title: i18n.tr('Info')
}
Flow {
anchors.top: infoHeader.bottom
anchors.right: parent.right
anchors.left: parent.left
spacing: units.gu(3)
Rectangle {
width: parent.width
height: units.gu(1)
}
Text {
id: manifestTitle
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
width: parent.width
height: units.gu(8)
fontSizeMode: Text.Fit
font.pixelSize: 144
}
Rectangle {
width: parent.width
height: units.gu(12)
Image {
source: "../../assets/logo.svg"
width: units.gu(12)
height: units.gu(12)
anchors.horizontalCenter: parent.horizontalCenter
}
}
Text {
horizontalAlignment: Text.AlignHCenter
width: parent.width
height: units.gu(3)
text: i18n.tr("<b>Version</b>")
fontSizeMode: Text.Fit
font.pixelSize: 72
}
Text {
id: manifestVersion
horizontalAlignment: Text.AlignHCenter
width: parent.width
height: units.gu(4)
fontSizeMode: Text.Fit
font.pixelSize: 72
}
Text {
horizontalAlignment: Text.AlignHCenter
width: parent.width
height: units.gu(3)
text: i18n.tr("<b>Maintainer</>")
fontSizeMode: Text.Fit
font.pixelSize: 72
}
Text {
id: manifestMaintener
horizontalAlignment: Text.AlignHCenter
width: parent.width
height: units.gu(2)
fontSizeMode: Text.Fit
font.pixelSize: 72
}
}
Flow {
spacing: 2
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.left: parent.left
ExternalLink {
url: "https://taiga.rdrive.ovh/project/utpass/issues"
text: i18n.tr("Suggest improvement(s) or report a bug(s)")
}
ExternalLink {
url: "https://git.rdrive.ovh/QRouland/UTPass"
text: i18n.tr("Access to the source code")
}
Text {
width: parent.width
height: units.gu(2)
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: i18n.tr("Released under the terms of the GNU GPL v3")
}
}
Component.onCompleted: {
var xhr = new XMLHttpRequest()
xhr.open("GET", "../../manifest_.json", false)
xhr.send()
var mJson = JSON.parse(xhr.responseText)
manifestTitle.text = "<b>" + mJson.title + "</b>"
manifestVersion.text = mJson.version + "<br>" + mJson.framework + "@" + mJson.architecture
manifestMaintener.text = mJson.maintainer
}
}

69
qml/pages/Password.qml Normal file
View File

@ -0,0 +1,69 @@
import QtQuick 2.4
import Ubuntu.Components 1.3
import Ubuntu.Components.Popups 1.3
import "headers"
Page {
id: passwordPage
property string title
property string plainText
property var objects
header: PageHeader {
id: passwordPageHeader
width: parent.width
height: units.gu(6)
title: passwordPage.title
contents: Item {
height: parent.height
width: parent.width
Label {
id: labelTitle
text: passwordPage.title
anchors.verticalCenter: parent.verticalCenter
}
}
leadingActionBar.height: units.gu(4)
leadingActionBar.actions: [
Action {
id: backAction
iconName: "back"
text: "Back"
onTriggered: {
passwordPage.plainText = ""
for (var object in objects) {
object.text = ""
object.destroy()
}
pageStack.pop()
}
}
]
}
Rectangle {
anchors.top: passwordPageHeader.bottom
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.left: parent.left
Flow {
id: container
anchors.fill: parent
}
}
Component.onCompleted: {
var text_split = passwordPage.plainText.split('\n')
var component = Qt.createComponent("../components/CopyText.qml")
for (var i = 0; i < text_split.length; i++) {
if (text_split[i]) {
var object = component.createObject(container)
object.text = text_split[i]
}
}
}
}

View File

@ -0,0 +1,72 @@
import QtQuick 2.4
import Ubuntu.Components 1.3
import Qt.labs.folderlistmodel 2.1
import Pass 1.0
import "../components"
import "headers"
Page {
id: passwordListPage
property string passwordStorePath
anchors.fill: parent
header: MainHeader {
id: passwordListHeader
leadingActionBar.height: units.gu(4)
leadingActionBar.actions: [
Action {
id: backAction
iconName: "back"
text: i18n.tr("Back")
visible: false
onTriggered: {
folderModel.folder = folderModel.parentFolder
if (folderModel.rootFolder === folderModel.folder) {
backAction.visible = false
}
}
}
]
}
Rectangle {
anchors.top: passwordListHeader.bottom
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.left: parent.left
visible: folderModel.count == 0
Text {
text: i18n.tr(
"No password found<br>You can import a password store zip in the settings")
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
horizontalAlignment: Text.AlignHCenter
}
}
ListView {
anchors.top: passwordListHeader.bottom
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.left: parent.left
spacing: 1
model: FolderListModel {
id: folderModel
nameFilters: ["*.gpg"]
rootFolder: passwordStorePath
folder: passwordStorePath
showDirs: true
}
delegate: FileDir {
id: fileDelegate
}
}
Component.onCompleted: {
passwordStorePath = "file:" + Pass.getPasswordStore()
}
}

View File

@ -0,0 +1,64 @@
import QtQuick 2.4
import Ubuntu.Components 1.3
PageHeader {
id: mainHeader
width: parent.width
height: units.gu(6)
title: i18n.tr("UTPass")
contents: Item {
height: parent.height
width: parent.width
Label {
id: labelTitle
text: mainHeader.title
anchors.verticalCenter: parent.verticalCenter
visible: true
}
TextField {
id: searchBar
anchors.right: parent.right
anchors.left: parent.left
placeholderText: i18n.tr("Search")
height: units.gu(4)
visible: false
anchors.verticalCenter: parent.verticalCenter
onFocusChanged: {
}
}
}
trailingActionBar.height: units.gu(4)
trailingActionBar.numberOfSlots: 2
trailingActionBar.actions: [
/*Action { TODO
iconName: "search"
text: i18n.tr("Search")
onTriggered: {
searchBar.visible = !searchBar.visible
labelTitle.visible = !searchBar.visible
if (searchBar.visible === true) {
searchBar.focus = true
}
}
},*/
Action {
iconName: "settings"
text: i18n.tr("Settings")
onTriggered: {
pageStack.push(Qt.resolvedUrl("../settings/Settings.qml"))
}
},
Action {
iconName: "info"
text: i18n.tr("Info")
onTriggered: {
pageStack.push(Qt.resolvedUrl("../Info.qml"))
}
}
]
}

View File

@ -0,0 +1,31 @@
import QtQuick 2.4
import Ubuntu.Components 1.3
PageHeader {
id: stackHeader
width: parent.width
height: units.gu(6)
title: i18n.tr("UTPass")
contents: Item {
height: parent.height
width: parent.width
Label {
id: labelTitle
text: stackHeader.title
anchors.verticalCenter: parent.verticalCenter
}
}
leadingActionBar.height: units.gu(4)
leadingActionBar.actions: [
Action {
id: backAction
iconName: "back"
text: "Back"
onTriggered: {
pageStack.pop()
}
}
]
}

View File

@ -0,0 +1,82 @@
import QtQuick 2.4
import Ubuntu.Components 1.3
import Ubuntu.Content 1.3
import Ubuntu.Components.Popups 1.3
import Pass 1.0
import Utils 1.0
import "../headers"
import "../../dialogs"
Page {
id: importKeyFilePage
property var activeTransfer
header: StackHeader {
id: importKeyHeader
title: i18n.tr("GPG Key Import")
}
ContentPeerPicker {
anchors.top: importKeyHeader.bottom
anchors.bottom: parent.bottom
anchors.topMargin: importKeyFilePage.header.height
width: parent.width
visible: parent.visible
showTitle: false
contentType: ContentType.Text
handler: ContentHandler.Source
onPeerSelected: {
peer.selectionType = ContentTransfer.Single
importKeyFilePage.activeTransfer = peer.request()
importKeyFilePage.activeTransfer.stateChanged.connect(function () {
if (importKeyFilePage.activeTransfer.state === ContentTransfer.Charged) {
console.log("Charged")
console.log(importKeyFilePage.activeTransfer.items[0].url)
var status = Pass.gpgImportKeyFromFile(
importKeyFilePage.activeTransfer.items[0].url)
Utils.rmFile(importKeyFilePage.activeTransfer.items[0].url)
if (status) {
PopupUtils.open(dialogImportKeyPageSucess)
} else {
PopupUtils.open(dialogImportKeyPageError)
}
importKeyFilePage.activeTransfer = null
}
})
}
onCancelPressed: {
pageStack.pop()
}
}
ContentTransferHint {
id: transferHint
anchors.fill: parent
activeTransfer: importKeyFilePage.activeTransfer
}
Component {
id: dialogImportKeyPageError
ErrorDialog {
textError: i18n.tr("Key import failed !")
}
}
Component {
id: dialogImportKeyPageSucess
SuccessDialog {
textSuccess: i18n.tr("Key successfully imported !")
onDialogClosed: {
pageStack.pop()
}
}
}
}

View File

@ -0,0 +1,99 @@
import QtQuick 2.4
import Ubuntu.Components 1.3
import Ubuntu.Content 1.3
import Ubuntu.Components.Popups 1.3
import Pass 1.0
import Utils 1.0
import "../headers"
import "../../dialogs"
Page {
id: importZipPage
property var activeTransfer
header: StackHeader {
id: importZipHeader
title: i18n.tr("Zip Password Store Import")
}
ContentPeerPicker {
anchors.top: importZipHeader.bottom
anchors.bottom: parent.bottom
anchors.topMargin: importZipPage.header.height
width: parent.width
visible: parent.visible
showTitle: false
contentType: ContentType.Text
handler: ContentHandler.Source
onPeerSelected: {
peer.selectionType = ContentTransfer.Single
importZipPage.activeTransfer = peer.request()
importZipPage.activeTransfer.stateChanged.connect(function () {
if (importZipPage.activeTransfer.state === ContentTransfer.Charged) {
console.log("Charged")
console.log(importZipPage.activeTransfer.items[0].url)
var status = Utils.unzip(
importZipPage.activeTransfer.items[0].url,
Pass.getPasswordStore())
Utils.rmFile(importZipPage.activeTransfer.items[0].url)
if (status) {
PopupUtils.open(dialogImportZipPageSuccess)
} else {
PopupUtils.open(dialogImportZipPageError)
}
importZipPage.activeTransfer = null
}
})
}
onCancelPressed: {
pageStack.pop()
}
}
ContentTransferHint {
id: transferHint
anchors.fill: parent
activeTransfer: importZipPage.activeTransfer
}
Component {
id: importZipPageImportValidation
SimpleValidationDialog {
text: i18n.tr(
"Importing a new zip will delete<br>any existing password store!<br>Continue ?")
onCanceled: {
pageStack.pop()
}
}
}
Component {
id: dialogImportZipPageError
ErrorDialog {
textError: i18n.tr("Password store import failed !")
}
}
Component {
id: dialogImportZipPageSuccess
SuccessDialog {
textSuccess: i18n.tr("Password store sucessfully imported !")
onDialogClosed: {
pageStack.pop()
}
}
}
Component.onCompleted: {
PopupUtils.open(importZipPageImportValidation, importZipPage)
}
}

View File

@ -0,0 +1,100 @@
import QtQuick 2.4
import Ubuntu.Components 1.3
import Ubuntu.Components.Popups 1.3
import Pass 1.0
import "../headers"
import "../../components"
import "../../dialogs"
Page {
id: infoKeysPage
property string currentKey
header: StackHeader {
id: infoKeysHeader
title: i18n.tr('Info Keys')
}
ListView {
id: infoKeysListView
anchors.top: infoKeysHeader.bottom
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.left: parent.left
model: Pass.gpgGetAllKeysModel()
delegate: Grid {
columns: 1
width: parent.width
horizontalItemAlignment: Grid.AlignHCenter
verticalItemAlignment: Grid.AlignVCenter
Rectangle {
width: parent.width
height: units.gu(1)
}
Text {
id: uidKey
width: parent.width
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: i18n.tr('Key id : %1').arg(model.modelData.uid)
}
Button {
id: buttonDeleteKey
text: i18n.tr("Delete this key")
color: UbuntuColors.red
onClicked: {
infoKeysPage.currentKey = model.modelData.uid
PopupUtils.open(infoKeysPageDeleteValidation, infoKeysPage)
}
}
Rectangle {
width: parent.width
height: units.gu(1)
}
}
}
Component {
id: infoKeysPageDeleteValidation
DoubleValidationDialog {
text1: i18n.tr(
"You're are about to delete<br>%1<br>Continue ?").arg(
infoKeysPage.currentKey)
text2: i18n.tr(
"%1<br>will be definitively removed.<br>Continue ?").arg(
infoKeysPage.currentKey)
onDoubleValidated: {
var status = Pass.gpgDeleteKeyId(infoKeysPage.currentKey)
if (status) {
PopupUtils.open(infoKeysPageDeleteSuccess)
} else {
PopupUtils.open(infoKeysPageDeleteError)
}
}
}
}
Component {
id: infoKeysPageDeleteError
ErrorDialog {
textError: i18n.tr("Key removal failed !")
}
}
Component {
id: infoKeysPageDeleteSuccess
SuccessDialog {
textSuccess: i18n.tr("Key successfully deleted !")
onDialogClosed: {
infoKeysListView.model = Pass.gpgGetAllKeysModel()
}
}
}
}

View File

@ -0,0 +1,59 @@
import QtQuick 2.4
import Ubuntu.Components 1.3
import Pass 1.0
import "../headers"
import "../../components"
Page {
id: settingsPage
property string gpgKeyId: ""
header: StackHeader {
id: settingsHeader
title: i18n.tr('Settings')
}
Flow {
anchors.top: settingsHeader.bottom
anchors.bottom: parent.bottom
width: parent.width
spacing: 1
Text {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
width: parent.width
height: units.gu(4)
text: i18n.tr('GPG')
}
PageStackLink {
page: Qt.resolvedUrl("ImportKeyFile.qml")
text: i18n.tr('Import a GPG key file')
}
PageStackLink {
page: Qt.resolvedUrl("InfoKeys.qml")
text: i18n.tr('Show GPG keys')
}
Text {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
width: parent.width
height: units.gu(4)
text: i18n.tr('Password Store')
}
PageStackLink {
page: Qt.resolvedUrl("ImportZip.qml")
text: i18n.tr('Import a Password Store Zip')
}
Text {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
width: parent.width
height: units.gu(4)
color: UbuntuColors.red
text: i18n.tr(
'Warning: importing delete any exiting Password Store')
}
}
}