[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdegames/kpat
From:       Stephan Kulow <coolo () kde ! org>
Date:       2004-11-09 10:36:25
Message-ID: 20041109103625.6582616D59 () office ! kde ! org
[Download RAW message or body]

CVS commit by coolo: 

do also list .png wallpapers


  M +18 -5     pwidget.cpp   1.120


--- kdegames/kpat/pwidget.cpp  #1.119:1.120
@@ -105,9 +105,22 @@ pWidget::pWidget()
                               actionCollection(), "wallpaper");
     list.clear();
-    wallpaperlist = KGlobal::dirs()->findAllResources("wallpaper", "*.jpg", false, true, list);
-    for (QStringList::Iterator it = list.begin(); it != list.end(); ++it)
-        *it = (*it).left((*it).length() - 4);
-    wallpapers->setItems(list);
-    wallpapers->setCurrentItem(list.findIndex("No-Ones-Laughing-3"));
+    wallpaperlist.clear();
+    QStringList wallpaperlist2 = KGlobal::dirs()->findAllResources("wallpaper", QString::null,
+                                                                   false, true, list);
+    QStringList list2;
+    for (QStringList::ConstIterator it = list.begin(); it != list.end(); ++it) {
+        QString file = *it;
+        int rindex = file.findRev('.');
+        if (rindex != -1) {
+          QString ext = file.mid(rindex + 1).lower();
+          if (ext == "jpeg" || ext == "png" || ext == "jpg") {
+             list2.append(file.left(rindex));
+             wallpaperlist.append( file );
+          }
+        }
+    }
+
+    wallpapers->setItems(list2);
+    wallpapers->setCurrentItem(list2.findIndex("No-Ones-Laughing-3"));
 
     changeWallpaper();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic