]> git.sesse.net Git - kdenlive/commitdiff
If a project is already opened, focus the correct tab instead of opening 2 tabs for...
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 19 Oct 2008 09:27:05 +0000 (09:27 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 19 Oct 2008 09:27:05 +0000 (09:27 +0000)
http://www.kdenlive.org:80/mantis/view.php?id=223

svn path=/branches/KDE4/; revision=2491

src/mainwindow.cpp

index 2231b2cc759c68d5694486bdcc25b133ecbb6cd8..3c8a7f32d3bea31f507113d01602476208d43d94 100644 (file)
@@ -948,6 +948,23 @@ void MainWindow::openLastFile() {
 }
 
 void MainWindow::openFile(const KUrl &url) {
+    // Check if the document is already opened
+    const int ct = m_timelineArea->count();
+    bool isOpened = false;
+    int i;
+    for (i = 0; i < ct; i++) {
+        TrackView *tab = (TrackView *) m_timelineArea->widget(i);
+        KdenliveDoc *doc = tab->document();
+        if (doc->url() == url) {
+            isOpened = true;
+            break;
+        }
+    }
+    if (isOpened) {
+        m_timelineArea->setCurrentIndex(i);
+        return;
+    }
+
     // Check for backup file
     QList<KAutoSaveFile *> staleFiles = KAutoSaveFile::staleFiles(url);
     if (!staleFiles.isEmpty()) {