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 {
property alias deleter: deleter
property var switcher: null
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 columns: Math.floor(parent.width / minCellSize)
......
......@@ -60,7 +60,6 @@ Flickable {
text: Qt.formatDateTime(wallClock.time, "dddd")
color: Theme.textColor
font.pixelSize: Theme.fontSizeLarge
font.weight: Font.Bold
anchors {
top: parent.top
horizontalCenter: parent.horizontalCenter
......@@ -93,7 +92,7 @@ Flickable {
width: parent.width
anchors{
top: daterow.bottom
topMargin: Theme.itemHeightLarge
topMargin: Theme.itemHeightLarge*1.5
}
spacing: Theme.itemSpacingMedium
Repeater {
......
......@@ -54,7 +54,6 @@ Rectangle {
font.pixelSize: Theme.fontSizeMedium
color: Theme.textColor
horizontalAlignment: Text.AlignHCenter
font.weight: Font.Bold
anchors {
horizontalCenter: parent.horizontalCenter
}
......
......@@ -35,6 +35,7 @@ import QtQuick.Controls.Styles.Nemo 1.0
import org.nemomobile.contacts 1.0
Item {
id:rootItem
height: (searchField.text.length > 0 ? listView.height+searchField.height : searchField.height) + (visible ? Theme.itemSpacingHuge + margin.height : 0)
visible: false
anchors.bottomMargin:Theme.itemSpacingHuge
......@@ -48,8 +49,10 @@ Item {
onVisibleChanged: {
if( visible) searchField.focus = true
else searchField.focus = false
if( visible){
searchField.focus = true
searchField.forceActiveFocus()
} else searchField.focus = false
oldHeight=height
}
......@@ -86,7 +89,12 @@ Item {
property: "searchString"
value: searchField.text.toLowerCase().trim()
}
}
onTextChanged: {
if(tex.lenght>0) {
searchField.forceActiveFocus()
}
}
}
}
ListView {
......@@ -180,7 +188,13 @@ Item {
var titles = []
var contacts = []
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) {
if(peopleModel.get(i).firstName && peopleModel.get(i).lastName) {
......@@ -217,11 +231,12 @@ Item {
iconTitle = filteredTitles[i].iconTitle
iconId = filteredTitles[i].iconSource
var id = filteredTitles[i].id
var folderId = filteredTitles[i].folderId
category = filteredTitles[i].category
found = existingTitleObject.hasOwnProperty(iconTitle)
if (!found) {
// 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) {
......@@ -278,8 +293,16 @@ Item {
}
width: iconImage.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 {
target: Lipstick.compositor
onWindowAdded: {
......@@ -330,14 +353,21 @@ Item {
onClicked: {
switch (category ) {
case "Application":
var winId
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)
searchLauncherModel.get(model.id).launchApplication()
else
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
case "Contact":
console.log("Call to person. Or open contextmenu where sms and call")
......
......@@ -220,7 +220,7 @@ Item {
height: root.height/4
font.pixelSize: root.height/4+root.height/5
font.bold: true
wrapMode: Text.ElideRight
elide:Text.ElideNone
text: (cellularNetworkName.value !== "") ? cellularNetworkName.value.substring(0,3).toUpperCase() : "NA"
}
......@@ -230,6 +230,7 @@ Item {
width: root.height/4
height: root/height/4
font.pixelSize: root.height/4+root.height/5
elide:Text.ElideNone
text: {
var techToG = {gprs: "2", egprs: "2.5", umts: "3", hspa: "3.5", lte: "4", unknown: "0"}
return techToG[cellularDataTechnology.value ? cellularDataTechnology.value : "unknown"] + "G"
......@@ -289,6 +290,7 @@ Item {
width: root.height/4
height: root.height/4
font.pixelSize: root.height/4+root.height/5
elide:Text.ElideNone
text: Qt.formatDateTime(wallClock.time, "hh")
}
Label {
......@@ -298,6 +300,7 @@ Item {
width: root.height/4
height: root.height/4
font.pixelSize: root.height/4+root.height/5
elide:Text.ElideNone
text: Qt.formatDateTime(wallClock.time, "mm")
}
}
......
......@@ -17,16 +17,21 @@ MouseArea {
property alias pressBg: pressBg
property int iconSize:Math.min(Theme.iconSizeLauncher, height-Theme.itemSpacingMedium)
property string timeAgo
property int swipeTreshold: notifyArea.width/3
drag.target: notifyArea
drag.target: modelData.userRemovable ? notifyArea : null
drag.axis: Drag.XAxis
drag.minimumX: 0-Theme.itemHeightMedium
drag.minimumX: -notifyArea.width
drag.maximumX: notifyArea.width
drag.onActiveChanged: {
if(!drag.active ) {
if((notifyArea.x > notifyArea.width/3)) {
if((notifyArea.x > swipeTreshold)) {
slideAnimation.start()
}else slideBackAnimation.start()
}else if (notifyArea.x < -swipeTreshold){
slideReverseAnimation.start()
} else {
slideBackAnimation.start()
}
}
}
......@@ -57,7 +62,7 @@ MouseArea {
timeAgo = days + " " + qsTr("day ago")
}
}else if (hours >= 1) {
if (hours >= 1) {
if (hours > 1) {
timeAgo = hours + " " + qsTr("hours ago")
} else {
timeAgo = hours + " " + qsTr("hour ago")
......@@ -76,6 +81,8 @@ MouseArea {
onClicked: {
if (modelData.userRemovable) {
slideAnimation.start()
} else {
modelData.actionInvoked("default")
}
}
NumberAnimation {
......@@ -88,6 +95,16 @@ MouseArea {
easing.type: Easing.InOutQuad
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 {
id:slideBackAnimation
target: notifyArea
......@@ -122,7 +139,9 @@ MouseArea {
source: {
if (modelData.icon)
return "image://theme/" + modelData.icon
else
else if (modelData.appIcon) {
return "image://theme/" + modelData.appIcon
} else
return defaultIcon
}
onStatusChanged: {
......@@ -144,11 +163,10 @@ MouseArea {
Label {
id: appName
text: modelData.appName
width: parent.width-appTimestamp.width-Theme.itemSpacingSmall
width: Math.min(implicitWidth, parent.width-appTimestamp.width-Theme.itemSpacingSmall)
color: Theme.textColor
elide: Text.ElideRight
font.pixelSize: Theme.fontSizeSmall
font.capitalization: Font.AllUppercase
anchors {
left: parent.left
}
......@@ -177,6 +195,7 @@ MouseArea {
left: parent.left
// topMargin: Theme.itemSpacingSmall
}
maximumLineCount: 1
elide: Text.ElideRight
}
......@@ -189,6 +208,7 @@ MouseArea {
anchors{
left: parent.left
}
maximumLineCount: 1
elide: Text.ElideRight
}
}
......
......@@ -122,6 +122,7 @@ Item {
Image {
id: icon
property string defaultIcon: "/usr/share/lipstick-glacier-home-qt5/qml/images/notification-circle.png"
anchors {
top: parent.top
left: parent.left
......@@ -130,7 +131,20 @@ Item {
}
width: notificationArea.notificationIconSize
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 {
......@@ -150,7 +164,6 @@ Item {
color: Theme.textColor
clip: true
elide: Text.ElideRight
Component.onCompleted: console.log(height, "--", notificationPreviewPresenter.notification != null)
}
Label {
......@@ -161,10 +174,7 @@ Item {
right: summary.right
}
height: if(!text) 0
font {
bold: true
pixelSize: Theme.fontSizeSmall
}
font.pixelSize: Theme.fontSizeSmall
text: notificationPreviewPresenter.notification != null ? notificationPreviewPresenter.notification.previewBody : ""
color: Theme.textColor
clip: true
......
......@@ -95,7 +95,7 @@ Rectangle {
wrapMode: Text.Wrap
font.pixelSize: Theme.fontSizeMedium
font.bold: true
color: "#ffffff"
color: Theme.textColor
}
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