Merge lp:~osomon/webbrowser-app/domain-with-only-one-entry into lp:webbrowser-app

Proposed by Olivier Tilloy
Status: Merged
Approved by: Günter Schwann
Approved revision: 343
Merged at revision: 343
Proposed branch: lp:~osomon/webbrowser-app/domain-with-only-one-entry
Merge into: lp:webbrowser-app
Diff against target: 94 lines (+34/-1)
4 files modified
src/Ubuntu/Components/Extras/Browser/history-domain-model.cpp (+10/-0)
src/Ubuntu/Components/Extras/Browser/history-domain-model.h (+7/-0)
src/app/TimelineView.qml (+5/-1)
tests/unittests/history-domain-model/tst_HistoryDomainModelTests.cpp (+12/-0)
To merge this branch: bzr merge lp:~osomon/webbrowser-app/domain-with-only-one-entry
Reviewer Review Type Date Requested Status
Günter Schwann (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+187455@code.launchpad.net

Commit message

Go directly to the entry instead of expanding the timeline view when there is only one entry for a given domain.
This change has been requested by design.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Günter Schwann (schwann) wrote :

works fine

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/Ubuntu/Components/Extras/Browser/history-domain-model.cpp'
--- src/Ubuntu/Components/Extras/Browser/history-domain-model.cpp 2013-08-06 15:45:18 +0000
+++ src/Ubuntu/Components/Extras/Browser/history-domain-model.cpp 2013-09-25 07:54:26 +0000
@@ -79,6 +79,16 @@
79 return m_lastVisit;79 return m_lastVisit;
80}80}
8181
82const int HistoryDomainModel::count() const
83{
84 return rowCount();
85}
86
87const QUrl HistoryDomainModel::firstUrl() const
88{
89 return data(index(0, 0), HistoryModel::Url).toUrl();
90}
91
82bool HistoryDomainModel::filterAcceptsRow(int source_row, const QModelIndex& source_parent) const92bool HistoryDomainModel::filterAcceptsRow(int source_row, const QModelIndex& source_parent) const
83{93{
84 if (m_domain.isEmpty()) {94 if (m_domain.isEmpty()) {
8595
=== modified file 'src/Ubuntu/Components/Extras/Browser/history-domain-model.h'
--- src/Ubuntu/Components/Extras/Browser/history-domain-model.h 2013-08-06 15:45:18 +0000
+++ src/Ubuntu/Components/Extras/Browser/history-domain-model.h 2013-09-25 07:54:26 +0000
@@ -23,6 +23,7 @@
23#include <QtCore/QDateTime>23#include <QtCore/QDateTime>
24#include <QtCore/QSortFilterProxyModel>24#include <QtCore/QSortFilterProxyModel>
25#include <QtCore/QString>25#include <QtCore/QString>
26#include <QtCore/QUrl>
2627
27class HistoryTimeframeModel;28class HistoryTimeframeModel;
2829
@@ -33,6 +34,8 @@
33 Q_PROPERTY(HistoryTimeframeModel* sourceModel READ sourceModel WRITE setSourceModel NOTIFY sourceModelChanged)34 Q_PROPERTY(HistoryTimeframeModel* sourceModel READ sourceModel WRITE setSourceModel NOTIFY sourceModelChanged)
34 Q_PROPERTY(QString domain READ domain WRITE setDomain NOTIFY domainChanged)35 Q_PROPERTY(QString domain READ domain WRITE setDomain NOTIFY domainChanged)
35 Q_PROPERTY(QDateTime lastVisit READ lastVisit NOTIFY lastVisitChanged)36 Q_PROPERTY(QDateTime lastVisit READ lastVisit NOTIFY lastVisitChanged)
37 Q_PROPERTY(int count READ count)
38 Q_PROPERTY(QUrl firstUrl READ firstUrl)
3639
37public:40public:
38 HistoryDomainModel(QObject* parent=0);41 HistoryDomainModel(QObject* parent=0);
@@ -45,6 +48,10 @@
4548
46 const QDateTime& lastVisit() const;49 const QDateTime& lastVisit() const;
4750
51 const int count() const;
52
53 const QUrl firstUrl() const;
54
48Q_SIGNALS:55Q_SIGNALS:
49 void sourceModelChanged() const;56 void sourceModelChanged() const;
50 void domainChanged() const;57 void domainChanged() const;
5158
=== modified file 'src/app/TimelineView.qml'
--- src/app/TimelineView.qml 2013-09-24 10:03:11 +0000
+++ src/app/TimelineView.qml 2013-09-25 07:54:26 +0000
@@ -288,9 +288,13 @@
288 timeline.currentIndex = -1288 timeline.currentIndex = -1
289 } else {289 } else {
290 domainsView.currentIndex = index290 domainsView.currentIndex = index
291 timeline.currentIndex = timelineIndex
292 entriesView.domain = model.domain291 entriesView.domain = model.domain
293 entriesView.model = model.entries292 entriesView.model = model.entries
293 if (model.entries.count === 1) {
294 historyEntryClicked(model.entries.firstUrl)
295 } else {
296 timeline.currentIndex = timelineIndex
297 }
294 }298 }
295 }299 }
296 }300 }
297301
=== modified file 'tests/unittests/history-domain-model/tst_HistoryDomainModelTests.cpp'
--- tests/unittests/history-domain-model/tst_HistoryDomainModelTests.cpp 2013-07-12 13:49:42 +0000
+++ tests/unittests/history-domain-model/tst_HistoryDomainModelTests.cpp 2013-09-25 07:54:26 +0000
@@ -105,6 +105,18 @@
105 model->setDomain("");105 model->setDomain("");
106 QCOMPARE(model->rowCount(), 2);106 QCOMPARE(model->rowCount(), 2);
107 }107 }
108
109 void shouldExposeCountAndFirstUrl()
110 {
111 QCOMPARE(model->count(), 0);
112 QVERIFY(model->firstUrl().isEmpty());
113 history->add(QUrl("http://example.org"), "Example Domain", QUrl());
114 QCOMPARE(model->count(), 1);
115 QCOMPARE(model->firstUrl(), QUrl("http://example.org"));
116 history->add(QUrl("http://example.com"), "Example Domain", QUrl());
117 QCOMPARE(model->count(), 2);
118 QCOMPARE(model->firstUrl(), QUrl("http://example.com"));
119 }
108};120};
109121
110QTEST_MAIN(HistoryDomainModelTests)122QTEST_MAIN(HistoryDomainModelTests)

Subscribers

People subscribed via source and target branches

to status/vote changes: