Bug 103515 - renaming file to unknown extension makes image vanish
Summary: renaming file to unknown extension makes image vanish
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: AdvancedRename-file (show other bugs)
Version: 0.7.2
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-08 21:01 UTC by Jens
Modified: 2022-01-31 21:57 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 7.5.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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();