diff --git a/CMakeLists.txt b/CMakeLists.txt index 5df238838..0062e0beb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -180,6 +180,8 @@ if(APPLE) set( SOCKETAPI_TEAM_IDENTIFIER_PREFIX "" CACHE STRING "SocketApi prefix (including a following dot) that must match the codesign key's TeamIdentifier/Organizational Unit" ) endif() +set(OWNCLOUD_PLACEHOLDER_SUFFIX ".owncloud" CACHE STRING "Placeholder suffix (must start with a .)") + if(BUILD_CLIENT) if(APPLE AND BUILD_UPDATER) find_package(Sparkle) diff --git a/config.h.in b/config.h.in index 0581afbd9..0983b6ba1 100644 --- a/config.h.in +++ b/config.h.in @@ -26,6 +26,7 @@ #cmakedefine APPLICATION_WIZARD_HEADER_BACKGROUND_COLOR "@APPLICATION_WIZARD_HEADER_BACKGROUND_COLOR@" #cmakedefine APPLICATION_WIZARD_HEADER_TITLE_COLOR "@APPLICATION_WIZARD_HEADER_TITLE_COLOR@" #cmakedefine APPLICATION_WIZARD_USE_CUSTOM_LOGO "@APPLICATION_WIZARD_USE_CUSTOM_LOGO@" +#cmakedefine OWNCLOUD_PLACEHOLDER_SUFFIX "@OWNCLOUD_PLACEHOLDER_SUFFIX@" #cmakedefine ZLIB_FOUND @ZLIB_FOUND@ diff --git a/mirall.desktop.in b/mirall.desktop.in index bde42a49f..970ad1da0 100644 --- a/mirall.desktop.in +++ b/mirall.desktop.in @@ -8,7 +8,7 @@ GenericName=Folder Sync Icon=@APPLICATION_ICON_NAME@ Keywords=@APPLICATION_NAME@;syncing;file;sharing; X-GNOME-Autostart-Delay=3 -MimeType=application/x-owncloud +MimeType=application/x-@APPLICATION_EXECUTABLE@ # Translations diff --git a/src/csync/csync_private.h b/src/csync/csync_private.h index 780dfb66d..bba72237f 100644 --- a/src/csync/csync_private.h +++ b/src/csync/csync_private.h @@ -215,7 +215,7 @@ struct OCSYNC_EXPORT csync_s { /** * The suffix to use for placeholder files. */ - QByteArray placeholder_suffix = ".owncloud"; + QByteArray placeholder_suffix; csync_s(const char *localUri, OCC::SyncJournalDb *statedb); ~csync_s(); diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 215945c2e..d16b77097 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -431,8 +431,8 @@ if(NOT BUILD_OWNCLOUD_OSX_BUNDLE AND NOT WIN32) ${CMAKE_CURRENT_BINARY_DIR}/${LINUX_APPLICATION_ID}.desktop) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${LINUX_APPLICATION_ID}.desktop DESTINATION ${DATADIR}/applications ) - #FIXME! branding - install(FILES owncloud.xml DESTINATION ${DATADIR}/mime/packages ) + configure_file(owncloud.xml.in ${APPLICATION_EXECUTABLE}.xml) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${APPLICATION_EXECUTABLE}.xml DESTINATION ${DATADIR}/mime/packages ) find_package(ECM 1.2.0 CONFIG) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") diff --git a/src/gui/application.cpp b/src/gui/application.cpp index f6d67a4bd..c4fb2009a 100644 --- a/src/gui/application.cpp +++ b/src/gui/application.cpp @@ -499,7 +499,7 @@ void Application::parseOptions(const QStringList &options) _backgroundMode = true; } else if (option == QLatin1String("--version") || option == QLatin1String("-v")) { _versionOnly = true; - } else if (option.endsWith(".owncloud")) { + } else if (option.endsWith(QStringLiteral(OWNCLOUD_PLACEHOLDER_SUFFIX))) { // placeholder file, open it after the Folder were created (if the app is not terminated) QTimer::singleShot(0, this, [this, option] { openPlaceholder(option); }); } else { @@ -679,7 +679,7 @@ void Application::slotGuiIsShowingSettings() void Application::openPlaceholder(const QString &filename) { - QLatin1String placeholderExt(".owncloud"); + QString placeholderExt = QStringLiteral(OWNCLOUD_PLACEHOLDER_SUFFIX); if (!filename.endsWith(placeholderExt)) { qWarning(lcApplication) << "Can only handle file ending in .owncloud. Unable to open" << filename; return; diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp index d408a9d32..f724a85c3 100644 --- a/src/gui/folder.cpp +++ b/src/gui/folder.cpp @@ -715,6 +715,7 @@ void Folder::setSyncOptions() opt._confirmExternalStorage = cfgFile.confirmExternalStorage(); opt._moveFilesToTrash = cfgFile.moveToTrash(); opt._newFilesArePlaceholders = _definition.usePlaceholders; + opt._placeholderSuffix = QStringLiteral(OWNCLOUD_PLACEHOLDER_SUFFIX); QByteArray chunkSizeEnv = qgetenv("OWNCLOUD_CHUNK_SIZE"); if (!chunkSizeEnv.isEmpty()) { diff --git a/src/gui/owncloud.xml b/src/gui/owncloud.xml deleted file mode 100644 index 7198b76bd..000000000 --- a/src/gui/owncloud.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - ownCloud placeholder style - - - diff --git a/src/gui/owncloud.xml.in b/src/gui/owncloud.xml.in new file mode 100644 index 000000000..5d1d06234 --- /dev/null +++ b/src/gui/owncloud.xml.in @@ -0,0 +1,7 @@ + + + + @APPLICATION_NAME@ placeholders + + + diff --git a/src/libsync/owncloudpropagator.cpp b/src/libsync/owncloudpropagator.cpp index 5d815aa43..5584c8652 100644 --- a/src/libsync/owncloudpropagator.cpp +++ b/src/libsync/owncloudpropagator.cpp @@ -605,9 +605,9 @@ QString OwncloudPropagator::getFilePath(const QString &tmp_file_name) const return _localDir + tmp_file_name; } -QString OwncloudPropagator::placeholderFilePath(const QString &fileName) const +QString OwncloudPropagator::addPlaceholderSuffix(const QString &fileName) const { - return getFilePath(fileName) + QLatin1String(".owncloud"); + return fileName + _syncOptions._placeholderSuffix; } void OwncloudPropagator::scheduleNextJob() diff --git a/src/libsync/owncloudpropagator.h b/src/libsync/owncloudpropagator.h index c6a52db13..4b34913e5 100644 --- a/src/libsync/owncloudpropagator.h +++ b/src/libsync/owncloudpropagator.h @@ -453,7 +453,7 @@ public: /* returns the local file path for the given tmp_file_name */ QString getFilePath(const QString &tmp_file_name) const; - QString placeholderFilePath(const QString &fileName) const; + QString addPlaceholderSuffix(const QString &fileName) const; /** Creates the job for an item. */ diff --git a/src/libsync/propagatedownload.cpp b/src/libsync/propagatedownload.cpp index a674e7365..6134f1e2a 100644 --- a/src/libsync/propagatedownload.cpp +++ b/src/libsync/propagatedownload.cpp @@ -402,10 +402,11 @@ void PropagateDownloadFile::startAfterIsEncryptedIsChecked() // If we want to download something that used to be a placeholder, // wipe the placeholder and proceed with a normal download if (_item->_type == ItemTypePlaceholderDownload) { - auto fn = propagator()->placeholderFilePath(_item->_file); + auto placeholder = propagator()->addPlaceholderSuffix(_item->_file); + auto fn = propagator()->getFilePath(placeholder); qCDebug(lcPropagateDownload) << "Downloading file that used to be a placeholder" << fn; QFile::remove(fn); - propagator()->_journal->deleteFileRecord(_item->_file + ".owncloud"); + propagator()->_journal->deleteFileRecord(placeholder); _item->_type = ItemTypeFile; } diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp index d4e2b090f..5770a5d3a 100644 --- a/src/libsync/syncengine.cpp +++ b/src/libsync/syncengine.cpp @@ -859,6 +859,7 @@ void SyncEngine::startSync() }; _csync_ctx->new_files_are_placeholders = _syncOptions._newFilesArePlaceholders; + _csync_ctx->placeholder_suffix = _syncOptions._placeholderSuffix.toUtf8(); // If needed, make sure we have up to date E2E information before the // discovery phase, otherwise we start right away diff --git a/src/libsync/syncoptions.h b/src/libsync/syncoptions.h index f442c380b..2e302bda9 100644 --- a/src/libsync/syncoptions.h +++ b/src/libsync/syncoptions.h @@ -38,6 +38,7 @@ struct SyncOptions /** Create a placeholder for new files instead of downloading */ bool _newFilesArePlaceholders = false; + QString _placeholderSuffix; /** The initial un-adjusted chunk size in bytes for chunked uploads, both * for old and new chunking algorithm, which classifies the item to be chunked