X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fuisupport%2Ficonloader.cpp;h=12cc59e61787ab13b9b7dea270153c2c9436f04b;hb=99934fe47293f61e1e62ecc0f0d49f958a992c32;hp=688d0b112fbafdca9ea5af2301301adfd16e9396;hpb=e8e1f038e6bf4a7bc938e316774374d3116ff39a;p=quassel.git diff --git a/src/uisupport/iconloader.cpp b/src/uisupport/iconloader.cpp index 688d0b11..12cc59e6 100644 --- a/src/uisupport/iconloader.cpp +++ b/src/uisupport/iconloader.cpp @@ -18,6 +18,7 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ +#include #include #include #include @@ -50,7 +51,19 @@ void IconLoader::setTheme(const QString &theme) { _themedIconDirNames.clear(); _plainIconDirNames.clear(); QString path; - QStringList dataDirNames = QString(qgetenv("XDG_DATA_DIRS")).split(':'); + QStringList dataDirNames = QString(qgetenv("XDG_DATA_DIRS")).split(':', QString::SkipEmptyParts); + +// Provide a fallback +# ifdef Q_OS_UNIX + if(dataDirNames.isEmpty()) dataDirNames.append("/usr/share"); + // on UNIX, we always check our install prefix + QString appDir = QCoreApplication::applicationDirPath(); + int binpos = appDir.lastIndexOf("/bin"); + if(binpos >= 0) { + appDir.replace(binpos, 4, "/share"); + if(!dataDirNames.contains(appDir)) dataDirNames.append(appDir); + } +# endif // System theme in $data/icons/$theme foreach(QString dir, dataDirNames) { @@ -59,7 +72,7 @@ void IconLoader::setTheme(const QString &theme) { _themedIconDirNames.append(path); } // Resource for system theme :/icons/$theme - path = QString(":/icons/%2"); + path = QString(":/icons/%1").arg(theme); if(QFile::exists(path)) _themedIconDirNames.append(path);