]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Before applying the cut item effect to a preview, assure that the cut items cache...
authorPeter Penz <peter.penz19@gmail.com>
Thu, 29 May 2008 20:01:13 +0000 (20:01 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Thu, 29 May 2008 20:01:13 +0000 (20:01 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=814273

src/iconmanager.cpp

index 78bb89cf80e35023eeab3a24b12fc4bb52e5cdcb..2a382713489496b44239bed6024ff39bd15c2a8c 100644 (file)
@@ -232,6 +232,20 @@ void IconManager::replaceIcon(const KUrl& url, const QPixmap& pixmap)
 
         const QMimeData* mimeData = QApplication::clipboard()->mimeData();
         if (KonqMimeData::decodeIsCutSelection(mimeData) && isCutItem(item)) {
+            // Remember the current icon in the cache for cut items before
+            // the disabled effect is applied. This makes it possible restoring
+            // the uncut version again when cutting other items.
+            QList<ItemInfo>::iterator begin = m_cutItemsCache.begin();
+            QList<ItemInfo>::iterator end   = m_cutItemsCache.end();
+            for (QList<ItemInfo>::iterator it = begin; it != end; ++it) {
+                if ((*it).url == item.url()) {
+                    (*it).pixmap = icon;
+                    break;
+                }
+            }
+
+            // apply the disabled effect to the icon for marking it as "cut item"
+            // and apply the icon to the item
             KIconEffect iconEffect;
             icon = iconEffect.apply(icon, KIconLoader::Desktop, KIconLoader::DisabledState);
             m_dolphinModel->setData(idx, QIcon(icon), Qt::DecorationRole);