Bug 25541 - multiple wallpapers attempts to load non-graphic files
Summary: multiple wallpapers attempts to load non-graphic files
Status: CLOSED FIXED
Alias: None
Product: kdesktop
Classification: Miscellaneous
Component: general (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-05-10 15:48 UTC by slambo
Modified: 2009-01-02 20:17 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description slambo 2001-05-10 15:38:49 UTC
(*** This bug was imported into bugs.kde.org ***)

Package:           kdesktop
Version:           KDE 2.1.1 
Severity:          normal
Installed from:    SuSE RPMs
Compiler:          gcc 2.95.2
OS:                Linux
OS/Compiler notes: SuSE 7.0 with relevant updates

When the multiple wallpaper attempts to randomly select a wallpaper it will sometimes display just the background colors that I have selected and not an image.  It seems like the selection function is selecting a non-graphic file to display and then failing.

I've got the multiple wallpaper options setup to randomly select an image from several directory names from the ~/Graphics/Trains hierarchy.  Within the folders in this hierarchy I've got all of the images that I want to display and notes about each of the images in associated .txt .html and .doc files.  All of my graphics in this tree are stored as either .GIF or .JPG format with appropriate filename extensions.

(Submitted via bugs.kde.org)
Comment 1 Waldo Bastian 2003-04-30 00:21:39 UTC
Subject: kdebase/kcontrol/background

CVS commit by waba: 

CCMAIL: 25541-done@bugs.kde.org
Skip files that aren't images in slide show mode.


  M +4 -1      bgrender.cpp   1.3
  M +20 -2     bgsettings.cpp   1.5
  M +5 -1      bgsettings.h   1.22


--- kdebase/kcontrol/background/bgsettings.cpp  #1.4:1.5
@@ -859,5 +859,10 @@ void KBackgroundSettings::updateWallpape
             QStringList::Iterator it;
             for (it=lst.begin(); it!=lst.end(); it++)
-                m_WallpaperFiles.append(dir.absFilePath(*it));
+            {
+                file = dir.absFilePath(*it);
+                QFileInfo fi(file);
+                if (fi.isFile() && fi.isReadable())
+                    m_WallpaperFiles.append(file);
+            }
         }
     }
@@ -901,4 +906,17 @@ QString KBackgroundSettings::currentWall
         return m_WallpaperFiles[m_CurrentWallpaper];
     return QString();
+}
+
+bool KBackgroundSettings::discardCurrentWallpaper()
+{
+    if (m_MultiMode == NoMulti || m_MultiMode == NoMultiRandom)
+    {
+       return false;
+    }
+    m_WallpaperFiles.remove(m_WallpaperFiles.at(m_CurrentWallpaper));
+    if (m_CurrentWallpaper >= (int) m_WallpaperFiles.count())
+        m_CurrentWallpaper = 0;
+
+    return true;
 }
 

--- kdebase/kcontrol/background/bgsettings.h  #1.21:1.22
@@ -228,4 +228,8 @@ public:
 
     QString currentWallpaper();
+    /*
+     * @return true if the currentWallpaper has changed
+     */
+    bool discardCurrentWallpaper();
     int lastWallpaperChange() const { return m_LastChange; }
     bool needWallpaperChange();

--- kdebase/kcontrol/background/bgrender.cpp  #1.2:1.3
@@ -277,4 +277,5 @@ int KBackgroundRenderer::doWallpaper(boo
     QImage wp;
     if (wpmode != NoWallpaper) {
+wp_load:
         if (currentWallpaper().isEmpty()) {
             wpmode = NoWallpaper;
@@ -289,4 +290,6 @@ int KBackgroundRenderer::doWallpaper(boo
         wp.load(file);
         if (wp.isNull()) {
+            if (discardCurrentWallpaper())
+               goto wp_load;
             wpmode = NoWallpaper;
             goto wp_out;


Comment 2 FiNeX 2009-01-02 20:17:40 UTC
Bug closed. Kdesktop is no more mantained.