on xenial help sign in
Add hasSeparator to a quickList entry.
171678eAndrea Azzarone
plugins/Unity/Launcher/launcheritem.cpp+1
@@ -42,6 +42,7 @@ LauncherItem::LauncherItem(const QString &appId, const QString &name, const QStr
42 QuickListEntry nameAction;
42 QuickListEntry nameAction;
43 nameAction.setActionId(QStringLiteral("launch_item"));
43 nameAction.setActionId(QStringLiteral("launch_item"));
44 nameAction.setText(m_name);
44 nameAction.setText(m_name);
45+ nameAction.setHasSeparator(true);
45 m_quickList->appendAction(nameAction);
46 m_quickList->appendAction(nameAction);
46
47
47 QuickListEntry pinningAction;
48 QuickListEntry pinningAction;
plugins/Unity/Launcher/quicklistentry.cpp+11
@@ -19,6 +19,7 @@
19#include "quicklistentry.h"
19#include "quicklistentry.h"
20
20
21QuickListEntry::QuickListEntry()
21QuickListEntry::QuickListEntry()
22+ : m_hasSeparator(false)
22{
23{
23}
24}
24
25
@@ -57,6 +58,16 @@ bool QuickListEntry::clickable() const
57 return !m_actionId.isEmpty();
58 return !m_actionId.isEmpty();
58}
59}
59
60
61+void QuickListEntry::setHasSeparator(bool hasSeparator)
62+{
63+ m_hasSeparator = hasSeparator;
64+}
65+
66+bool QuickListEntry::hasSeparator() const
67+{
68+ return m_hasSeparator;
69+}
70+
60bool QuickListEntry::operator==(const QuickListEntry &other)
71bool QuickListEntry::operator==(const QuickListEntry &other)
61{
72{
62 return !other.actionId().isEmpty() && other.actionId() == m_actionId;
73 return !other.actionId().isEmpty() && other.actionId() == m_actionId;
plugins/Unity/Launcher/quicklistentry.h+4
@@ -37,12 +37,16 @@ public:
37
37
38 bool clickable() const;
38 bool clickable() const;
39
39
40+ void setHasSeparator(bool hasSeparator);
41+ bool hasSeparator() const;
42+
40 bool operator==(const QuickListEntry & other);
43 bool operator==(const QuickListEntry & other);
41
44
42private:
45private:
43 QString m_actionId;
46 QString m_actionId;
44 QString m_text;
47 QString m_text;
45 QString m_icon;
48 QString m_icon;
49+ bool m_hasSeparator;
46};
50};
47
51
48#endif // QUICKLISTENTRY
52#endif // QUICKLISTENTRY
plugins/Unity/Launcher/quicklistmodel.cpp+2
@@ -79,6 +79,8 @@ QVariant QuickListModel::data(const QModelIndex &index, int role) const
79 return m_list.at(index.row()).icon();
79 return m_list.at(index.row()).icon();
80 case RoleClickable:
80 case RoleClickable:
81 return m_list.at(index.row()).clickable();
81 return m_list.at(index.row()).clickable();
82+ case RoleHasSeparator:
83+ return m_list.at(index.row()).hasSeparator();
82 }
84 }
83 return QVariant();
85 return QVariant();
84}
86}
qml/Launcher/LauncherPanel.qml+1
@@ -792,6 +792,7 @@ Rectangle {
792 highlightColor: !model.clickable ? quickList.color : undefined // make disabled items visually unclickable
792 highlightColor: !model.clickable ? quickList.color : undefined // make disabled items visually unclickable
793 divider.colorFrom: UbuntuColors.inkstone
793 divider.colorFrom: UbuntuColors.inkstone
794 divider.colorTo: UbuntuColors.inkstone
794 divider.colorTo: UbuntuColors.inkstone
795+ divider.visible: model.hasSeparator
795
796
796 Label {
797 Label {
797 id: label
798 id: label
tests/mocks/Unity/Launcher/MockQuickListModel.cpp+2
@@ -37,6 +37,8 @@ QVariant MockQuickListModel::data(const QModelIndex &index, int role) const
37 return QLatin1String("copy.png");
37 return QLatin1String("copy.png");
38 case RoleClickable:
38 case RoleClickable:
39 return index.row() == 1 ? false : true;
39 return index.row() == 1 ? false : true;
40+ case RoleHasSeparator:
41+ return index.row() <= 1 ? true : false;
40 }
42 }
41 return QVariant();
43 return QVariant();
42}
44}