[Digikam-devel] [Bug 135307] After deleting a file, user comments entered for pictures apply to the wrong picture
Marcel Wiesweg
marcel.wiesweg at gmx.de
Mon Oct 9 14:57:26 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=135307
marcel.wiesweg gmx de changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
------- Additional Comments From marcel.wiesweg gmx de 2006-10-09 15:57 -------
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();
More information about the Digikam-devel
mailing list