1
0
mirror of https://github.com/QRouland/UTPass.git synced 2025-01-27 17:06:39 +00:00
UTPass/qml/components/FileDir.qml

77 lines
2.1 KiB
QML
Raw Normal View History

2025-01-10 15:28:42 +01:00
import "../dialogs"
import "../styles"
import Lomiri.Components 1.3
import Lomiri.Components.Popups 1.3
2019-09-20 21:29:39 +02:00
import Pass 1.0
2025-01-10 15:28:42 +01:00
import QtQuick 2.4
2019-09-20 21:29:39 +02:00
Component {
Rectangle {
id: fileDir
2025-01-10 15:28:42 +01:00
2019-09-20 21:29:39 +02:00
property string activePasswordName
anchors.right: parent.right
anchors.left: parent.left
height: units.gu(5)
Text {
text: fileBaseName
anchors.left: parent.left
anchors.leftMargin: units.gu(2)
anchors.verticalCenter: parent.verticalCenter
}
Icon {
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
anchors.rightMargin: units.gu(2)
height: units.gu(4)
name: fileIsDir ? "go-next" : "lock"
color: LomiriColors.orange
2019-09-20 21:29:39 +02:00
}
MouseArea {
anchors.fill: parent
onClicked: {
if (fileIsDir) {
2025-01-10 15:28:42 +01:00
folderModel.folder = folderModel.folder + "/" + fileName;
backAction.visible = true;
2019-09-20 21:29:39 +02:00
} else {
2025-01-10 15:28:42 +01:00
fileDir.activePasswordName = fileBaseName;
Pass.onDecrypted.connect(function(text) {
pageStack.push(Qt.resolvedUrl("../pages/Password.qml"), {
"plainText": text,
"title": fileDir.activePasswordName
});
});
Pass.onDecryptFailed.connect(function() {
PopupUtils.open(passwordPageDecryptError);
});
Pass.decrypt(folderModel.folder + "/" + fileName);
2019-09-20 21:29:39 +02:00
}
}
}
CustomBorder {
commonBorder: false
lBorderwidth: 0
rBorderwidth: 0
tBorderwidth: 0
bBorderwidth: 1
borderColor: LomiriColors.warmGrey
2019-09-20 21:29:39 +02:00
}
Component {
id: passwordPageDecryptError
2025-01-10 15:28:42 +01:00
2019-09-20 21:29:39 +02:00
ErrorDialog {
textError: i18n.tr("Decryption failed !")
}
2025-01-10 15:28:42 +01:00
2019-09-20 21:29:39 +02:00
}
2025-01-10 15:28:42 +01:00
2019-09-20 21:29:39 +02:00
}
2025-01-10 15:28:42 +01:00
2019-09-20 21:29:39 +02:00
}