on xenial help sign in
Search for icons the legacy way
40f1b55Josh Arenson
plugins/LightDM/SessionsModel.cpp+32−1
@@ -52,11 +52,42 @@ QUrl SessionsModel::iconUrl(const QString sessionName) const
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) +
56+ "/custom_" + sessionName.toLower() + "_badge.png";
55 QString iconUrl = searchDirectory.toString(QUrl::StripTrailingSlash) +
57 QString iconUrl = searchDirectory.toString(QUrl::StripTrailingSlash) +
56 "/" + sessionName.toLower() + "_badge.png";
58 "/" + sessionName.toLower() + "_badge.png";
59+
60+ QFile customIconFile(customIconUrl);
57 QFile iconFile(iconUrl);
61 QFile iconFile(iconUrl);
62+ if (customIconFile.exists()) {
63+ return QUrl(customIconUrl);
58− if (iconFile.exists()) {
64+ } else if (iconFile.exists()) {
59 return QUrl(iconUrl);
65 return QUrl(iconUrl);
66+ } else{
67+ // Search the legacy way
68+ QString path = searchDirectory.toString(QUrl::StripTrailingSlash) + "/";
69+ if (sessionName == "ubuntu" || sessionName == "ubuntu-2d") {
70+ path += "ubuntu_badge.png";
71+ } else if(
72+ sessionName == "gnome-classic" ||
73+ sessionName == "gnome-flashback-compiz" ||
74+ sessionName == "gnome-flashback-metacity" ||
75+ sessionName == "gnome-shell" ||
76+ sessionName == "gnome-wayland" ||
77+ sessionName == "gnome"
78+ ){
79+ path += "gnome_badge.png";
80+ } else if (sessionName == "plasma") {
81+ path += "kde_badge.png";
82+ } else if (sessionName == "xterm") {
83+ path += "recovery_console_badge.png";
84+ } else if (sessionName == "remote-login") {
85+ path += "remote_login_help.png";
86+ }
87+
88+ if (QFile(path).exists()) {
89+ return path;
90+ }
60 }
91 }
61 }
92 }
62
93