Summary: | After deleting a file, user comments entered for pictures apply to the wrong picture | ||
---|---|---|---|
Product: | [Applications] digikam | Reporter: | Jeff Mitchell <mitchell> |
Component: | Tags-Captions | Assignee: | Digikam Developers <digikam-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | major | CC: | caulier.gilles |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Gentoo Packages | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | 0.9.0 | |
Sentry Crash Report: |
Description
Jeff Mitchell
2006-10-08 23:53:14 UTC
I'm giving it major severity initially because it's a metadata/file corruption issue. Also, after deleting picture B, if picture C had tags, those tags are unchecked in the digiKam Image Editor when it is displayed. SVN commit 593901 by mwiesweg: - in deleteCurrentItem, set d->imageInfoCurrent and d->imageInfoList to new image as well - add loadCurrentList for shared code of loadURL and loadImageInfos, so that loadURL can now properly set d->imageInfoList to empty list BUG: 135307 M +1 -0 NEWS M +43 -22 utilities/imageeditor/editor/imagewindow.cpp M +1 -0 utilities/imageeditor/editor/imagewindow.h --- trunk/extragear/graphics/digikam/NEWS #593900:593901 @@ -300,5 +300,6 @@ 176 ==> 134869 : High CPU usage while displaying ICC Profile. 177 ==> 134761 : a rotated RAW image get saved straight with an inconsistent Exif orientation 178 ==> 135236 : Right-click menu rename function cuts to the first period (not the extention one) +179 ==> 135307 : After deleting a file, user comments entered for pictures apply to the wrong picture ---------------------------------------------------------------------------------------------------- --- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/imagewindow.cpp #593900:593901 @@ -370,51 +370,64 @@ void ImageWindow::loadURL(const KURL::List& urlList, const KURL& urlCurrent, const QString& caption, bool allowSaving, AlbumIconView* view) { - // if window is iconified, show it - if (isMinimized()) - { - KWin::deIconifyWindow(winId()); - } - - if (!promptUserSave(d->urlCurrent)) - return; - - setCaption(i18n("digiKam Image Editor - %1").arg(caption)); - - d->view = view; d->urlList = urlList; d->urlCurrent = urlCurrent; - d->allowSaving = allowSaving; + d->imageInfoList = ImageInfoList(); + d->imageInfoCurrent = 0; - m_saveAction->setEnabled(false); - m_revertAction->setEnabled(false); - m_undoAction->setEnabled(false); - m_redoAction->setEnabled(false); - - QTimer::singleShot(0, this, SLOT(slotLoadCurrent())); + loadCurrentList(caption, allowSaving, view); } void ImageWindow::loadImageInfos(const ImageInfoList &imageInfoList, ImageInfo *imageInfoCurrent, const QString& caption, bool allowSaving, AlbumIconView* view) { + // the ownership of the list's objects is passed to us d->imageInfoList = imageInfoList; d->imageInfoCurrent = imageInfoCurrent; d->imageInfoList.setAutoDelete(true); // create URL list - KURL::List urlList; + d->urlList = KURL::List(); ImageInfoListIterator it(d->imageInfoList); ImageInfo *info; for (; (info = it.current()); ++it) { - urlList.append(info->kurl()); + d->urlList.append(info->kurl()); } - loadURL(urlList, imageInfoCurrent->kurl(), caption, allowSaving, view); + d->urlCurrent = d->imageInfoCurrent->kurl(); + + loadCurrentList(caption, allowSaving, view); } +void ImageWindow::loadCurrentList(const QString& caption, bool allowSaving, AlbumIconView* view) +{ + // this method contains the code shared by loadURL and loadImageInfos + + // if window is iconified, show it + if (isMinimized()) + { + KWin::deIconifyWindow(winId()); + } + + if (!promptUserSave(d->urlCurrent)) + return; + + setCaption(i18n("digiKam Image Editor - %1").arg(caption)); + + d->view = view; + d->allowSaving = allowSaving; + + m_saveAction->setEnabled(false); + m_revertAction->setEnabled(false); + m_undoAction->setEnabled(false); + m_redoAction->setEnabled(false); + + QTimer::singleShot(0, this, SLOT(slotLoadCurrent())); +} + void ImageWindow::slotLoadCurrent() { KURL::List::iterator it = d->urlList.find(d->urlCurrent); @@ -880,6 +893,9 @@ useTrash = !permanently; } + // bring all (sidebar) to a defined state without letting them sit on the deleted file + emit signalNoCurrentItem(); + if (!SyncJob::del(d->urlCurrent, useTrash)) { QString errMsg(SyncJob::lastErrorMsg()); @@ -891,6 +907,7 @@ KURL CurrentToRemove = d->urlCurrent; KURL::List::iterator it = d->urlList.find(d->urlCurrent); + int index = d->imageInfoList.find(d->imageInfoCurrent); if (it != d->urlList.end()) { @@ -900,7 +917,9 @@ KURL urlNext = *(++it); d->urlCurrent = urlNext; + d->imageInfoCurrent = d->imageInfoList.at(index + 1); d->urlList.remove(CurrentToRemove); + d->imageInfoList.remove(index); slotLoadCurrent(); return; } @@ -910,7 +929,9 @@ KURL urlPrev = *(--it); d->urlCurrent = urlPrev; + d->imageInfoCurrent = d->imageInfoList.at(index - 1); d->urlList.remove(CurrentToRemove); + d->imageInfoList.remove(index); slotLoadCurrent(); return; } --- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/imagewindow.h #593900:593901 @@ -82,6 +82,7 @@ private: + void loadCurrentList(const QString& caption, bool allowSaving, AlbumIconView* view); void closeEvent(QCloseEvent* e); void setupActions(); SVN commit 593903 by mwiesweg: - get rid of SyncJob here, use standard AlbumThumbnailLoader and change menu entry when icon is available. The event loop of SyncJob caused a bug very difficult to find, when the ImageLoaded event was actually received in the event loop opened by SyncJob, called from handling the ImageLoadingStarted event in the end. All assumptions about the order of events are thwarted. - Handle the AlbumsCleared signal from AlbumManager here as well CCBUG: 135307 M +27 -3 imagedescedittab.cpp M +1 -0 imagedescedittab.h --- trunk/extragear/graphics/digikam/libs/imageproperties/imagedescedittab.cpp #593902:593903 @@ -62,7 +62,6 @@ #include "album.h" #include "albumsettings.h" #include "tagcreatedlg.h" -#include "syncjob.h" #include "navigatebarwidget.h" #include "imageinfo.h" #include "ratingwidget.h" @@ -281,6 +280,9 @@ connect(man, SIGNAL(signalAlbumRenamed(Album*)), this, SLOT(slotAlbumRenamed(Album*))); + connect(man, SIGNAL(signalAlbumsCleared()), + this, SLOT(slotAlbumsCleared())); + connect(man, SIGNAL(signalAlbumIconChanged(Album*)), this, SLOT(slotAlbumIconChanged(Album*))); @@ -497,6 +499,7 @@ updateRating(); updateDate(); updateTagsView(); + update(); } void ImageDescEditTab::updateTagsView() @@ -788,6 +791,11 @@ album->removeExtraData(this); } +void ImageDescEditTab::slotAlbumsCleared() +{ + d->tagsView->clear(); +} + void ImageDescEditTab::slotAlbumIconChanged(Album* a) { if (!a || a->isRoot() || a->type() != Album::TAG) @@ -844,12 +852,20 @@ if(!album || album->type() != Album::TAG) return; + // update item in tags tree QCheckListItem* item = (QCheckListItem*)album->extraData(this); if(!item) return; item->setPixmap(0, thumbnail); + + // update item in recent tags popup menu, if found therein + QPopupMenu *menu = d->recentTagsBtn->popup(); + if (menu->indexOf(album->id()) != -1) + { + menu->changeItem(album->id(), thumbnail, menu->text(album->id())); + } } void ImageDescEditTab::slotThumbnailLost(Album *) @@ -915,9 +931,17 @@ TAlbum* album = albumMan->findTAlbum(*it); if (album) { - QPixmap pix = SyncJob::getTagThumbnail(album); + AlbumThumbnailLoader *loader = AlbumThumbnailLoader::instance(); + QPixmap icon; + if (!loader->getTagThumbnail(album, icon)) + { + if (icon.isNull()) + { + icon = loader->getStandardTagIcon(album, 20); + } + } QString text = album->title() + " (" + ((TAlbum*)album->parent())->prettyURL() + ")"; - menu->insertItem(pix, text, album->id()); + menu->insertItem(icon, text, album->id()); } } } --- trunk/extragear/graphics/digikam/libs/imageproperties/imagedescedittab.h #593902:593903 @@ -109,6 +109,7 @@ void slotAlbumDeleted(Album* a); void slotAlbumIconChanged(Album* a); void slotAlbumRenamed(Album* a); + void slotAlbumsCleared(); void slotGotThumbnailFromIcon(Album *album, const QPixmap& thumbnail); void slotThumbnailLost(Album *album); |