Add hasSeparator to a quickList entry.
commit171678e8fc50d0e21d217b53c64c6af10da44071
authorAndrea Azzarone <azzaronea@gmail.com>
dateThu 27 Oct 2016, 15:00 (10 years ago)
parent8bc0feb
plugins/Unity/Launcher/launcheritem.cpp+1
@@ -42,6 +42,7 @@ LauncherItem::LauncherItem(const QString &appId, const QString &name, const QStr
4242 QuickListEntry nameAction;
4343 nameAction.setActionId(QStringLiteral("launch_item"));
4444 nameAction.setText(m_name);
45+ nameAction.setHasSeparator(true);
4546 m_quickList->appendAction(nameAction);
4647
4748 QuickListEntry pinningAction;
plugins/Unity/Launcher/quicklistentry.cpp+11
@@ -19,6 +19,7 @@
1919#include "quicklistentry.h"
2020
2121QuickListEntry::QuickListEntry()
22+ : m_hasSeparator(false)
2223{
2324}
2425
@@ -57,6 +58,16 @@ bool QuickListEntry::clickable() const
5758 return !m_actionId.isEmpty();
5859}
5960
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+
6071bool QuickListEntry::operator==(const QuickListEntry &other)
6172{
6273 return !other.actionId().isEmpty() && other.actionId() == m_actionId;
plugins/Unity/Launcher/quicklistentry.h+4
@@ -37,12 +37,16 @@ public:
3737
3838 bool clickable() const;
3939
40+ void setHasSeparator(bool hasSeparator);
41+ bool hasSeparator() const;
42+
4043 bool operator==(const QuickListEntry & other);
4144
4245private:
4346 QString m_actionId;
4447 QString m_text;
4548 QString m_icon;
49+ bool m_hasSeparator;
4650};
4751
4852#endif // QUICKLISTENTRY
plugins/Unity/Launcher/quicklistmodel.cpp+2
@@ -79,6 +79,8 @@ QVariant QuickListModel::data(const QModelIndex &index, int role) const
7979 return m_list.at(index.row()).icon();
8080 case RoleClickable:
8181 return m_list.at(index.row()).clickable();
82+ case RoleHasSeparator:
83+ return m_list.at(index.row()).hasSeparator();
8284 }
8385 return QVariant();
8486}
qml/Launcher/LauncherPanel.qml+1
@@ -792,6 +792,7 @@ Rectangle {
792792 highlightColor: !model.clickable ? quickList.color : undefined // make disabled items visually unclickable
793793 divider.colorFrom: UbuntuColors.inkstone
794794 divider.colorTo: UbuntuColors.inkstone
795+ divider.visible: model.hasSeparator
795796
796797 Label {
797798 id: label
tests/mocks/Unity/Launcher/MockQuickListModel.cpp+2
@@ -37,6 +37,8 @@ QVariant MockQuickListModel::data(const QModelIndex &index, int role) const
3737 return QLatin1String("copy.png");
3838 case RoleClickable:
3939 return index.row() == 1 ? false : true;
40+ case RoleHasSeparator:
41+ return index.row() <= 1 ? true : false;
4042 }
4143 return QVariant();
4244}