on xenial help sign in
more fixes
55c9ca5Michael Zanetti
plugins/Utils/appdrawerproxymodel.cpp+4−3
@@ -7,6 +7,7 @@ AppDrawerProxyModel::AppDrawerProxyModel(QObject *parent):
7{
7{
8 setSortRole(AppDrawerModelInterface::RoleName);
8 setSortRole(AppDrawerModelInterface::RoleName);
9 setSortLocaleAware(true);
9 setSortLocaleAware(true);
10+ sort(0);
10
11
11 connect(this, &QAbstractListModel::rowsInserted, this, &AppDrawerProxyModel::countChanged);
12 connect(this, &QAbstractListModel::rowsInserted, this, &AppDrawerProxyModel::countChanged);
12 connect(this, &QAbstractListModel::rowsRemoved, this, &AppDrawerProxyModel::countChanged);
13 connect(this, &QAbstractListModel::rowsRemoved, this, &AppDrawerProxyModel::countChanged);
@@ -97,7 +98,7 @@ QVariant AppDrawerProxyModel::data(const QModelIndex &index, int role) const
97 QModelIndex idx = mapToSource(index);
98 QModelIndex idx = mapToSource(index);
98 if (role == Qt::UserRole) {
99 if (role == Qt::UserRole) {
99 QString name = m_source->data(idx, AppDrawerModelInterface::RoleName).toString();
100 QString name = m_source->data(idx, AppDrawerModelInterface::RoleName).toString();
100− return name.length() > 0 ? QString(name.at(0)) : QChar();
101+ return name.length() > 0 ? QString(name.at(0)).toUpper() : QChar();
101 }
102 }
102 return m_source->data(idx, role);
103 return m_source->data(idx, role);
103}
104}
@@ -121,7 +122,7 @@ bool AppDrawerProxyModel::filterAcceptsRow(int source_row, const QModelIndex &so
121 QChar currentLetter = currentName.length() > 0 ? currentName.at(0) : QChar();
122 QChar currentLetter = currentName.length() > 0 ? currentName.at(0) : QChar();
122 QString previousName = m_source->data(m_source->index(source_row - 1,0 ), AppDrawerModelInterface::RoleName).toString();
123 QString previousName = m_source->data(m_source->index(source_row - 1,0 ), AppDrawerModelInterface::RoleName).toString();
123 QChar previousLetter = previousName.length() > 0 ? previousName.at(0) : QChar();
124 QChar previousLetter = previousName.length() > 0 ? previousName.at(0) : QChar();
124− if (currentLetter == previousLetter) {
125+ if (currentLetter.toLower() == previousLetter.toLower()) {
125 return false;
126 return false;
126 }
127 }
127 } else if(m_group == GroupByAll && source_row > 0) {
128 } else if(m_group == GroupByAll && source_row > 0) {
@@ -130,7 +131,7 @@ bool AppDrawerProxyModel::filterAcceptsRow(int source_row, const QModelIndex &so
130 if (!m_filterLetter.isEmpty()) {
131 if (!m_filterLetter.isEmpty()) {
131 QString currentName = m_source->data(m_source->index(source_row, 0), AppDrawerModelInterface::RoleName).toString();
132 QString currentName = m_source->data(m_source->index(source_row, 0), AppDrawerModelInterface::RoleName).toString();
132 QString currentLetter = currentName.length() > 0 ? QString(currentName.at(0)) : QString();
133 QString currentLetter = currentName.length() > 0 ? QString(currentName.at(0)) : QString();
133− if (currentLetter != m_filterLetter) {
134+ if (currentLetter.toLower() != m_filterLetter.toLower()) {
134 return false;
135 return false;
135 }
136 }
136 }
137 }
qml/Launcher/Drawer.qml+33−3
@@ -27,6 +27,7 @@ FocusScope {
27 id: sortProxyModel
27 id: sortProxyModel
28 source: appDrawerModel
28 source: appDrawerModel
29 filterString: searchField.text
29 filterString: searchField.text
30+ sortBy: AppDrawerProxyModel.SortByAToZ
30 }
31 }
31
32
32 Item {
33 Item {
@@ -57,6 +58,9 @@ FocusScope {
57 },
58 },
58 Action {
59 Action {
59 text: i18n.ctr("Most used apps", "Most used")
60 text: i18n.ctr("Most used apps", "Most used")
61+ },
62+ Action {
63+ text: "DBG"
60 }
64 }
61 ]
65 ]
62
66
@@ -72,7 +76,13 @@ FocusScope {
72 Loader {
76 Loader {
73 id: listLoader
77 id: listLoader
74 anchors { left: parent.left; top: sectionsContainer.bottom; right: parent.right; bottom: parent.bottom; leftMargin: units.gu(1); rightMargin: units.gu(1) }
78 anchors { left: parent.left; top: sectionsContainer.bottom; right: parent.right; bottom: parent.bottom; leftMargin: units.gu(1); rightMargin: units.gu(1) }
79+ sourceComponent: {
75− sourceComponent: sections.selectedIndex == 0 ? aToZComponent : mostUsedComponent
80+ switch (sections.selectedIndex) {
81+ case 0: return aToZComponent;
82+ case 1: return mostUsedComponent;
83+ default: return debugComponent;
84+ }
85+ }
76 }
86 }
77
87
78 MouseArea {
88 MouseArea {
@@ -108,6 +118,27 @@ FocusScope {
108 }
118 }
109 }
119 }
110
120
121+ Component {
122+ id: debugComponent
123+ ListView {
124+ anchors.fill: parent
125+ topMargin: units.gu(1)
126+ bottomMargin: units.gu(1)
127+ spacing: units.gu(1)
128+ clip: true
129+
130+ model: sortProxyModel
131+// model: AppDrawerProxyModel {
132+// source: sortProxyModel
133+// group: AppDrawerProxyModel.GroupByAToZ
134+// sortBy: AppDrawerProxyModel.SortByAToZ
135+// }
136+ delegate: Label {
137+ text: model.letter + " - " + model.name
138+ }
139+ }
140+ }
141+
111 Component {
142 Component {
112 id: mostUsedComponent
143 id: mostUsedComponent
113 ListView {
144 ListView {
@@ -135,7 +166,6 @@ FocusScope {
135 // NOTE: Cannot use gridView.rows here as it would evaluate to 0 at first and only update later,
166 // NOTE: Cannot use gridView.rows here as it would evaluate to 0 at first and only update later,
136 // which messes up the ListView.
167 // which messes up the ListView.
137 height: (Math.ceil(mostUsedGridView.model.count / mostUsedGridView.columns) * mostUsedGridView.delegateHeight) + units.gu(2)
168 height: (Math.ceil(mostUsedGridView.model.count / mostUsedGridView.columns) * mostUsedGridView.delegateHeight) + units.gu(2)
138− enabled: parent.interactive
139
169
140 DrawerGridView {
170 DrawerGridView {
141 id: mostUsedGridView
171 id: mostUsedGridView
@@ -170,6 +200,7 @@ FocusScope {
170
200
171 model: AppDrawerProxyModel {
201 model: AppDrawerProxyModel {
172 source: sortProxyModel
202 source: sortProxyModel
203+ sortBy: AppDrawerProxyModel.SortByAToZ
173 group: AppDrawerProxyModel.GroupByAToZ
204 group: AppDrawerProxyModel.GroupByAToZ
174 }
205 }
175
206
@@ -177,7 +208,6 @@ FocusScope {
177 width: parent.width
208 width: parent.width
178 color: "#20ffffff"
209 color: "#20ffffff"
179 aspect: UbuntuShape.Flat
210 aspect: UbuntuShape.Flat
180− enabled: parent.interactive
181
211
182 // NOTE: Cannot use gridView.rows here as it would evaluate to 0 at first and only update later,
212 // NOTE: Cannot use gridView.rows here as it would evaluate to 0 at first and only update later,
183 // which messes up the ListView.
213 // which messes up the ListView.