Bug 103515

Summary: renaming file to unknown extension makes image vanish
Product: [Applications] digikam Reporter: Jens <jens-bugs.kde.org>
Component: AdvancedRename-fileAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: caulier.gilles
Priority: NOR    
Version: 0.7.2   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In: 7.5.0

Description Jens 2005-04-08 21:01:25 UTC
Version:           0.7.2 (using KDE 3.4.0 Level "b" , SUSE 9.2 UNSUPPORTED)
Compiler:          gcc version 3.3.4 (pre 3.3.5 20040809)
OS:                Linux (i686) release 2.6.8-24.14-default

Pressing F2 over an image and renaming it, thereby changing the extension (accidentally) to something Digikam does not know about (eg. ".jp"), makes the image disappear completely in Digikam.

I would like Digikam to warn the user if this is about to happen. Or, better yet, hide file extensions witin digikam altogether.

Thank you!
Comment 1 Renchi Raju 2005-04-16 19:29:01 UTC
CVS commit by pahlibar: 



if user renames file to a new name with an extension not in the current 
list of filters, add the extension to the filter
BUGS: 103515


  M +18 -1     albumiconview.cpp   1.112


--- kdeextragear-3/digikam/digikam/albumiconview.cpp  #1.111:1.112
@@ -761,9 +761,26 @@ void AlbumIconView::slotRename(AlbumIcon
         return;
 
+    QFileInfo fi(newName);
+    QString newExt(QString("*.") + fi.extension());
+    AlbumSettings* settings = AlbumSettings::instance();
+
+    if ( !(QStringList::split(" ", settings->getImageFileFilter()).contains(newExt) ||
+           QStringList::split(" ", settings->getMovieFileFilter()).contains(newExt) ||
+           QStringList::split(" ", settings->getAudioFileFilter()).contains(newExt) ||
+           QStringList::split(" ", settings->getRawFileFilter()).contains(newExt)) )
+    {
+        settings->setImageFileFilter(settings->getImageFileFilter() +
+                                     QString(" ") + newExt);
+        d->imageLister->setNameFilter(d->albumSettings->getImageFileFilter() + " " +
+                                      d->albumSettings->getMovieFileFilter() + " " +
+                                      d->albumSettings->getAudioFileFilter() + " " +
+                                      d->albumSettings->getRawFileFilter());
+    }
+    
     KURL newURL = item->fileItem()->url().upURL();
     newURL.addPath(newName);
     d->nextItemToSelect = newURL.url();
 
-    if (d->currentAlbum && d->currentAlbum->type() == Album::TAG)
+    if (d->currentAlbum)
         d->imageLister->updateDirectory();