[Digikam-devel] extragear/libs/kipi-plugins/imagesgallery

Tom Albers tomalbers at kde.nl
Sun Aug 7 15:12:27 BST 2005


SVN commit 443826 by toma:

Fixed two problems here:
- when exporting tags a folder name "Tag: foo", was used.  Konqueror would state that that protocol is not supported. Removed the : as a solution.
- tags do not have a url, so using that as unique identifier in the map, was causing trouble. Exporting four tag albums resulted in four identical folders, because the key always returned 0. Used a QMapIterator and an int as a key.

Could some people check if this is ok?
CCMAIL: digikam-devel at kde.org
BUG: 102219



 M  +18 -9     imagesgallery.cpp  
 M  +3 -1      imagesgallery.h  


--- trunk/extragear/libs/kipi-plugins/imagesgallery/imagesgallery.cpp #443825:443826
@@ -16,6 +16,9 @@
 //    Copyright 2003-2004 by Gilles Caulier <caulier dot gilles at free.fr> for
 //    DigikamPlugins port.
 //
+//    Copyright 2005 by Tom Albers <tomalbers at kde.nl> fixing problems with making
+//    exports for tags
+//
 //    This program is free software; you can redistribute it and/or modify
 //    it under the terms of the GNU General Public License as published by
 //    the Free Software Foundation; either version 2 of the License, or
@@ -373,15 +376,21 @@
 
     m_albumsMap = new AlbumsMap;
         
+    m_totalAlbums = 0;
     for( QValueList<KIPI::ImageCollection>::Iterator albumIt = albumsList.begin() ;
          !m_cancelled && (albumIt != albumsList.end()) ; ++albumIt )
         {
-        AlbumData data((*albumIt).name(),    (*albumIt).category(),
+          
+        // a folder name "Tag: foo" is asking for trouble. Konqueror report that
+        // there is no such protocol. Delete the :
+        QString tempName = (*albumIt).name().replace("Tag: ", "Tag ");
+
+        AlbumData data(tempName,             (*albumIt).category(),
                        (*albumIt).comment(), (*albumIt).date(), 
                        (*albumIt).path(),    (*albumIt).images());
         
-        m_albumsMap->insert( (*albumIt).path().prettyURL(), data );
-        m_albumUrlList.append( (*albumIt).path() );
+        m_albumsMap->insert( m_totalAlbums, data );
+        m_totalAlbums++;
         }
     
     // Load images comments if necessary.
@@ -422,11 +431,11 @@
        KIO::file_copy(srcURL, destURL, -1, true, false, false);           
        }
 
-       for( KURL::List::Iterator albumsUrlIt = m_albumUrlList.begin() ;
-            !m_cancelled && (albumsUrlIt != m_albumUrlList.end()) ; ++albumsUrlIt )
+       QMapIterator<int, AlbumData> albumIt;
+       for( albumIt = m_albumsMap->begin() ; !m_cancelled && (albumIt != m_albumsMap->end()) ; ++albumIt )
           {
-          m_albumUrl = *albumsUrlIt;
-          AlbumData data = (*m_albumsMap)[m_albumUrl.prettyURL()];
+          m_currentAlbum = albumIt.key();
+          AlbumData data = (*albumIt);
           KURL::List images = data.itemsUrl();
 
           for( KURL::List::Iterator urlIt = images.begin(); urlIt != images.end(); ++urlIt ) 
@@ -457,7 +466,7 @@
                  d->message = i18n("Could not create folder '%1'").arg(SubTPath);
                  QApplication::sendEvent(m_parent, new QCustomEvent(QEvent::User, d));
                  usleep(1000);
-                 
+
                  return;
                  }
 
@@ -683,7 +692,7 @@
                                const QString& TargetimagesFormat)
 {
     KIPIImagesGalleryPlugin::EventData *d;
-    AlbumData data = (*m_albumsMap)[m_albumUrl.prettyURL()];
+    AlbumData data = (*m_albumsMap)[m_currentAlbum];
     int numOfImages = data.countItems();
     
     kdDebug( 51000 ) << "Num of images in " << data.albumName().ascii() << " : " 
--- trunk/extragear/libs/kipi-plugins/imagesgallery/imagesgallery.h #443825:443826
@@ -98,7 +98,7 @@
 // directly because operator<(KURL,KURL) is not defined in KDE 3.1
 
 typedef QMap<QString, QString>   CommentMap;  // List of Albums items comments.
-typedef QMap<QString, AlbumData> AlbumsMap;   // Albums data list.
+typedef QMap<int, AlbumData> AlbumsMap;   // Albums data list.
 
 
 class ImagesGallery : public QObject
@@ -181,6 +181,8 @@
   int                 m_colorDepthThumbnails;
   int                 m_thumbsCompression;
   int                 m_albumListSize;
+  int                 m_currentAlbum;
+  int                 m_totalAlbums;
   
   KURL::List          m_albumUrlList; // Urls of Albums list from setup dialog.
   KURL                m_albumUrl;     // Current album Url use in the thread.



More information about the Digikam-devel mailing list