[Digikam-devel] [Bug 113801] Little problem with image files extensions

Gilles Caulier caulier.gilles at free.fr
Thu Jul 27 08:22:29 BST 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=113801         




------- Additional Comments From caulier.gilles free fr  2006-07-27 09:22 -------
SVN commit 566834 by cgilles:

digikam from trunk : do not include file name extension during file renaming operation from users.

Note : with the old implementation, when the the filename extension is changed by user, we will check if this one is in the mimetype setup. if no, it's added, bu _always_ like an image mimetype !!! Imaging if you put a sound or a video mimetype in the image mimetype list : image editor will trying to open it... 

The mimetype registration with renaming is now removed. 

BUG: 117375
CCBUGS: 113801

 M  +19 -30    albumiconview.cpp  
 M  +28 -30    albumiconview.h  


--- trunk/extragear/graphics/digikam/digikam/albumiconview.cpp #566833:566834
 @ -1,8 +1,8  @
 /* ============================================================
  * Authors: Renchi Raju <renchi pooh tam uiuc edu>
  *          Caulier Gilles <caulier dot gilles at kdemail dot net>
- * Date  : 2002-16-10
- * Description : 
+ * Date   : 2002-16-10
+ * Description : album icon view 
  * 
  * Copyright 2002-2005 by Renchi Raju and Gilles Caulier
  * Copyright      2006 by Gilles Caulier
 @ -254,7 +254,6  @
 
     connect(watch, SIGNAL(signalImageCaptionChanged(Q_LLONG)),
             this, SLOT(slotImageAttributesChanged(Q_LLONG)));
-
 }
 
 AlbumIconView::~AlbumIconView()
 @ -744,8 +743,9  @
             KURLDrag::decode(data, srcURLs);
 
             KIO::Job* job = DIO::copy(srcURLs, destURL);
+
             connect(job, SIGNAL(result(KIO::Job*)),
-                    SLOT(slotDIOResult(KIO::Job*)));
+                    this, SLOT(slotDIOResult(KIO::Job*)));
         }
     }
 }
 @ -781,20 +781,21  @
     if (!item)
         return;
 
-    QString oldName = item->imageInfo()->name();
+    QFileInfo fi(item->imageInfo()->name());
+    QString ext  = QString(".") + fi.extension();
+    QString name = fi.fileName();
+    name.truncate(fi.fileName().length() - ext.length());
 
     bool ok;
 
 #if KDE_IS_VERSION(3,2,0)
-    QString newName = KInputDialog::getText(i18n("Rename Item"),
-                                            i18n("Enter new name:"),
-                                            oldName,
-                                            &ok, this);
+    QString newName = KInputDialog::getText(i18n("Rename Item (%1)").arg(fi.fileName()), 
+                                            i18n("Enter new name (without extension):"),
+                                            name, &ok, this);
 #else
-    QString newName = KLineEditDlg::getText(i18n("Rename Item"),
-                                            i18n("Enter new name:"),
-                                            oldName,
-                                            &ok, this);
+    QString newName = KLineEditDlg::getText(i18n("Rename Item (%1)").arg(fi.fileName()), 
+                                            i18n("Enter new name (without extension):"),
+                                            name, &ok, this);
 #endif
 
     if (!ok)
 @ -802,26 +803,13  @
 
     QString oldURL = item->imageInfo()->kurl().url();
 
-    if (!item->imageInfo()->setName(newName))
+    if (!item->imageInfo()->setName(newName + ext))
         return;
 
     d->itemDict.remove(oldURL);
     d->itemDict.insert(item->imageInfo()->kurl().url(), item);
 
     item->repaint();
-
-    // if user has inadvertently renamed a file to one with an extension
-    // not in the current list of extensions, add it to the list of
-    // extension
-
-    QFileInfo fi(newName);
-    QString newExt("*." + fi.extension());
-    AlbumSettings* settings = AlbumSettings::instance();
-    if (settings->addImageFileExtension(newExt))
-    {
-        d->imageLister->setNameFilter(settings->getAllFileFilter());
-    }
-
     signalItemsAdded();
 }
 
 @ -871,8 +859,9  @
     }
 
     KIO::Job* job = DIO::del(urlList);
+
     connect(job, SIGNAL(result(KIO::Job*)),
-            SLOT(slotDIOResult(KIO::Job*)));
+            this, SLOT(slotDIOResult(KIO::Job*)));
 }
 
 void AlbumIconView::slotFilesModified()
 @ -1118,14 +1107,14  @
             {
                 KIO::Job* job = DIO::move(srcURLs, destURL);
                 connect(job, SIGNAL(result(KIO::Job*)),
-                        SLOT(slotDIOResult(KIO::Job*)));
+                        this, SLOT(slotDIOResult(KIO::Job*)));
                 break;
             }
             case 11: 
             {
                 KIO::Job* job = DIO::copy(srcURLs, destURL);
                 connect(job, SIGNAL(result(KIO::Job*)),
-                        SLOT(slotDIOResult(KIO::Job*)));
+                        this, SLOT(slotDIOResult(KIO::Job*)));
                 break;
             }
             default:
--- trunk/extragear/graphics/digikam/digikam/albumiconview.h #566833:566834
 @ -1,8 +1,8  @
 /* ============================================================
  * Authors: Renchi Raju <renchi pooh tam uiuc edu>
  *          Caulier Gilles <caulier dot gilles at kdemail dot net>
- * Date  : 2002-16-10
- * Description : 
+ * Date   : 2002-16-10
+ * Description : album icon view 
  * 
  * Copyright 2002-2005 by Renchi Raju and Gilles Caulier
  * Copyright      2006 by Gilles Caulier
 @ -34,13 +34,11  @
 #include "imageinfo.h"
 #include "albumitemhandler.h"
 
-class QMouseEvent;
 class QResizeEvent;
 class QDragMoveEvent;
 class QDropEvent;
 class QPoint;
 class QString;
-class QPainter;
 class QPixmap;
 
 namespace KIO
 @ -53,10 +51,10  @
 
 class AlbumIconItem;
 class AlbumSettings;
-class AlbumIconViewPrivate;
 class ThumbnailSize;
 class Album;
 class PixmapManager;
+class AlbumIconViewPrivate;
 
 class AlbumIconView : public IconView,
                       public AlbumItemHandler
 @ -112,7 +110,32  @
     AlbumIconItem* findItem(const QString& url) const;
     AlbumIconItem* nextItemToThumbnail() const;
     PixmapManager* pixmapManager() const;
+   
+signals:
+
+    void signalItemsAdded();
+    void signalItemDeleted(AlbumIconItem* iconItem);
+    void signalCleared();
+
+public slots:
+
+    void slotSetExifOrientation(int orientation);
+    void slotRename(AlbumIconItem* item);
+    void slotDeleteSelectedItems();
+    void slotDisplayItem(AlbumIconItem *item=0);
+    void slotAlbumModified();
+    void slotSetAlbumThumbnail(AlbumIconItem *iconItem);
+    void slotCopy();
+    void slotPaste();
     
+    void slotAssignRating(int rating);
+    void slotAssignRatingNoStar();
+    void slotAssignRatingOneStar();
+    void slotAssignRatingTwoStar();
+    void slotAssignRatingThreeStar();
+    void slotAssignRatingFourStar();
+    void slotAssignRatingFiveStar();
+
 protected:
 
     void resizeEvent(QResizeEvent* e);
 @ -152,31 +175,6  @
     void slotImageAttributesChanged(Q_LLONG imageId);
     void slotAlbumImagesChanged(int albumId);
 
-public slots:
-
-    void slotSetExifOrientation(int orientation);
-    void slotRename(AlbumIconItem* item);
-    void slotDeleteSelectedItems();
-    void slotDisplayItem(AlbumIconItem *item=0);
-    void slotAlbumModified();
-    void slotSetAlbumThumbnail(AlbumIconItem *iconItem);
-    void slotCopy();
-    void slotPaste();
-    
-    void slotAssignRating(int rating);
-    void slotAssignRatingNoStar();
-    void slotAssignRatingOneStar();
-    void slotAssignRatingTwoStar();
-    void slotAssignRatingThreeStar();
-    void slotAssignRatingFourStar();
-    void slotAssignRatingFiveStar();
-    
-signals:
-
-    void signalItemsAdded();
-    void signalItemDeleted(AlbumIconItem* iconItem);
-    void signalCleared();
-
 private:
     
     void updateBannerRectPixmap();



More information about the Digikam-devel mailing list