Version: (using KDE Devel) Installed from: Compiled sources Compiler: gcc3.4.3 OS: Linux "Name change" dialog (aka F2) shouldn't allow for changing file extension OR when changing name extension is should automatically (eventually with help of some auxiliary dialog) perform transformation of image eg. from JPEG into PNG. Dialog window should look like (ascii-art): New name: +-------------------+ |pa123456 |.jpg +-------------------+ With non-editable extension. Currently user can change extension WITHOUT actually changing type of file which can lead to many problems in future. Extension could be listed as combo list to change extension with changing filetype - with all consequences.
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();