Bug 119205

Summary: digikam: d&d of image into librarypath root dir ==> images are invisible
Product: [Applications] digikam Reporter: Achim Bohnet <ach>
Component: Albums-MainViewAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 0.8.0   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In: 0.9.0
Sentry Crash Report:

Description Achim Bohnet 2005-12-30 00:10:39 UTC
Version:           0.8.0 (using KDE 3.5.0, Kubuntu Package 4:3.5.0-0ubuntu3 dapper)
Compiler:          Target: i486-linux-gnu
OS:                Linux (i686) release 2.6.15-9-686

to reproduce:

o create a fresh user
o start digikam (no album exists at this time)
o d&d an image into the thumbnail view
==> image end up in root dir of library_path (e.g.
~/Pictures/  and is therefore invisible because only
images in Albums aka subdirs of the library_path dir
are displayed.

Ah, same is true if one selects 'My Albums' and
drops an image into the empty thumbnails view:
the image is copied into the library_path dir
but not displayed.

Achim
Comment 1 Achim Bohnet 2005-12-30 00:26:57 UTC
When one select 'My Tags' and drop an image in this
empty thumbnails view.  It looks like the image is copied
but not displayed.   Difference to 'My Albums' is that I
could not find the image, so it's not copied.

Date view does not display a root node.  Aren't the root
nodes in Albums and Tags tree a remnant of from 0.7* days
when Albums and Tags were displayed in the same widget?

When the title 'My Tags' and 'My Albums' at the top would
display the same RMB menu as the root nodes right below
the title.  It would be possible to remove the root nodes
(AFAICS).

Achim
Comment 2 caulier.gilles 2006-12-11 13:10:55 UTC
SVN commit 612433 by cgilles:

digikam from trunk : never handle root album with Drag & Drop and Copy & Paste operations.
BUG: 119205

 M  +19 -16    albumfolderview.cpp  
 M  +16 -12    albumiconview.cpp  


--- trunk/extragear/graphics/digikam/digikam/albumfolderview.cpp #612432:612433
@@ -45,7 +45,6 @@
 #include "ddebug.h"
 #include "digikamapp.h"
 #include "album.h"
-#include "albumfolderview.h"
 #include "albumpropsedit.h"
 #include "album.h"
 #include "albummanager.h"
@@ -59,6 +58,8 @@
 #include "dragobjects.h"
 #include "albumthumbnailloader.h"
 #include "deletedialog.h"
+#include "albumfolderview.h"
+#include "albumfolderview.moc"
 
 // X11 C Ansi includes.
 
@@ -103,7 +104,7 @@
                    : FolderItem(parent, album->title())
 {
     setDragEnabled(true);
-    m_album = album;
+    m_album     = album;
     m_groupItem = false;
 }
 
@@ -111,7 +112,7 @@
                    : FolderItem(parent, album->title())
 {
     setDragEnabled(true);
-    m_album = album;
+    m_album     = album;
     m_groupItem = false;
 }
 
@@ -265,7 +266,7 @@
     if (failed)
     {
         DWarning() << k_funcinfo << " Failed to find parent for Album "
-                    << palbum->url() << endl;
+                   << palbum->url() << endl;
         return;
     }
 
@@ -777,7 +778,7 @@
             {
                 return false;
             }
-        };
+        }
     }
 
     if(itemDrop  && !itemDrop->parent())
@@ -812,7 +813,7 @@
     if(!acceptDrop(e))
         return;
 
-    QPoint vp = contentsToViewport(e->pos());
+    QPoint vp                     = contentsToViewport(e->pos());
     AlbumFolderViewItem *itemDrop = dynamic_cast<AlbumFolderViewItem*>(itemAt(vp));
 
     if(AlbumDrag::canDecode(e))
@@ -849,7 +850,7 @@
                 }
                 KIO::Job* job = DIO::move(album->kurl(), destAlbum->kurl());
                 connect(job, SIGNAL(result(KIO::Job*)),
-                        SLOT(slotDIOResult(KIO::Job*)));
+                        this, SLOT(slotDIOResult(KIO::Job*)));
             }
         }
         else if (AlbumSettings::instance()->getAlbumSortOrder()
@@ -893,7 +894,7 @@
 
         // all the albumids will be the same
         int albumID = albumIDs.first();
-        srcAlbum = d->albumMan->findPAlbum(albumID);
+        srcAlbum    = d->albumMan->findPAlbum(albumID);
         if (!srcAlbum)
         {
             DWarning() << "Could not find source album of drag"
@@ -972,14 +973,14 @@
             {
                 KIO::Job* job = DIO::move(kioURLs, destAlbum->kurl());
                 connect(job, SIGNAL(result(KIO::Job*)),
-                        SLOT(slotDIOResult(KIO::Job*)));
+                        this, SLOT(slotDIOResult(KIO::Job*)));
                 break;
             }
             case 11:
             {
                 KIO::Job* job = DIO::copy(kioURLs, destAlbum->kurl());
                 connect(job, SIGNAL(result(KIO::Job*)),
-                        SLOT(slotDIOResult(KIO::Job*)));
+                        this, SLOT(slotDIOResult(KIO::Job*)));
                 break;
             }
             case 12:
@@ -994,10 +995,10 @@
         return;
     }
 
-    if(QUriDrag::canDecode(e))
+    // -- DnD from an external source ----------------------------------------
+
+    if(QUriDrag::canDecode(e))               
     {
-        // DnD from an external source
-
         PAlbum* destAlbum = 0;
 
         if (itemDrop)
@@ -1005,6 +1006,10 @@
         else
             destAlbum = d->albumMan->findPAlbum(0);
 
+        // B.K.O #119205: do not handle root album.
+        if (destAlbum->isRoot())
+            return;
+
         KURL destURL(destAlbum->kurl());
 
         KURL::List srcURLs;
@@ -1147,7 +1152,7 @@
         {
             return findParentByDate(album, failed);
         }
-    };
+    }
 
     failed = true;
     return 0;
@@ -1312,5 +1317,3 @@
 }
 
 }  // namespace Digikam
-
-#include "albumfolderview.moc"
--- trunk/extragear/graphics/digikam/digikam/albumiconview.cpp #612432:612433
@@ -464,7 +464,7 @@
     }
             
     QPopupMenu popmenu(this);
-    KAction *paste = KStdAction::paste(this, SLOT(slotPaste()), 0);
+    KAction *paste    = KStdAction::paste(this, SLOT(slotPaste()), 0);
     QMimeSource *data = kapp->clipboard()->data(QClipboard::Clipboard);
     
     if(!data || !QUriDrag::canDecode(data))
@@ -740,13 +740,17 @@
             d->currentAlbum->type() == Album::PHYSICAL)
         {
             PAlbum* palbum = (PAlbum*)d->currentAlbum;
+            
+            // B.K.O #119205: do not handle root album.
+            if (palbum->isRoot())
+                return;
+
             KURL destURL(palbum->kurl());
 
             KURL::List srcURLs;
             KURLDrag::decode(data, srcURLs);
 
             KIO::Job* job = DIO::copy(srcURLs, destURL);
-
             connect(job, SIGNAL(result(KIO::Job*)),
                     this, SLOT(slotDIOResult(KIO::Job*)));
         }
@@ -848,7 +852,7 @@
 
     KIO::Job* job = DIO::del(urlList, useTrash);
     connect(job, SIGNAL(result(KIO::Job*)),
-            SLOT(slotDIOResult(KIO::Job*)));
+            this, SLOT(slotDIOResult(KIO::Job*)));
 }
 
 void AlbumIconView::slotDeleteSelectedItemsDirectly(bool useTrash)
@@ -1513,16 +1517,16 @@
 
 void AlbumIconView::updateItemRectsPixmap()
 {
-    d->itemRect = QRect(0,0,0,0);
-    d->itemRatingRect = QRect(0,0,0,0);
-    d->itemDateRect = QRect(0,0,0,0);
-    d->itemModDateRect = QRect(0,0,0,0);
-    d->itemPixmapRect = QRect(0,0,0,0);
-    d->itemNameRect = QRect(0,0,0,0);
-    d->itemCommentsRect = QRect(0,0,0,0);
+    d->itemRect           = QRect(0,0,0,0);
+    d->itemRatingRect     = QRect(0,0,0,0);
+    d->itemDateRect       = QRect(0,0,0,0);
+    d->itemModDateRect    = QRect(0,0,0,0);
+    d->itemPixmapRect     = QRect(0,0,0,0);
+    d->itemNameRect       = QRect(0,0,0,0);
+    d->itemCommentsRect   = QRect(0,0,0,0);
     d->itemResolutionRect = QRect(0,0,0,0);
-    d->itemSizeRect = QRect(0,0,0,0);
-    d->itemTagRect = QRect(0,0,0,0);
+    d->itemSizeRect       = QRect(0,0,0,0);
+    d->itemTagRect        = QRect(0,0,0,0);
 
     d->fnReg  = font();
     d->fnCom  = font();