]> git.sesse.net Git - kdenlive/commitdiff
Move all cached data in one operation, so that user does not get one dialog box for...
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 28 Aug 2011 16:57:51 +0000 (16:57 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 28 Aug 2011 16:57:51 +0000 (16:57 +0000)
http://kdenlive.org/mantis/view.php?id=2297

svn path=/trunk/kdenlive/; revision=5842

src/kdenlivedoc.cpp

index 86a73e612f0968f87f4c33e8636ff5467b8192a4..ddc79e2976bf61620519fc290a2e9dc883681c62 100644 (file)
@@ -39,6 +39,7 @@
 #include <KFileDialog>
 #include <KIO/NetAccess>
 #include <KIO/CopyJob>
+#include <KIO/JobUiDelegate>
 #include <KApplication>
 #include <KGlobal>
 #include <KBookmarkManager>
@@ -766,6 +767,7 @@ void KdenliveDoc::setProjectFolder(KUrl url)
 void KdenliveDoc::moveProjectData(KUrl url)
 {
     QList <DocClipBase*> list = m_clipManager->documentClipList();
+    KUrl::List cacheUrls;
     for (int i = 0; i < list.count(); i++) {
         DocClipBase *clip = list.at(i);
         if (clip->clipType() == TEXT) {
@@ -779,16 +781,17 @@ void KdenliveDoc::moveProjectData(KUrl url)
         KUrl oldVideoThumbUrl = KUrl(m_projectFolder.path(KUrl::AddTrailingSlash) + "thumbs/" + hash + ".png");
         KUrl oldAudioThumbUrl = KUrl(m_projectFolder.path(KUrl::AddTrailingSlash) + "thumbs/" + hash + ".thumb");
         if (KIO::NetAccess::exists(oldVideoThumbUrl, KIO::NetAccess::SourceSide, 0)) {
-            KUrl newUrl = KUrl(url.path(KUrl::AddTrailingSlash) + "thumbs/" + hash + ".png");
-            KIO::Job *job = KIO::copy(oldVideoThumbUrl, newUrl);
-            KIO::NetAccess::synchronousRun(job, 0);
+            cacheUrls << oldVideoThumbUrl;
         }
         if (KIO::NetAccess::exists(oldAudioThumbUrl, KIO::NetAccess::SourceSide, 0)) {
-            KUrl newUrl = KUrl(url.path(KUrl::AddTrailingSlash) + "thumbs/" + hash + ".thumb");
-            KIO::Job *job = KIO::copy(oldAudioThumbUrl, newUrl);
-            if (KIO::NetAccess::synchronousRun(job, 0)) clip->refreshThumbUrl();
+            cacheUrls << oldAudioThumbUrl;
         }
     }
+    if (!cacheUrls.isEmpty()) {
+        KIO::Job *job = KIO::copy(cacheUrls, KUrl(url.path(KUrl::AddTrailingSlash) + "thumbs/"));
+        job->ui()->setWindow(kapp->activeWindow());
+        KIO::NetAccess::synchronousRun(job, 0);
+    }
 }
 
 const QString &KdenliveDoc::profilePath() const