[Digikam-devel] [Bug 146083] bugs in drag and drop
Gilles Caulier
caulier.gilles at gmail.com
Tue Sep 4 15:07:51 BST 2007
------- 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=146083
caulier.gilles gmail com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
------- Additional Comments From caulier.gilles gmail com 2007-09-04 16:07 -------
SVN commit 708316 by cgilles:
digiKam from trunk (KDE4) : backport commits #707040 from KDE3 branch
BUG: 146083
M +2 -0 digikam/albumiconview.cpp
M +6 -0 project/project.kdevelop
M +69 -8 utilities/lighttable/lighttablewindow.cpp
M +1 -0 utilities/lighttable/lighttablewindow.h
--- trunk/extragear/graphics/digikam/digikam/albumiconview.cpp #708315:708316
@ -1057,6 +1057,8 @
ltview->raise();
ltview->setFocus();
ltview->loadImageInfos(list, current);
+ if (list.count()>1)
+ ltview->setLeftRightItems(list);
}
// ------------------------------------------------------------------------------
--- trunk/extragear/graphics/digikam/project/project.kdevelop #708315:708316
@ -150,6 +150,12 @
<projectname>project</projectname>
<projectname>project</projectname>
<projectname>project</projectname>
+ <projectname>project</projectname>
+ <projectname>project</projectname>
+ <projectname>project</projectname>
+ <projectname>project</projectname>
+ <projectname>project</projectname>
+ <projectname>project</projectname>
</general>
<kdevfileview>
<groups>
--- trunk/extragear/graphics/digikam/utilities/lighttable/lighttablewindow.cpp #708315:708316
@ -497,11 +497,22 @
createGUI("lighttablewindowui.rc");
}
+// Deal with items dropped onto the thumbbar (e.g. from the Album view)
void LightTableWindow::slotThumbbarDroppedItems(const ImageInfoList& list)
{
loadImageInfos(list, ImageInfo());
+ 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, const ImageInfo &givenImageInfoCurrent)
{
ImageInfoList l = list;
@ -537,10 +548,6 @
}
d->barView->blockSignals(false);
- LightTableBarItem *ltItem = dynamic_cast<LightTableBarItem*>(d->barView->findItemByInfo(imageInfoCurrent));
- if (ltItem)
- d->barView->setSelectedItem(ltItem);
-
// if window is iconified, show it
if (isMinimized())
{
@ -723,30 +730,84 @
d->previewView->checkForSelection(info);
}
+// Deal with one (or more) items dropped onto the left panel
void LightTableWindow::slotLeftDroppedItems(const ImageInfoList& list)
{
ImageInfo info = list.first();
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.first();
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<LightTableBarItem*>(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<LightTableBarItem*>(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().isNull())
--- trunk/extragear/graphics/digikam/utilities/lighttable/lighttablewindow.h #708315:708316
@ -58,6 +58,7 @
static bool lightTableWindowCreated();
void loadImageInfos(const ImageInfoList &list, const ImageInfo &imageInfoCurrent);
+ void setLeftRightItems(const ImageInfoList &list);
signals:
More information about the Digikam-devel
mailing list