mirror of
https://github.com/QRouland/UTPass.git
synced 2025-06-29 16:52:29 +00:00
Initial Commit
This commit is contained in:
68
qml/Main.qml
Normal file
68
qml/Main.qml
Normal file
@ -0,0 +1,68 @@
|
||||
import QtQuick 2.4
|
||||
import QtQuick.Layouts 1.1
|
||||
import Qt.labs.folderlistmodel 2.1
|
||||
import Ubuntu.Components 1.3
|
||||
|
||||
import Pass 1.0
|
||||
import "components" as MyComponents
|
||||
|
||||
MainView {
|
||||
id: root
|
||||
objectName: "mainView"
|
||||
applicationName: "utpass.qrouland"
|
||||
automaticOrientation: true
|
||||
|
||||
width: units.gu(45)
|
||||
height: units.gu(75)
|
||||
|
||||
Page {
|
||||
id: page
|
||||
anchors.fill: parent
|
||||
|
||||
header: PageHeader {
|
||||
id: header
|
||||
width: parent.width
|
||||
height: units.gu(6)
|
||||
title: i18n.tr("UTPass")
|
||||
flickable: navigation
|
||||
leadingActionBar.height: units.gu(4)
|
||||
leadingActionBar.actions: [
|
||||
Action {
|
||||
id: backAction
|
||||
iconName: "back"
|
||||
text: "Back"
|
||||
visible:false
|
||||
onTriggered: {
|
||||
folderModel.folder = folderModel.parentFolder;
|
||||
if(folderModel.rootFolder === folderModel.folder) {
|
||||
backAction.visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Flickable {
|
||||
id: navigation
|
||||
anchors.fill: parent
|
||||
|
||||
ListView {
|
||||
id : listViewDirs
|
||||
anchors.fill: parent
|
||||
spacing: 1
|
||||
model: FolderListModel {
|
||||
id: folderModel
|
||||
nameFilters: ["*.gpg"]
|
||||
rootFolder: "file:assets/lol"
|
||||
folder: "file:assets/lol"
|
||||
}
|
||||
delegate: MyComponents.ViewFileDir {
|
||||
id: fileDelegate
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Component.onCompleted: Pass.speak()
|
||||
}
|
34
qml/components/CustomBorder.qml
Normal file
34
qml/components/CustomBorder.qml
Normal file
@ -0,0 +1,34 @@
|
||||
// Author : Amit Tomar
|
||||
// @ https://stackoverflow.com/questions/16534489/qml-control-border-width-and-color-on-any-one-side-of-rectangle-element#16562823
|
||||
import QtQuick 2.4
|
||||
|
||||
Rectangle
|
||||
{
|
||||
property bool commonBorder : true
|
||||
|
||||
property int lBorderwidth : 1
|
||||
property int rBorderwidth : 1
|
||||
property int tBorderwidth : 1
|
||||
property int bBorderwidth : 1
|
||||
|
||||
property int commonBorderWidth : 1
|
||||
|
||||
z : -1
|
||||
|
||||
property string borderColor : "white"
|
||||
|
||||
color: borderColor
|
||||
|
||||
anchors
|
||||
{
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
|
||||
topMargin : commonBorder ? -commonBorderWidth : -tBorderwidth
|
||||
bottomMargin : commonBorder ? -commonBorderWidth : -bBorderwidth
|
||||
leftMargin : commonBorder ? -commonBorderWidth : -lBorderwidth
|
||||
rightMargin : commonBorder ? -commonBorderWidth : -rBorderwidth
|
||||
}
|
||||
}
|
37
qml/components/ViewFileDir.qml
Normal file
37
qml/components/ViewFileDir.qml
Normal file
@ -0,0 +1,37 @@
|
||||
import QtQuick 2.4
|
||||
import Ubuntu.Components 1.3
|
||||
|
||||
Component {
|
||||
Rectangle {
|
||||
width: page.width
|
||||
height: units.gu(5)
|
||||
Text {
|
||||
text: fileBaseName
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: units.gu(1)
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
Icon {
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: units.gu(4)
|
||||
height: units.gu(4)
|
||||
name: fileIsDir ? "go-next" : "lock"
|
||||
color: UbuntuColors.orange
|
||||
}
|
||||
MouseArea
|
||||
{
|
||||
anchors.fill: parent
|
||||
onClicked: { if (fileIsDir){ folderModel.folder = folderModel.folder + "/" + fileName ; backAction.visible = true;} }
|
||||
}
|
||||
CustomBorder
|
||||
{
|
||||
commonBorder: false
|
||||
lBorderwidth: 0
|
||||
rBorderwidth: 0
|
||||
tBorderwidth: 0
|
||||
bBorderwidth: 1
|
||||
borderColor: UbuntuColors.warmGrey
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user