Bug 102219 - when you export html from a tags gallery links are incorrect
Summary: when you export html from a tags gallery links are incorrect
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Plugin-Generic-HTMLGallery (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-03-23 00:12 UTC by Bret Baptist
Modified: 2018-03-23 21:04 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 0.1.0


Attachments
Index with incorrect links (1.63 KB, text/html)
2005-03-24 21:24 UTC, Bret Baptist
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bret Baptist 2005-03-23 00:12:31 UTC
Version:           0.1.0 (using KDE 3.3.1, Mandrake Linux Cooker i586 - Cooker)
Compiler:          gcc version 3.4.1 (Mandrakelinux 10.1 3.4.1-4mdk)
OS:                Linux (i686) release 2.6.10-1.mm.s.18mdk

If you select Tags galleries for export with the HTML export plugin you get broken links into the gallery folders on the main index.html.


Bret Baptist.
Comment 1 Tom Albers 2005-03-23 21:13:28 UTC
Could you provide an example for me to see the problem?
Comment 2 caulier.gilles 2005-03-24 06:33:18 UTC
Tom,

I remember that Renchi have fixed a similar problem in batch process kipi plugin (i think). Take a look in CVS log.

A nice day 

Gilles
Comment 3 Bret Baptist 2005-03-24 21:24:00 UTC
Created attachment 10329 [details]
Index with incorrect links

While testing this I discovered that you need to add at least two tag galleries
to the HTML export for it to mess up.  If you create the two directory names
you see the galleries link to, the links will not work.


Bret Baptist.
Comment 4 Tom Albers 2005-08-07 16:13:07 UTC
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@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@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.
Comment 5 Renchi Raju 2005-08-25 08:50:01 UTC
*** Bug 111462 has been marked as a duplicate of this bug. ***