Placeholders: Fixup clicking on placeholder after previous change
authorOlivier Goffart <ogoffart@woboq.com>
Thu, 25 Jan 2018 15:25:11 +0000 (16:25 +0100)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 15 Dec 2020 09:57:49 +0000 (10:57 +0100)
Now that the name in the db is the name of the placeholder file,
we need to adjust the call to downloadPlaceholder

src/gui/application.cpp
src/gui/application.h
src/gui/folder.h

index c0936f3bd8e8a117ea0eb38485ab890e8b3af1c1..f6d67a4bde5b80e3654c0b0ed9f39d9d0fe64e8c 100644 (file)
@@ -684,15 +684,15 @@ void Application::openPlaceholder(const QString &filename)
         qWarning(lcApplication) << "Can only handle file ending in .owncloud. Unable to open" << filename;
         return;
     }
-    QString normalName = filename.left(filename.size() - placeholderExt.size());
     auto folder = FolderMan::instance()->folderForPath(filename);
     if (!folder) {
         qWarning(lcApplication) << "Can't find sync folder for" << filename;
         // TODO: show a QMessageBox for errors
         return;
     }
-    QString relativePath = QDir::cleanPath(normalName).mid(folder->cleanPath().length() + 1);
+    QString relativePath = QDir::cleanPath(filename).mid(folder->cleanPath().length() + 1);
     folder->downloadPlaceholder(relativePath);
+    QString normalName = filename.left(filename.size() - placeholderExt.size());
     auto con = QSharedPointer<QMetaObject::Connection>::create();
     *con = QObject::connect(folder, &Folder::syncFinished, [con, normalName] {
         QObject::disconnect(*con);
index a184cf5ef3777c15ff14794061ed9a500a24e315..d771c1422eee54ab789e0cd6d1e6c7090421bd74 100644 (file)
@@ -75,6 +75,7 @@ public slots:
     void slotCrash();
     /**
      * Will download a placeholder file, and open the result.
+     * The argument is the filename of the placeholder file (including the extension)
      */
     void openPlaceholder(const QString &filename);
 
index 778e35ad5b7819a71fa0932d42d81693d2773d4b..3759f16da72b4e3bcf838276a1785e3e14b7ab69 100644 (file)
@@ -280,6 +280,7 @@ public slots:
 
     /**
      * Mark a placeholder as being ready for download, and start a sync.
+     * relativePath is the patch to the placeholder file (includeing the extension)
      */
     void downloadPlaceholder(const QString &relativepath);