mirror of
https://github.com/QRouland/UTPass.git
synced 2025-02-24 04:14:55 +00:00
Some clean up
This commit is contained in:
parent
c6f2424017
commit
7e8ac60cc9
@ -19,14 +19,15 @@ Page {
|
||||
for (var i = 0; i < __passwords.length; i++) {
|
||||
if (__passwords[i].toUpperCase().indexOf(filter.toUpperCase()) > -1)
|
||||
ret.push(__passwords[i]);
|
||||
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
function __searchUpdateModel(text) {
|
||||
var ret = __searchPasswords(text);
|
||||
function __searchUpdateModel() {
|
||||
const filter = passwordListHeader.searchBar.text;
|
||||
console.info("filter : %1".arg(filter));
|
||||
var ret = __searchPasswords(filter);
|
||||
passwordListSearch.model.clear();
|
||||
for (var i = 0; i < ret.length; i++) {
|
||||
if (ret[i])
|
||||
@ -51,6 +52,7 @@ Page {
|
||||
});
|
||||
Pass.onLsSucceed.connect(function(passwords) {
|
||||
passwordListPage.__passwords = passwords;
|
||||
__searchUpdateModel();
|
||||
});
|
||||
Pass.ls();
|
||||
}
|
||||
@ -109,7 +111,7 @@ Page {
|
||||
anchors.right: parent.right
|
||||
anchors.left: parent.left
|
||||
spacing: 1
|
||||
visible: passwordListNav.model.count !== 0 && passwordListHeader.searchBarIsActive
|
||||
visible: passwordListNav.model.count !== 0 && !passwordListHeader.searchBar.visible
|
||||
|
||||
model: FolderListModel {
|
||||
nameFilters: ["*.gpg"]
|
||||
@ -146,7 +148,7 @@ Page {
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.right: parent.right
|
||||
anchors.left: parent.left
|
||||
visible: passwordListNav.model.count !== 0 && !passwordListHeader.searchBarIsActive
|
||||
visible: passwordListNav.model.count !== 0 && passwordListHeader.searchBar.visible
|
||||
|
||||
model: ListModel {
|
||||
}
|
||||
@ -175,11 +177,16 @@ Page {
|
||||
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: searchTimer
|
||||
interval: 500
|
||||
onTriggered: __searchUpdateModel()
|
||||
}
|
||||
|
||||
header: MainHeader {
|
||||
id: passwordListHeader
|
||||
|
||||
onSearchBarActived: __searchUpdateModel("")
|
||||
onSearchBarTextChanged: __searchUpdateModel(text)
|
||||
searchBar.onTextChanged: searchTimer.restart()
|
||||
leadingActionBar.height: units.gu(4)
|
||||
leadingActionBar.actions: [
|
||||
Action {
|
||||
|
@ -4,10 +4,9 @@ import QtQuick 2.4
|
||||
PageHeader {
|
||||
id: mainHeader
|
||||
|
||||
readonly property bool searchBarIsActive: !searchBar.visible
|
||||
|
||||
signal searchBarActived()
|
||||
signal searchBarTextChanged(string text)
|
||||
property alias searchBar: searchBar
|
||||
//property alias searchBarText: searchBar.text
|
||||
//signal searchBarTextChanged(string text)
|
||||
|
||||
width: parent.width
|
||||
height: units.gu(6)
|
||||
@ -16,14 +15,13 @@ PageHeader {
|
||||
trailingActionBar.numberOfSlots: 2
|
||||
trailingActionBar.actions: [
|
||||
Action {
|
||||
iconName: searchBarIsActive ? "search" : "close"
|
||||
iconName: !searchBar.visible ? "search" : "close"
|
||||
text: i18n.tr("Search")
|
||||
onTriggered: {
|
||||
searchBar.visible = !searchBar.visible;
|
||||
labelTitle.visible = !searchBar.visible;
|
||||
if (searchBar.visible === true) {
|
||||
searchBar.focus = true;
|
||||
searchBarActived();
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -64,7 +62,6 @@ PageHeader {
|
||||
height: units.gu(4)
|
||||
visible: false
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
onTextChanged: searchBarTextChanged(searchBar.text)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,7 +15,6 @@ Page {
|
||||
property string __repoUrl
|
||||
|
||||
function __loadForm() {
|
||||
console.debug("yo");
|
||||
switch (combo.selectedIndex) {
|
||||
case 0:
|
||||
importGitCloneForm.source = Qt.resolvedUrl("../../components/GitCloneHttp.qml");
|
||||
|
Loading…
x
Reference in New Issue
Block a user