[Digikam-devel] [Bug 142774] Moving pictures between albums

Gilles Caulier caulier.gilles at gmail.com
Tue Dec 4 06:46:46 GMT 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=142774         




------- Additional Comments From caulier.gilles gmail com  2007-12-04 07:46 -------
SVN commit 743941 by cgilles:

digiKam from KDE3 branch : support Copy and Paste between Physical Albums and Tags Albums
CCMAIL: digikam-devel kde org


 M  +43 -17    albumiconview.cpp


--- branches/extragear/kde3/graphics/digikam/digikam/albumiconview.cpp #743940:743941
 @ -689,7 +689,6  @

    // --------------------------------------------------------

-
    popmenu.insertItem(SmallIcon("edittrash"),
                       i18n("Move to Trash", "Move %n Files to Trash" , selectedImageIDs.count() ), 16);

 @ -848,29 +847,56  @
 void AlbumIconView::slotPaste()
 {
    QMimeSource *data = kapp->clipboard()->data(QClipboard::Clipboard);
-    if(!data || !QUriDrag::canDecode(data))
+    if(!data)
        return;

-    if(d->currentAlbum->type() == Album::PHYSICAL)
+    if(d->currentAlbum->type() == Album::PHYSICAL &&
+       QUriDrag::canDecode(data))
    {
-        if (QUriDrag::canDecode(data) &&
-            d->currentAlbum->type() == Album::PHYSICAL)
-        {
-            PAlbum* palbum = (PAlbum*)d->currentAlbum;
-
-            // B.K.O #119205: do not handle root album.
-            if (palbum->isRoot())
-                return;
+        PAlbum* palbum = (PAlbum*)d->currentAlbum;
+
+        // B.K.O #119205: do not handle root album.
+        if (palbum->isRoot())
+            return;

-            KURL destURL(palbum->kurl());
+        KURL destURL(palbum->kurl());

-            KURL::List srcURLs;
-            KURLDrag::decode(data, srcURLs);
+        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*)));
+        KIO::Job* job = DIO::copy(srcURLs, destURL);
+        connect(job, SIGNAL(result(KIO::Job*)),
+                this, SLOT(slotDIOResult(KIO::Job*)));
+    }
+    else if(d->currentAlbum->type() == Album::TAG &&
+            ItemDrag::canDecode(data))
+    {
+        TAlbum* talbum = (TAlbum*)d->currentAlbum;
+
+        // B.K.O #119205: do not handle root album.
+        if (talbum->isRoot())
+            return;
+
+        KURL::List      urls;
+        KURL::List      kioURLs;
+        QValueList<int> albumIDs;
+        QValueList<int> imageIDs;
+
+        if (!ItemDrag::decode(data, urls, kioURLs, albumIDs, imageIDs))
+            return;
+
+        if (urls.isEmpty() || kioURLs.isEmpty() || albumIDs.isEmpty() || imageIDs.isEmpty())
+            return;
+
+        QPtrList<ImageInfo> list;
+        for (QValueList<int>::const_iterator it = imageIDs.begin();
+             it != imageIDs.end(); ++it)
+        {
+            ImageInfo *info = new ImageInfo(*it);
+            list.append(info);
        }
+
+        changeTagOnImageInfos(list, QValueList<int>() << talbum->id(), true, true);
    }
 }



More information about the Digikam-devel mailing list