on xenial help sign in
Compilation fixes. Generate ShowAllFilterOption ids automatically.
6b46823Pawel Stolowski
plugins/Unity/genericoptionsmodel.cpp+3−3
@@ -29,7 +29,7 @@ GenericOptionsModel::GenericOptionsModel(bool showAllOption, QObject *parent)
29{
29{
30 if (showAllOption)
30 if (showAllOption)
31 {
31 {
32− auto showAll = ShowAllFilterOption("TODO", this);
32+ auto showAll = new ShowAllFilterOption(this);
33 connect(showAll, SIGNAL(activeChanged(bool)), this, SLOT(onOptionChanged()));
33 connect(showAll, SIGNAL(activeChanged(bool)), this, SLOT(onOptionChanged()));
34 connect(showAll, SIGNAL(activeChanged(bool)), this, SLOT(onShowAllClicked(bool)));
34 connect(showAll, SIGNAL(activeChanged(bool)), this, SLOT(onShowAllClicked(bool)));
35 addOption(showAll, 0);
35 addOption(showAll, 0);
@@ -60,7 +60,7 @@ QVariant GenericOptionsModel::data(const QModelIndex& index, int role) const
60 return QVariant();
60 return QVariant();
61 }
61 }
62
62
63− auto filterOption = (m_showAll != nullptr && index.row() == 0) ? m_showAll : m_options[index.row()];
63+ auto filterOption = m_options[index.row()];
64 switch (role)
64 switch (role)
65 {
65 {
66 case GenericOptionsModel::RoleId:
66 case GenericOptionsModel::RoleId:
@@ -81,7 +81,7 @@ QVariant GenericOptionsModel::data(const QModelIndex& index, int role) const
81
81
82int GenericOptionsModel::rowCount(const QModelIndex& /* parent */) const
82int GenericOptionsModel::rowCount(const QModelIndex& /* parent */) const
83{
83{
84− return m_options.size;
84+ return m_options.size();
85}
85}
86
86
87void GenericOptionsModel::setActive(int idx, bool value)
87void GenericOptionsModel::setActive(int idx, bool value)
plugins/Unity/showallfilteroption.cpp+6−4
@@ -22,11 +22,13 @@
22
22
23#include <libintl.h>
23#include <libintl.h>
24
24
25+unsigned int ShowAllFilterOption::m_showAllCount = 0;
26+
25−ShowAllFilterOption::ShowAllFilterOption(const QString &id, QObject *parent) :
27+ShowAllFilterOption::ShowAllFilterOption(QObject *parent) :
26 AbstractFilterOption(parent),
28 AbstractFilterOption(parent),
27− m_active(false),
29+ m_active(false)
28− m_id(id)
29{
30{
31+ m_id = QString("show_all::%1").arg(m_showAllCount++);
30}
32}
31
33
32QString ShowAllFilterOption::id() const
34QString ShowAllFilterOption::id() const
@@ -36,7 +38,7 @@ QString ShowAllFilterOption::id() const
36
38
37QString ShowAllFilterOption::name() const
39QString ShowAllFilterOption::name() const
38{
40{
39− QString::fromUtf8(dgettext("unity", "All"));
41+ return QString::fromUtf8(dgettext("unity", "All"));
40}
42}
41
43
42QString ShowAllFilterOption::iconHint() const
44QString ShowAllFilterOption::iconHint() const
plugins/Unity/showallfilteroption.h+3−1
@@ -28,7 +28,7 @@ class Q_DECL_EXPORT ShowAllFilterOption : public AbstractFilterOption
28 Q_OBJECT
28 Q_OBJECT
29
29
30public:
30public:
31− explicit ShowAllFilterOption(const QString &id, QObject *parent = nullptr);
31+ explicit ShowAllFilterOption(QObject *parent = nullptr);
32
32
33 /* getters */
33 /* getters */
34 QString id() const override;
34 QString id() const override;
@@ -42,6 +42,8 @@ public:
42private:
42private:
43 bool m_active;
43 bool m_active;
44 QString m_id;
44 QString m_id;
45+
46+ static unsigned int m_showAllCount;
45};
47};
46
48
47Q_DECLARE_METATYPE(ShowAllFilterOption*)
49Q_DECLARE_METATYPE(ShowAllFilterOption*)