From kde-bugs-dist Fri Aug 31 20:42:36 2007 From: Arnd Baecker Date: Fri, 31 Aug 2007 20:42:36 +0000 To: kde-bugs-dist Subject: [Bug 146083] bugs in drag and drop Message-Id: <20070831204236.5129.qmail () ktown ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-bugs-dist&m=118859300520982 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is. http://bugs.kde.org/show_bug.cgi?id=146083 arnd.baecker web de changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |FIXED ------- Additional Comments From arnd.baecker web de 2007-08-31 22:42 ------- SVN commit 707040 by abaecker: ensure that left and right view of the lighttable are populated properly on F6 BUG: 146083 TODO:KDE4PORT M +2 -0 digikam/albumiconview.cpp M +76 -9 utilities/lighttable/lighttablewindow.cpp M +2 -1 utilities/lighttable/lighttablewindow.h --- branches/extragear/kde3/graphics/digikam/digikam/albumiconview.cpp #707039:707040 @ -1065,6 +1065,8 @ ltview->raise(); ltview->setFocus(); ltview->loadImageInfos(list, current); + if (list.count()>1) + ltview->setLeftRightItems(list); } // ------------------------------------------------------------------------------ --- branches/extragear/kde3/graphics/digikam/utilities/lighttable/lighttablewindow.cpp #707039:707040 @ -497,13 +497,26 @ false, true); } +// Deal with items dropped onto the thumbbar (e.g. from the Album view) void LightTableWindow::slotThumbbarDroppedItems(const ImageInfoList& list) { loadImageInfos(list, 0); + if (list.count()>1) + setLeftRightItems(list); } + +// We get here either +// - via F6 (from the albumview) +// a) digikamapp.cpp: key_F6 leads to slotImageLightTable()) +// b) digikamview.cpp: void DigikamView::slotImageLightTable() +// calls d->iconView->insertToLightTable(list, info); +// c) albumiconview.cpp: AlbumIconView::insertToLightTable +// calls ltview->loadImageInfos(list, current); +// - via drag&drop, i.e. calls issued by the ...Dropped... routines void LightTableWindow::loadImageInfos(const ImageInfoList &list, ImageInfo *imageInfoCurrent) { + ImageInfoList l = list; if (!imageInfoCurrent) @ -535,11 +548,7 @ } } d->barView->blockSignals(false); - - LightTableBarItem *ltItem = dynamic_cast(d->barView->findItemByInfo(imageInfoCurrent)); - if (ltItem) - d->barView->setSelectedItem(ltItem); - + // if window is iconified, show it if (isMinimized()) { @ -722,30 +731,88 @ d->previewView->checkForSelection(info); } +// Deal with one (or more) items dropped onto the left panel void LightTableWindow::slotLeftDroppedItems(const ImageInfoList& list) { ImageInfo *info = *(list.begin()); loadImageInfos(list, info); // We will check if first item from list is already stored in thumbbar - // Note than thumbbar store all ImageInfo reference in memory for preview object. + // Note that the thumbbar stores all ImageInfo reference + // in memory for preview object. LightTableBarItem *item = d->barView->findItemByInfo(info); - if (item) + if (item) + { slotSetItemOnLeftPanel(item->info()); + // One approach is to make this item the current one, via + // d->barView->setSelectedItem(item); + // However, this is not good, because this also sets + // the right thumb to the same image. + // Therefore we use setLeftRightItems if there is more than + // one item in the list of dropped images. + } + if (list.count()>1) + setLeftRightItems(list); + } +// Deal with one (or more) items dropped onto the right panel void LightTableWindow::slotRightDroppedItems(const ImageInfoList& list) { ImageInfo *info = *(list.begin()); loadImageInfos(list, info); + if (list.count()>1) + setLeftRightItems(list); // We will check if first item from list is already stored in thumbbar - // Note than thumbbar store all ImageInfo reference in memory for preview object. + // Note that the thumbbar stores all ImageInfo reference + // in memory for preview object. LightTableBarItem *item = d->barView->findItemByInfo(info); - if (item) + if (item) + { slotSetItemOnRightPanel(item->info()); + // Make this item the current one. + d->barView->setSelectedItem(item); + } + + if (list.count()>1) + setLeftRightItems(list); + } + +// Set the images for the left and right panel. +void LightTableWindow::setLeftRightItems(const ImageInfoList &list) +{ + ImageInfoList l = list; + + // Make sure that more than just one item is in the list. + if (l.count()<=1) + return; + + ImageInfo *info = l.first(); + LightTableBarItem *ltItem = dynamic_cast(d->barView->findItemByInfo(info)); + + if (ltItem) { + // The first item is used for the left panel. + d->barView->setOnLeftPanel(info); + slotSetItemOnLeftPanel(info); + + // The subsequent item is used for the right panel. + LightTableBarItem* next = dynamic_cast(ltItem->next()); + if (next) + { + d->barView->setOnRightPanel(next->info()); + slotSetItemOnRightPanel(next->info()); + d->barView->setSelectedItem(next); + // ensure that the selected item is visible + // FIXME: this does not work: + d->barView->ensureItemVisible(next); + } + } +} + + void LightTableWindow::slotSetItemLeft() { if (d->barView->currentItemImageInfo()) --- branches/extragear/kde3/graphics/digikam/utilities/lighttable/lighttablewindow.h #707039:707040 @ -58,6 +58,7 @ static bool lightTableWindowCreated(); void loadImageInfos(const ImageInfoList &list, ImageInfo *imageInfoCurrent); + void setLeftRightItems(const ImageInfoList &list); signals: @ -100,7 +101,7 @ void slotSetItemOnRightPanel(ImageInfo*); void slotLeftDroppedItems(const ImageInfoList&); void slotRightDroppedItems(const ImageInfoList&); - + void slotLeftPanelLeftButtonClicked(); void slotRightPanelLeftButtonClicked();