on xenial help sign in
Fix session badges
c923993Josh Arenson
plugins/LightDM/SessionsModel.cpp+14−14
@@ -47,15 +47,15 @@ void SessionsModel::setIconSearchDirectories(const QList<QUrl> searchDirectories
47 Q_EMIT iconSearchDirectoriesChanged();
47 Q_EMIT iconSearchDirectoriesChanged();
48}
48}
49
49
50−QUrl SessionsModel::iconUrl(const QString sessionName) const
50+QUrl SessionsModel::iconUrl(const QString sessionKey) const
51{
51{
52 Q_FOREACH(const QUrl& searchDirectory, m_iconSearchDirectories)
52 Q_FOREACH(const QUrl& searchDirectory, m_iconSearchDirectories)
53 {
53 {
54 // This is an established icon naming convention
54 // This is an established icon naming convention
55 QString customIconUrl = searchDirectory.toString(QUrl::StripTrailingSlash) +
55 QString customIconUrl = searchDirectory.toString(QUrl::StripTrailingSlash) +
56− "/custom_" + sessionName + "_badge.png";
56+ "/custom_" + sessionKey + "_badge.png";
57 QString iconUrl = searchDirectory.toString(QUrl::StripTrailingSlash) +
57 QString iconUrl = searchDirectory.toString(QUrl::StripTrailingSlash) +
58− "/" + sessionName + "_badge.png";
58+ "/" + sessionKey + "_badge.png";
59
59
60 QFile customIconFile(customIconUrl);
60 QFile customIconFile(customIconUrl);
61 QFile iconFile(iconUrl);
61 QFile iconFile(iconUrl);
@@ -67,26 +67,26 @@ QUrl SessionsModel::iconUrl(const QString sessionName) const
67 // Search the legacy way
67 // Search the legacy way
68 QString path = searchDirectory.toString(QUrl::StripTrailingSlash) + "/";
68 QString path = searchDirectory.toString(QUrl::StripTrailingSlash) + "/";
69 bool iconFound = false;
69 bool iconFound = false;
70− if (sessionName == "ubuntu" || sessionName == "ubuntu-2d") {
70+ if (sessionKey == "ubuntu" || sessionKey == "ubuntu-2d") {
71 path += "ubuntu_badge.png";
71 path += "ubuntu_badge.png";
72 iconFound = true;
72 iconFound = true;
73 } else if(
73 } else if(
74− sessionName == "gnome-classic" ||
74+ sessionKey == "gnome-classic" ||
75− sessionName == "gnome-flashback-compiz" ||
75+ sessionKey == "gnome-flashback-compiz" ||
76− sessionName == "gnome-flashback-metacity" ||
76+ sessionKey == "gnome-flashback-metacity" ||
77− sessionName == "gnome-shell" ||
77+ sessionKey == "gnome-shell" ||
78− sessionName == "gnome-wayland" ||
78+ sessionKey == "gnome-wayland" ||
79− sessionName == "gnome"
79+ sessionKey == "gnome"
80 ){
80 ){
81 path += "gnome_badge.png";
81 path += "gnome_badge.png";
82 iconFound = true;
82 iconFound = true;
83− } else if (sessionName == "plasma") {
83+ } else if (sessionKey == "plasma") {
84 path += "kde_badge.png";
84 path += "kde_badge.png";
85 iconFound = true;
85 iconFound = true;
86− } else if (sessionName == "xterm") {
86+ } else if (sessionKey == "xterm") {
87 path += "recovery_console_badge.png";
87 path += "recovery_console_badge.png";
88 iconFound = true;
88 iconFound = true;
89− } else if (sessionName == "remote-login") {
89+ } else if (sessionKey == "remote-login") {
90 path += "remote_login_help.png";
90 path += "remote_login_help.png";
91 iconFound = true;
91 iconFound = true;
92 }
92 }
@@ -105,7 +105,7 @@ QVariant SessionsModel::data(const QModelIndex& index, int role) const
105{
105{
106 switch (role) {
106 switch (role) {
107 case SessionsModel::IconRole:
107 case SessionsModel::IconRole:
108− return iconUrl(m_model->data(index, Qt::DisplayRole).toString());
108+ return iconUrl(m_model->data(index, QLightDM::SessionsModel::KeyRole).toString());
109 default:
109 default:
110 return m_model->data(index, role);
110 return m_model->data(index, role);
111 }
111 }