[Kde-imaging] [Bug 125766] Export Albums on DVD

Angelo Naselli anaselli at linux.it
Sat Jul 29 20:07:58 CEST 2006


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=125766         
anaselli linux it changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From anaselli linux it  2006-07-29 20:07 -------
SVN commit 567662 by anaselli:

BUG: 125766

 M  +28 -4     cdarchiving.cpp  
 M  +3 -0      cdarchiving.h  


--- trunk/extragear/libs/kipi-plugins/cdarchiving/cdarchiving.cpp #567661:567662
 @ -232,7 +232,6  @
     m_StreamMainPageAlbumPreview = "";
         
     // Get config from setup dialog.
-    
     albumsList = m_configDlg->getSelectedAlbums();
     m_useHTMLInterface = m_configDlg->getUseHTMLInterface();
     m_useAutoRunWin32 = m_configDlg->getUseAutoRunWin32();
 @ -525,13 +524,15  @
     destURL = MainTPath + QString::fromLatin1("/up.png");
     KIO::file_copy(srcURL, destURL, -1, true, false, false);
 
+    //clear the temporary list for unique names
+    m_collection_name_list.clear();
     for (QValueList<KIPI::ImageCollection>::iterator it = m_albumsList.begin();
          it != m_albumsList.end(); ++it)
     {
         KIPI::ImageCollection album = *it;
         kdDebug( 51000 ) << "HTML Interface for Album: " << album.name() << endl;
 
-        m_AlbumTitle      = webifyFileName(album.name());
+        m_AlbumTitle      = makeFileNameUnique(m_collection_name_list, webifyFileName(album.name())); //webifyFileName(album.name());
         m_AlbumComments   = m_interface->hasFeature(KIPI::AlbumsHaveComments) ?
                             album.comment() : QString();
         m_AlbumCollection = m_interface->hasFeature(KIPI::AlbumsHaveCategory) ?
 @ -1541,8 +1542,12  @
     if ( HTMLinterfaceFolder.isEmpty() == false )
        AddFolderTreeToK3bXMLProjectFile(HTMLinterfaceFolder, &stream);
 
+    //clear the temporary list for unique names
+    m_collection_name_list.clear();
+
     for (QValueList<KIPI::ImageCollection>::iterator it = m_albumsList.begin();
          !m_cancelled && (it != m_albumsList.end()); ++it)
+
     {
         d = new KIPICDArchivingPlugin::EventData;
         d->action = KIPICDArchivingPlugin::Progress;
 @ -1652,9 +1657,10  @
    QString Temp;
    QString collection_name;
    if (m_useHTMLInterface)
-    collection_name = webifyFileName(collection.name());
+    collection_name = makeFileNameUnique(m_collection_name_list, webifyFileName(collection.name()));
    else
-    collection_name = collection.name();
+    collection_name = makeFileNameUnique(m_collection_name_list, collection.name());
+   kdDebug( 51000 ) << "num of unique collections: "<<  m_collection_name_list.size() << endl;
 
    Temp = "<directory name=\""
           + EscapeSgmlText(QTextCodec::codecForLocale(), collection_name, true, true)
 @ -1872,6 +1878,24  @
   return fileName;
 }
 
+/**
+ * Make sure a file name is unique in list
+ */
+QString CDArchiving::makeFileNameUnique(const QStringList& list, QString fileName) {
+  // Make sure the file name is unique
+  QString fileNameBase=fileName;
+  int count=1;
+  while (list.findIndex(fileName)!=-1) {
+    fileName=fileNameBase + "-" + QString::number(count);
+    ++count;
+  };
+  
+  m_collection_name_list += fileName;
+ 
+  return fileName;
+}
+
+
 }  // NameSpace KIPICDArchivingPlugin
 
 #include "cdarchiving.moc"
--- trunk/extragear/libs/kipi-plugins/cdarchiving/cdarchiving.h #567661:567662
 @ -152,6 +152,7  @
   
   QObject            *m_parent;
   
+  QStringList        m_collection_name_list;
 private:
   
   bool buildHTMLInterface (void);
 @ -203,6 +204,8  @
   void readSettings(void);
 
   QString webifyFileName(QString fileName);
+  QString makeFileNameUnique(const QStringList& list, QString fileName);
+
 };
 
 }  // NameSpace KIPICDArchivingPlugin


More information about the Kde-imaging mailing list