diff --git a/src/common/utility.h b/src/common/utility.h index fbc3653a7b242..5bc8b5c5307ec 100644 --- a/src/common/utility.h +++ b/src/common/utility.h @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -184,8 +183,6 @@ namespace Utility { */ OCSYNC_EXPORT QString timeAgoInWords(const QDateTime &dt, const QDateTime &from = QDateTime()); - OCSYNC_EXPORT QMimeType mimeTypeForFile(const QString &filePath); - class OCSYNC_EXPORT StopWatch { private: @@ -357,4 +354,4 @@ inline bool Utility::isBSD() } } -#endif // UTILITY_H +#endif // UTILITY_H \ No newline at end of file diff --git a/src/common/utility_mac.mm b/src/common/utility_mac.mm index 4b4d925d5ec69..2671924ec9eb2 100644 --- a/src/common/utility_mac.mm +++ b/src/common/utility_mac.mm @@ -266,9 +266,4 @@ void Utility::registerUriHandlerForLocalEditing() { /* URI handler is registered via MacOSXBundleInfo.plist.in */ } -QMimeType Utility::mimeTypeForFile(const QString &filePath) -{ - return QMimeDatabase().mimeTypeForFile(filePath); -} - -} // namespace OCC +} // namespace OCC \ No newline at end of file diff --git a/src/common/utility_unix.cpp b/src/common/utility_unix.cpp index 3b9381a227377..77c8843abb263 100644 --- a/src/common/utility_unix.cpp +++ b/src/common/utility_unix.cpp @@ -150,9 +150,4 @@ void Utility::registerUriHandlerForLocalEditing() process.waitForFinished(); } -QMimeType Utility::mimeTypeForFile(const QString &filePath) -{ - return QMimeDatabase().mimeTypeForFile(filePath); -} - -} // namespace OCC +} // namespace OCC \ No newline at end of file diff --git a/src/common/utility_win.cpp b/src/common/utility_win.cpp index 6d63672a72c18..8e718e0202ee9 100644 --- a/src/common/utility_win.cpp +++ b/src/common/utility_win.cpp @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -45,19 +44,6 @@ static const char systemRunPathC[] = R"(HKEY_LOCAL_MACHINE\Software\Microsoft\Wi static const char runPathC[] = R"(HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run)"; namespace OCC { - -QString mimeNameForFile(const QString &filePath) -{ - LPWSTR mimeTypeFound = NULL; - HRESULT hr = FindMimeFromData(NULL, filePath.toStdWString().c_str(), NULL, 0, NULL, FMFD_URLASFILENAME, &mimeTypeFound, 0); - if (SUCCEEDED(hr)) { - const auto result = QString::fromWCharArray(mimeTypeFound); - CoTaskMemFree(mimeTypeFound); - return result; - } - - return {}; -} QVector Utility::queryProcessInfosKeepingFileOpen(const QString &filePath) { @@ -552,9 +538,4 @@ Utility::NtfsPermissionLookupRAII::~NtfsPermissionLookupRAII() qt_ntfs_permission_lookup--; } -QMimeType Utility::mimeTypeForFile(const QString &filePath) -{ - return QMimeDatabase().mimeTypeForName(mimeNameForFile(filePath)); -} - -} // namespace OCC +} // namespace OCC \ No newline at end of file diff --git a/src/csync/ConfigureChecks.cmake b/src/csync/ConfigureChecks.cmake index 7347c255a26a3..bd1a74be11f02 100644 --- a/src/csync/ConfigureChecks.cmake +++ b/src/csync/ConfigureChecks.cmake @@ -31,7 +31,7 @@ if (NOT LINUX) endif (NOT LINUX) if(WIN32) - set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} psapi kernel32 Rstrtmgr urlmon) + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} psapi kernel32 Rstrtmgr) endif() check_function_exists(utimes HAVE_UTIMES) diff --git a/src/gui/caseclashfilenamedialog.cpp b/src/gui/caseclashfilenamedialog.cpp index cc031db38755f..27ca251a69911 100644 --- a/src/gui/caseclashfilenamedialog.cpp +++ b/src/gui/caseclashfilenamedialog.cpp @@ -211,7 +211,7 @@ void CaseClashFilenameDialog::updateFileWidgetGroup(const QString &filePath, const auto fileSizeString = locale().formattedDataSize(filePathFileInfo.size()); const auto fileUrl = QUrl::fromLocalFile(filePath).toString(); const auto linkString = QStringLiteral("%2").arg(fileUrl, linkText); - const auto mime = Utility::mimeTypeForFile(_filePath); + const auto mime = QMimeDatabase().mimeTypeForFile(_filePath, QMimeDatabase::MatchExtension); QIcon fileTypeIcon; qCDebug(lcCaseClashConflictFialog) << filePath << filePathFileInfo.exists() << filename << lastModifiedString << fileSizeString << fileUrl << linkString << mime;