Make IconLoader compile again
[quassel.git] / src / uisupport / iconloader.cpp
index 688d0b1..354e0ee 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2005-08 by the Quassel IRC Team                         *
+ *   Copyright (C) 2005-09 by the Quassel Project                          *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  ***************************************************************************/
 
+#ifndef HAVE_KDE
+
+#include <QCoreApplication>
 #include <QDebug>
 #include <QDir>
 #include <QFile>
 
 #include "iconloader.h"
+#include "quassel.h"
+#include "util.h"
 
 IconLoader IconLoader::_iconLoader;
 int IconLoader::_groupSize[] = { 48, 22, 22, 16, 32, 22 };  // default sizes taken from Oxygen
@@ -50,7 +55,7 @@ void IconLoader::setTheme(const QString &theme) {
   _themedIconDirNames.clear();
   _plainIconDirNames.clear();
   QString path;
-  QStringList dataDirNames = QString(qgetenv("XDG_DATA_DIRS")).split(':');
+  QStringList dataDirNames = Quassel::dataDirPaths();
 
   // System theme in $data/icons/$theme
   foreach(QString dir, dataDirNames) {
@@ -59,14 +64,14 @@ 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);
 
   // Own icons in $data/apps/quassel/icons/hicolor
   // Also, plain icon dirs $data/apps/quassel/pics
   foreach(QString dir, dataDirNames) {
-    path = QString("%1/apps/quassel/icons/hicolor").arg(dir);
+    path = QString("%1/icons/hicolor").arg(dir);
     if(QFile::exists(path))
       _themedIconDirNames.append(path);
     path = QString("%1/apps/quassel/pics").arg(dir);
@@ -120,6 +125,7 @@ QString IconLoader::findIconPath(const QString &name, int size) {
     if(QFile::exists(path)) return path;
   }
 
+  qWarning() << "Icon not found:" << name << size;
   return QString();
 }
 
@@ -144,3 +150,5 @@ QPixmap SmallIcon(const QString& name, int force_size) {
   IconLoader *loader = IconLoader::global();
   return loader->loadIcon(name, IconLoader::Small, force_size);
 }
+
+#endif