Merge lp:~fboucault/unity-2d/dash_home_shortcuts_filter into lp:unity-2d

Proposed by Florian Boucault on 2011-08-31
Status: Merged
Approved by: Gerry Boland on 2011-08-31
Approved revision: 681
Merged at revision: 685
Proposed branch: lp:~fboucault/unity-2d/dash_home_shortcuts_filter
Merge into: lp:unity-2d
Diff against target: 152 lines (+52/-7)
7 files modified
libunity-2d-private/src/filters.cpp (+10/-0)
libunity-2d-private/src/filters.h (+2/-0)
libunity-2d-private/src/listmodelwrapper.h (+8/-0)
libunity-2d-private/src/radiooptionfilter.cpp (+10/-0)
libunity-2d-private/src/radiooptionfilter.h (+2/-0)
places/HomeShortcuts.qml (+3/-7)
places/dash.qml (+17/-0)
To merge this branch: bzr merge lp:~fboucault/unity-2d/dash_home_shortcuts_filter
Reviewer Review Type Date Requested Status
Gerry Boland 2011-08-31 Pending
Review via email: mp+73506@code.launchpad.net

Description of the change

[dash] Home buttons 'Media' and 'Internet' apps now also activate the right filter and open up the 'Filter results' pane.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'libunity-2d-private/src/filters.cpp'
--- libunity-2d-private/src/filters.cpp 2011-08-24 08:36:07 +0000
+++ libunity-2d-private/src/filters.cpp 2011-08-31 10:59:42 +0000
@@ -76,6 +76,16 @@
76 }76 }
77}77}
7878
79Filter* Filters::getFilter(const QString& id) const
80{
81 Q_FOREACH (Filter* filter, m_filters) {
82 if (filter->id() == id) {
83 return filter;
84 }
85 }
86 return NULL;
87}
88
79void Filters::onFilterAdded(unity::dash::Filter::Ptr unityFilter)89void Filters::onFilterAdded(unity::dash::Filter::Ptr unityFilter)
80{90{
81 if (unityFilter == NULL) {91 if (unityFilter == NULL) {
8292
=== modified file 'libunity-2d-private/src/filters.h'
--- libunity-2d-private/src/filters.h 2011-08-19 17:12:24 +0000
+++ libunity-2d-private/src/filters.h 2011-08-31 10:59:42 +0000
@@ -48,6 +48,8 @@
48 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;48 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
49 int rowCount(const QModelIndex& parent = QModelIndex()) const;49 int rowCount(const QModelIndex& parent = QModelIndex()) const;
5050
51 Q_INVOKABLE Filter* getFilter(const QString& id) const;
52
51private:53private:
52 unity::dash::Filters::Ptr m_unityFilters;54 unity::dash::Filters::Ptr m_unityFilters;
53 QList<Filter*> m_filters;55 QList<Filter*> m_filters;
5456
=== modified file 'libunity-2d-private/src/listmodelwrapper.h'
--- libunity-2d-private/src/listmodelwrapper.h 2011-08-25 12:41:57 +0000
+++ libunity-2d-private/src/listmodelwrapper.h 2011-08-31 10:59:42 +0000
@@ -46,6 +46,8 @@
46 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;46 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
47 int rowCount(const QModelIndex& parent = QModelIndex()) const;47 int rowCount(const QModelIndex& parent = QModelIndex()) const;
4848
49 const QList<WrapperItem*>& rawList() const;
50
49private:51private:
50 void onItemAdded(ItemClass item);52 void onItemAdded(ItemClass item);
51 void onItemRemoved(ItemClass item);53 void onItemRemoved(ItemClass item);
@@ -95,6 +97,12 @@
95}97}
9698
97template <class WrapperItem, class ItemClass>99template <class WrapperItem, class ItemClass>
100const QList<WrapperItem*>& ListModelWrapper<WrapperItem, ItemClass>::rawList() const
101{
102 return m_list;
103}
104
105template <class WrapperItem, class ItemClass>
98QVariant ListModelWrapper<WrapperItem, ItemClass>::data(const QModelIndex& index, int role) const106QVariant ListModelWrapper<WrapperItem, ItemClass>::data(const QModelIndex& index, int role) const
99{107{
100 if (!index.isValid()) {108 if (!index.isValid()) {
101109
=== modified file 'libunity-2d-private/src/radiooptionfilter.cpp'
--- libunity-2d-private/src/radiooptionfilter.cpp 2011-08-24 12:24:38 +0000
+++ libunity-2d-private/src/radiooptionfilter.cpp 2011-08-31 10:59:42 +0000
@@ -30,6 +30,16 @@
30 return m_options;30 return m_options;
31}31}
3232
33FilterOption* RadioOptionFilter::getOption(const QString& id) const
34{
35 Q_FOREACH (FilterOption* option, m_options->rawList()) {
36 if (option->id() == id) {
37 return option;
38 }
39 }
40 return NULL;
41}
42
33void RadioOptionFilter::setUnityFilter(unity::dash::Filter::Ptr filter)43void RadioOptionFilter::setUnityFilter(unity::dash::Filter::Ptr filter)
34{44{
35 Filter::setUnityFilter(filter);45 Filter::setUnityFilter(filter);
3646
=== modified file 'libunity-2d-private/src/radiooptionfilter.h'
--- libunity-2d-private/src/radiooptionfilter.h 2011-08-24 12:36:27 +0000
+++ libunity-2d-private/src/radiooptionfilter.h 2011-08-31 10:59:42 +0000
@@ -43,6 +43,8 @@
43 /* getters */43 /* getters */
44 FilterOptions* options() const;44 FilterOptions* options() const;
4545
46 Q_INVOKABLE FilterOption* getOption(const QString& id) const;
47
46Q_SIGNALS:48Q_SIGNALS:
47 void optionsChanged();49 void optionsChanged();
4850
4951
=== modified file 'places/HomeShortcuts.qml'
--- places/HomeShortcuts.qml 2011-08-11 16:12:07 +0000
+++ places/HomeShortcuts.qml 2011-08-31 10:59:42 +0000
@@ -55,23 +55,19 @@
55 focus: true55 focus: true
56 label: u2d.tr("Media Apps")56 label: u2d.tr("Media Apps")
57 icon: "artwork/find_media_apps.png"57 icon: "artwork/find_media_apps.png"
58 /* FIXME: this should not only activate the applications lens but also58 onClicked: activateLensWithOptionFilter("applications.lens", "type", "media")
59 activate the types filter. */
60 onClicked: activateLens("applications.lens")
61 }59 }
6260
63 HomeButton {61 HomeButton {
64 label: u2d.tr("Internet Apps")62 label: u2d.tr("Internet Apps")
65 icon: "artwork/find_internet_apps.png"63 icon: "artwork/find_internet_apps.png"
66 /* FIXME: this should not only activate the applications lens but also64 onClicked: activateLensWithOptionFilter("applications.lens", "type", "internet")
67 activate the types filter. */
68 onClicked: activateLens("applications.lens")
69 }65 }
7066
71 HomeButton {67 HomeButton {
72 label: u2d.tr("More Apps")68 label: u2d.tr("More Apps")
73 icon: "artwork/find_more_apps.png"69 icon: "artwork/find_more_apps.png"
74 onClicked: activateLens("applications.lens")70 onClicked: activateLensAndClearFilter("applications.lens", "type")
75 }71 }
7672
77 HomeButton {73 HomeButton {
7874
=== modified file 'places/dash.qml'
--- places/dash.qml 2011-08-23 22:16:05 +0000
+++ places/dash.qml 2011-08-31 10:59:42 +0000
@@ -104,6 +104,23 @@
104 dashView.activeLens = ""104 dashView.activeLens = ""
105 }105 }
106106
107 function activateLensWithOptionFilter(lensId, filterId, optionId) {
108 var lens = lenses.get(lensId)
109 var filter = lens.filters.getFilter(filterId)
110 var option = filter.getOption(optionId)
111 filter.clear()
112 option.active = true
113 filterPane.folded = false
114 activateLens(lensId)
115 }
116
117 function activateLensAndClearFilter(lensId, filterId) {
118 var lens = lenses.get(lensId)
119 var filter = lens.filters.getFilter(filterId)
120 filter.clear()
121 activateLens(lensId)
122 }
123
107 property variant lenses: Lenses {}124 property variant lenses: Lenses {}
108125
109 Item {126 Item {

Subscribers

People subscribed via source and target branches