[Merge] lp:~artmello/webbrowser-app/webbrowser-app-history_view_convergence into lp:webbrowser-app

Arthur Mello arthur.mello at canonical.com
Thu Jul 30 02:08:44 UTC 2015


All the comments were addressed, except the one related with selection highlight for the right panel covering the timestamp. The way it was implemented, the timestamp is part of the ListItem (UrlDelegate). That way the timestamp is a valid area to execute actions (click to open, swipe to delete and long press to select), what I believe it is a desired behavior, and the selection check button will be displayed on the left of the timestamp. The down side is that the highlight will cover timestamp too. Since we are waiting for a confirmation from design team if the leading action should override timestamp and separating both, the timestamp and the UrlDelegate, will add a lot of code to keep the desired features, maybe we could wait to change that. What do you think?

Diff comments:

> 
> === added file 'src/app/webbrowser/HistoryViewLandscape.qml'
> --- src/app/webbrowser/HistoryViewLandscape.qml	1970-01-01 00:00:00 +0000
> +++ src/app/webbrowser/HistoryViewLandscape.qml	2015-06-26 02:06:13 +0000
> @@ -0,0 +1,226 @@
> +/*
> + * Copyright 2015 Canonical Ltd.
> + *
> + * This file is part of webbrowser-app.
> + *
> + * webbrowser-app is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; version 3.
> + *
> + * webbrowser-app is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program.  If not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +import QtQuick 2.0
> +import Ubuntu.Components 1.2
> +import Ubuntu.Components.ListItems 1.0 as ListItems
> +import webbrowserapp.private 0.1
> +
> +Item {
> +    id: historyViewLandscape
> +
> +    property alias historyModel: historyTimeframeModel.sourceModel
> +    property alias count: lastVisitDateListView.count
> +
> +    signal historyEntryClicked(url url)
> +    signal historyEntryRemoved(url url)
> +    signal done()
> +
> +    Rectangle {
> +        anchors.fill: parent
> +    }
> +
> +    Row {
> +        anchors {
> +            top: lastVisitedHeader.bottom
> +            left: parent.left
> +            bottom: bottomToolbar.top
> +            leftMargin: units.gu(2)
> +            rightMargin: units.gu(2)
> +        }
> +
> +        spacing: units.gu(2)
> +
> +        ListView {
> +            id: lastVisitDateListView
> +
> +            width: units.gu(40)
> +            height: parent.height
> +
> +            model: HistoryLastVisitDateListModel {
> +                sourceModel: HistoryTimeframeModel {
> +                    id: historyTimeframeModel
> +                }
> +            }
> +
> +            delegate: ListItem {
> +                anchors {
> +                    left: parent.left
> +                    right: parent.right
> +                }
> +
> +                width: parent.width
> +                height: units.gu(4)
> +
> +                Label {
> +                    anchors {
> +                        top: parent.top
> +                        left: parent.left
> +                        topMargin: units.gu(1)
> +                        leftMargin: units.gu(2)
> +                    }
> +
> +                    height: parent.height
> +
> +                    text: {
> +                        var today = new Date()
> +                        var yesterday = new Date()
> +                        yesterday.setDate(yesterday.getDate() - 1)
> +                        if ((lastVisitDate.getUTCFullYear() == today.getFullYear()) &&
> +                            (lastVisitDate.getUTCMonth() == today.getMonth())) {
> +                            var dayDifference = lastVisitDate.getUTCDate() - today.getDate()
> +                            if (dayDifference == 0) {
> +                                return i18n.tr("Today")
> +                            } else if (dayDifference == -1) {
> +                                return i18n.tr("Yesterday")
> +                            }
> +                        }
> +                        return Qt.formatDate(lastVisitDate, Qt.DefaultLocaleLongDate)
> +                    }
> +
> +                    fontSize: "small"
> +                }
> +
> +                MouseArea {
> +                    anchors.fill: parent
> +                    onClicked: urlsListView.model = entries
> +                }
> +            }
> +        }
> +
> +        ListView {
> +            id: urlsListView
> +            width: historyViewLandscape.width - lastVisitDateListView.width
> +            height: parent.height
> +
> +            model: historyViewLandscape.historyModel
> +
> +            delegate: Row {
> +                width: parent.width
> +                height: units.gu(5)
> +
> +                spacing: units.gu(1)
> +
> +                Item {
> +                    height: parent.height
> +                    width: timeLabel.width
> +                
> +                    Label {
> +                        id: timeLabel
> +                        anchors.centerIn: parent
> +                        text: Qt.formatDateTime(model.lastVisit, "hh:mm")
> +                        fontSize: "xx-small"
> +                    }
> +                }
> +
> +                Item {
> +                    width: parent.width - timeLabel.width - units.gu(1)
> +                    height: parent.height
> + 
> +                    UrlDelegate{
> +                        anchors.fill: parent
> +   
> +                        icon: model.icon
> +                        title: model.title ? model.title : model.url
> +                        url: model.url
> +
> +                        onClicked: historyViewLandscape.historyEntryClicked(model.url)
> +                        onRemoved: {
> +                            if (urlsListView.count == 1) {
> +                                historyViewLandscape.historyEntryRemoved(model.url)
> +                                urlsListView.model = historyViewLandscape.historyModel
> +                            } else {
> +                                historyViewLandscape.historyEntryRemoved(model.url)
> +                            }

At this point, if we are removing the last entry for a day, we want to remove the entry and point the model for Urls ListView to something else. It will generate me a qml error if I change the model before removing the entry as proposed.

> +                        }
> +                    }
> +                }
> +            }
> +        }
> +    }
> +
> +    Rectangle {
> +        id: lastVisitedHeader
> +
> +        width: parent.width
> +        height: units.gu(7)
> +
> +        Label {
> +            anchors {
> +                top: parent.top
> +                left: parent.left
> +                topMargin: units.gu(2)
> +                leftMargin: units.gu(2)
> +            }
> +
> +            text: i18n.tr("Last Visited")    
> +        }
> +
> +        ListItems.ThinDivider {
> +            anchors {
> +                left: parent.left
> +                right: parent.right
> +                bottom: parent.bottom
> +                bottomMargin: units.gu(1)
> +            }
> +        }
> +    }
> +
> +    Toolbar {
> +        id: bottomToolbar
> +        height: units.gu(7)
> +
> +        anchors {
> +            left: parent.left
> +            right: parent.right
> +            bottom: parent.bottom
> +        }
> +
> +        Button {
> +            objectName: "doneButton"
> +            anchors {
> +                left: parent.left
> +                leftMargin: units.gu(2)
> +                verticalCenter: parent.verticalCenter
> +            }
> +
> +            strokeColor: UbuntuColors.darkGrey
> +
> +            text: i18n.tr("Done")
> +
> +            onClicked: historyViewLandscape.done()
> +        }
> +
> +        ToolbarAction {
> +            anchors {
> +                right: parent.right
> +                rightMargin: units.gu(2)
> +                verticalCenter: parent.verticalCenter
> +            }
> +            height: parent.height - units.gu(2)
> +
> +            text: i18n.tr("New tab")
> +            iconName: "tab-new"
> +
> +            onClicked: {
> +                browser.openUrlInNewTab("", true)
> +                historyViewLandscape.done()
> +            }
> +        }
> +    }
> +}


-- 
https://code.launchpad.net/~artmello/webbrowser-app/webbrowser-app-history_view_convergence/+merge/263052
Your team Ubuntu Phablet Team is subscribed to branch lp:webbrowser-app.



More information about the Ubuntu-reviews mailing list