]> cloud.milkyroute.net Git - dolphin.git/commitdiff
DolphinView: Ensure to update the whole viewState after a job created files
authorMéven Car <meven@kde.org>
Sat, 16 Dec 2023 12:14:17 +0000 (13:14 +0100)
committerMéven Car <meven.car@kdemail.net>
Mon, 18 Dec 2023 10:10:11 +0000 (10:10 +0000)
BUG: 476670

src/views/dolphinview.cpp
src/views/dolphinview.h

index 4e74245c129d5c08685e23931f27f844b230116f..8190c17780876e88f4621ec96dfbb87a1eaaa110 100644 (file)
@@ -1422,10 +1422,12 @@ void DolphinView::slotItemCreated(const QUrl &url)
     }
 }
 
-void DolphinView::onDirectoryLoadingCompleted()
+void DolphinView::onDirectoryLoadingCompletedAfterJob()
 {
     // the model should now contain all the items created by the job
-    updateSelectionState();
+    m_selectJobCreatedItems = true; // to make sure we overwrite selection
+    // update the view: scroll into View and selection
+    updateViewState();
     m_selectJobCreatedItems = false;
     m_selectedUrls.clear();
 }
@@ -1445,7 +1447,7 @@ void DolphinView::slotJobResult(KJob *job)
         updateSelectionState();
         if (!m_selectedUrls.isEmpty()) {
             // not all urls were found, the model may not be up to date
-            connect(m_model, &KFileItemModel::directoryLoadingCompleted, this, &DolphinView::onDirectoryLoadingCompleted, Qt::UniqueConnection);
+            connect(m_model, &KFileItemModel::directoryLoadingCompleted, this, &DolphinView::onDirectoryLoadingCompletedAfterJob, Qt::SingleShotConnection);
         } else {
             m_selectJobCreatedItems = false;
             m_selectedUrls.clear();
index 0b0c83487680725a6aaadd20919994f23542b911..8b31f2b43b8e651233e8f04cdc75c97343c0bbc2 100644 (file)
@@ -829,7 +829,7 @@ private Q_SLOTS:
 
     void slotTwoClicksRenamingTimerTimeout();
 
-    void onDirectoryLoadingCompleted();
+    void onDirectoryLoadingCompletedAfterJob();
 
 private:
     void loadDirectory(const QUrl &url, bool reload = false);