Commit 8442ef11 authored by Sergey Chupligin's avatar Sergey Chupligin Committed by Sergey Chupligin

[AppLauncher] Make search panel configurable

parent 51265a95
...@@ -54,7 +54,7 @@ Flickable{ ...@@ -54,7 +54,7 @@ Flickable{
SearchListView { SearchListView {
id: searchListView id: searchListView
width: appLauncher.width width: appLauncher.width
visible: alwaysShowSearch visible: alwaysShowSearch.value == true
Timer{ Timer{
id: searchListViewTimer; id: searchListViewTimer;
...@@ -62,9 +62,9 @@ Flickable{ ...@@ -62,9 +62,9 @@ Flickable{
interval: 7000; interval: 7000;
repeat: true repeat: true
onTriggered: { onTriggered: {
if(searchString.length < 1 && !alwaysShowSearch) if(searchString.length < 1 && !alwaysShowSearch.value == true)
{ {
headerItem.visible = false searchListView.visible = false
} }
} }
} }
...@@ -122,6 +122,13 @@ Flickable{ ...@@ -122,6 +122,13 @@ Flickable{
topMargin: Theme.itemSpacingHuge topMargin: Theme.itemSpacingHuge
} }
onContentYChanged: {
if( contentY < -Theme.itemHeightHuge*2 && alwaysShowSearch.value == false ) {
searchListView.visible = true
searchListViewTimer.running = true
}
}
property int folderIndex: -1 property int folderIndex: -1
property bool isRootFolder:true property bool isRootFolder:true
property bool newFolderActive property bool newFolderActive
......
...@@ -30,24 +30,19 @@ ...@@ -30,24 +30,19 @@
** **
****************************************************************************************/ ****************************************************************************************/
import QtQuick 2.6 import QtQuick 2.6
import org.nemomobile.lipstick 0.1
import QtQuick.Controls.Nemo 1.0 import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0 import QtQuick.Controls.Styles.Nemo 1.0
import org.nemomobile.lipstick 0.1
import org.nemomobile.contacts 1.0 import org.nemomobile.contacts 1.0
Item { Item {
id:rootItem id:rootItem
height: (searchField.text.length > 0 ? listView.height+searchField.height : searchField.height) + (visible ? Theme.itemSpacingHuge + margin.height : 0) height: calculateHeight()
visible: false
anchors.bottomMargin:Theme.itemSpacingHuge anchors.bottomMargin:Theme.itemSpacingHuge
property alias searchField: searchField property alias searchField: searchField
property int oldHeight property int oldHeight
Behavior on height {
enabled:!visible
NumberAnimation{ duration: 300 }
}
InverseMouseArea { InverseMouseArea {
anchors.fill: parent anchors.fill: parent
onPressed: cleanup() onPressed: cleanup()
...@@ -59,28 +54,44 @@ Item { ...@@ -59,28 +54,44 @@ Item {
appLauncher.searchString = "" appLauncher.searchString = ""
searchField.text = "" searchField.text = ""
if(!alwaysShowSearch) if(!alwaysShowSearch.value == true)
{ {
searchListView.visible = false; searchListView.visible = false;
} }
} }
function calculateHeight()
{
if(rootItem.visible){
if(searchField.text.length > 0){
return parent.height
}
return searchRow.height+Theme.itemSpacingHuge
}
else
{
return 0;
}
}
onVisibleChanged: { onVisibleChanged: {
if( visible){ if(alwaysShowSearch.value == false)
{
if(visible){
rootItem.height = calculateHeight()
searchField.focus = true searchField.focus = true
searchField.forceActiveFocus() searchField.forceActiveFocus()
} else searchField.focus = false } else {
searchField.focus = false
}
oldHeight=height oldHeight=height
} }
Item {
id:margin
height: Theme.itemSpacingSmall
} }
Row { Row {
id:searchRow id:searchRow
anchors { anchors {
top:margin.bottom top: parent.top
left: parent.left left: parent.left
right: parent.right right: parent.right
topMargin: Theme.itemSpacingHuge topMargin: Theme.itemSpacingHuge
...@@ -95,6 +106,15 @@ Item { ...@@ -95,6 +106,15 @@ Item {
height: searchField.height height: searchField.height
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
source: "image://theme/search" source: "image://theme/search"
MouseArea{
id: hideShowMouseArea
anchors.fill: parent
onPressAndHold: {
hideShowRow.visible = true
rootItem.height = rootItem.height+hideShowRow.height
}
}
} }
TextField { TextField {
...@@ -112,15 +132,54 @@ Item { ...@@ -112,15 +132,54 @@ Item {
} }
} }
} }
}
Row{
id: hideShowRow
visible: false
width: parent.width-Theme.itemSpacingMedium*2
height: visible ? hideShowButton.height+Theme.itemSpacingMedium : 0
anchors{
top: searchRow.bottom
topMargin: visible ? Theme.itemSpacingMedium : 0
}
Button{
id: hideShowButton
text: alwaysShowSearch.value == true ? qsTr("Hide search panel") : qsTr("Pinup search panel")
width: parent.width
onClicked: {
rootItem.height = rootItem.height-hideShowRow.height
hideShowRow.visible = false
if(alwaysShowSearch.value == true)
{
alwaysShowSearch.value = false
}
else
{
alwaysShowSearch.value = true
}
}
}
InverseMouseArea {
anchors.fill: parent
onPressed: {
rootItem.height = rootItem.height-hideShowRow.height
hideShowRow.visible = false
}
}
} }
ListView { ListView {
id:listView id:listView
clip: true clip: true
width: parent.width width: parent.width
height:contentHeight height:contentHeight
anchors.top: searchRow.bottom anchors{
anchors.topMargin: Theme.itemSpacingSmall top: searchRow.bottom
topMargin: listModel.count > 0 ? Theme.itemSpacingSmall : 0
}
visible: searchString.length>0 visible: searchString.length>0
section.property: 'category' section.property: 'category'
section.delegate: Component{ section.delegate: Component{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment