]> git.sesse.net Git - kdenlive/blobdiff - src/projectlist.cpp
Improve handling of missing clips:
[kdenlive] / src / projectlist.cpp
index 28869c87b2ffb2b88b3c620ae37b77091df802e2..20ab1d4b3c6e23fb888cbec8a7b87423bad806e1 100644 (file)
@@ -86,7 +86,7 @@ ProjectList::ProjectList(QWidget *parent) :
     layout->addWidget(m_toolbar);
     layout->addWidget(m_listView);
     setLayout(layout);
-    
+
 
 
     connect(m_listView, SIGNAL(itemSelectionChanged()), this, SLOT(slotClipSelected()));
@@ -356,10 +356,10 @@ void ProjectList::slotRemoveClip()
         if (item->isGroup()) folderids[item->groupName()] = item->clipId();
         else ids << item->clipId();
         if (item->numReferences() > 0) {
-            if (KMessageBox::questionYesNo(this, i18np("Delete clip <b>%2</b> ?<br>This will also remove the clip in timeline", "Delete clip <b>%2</b> ?<br>This will also remove its %1 clips in timeline", item->numReferences(), item->names().at(1)), i18n("Delete Clip")) != KMessageBox::Yes) return;
+            if (KMessageBox::questionYesNo(this, i18np("Delete clip <b>%2</b>?<br>This will also remove the clip in timeline", "Delete clip <b>%2</b>?<br>This will also remove its %1 clips in timeline", item->numReferences(), item->names().at(1)), i18n("Delete Clip")) != KMessageBox::Yes) return;
         } else if (item->isGroup() && item->childCount() > 0) {
             int children = item->childCount();
-            if (KMessageBox::questionYesNo(this, i18n("Delete folder <b>%2</b> ?<br>This will also remove the %1 clips in that folder", children, item->names().at(1)), i18n("Delete Folder")) != KMessageBox::Yes) return;
+            if (KMessageBox::questionYesNo(this, i18n("Delete folder <b>%2</b>?<br>This will also remove the %1 clips in that folder", children, item->names().at(1)), i18n("Delete Folder")) != KMessageBox::Yes) return;
             for (int i = 0; i < children; ++i) {
                 ProjectItem *child = static_cast <ProjectItem *>(item->child(i));
                 ids << child->clipId();
@@ -619,15 +619,20 @@ void ProjectList::slotAddClip(const QList <QUrl> givenList, QString group)
     m_doc->slotAddClipList(list, group, groupId);
 }
 
-void ProjectList::slotRemoveInvalidClip(const QString &id)
+void ProjectList::slotRemoveInvalidClip(const QString &id, bool replace)
 {
     ProjectItem *item = getItemById(id);
     if (item) {
         const QString path = item->referencedClip()->fileURL().path();
-        if (!path.isEmpty()) KMessageBox::sorry(this, i18n("Clip <b>%1</b><br>is invalid, will be removed from project.", path));
+        if (!path.isEmpty()) {
+            if (replace) KMessageBox::sorry(this, i18n("Clip <b>%1</b><br>is invalid, will be removed from project.", path));
+            else {
+                if (KMessageBox::questionYesNo(this, i18n("Clip <b>%1</b><br>is missing or invalid. Remove it from project?", path), i18n("Invalid clip")) == KMessageBox::Yes) replace = true;
+            }
+        }
         QList <QString> ids;
         ids << id;
-        m_doc->deleteProjectClip(ids);
+        if (replace) m_doc->deleteProjectClip(ids);
     }
     if (!m_infoQueue.isEmpty()) QTimer::singleShot(300, this, SLOT(slotProcessNextClipInQueue()));
     else m_listView->setEnabled(true);