Commit 7ee89154 authored by eekkelund's avatar eekkelund

[SearchListView][NotificationItem] Add apps inside of folder to search result...

[SearchListView][NotificationItem] Add apps inside of folder to search result & launchable. Add possibility to dismiss(swipe away) notification. Small bug fixes
parent 0df0bfa4
...@@ -41,7 +41,7 @@ GridView { ...@@ -41,7 +41,7 @@ GridView {
property alias deleter: deleter property alias deleter: deleter
property var switcher: null property var switcher: null
property string searchString property string searchString
property int minCellSize: Theme.iconSizeLauncher + Theme.itemSpacingHuge property int minCellSize: Theme.iconSizeLauncher + Theme.iconSizeLauncher/2
property int rows: Math.floor(parent.height / minCellSize) property int rows: Math.floor(parent.height / minCellSize)
property int columns: Math.floor(parent.width / minCellSize) property int columns: Math.floor(parent.width / minCellSize)
......
...@@ -60,7 +60,6 @@ Flickable { ...@@ -60,7 +60,6 @@ Flickable {
text: Qt.formatDateTime(wallClock.time, "dddd") text: Qt.formatDateTime(wallClock.time, "dddd")
color: Theme.textColor color: Theme.textColor
font.pixelSize: Theme.fontSizeLarge font.pixelSize: Theme.fontSizeLarge
font.weight: Font.Bold
anchors { anchors {
top: parent.top top: parent.top
horizontalCenter: parent.horizontalCenter horizontalCenter: parent.horizontalCenter
...@@ -93,7 +92,7 @@ Flickable { ...@@ -93,7 +92,7 @@ Flickable {
width: parent.width width: parent.width
anchors{ anchors{
top: daterow.bottom top: daterow.bottom
topMargin: Theme.itemHeightLarge topMargin: Theme.itemHeightLarge*1.5
} }
spacing: Theme.itemSpacingMedium spacing: Theme.itemSpacingMedium
Repeater { Repeater {
......
...@@ -54,7 +54,6 @@ Rectangle { ...@@ -54,7 +54,6 @@ Rectangle {
font.pixelSize: Theme.fontSizeMedium font.pixelSize: Theme.fontSizeMedium
color: Theme.textColor color: Theme.textColor
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
font.weight: Font.Bold
anchors { anchors {
horizontalCenter: parent.horizontalCenter horizontalCenter: parent.horizontalCenter
} }
......
...@@ -35,6 +35,7 @@ import QtQuick.Controls.Styles.Nemo 1.0 ...@@ -35,6 +35,7 @@ import QtQuick.Controls.Styles.Nemo 1.0
import org.nemomobile.contacts 1.0 import org.nemomobile.contacts 1.0
Item { Item {
id:rootItem
height: (searchField.text.length > 0 ? listView.height+searchField.height : searchField.height) + (visible ? Theme.itemSpacingHuge + margin.height : 0) height: (searchField.text.length > 0 ? listView.height+searchField.height : searchField.height) + (visible ? Theme.itemSpacingHuge + margin.height : 0)
visible: false visible: false
anchors.bottomMargin:Theme.itemSpacingHuge anchors.bottomMargin:Theme.itemSpacingHuge
...@@ -48,8 +49,10 @@ Item { ...@@ -48,8 +49,10 @@ Item {
onVisibleChanged: { onVisibleChanged: {
if( visible) searchField.focus = true if( visible){
else searchField.focus = false searchField.focus = true
searchField.forceActiveFocus()
} else searchField.focus = false
oldHeight=height oldHeight=height
} }
...@@ -68,25 +71,30 @@ Item { ...@@ -68,25 +71,30 @@ Item {
rightMargin: Theme.itemSpacingMedium rightMargin: Theme.itemSpacingMedium
bottomMargin:Theme.itemSpacingHuge bottomMargin:Theme.itemSpacingHuge
} }
Image { Image {
id:searchIcon id:searchIcon
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
width:height width:height
height: searchField.height height: searchField.height
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
source: "image://theme/search" source: "image://theme/search"
} }
TextField { TextField {
id:searchField id:searchField
width:parent.width - searchIcon.width - Theme.itemSpacingMedium width:parent.width - searchIcon.width - Theme.itemSpacingMedium
placeholderText: qsTr("Search") placeholderText: qsTr("Search")
Binding { Binding {
target: gridview target: gridview
property: "searchString" property: "searchString"
value: searchField.text.toLowerCase().trim() value: searchField.text.toLowerCase().trim()
}
onTextChanged: {
if(tex.lenght>0) {
searchField.forceActiveFocus()
}
}
} }
}
} }
ListView { ListView {
...@@ -180,7 +188,13 @@ Item { ...@@ -180,7 +188,13 @@ Item {
var titles = [] var titles = []
var contacts = [] var contacts = []
for (i = 0; i < searchLauncherModel.itemCount; ++i) { for (i = 0; i < searchLauncherModel.itemCount; ++i) {
titles.push({'iconTitle':searchLauncherModel.get(i).title, 'iconSource':searchLauncherModel.get(i).iconId, 'id':i, 'category':qsTr("Application")}) if (searchLauncherModel.get(i).type === LauncherModel.Folder) {
for(var j = 0; j< searchLauncherModel.get(i).itemCount; ++j ) {
titles.push({'iconTitle':searchLauncherModel.get(i).get(j).title, 'iconSource':searchLauncherModel.get(i).get(j).iconId, 'id':i, 'folderId':j, 'category':qsTr("Application")})
}
} else {
titles.push({'iconTitle':searchLauncherModel.get(i).title, 'iconSource':searchLauncherModel.get(i).iconId, 'id':i, 'folderId':-1, 'category':qsTr("Application")})
}
} }
for (i = 0; i < peopleModel.count; ++i) { for (i = 0; i < peopleModel.count; ++i) {
if(peopleModel.get(i).firstName && peopleModel.get(i).lastName) { if(peopleModel.get(i).firstName && peopleModel.get(i).lastName) {
...@@ -217,11 +231,12 @@ Item { ...@@ -217,11 +231,12 @@ Item {
iconTitle = filteredTitles[i].iconTitle iconTitle = filteredTitles[i].iconTitle
iconId = filteredTitles[i].iconSource iconId = filteredTitles[i].iconSource
var id = filteredTitles[i].id var id = filteredTitles[i].id
var folderId = filteredTitles[i].folderId
category = filteredTitles[i].category category = filteredTitles[i].category
found = existingTitleObject.hasOwnProperty(iconTitle) found = existingTitleObject.hasOwnProperty(iconTitle)
if (!found) { if (!found) {
// for simplicity, just adding to end instead of corresponding position in original list // for simplicity, just adding to end instead of corresponding position in original list
listModel.append({'title':iconTitle, 'iconSource':iconId, 'id':id, 'category':category}) listModel.append({'title':iconTitle, 'iconSource':iconId, 'id':id, 'folderId':folderId, 'category':category})
} }
} }
for (i = 0; i < contacts.length; ++i) { for (i = 0; i < contacts.length; ++i) {
...@@ -278,8 +293,16 @@ Item { ...@@ -278,8 +293,16 @@ Item {
} }
width: iconImage.width width: iconImage.width
height: width height: width
enabled: (searchLauncherModel.get(model.id).type === LauncherModel.Application) ? searchLauncherModel.get(model.id).isLaunching ? switcher.switchModel.getWindowIdForTitle(model.title) == 0 : false : false enabled: {
if(searchLauncherModel.get(model.id).type === LauncherModel.Application) {
if(searchLauncherModel.get(model.id).isLaunching)
return switcher.switchModel.getWindowIdForTitle(model.title) == 0
} else if (searchLauncherModel.get(model.id).type === LauncherModel.Folder && model.folderId > -1) {
if (searchLauncherModel.get(model.id).get(model.folderId).isLaunching)
return switcher.switchModel.getWindowIdForTitle(model.title) == 0
}
return false
}
Connections { Connections {
target: Lipstick.compositor target: Lipstick.compositor
onWindowAdded: { onWindowAdded: {
...@@ -330,14 +353,21 @@ Item { ...@@ -330,14 +353,21 @@ Item {
onClicked: { onClicked: {
switch (category ) { switch (category ) {
case "Application": case "Application":
var winId
if (searchLauncherModel.get(model.id).type !== LauncherModel.Folder) { if (searchLauncherModel.get(model.id).type !== LauncherModel.Folder) {
var winId = switcher.switchModel.getWindowIdForTitle(model.title) winId = switcher.switchModel.getWindowIdForTitle(model.title)
if (winId == 0 || !searchLauncherModel.get(model.id).isLaunching) if (winId == 0 || !searchLauncherModel.get(model.id).isLaunching)
searchLauncherModel.get(model.id).launchApplication() searchLauncherModel.get(model.id).launchApplication()
else else
Lipstick.compositor.windowToFront(winId) Lipstick.compositor.windowToFront(winId)
} else if (searchLauncherModel.get(model.id).type === LauncherModel.Folder && model.folderId > -1) {
winId = switcher.switchModel.getWindowIdForTitle(model.title)
if (winId == 0 || !searchLauncherModel.get(model.id).get(model.folderId).isLaunching)
searchLauncherModel.get(model.id).get(model.folderId).launchApplication()
else
Lipstick.compositor.windowToFront(winId)
} }
context.state=""
break break
case "Contact": case "Contact":
console.log("Call to person. Or open contextmenu where sms and call") console.log("Call to person. Or open contextmenu where sms and call")
......
...@@ -220,7 +220,7 @@ Item { ...@@ -220,7 +220,7 @@ Item {
height: root.height/4 height: root.height/4
font.pixelSize: root.height/4+root.height/5 font.pixelSize: root.height/4+root.height/5
font.bold: true font.bold: true
wrapMode: Text.ElideRight elide:Text.ElideNone
text: (cellularNetworkName.value !== "") ? cellularNetworkName.value.substring(0,3).toUpperCase() : "NA" text: (cellularNetworkName.value !== "") ? cellularNetworkName.value.substring(0,3).toUpperCase() : "NA"
} }
...@@ -230,6 +230,7 @@ Item { ...@@ -230,6 +230,7 @@ Item {
width: root.height/4 width: root.height/4
height: root/height/4 height: root/height/4
font.pixelSize: root.height/4+root.height/5 font.pixelSize: root.height/4+root.height/5
elide:Text.ElideNone
text: { text: {
var techToG = {gprs: "2", egprs: "2.5", umts: "3", hspa: "3.5", lte: "4", unknown: "0"} var techToG = {gprs: "2", egprs: "2.5", umts: "3", hspa: "3.5", lte: "4", unknown: "0"}
return techToG[cellularDataTechnology.value ? cellularDataTechnology.value : "unknown"] + "G" return techToG[cellularDataTechnology.value ? cellularDataTechnology.value : "unknown"] + "G"
...@@ -289,6 +290,7 @@ Item { ...@@ -289,6 +290,7 @@ Item {
width: root.height/4 width: root.height/4
height: root.height/4 height: root.height/4
font.pixelSize: root.height/4+root.height/5 font.pixelSize: root.height/4+root.height/5
elide:Text.ElideNone
text: Qt.formatDateTime(wallClock.time, "hh") text: Qt.formatDateTime(wallClock.time, "hh")
} }
Label { Label {
...@@ -298,6 +300,7 @@ Item { ...@@ -298,6 +300,7 @@ Item {
width: root.height/4 width: root.height/4
height: root.height/4 height: root.height/4
font.pixelSize: root.height/4+root.height/5 font.pixelSize: root.height/4+root.height/5
elide:Text.ElideNone
text: Qt.formatDateTime(wallClock.time, "mm") text: Qt.formatDateTime(wallClock.time, "mm")
} }
} }
......
...@@ -17,16 +17,21 @@ MouseArea { ...@@ -17,16 +17,21 @@ MouseArea {
property alias pressBg: pressBg property alias pressBg: pressBg
property int iconSize:Math.min(Theme.iconSizeLauncher, height-Theme.itemSpacingMedium) property int iconSize:Math.min(Theme.iconSizeLauncher, height-Theme.itemSpacingMedium)
property string timeAgo property string timeAgo
property int swipeTreshold: notifyArea.width/3
drag.target: notifyArea drag.target: modelData.userRemovable ? notifyArea : null
drag.axis: Drag.XAxis drag.axis: Drag.XAxis
drag.minimumX: 0-Theme.itemHeightMedium drag.minimumX: -notifyArea.width
drag.maximumX: notifyArea.width drag.maximumX: notifyArea.width
drag.onActiveChanged: { drag.onActiveChanged: {
if(!drag.active ) { if(!drag.active ) {
if((notifyArea.x > notifyArea.width/3)) { if((notifyArea.x > swipeTreshold)) {
slideAnimation.start() slideAnimation.start()
}else slideBackAnimation.start() }else if (notifyArea.x < -swipeTreshold){
slideReverseAnimation.start()
} else {
slideBackAnimation.start()
}
} }
} }
...@@ -57,7 +62,7 @@ MouseArea { ...@@ -57,7 +62,7 @@ MouseArea {
timeAgo = days + " " + qsTr("day ago") timeAgo = days + " " + qsTr("day ago")
} }
}else if (hours >= 1) { }else if (hours >= 1) {
if (hours >= 1) { if (hours > 1) {
timeAgo = hours + " " + qsTr("hours ago") timeAgo = hours + " " + qsTr("hours ago")
} else { } else {
timeAgo = hours + " " + qsTr("hour ago") timeAgo = hours + " " + qsTr("hour ago")
...@@ -76,6 +81,8 @@ MouseArea { ...@@ -76,6 +81,8 @@ MouseArea {
onClicked: { onClicked: {
if (modelData.userRemovable) { if (modelData.userRemovable) {
slideAnimation.start() slideAnimation.start()
} else {
modelData.actionInvoked("default")
} }
} }
NumberAnimation { NumberAnimation {
...@@ -88,6 +95,16 @@ MouseArea { ...@@ -88,6 +95,16 @@ MouseArea {
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
onStopped: modelData.actionInvoked("default") onStopped: modelData.actionInvoked("default")
} }
NumberAnimation {
id:slideReverseAnimation
target: notifyArea
property: "x"
duration: 200
from: notifyArea.x
to: -notifyArea.width
easing.type: Easing.InOutQuad
onStopped: modelData.removeRequested()
}
NumberAnimation { NumberAnimation {
id:slideBackAnimation id:slideBackAnimation
target: notifyArea target: notifyArea
...@@ -122,7 +139,9 @@ MouseArea { ...@@ -122,7 +139,9 @@ MouseArea {
source: { source: {
if (modelData.icon) if (modelData.icon)
return "image://theme/" + modelData.icon return "image://theme/" + modelData.icon
else else if (modelData.appIcon) {
return "image://theme/" + modelData.appIcon
} else
return defaultIcon return defaultIcon
} }
onStatusChanged: { onStatusChanged: {
...@@ -144,11 +163,10 @@ MouseArea { ...@@ -144,11 +163,10 @@ MouseArea {
Label { Label {
id: appName id: appName
text: modelData.appName text: modelData.appName
width: parent.width-appTimestamp.width-Theme.itemSpacingSmall width: Math.min(implicitWidth, parent.width-appTimestamp.width-Theme.itemSpacingSmall)
color: Theme.textColor color: Theme.textColor
elide: Text.ElideRight elide: Text.ElideRight
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.capitalization: Font.AllUppercase
anchors { anchors {
left: parent.left left: parent.left
} }
...@@ -175,8 +193,9 @@ MouseArea { ...@@ -175,8 +193,9 @@ MouseArea {
font.pixelSize: Theme.fontSizeTiny font.pixelSize: Theme.fontSizeTiny
anchors{ anchors{
left: parent.left left: parent.left
// topMargin: Theme.itemSpacingSmall // topMargin: Theme.itemSpacingSmall
} }
maximumLineCount: 1
elide: Text.ElideRight elide: Text.ElideRight
} }
...@@ -189,6 +208,7 @@ MouseArea { ...@@ -189,6 +208,7 @@ MouseArea {
anchors{ anchors{
left: parent.left left: parent.left
} }
maximumLineCount: 1
elide: Text.ElideRight elide: Text.ElideRight
} }
} }
......
...@@ -122,6 +122,7 @@ Item { ...@@ -122,6 +122,7 @@ Item {
Image { Image {
id: icon id: icon
property string defaultIcon: "/usr/share/lipstick-glacier-home-qt5/qml/images/notification-circle.png"
anchors { anchors {
top: parent.top top: parent.top
left: parent.left left: parent.left
...@@ -130,7 +131,20 @@ Item { ...@@ -130,7 +131,20 @@ Item {
} }
width: notificationArea.notificationIconSize width: notificationArea.notificationIconSize
height: width height: width
source: "/usr/share/lipstick-glacier-home-qt5/qml/images/notification-circle.png" source: {
if (notificationPreviewPresenter.notification.icon)
return "image://theme/" + notificationPreviewPresenter.notification.icon
else if (notificationPreviewPresenter.notification.appIcon) {
return "image://theme/" + notificationPreviewPresenter.notification.appIcon
} else
return defaultIcon
}
onStatusChanged: {
if (icon.status == Image.Error) {
icon.source = defaultIcon
}
}
} }
Label { Label {
...@@ -150,7 +164,6 @@ Item { ...@@ -150,7 +164,6 @@ Item {
color: Theme.textColor color: Theme.textColor
clip: true clip: true
elide: Text.ElideRight elide: Text.ElideRight
Component.onCompleted: console.log(height, "--", notificationPreviewPresenter.notification != null)
} }
Label { Label {
...@@ -161,10 +174,7 @@ Item { ...@@ -161,10 +174,7 @@ Item {
right: summary.right right: summary.right
} }
height: if(!text) 0 height: if(!text) 0
font { font.pixelSize: Theme.fontSizeSmall
bold: true
pixelSize: Theme.fontSizeSmall
}
text: notificationPreviewPresenter.notification != null ? notificationPreviewPresenter.notification.previewBody : "" text: notificationPreviewPresenter.notification != null ? notificationPreviewPresenter.notification.previewBody : ""
color: Theme.textColor color: Theme.textColor
clip: true clip: true
......
...@@ -95,7 +95,7 @@ Rectangle { ...@@ -95,7 +95,7 @@ Rectangle {
wrapMode: Text.Wrap wrapMode: Text.Wrap
font.pixelSize: Theme.fontSizeMedium font.pixelSize: Theme.fontSizeMedium
font.bold: true font.bold: true
color: "#ffffff" color: Theme.textColor
} }
CheckBox { CheckBox {
......
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