platform_file_utilities.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. This file is part of Telegram Desktop,
  3. the official desktop application for the Telegram messaging service.
  4. For license and copyright information please follow this link:
  5. https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
  6. */
  7. #pragma once
  8. #include "core/file_utilities.h"
  9. namespace Platform {
  10. namespace File {
  11. QString UrlToLocal(const QUrl &url);
  12. // All these functions may enter a nested event loop. Use with caution.
  13. void UnsafeOpenUrl(const QString &url);
  14. void UnsafeOpenEmailLink(const QString &email);
  15. bool UnsafeShowOpenWithDropdown(const QString &filepath);
  16. bool UnsafeShowOpenWith(const QString &filepath);
  17. void UnsafeLaunch(const QString &filepath);
  18. void PostprocessDownloaded(const QString &filepath);
  19. } // namespace File
  20. namespace FileDialog {
  21. void InitLastPath();
  22. bool Get(
  23. QPointer<QWidget> parent,
  24. QStringList &files,
  25. QByteArray &remoteContent,
  26. const QString &caption,
  27. const QString &filter,
  28. ::FileDialog::internal::Type type,
  29. QString startFile = QString());
  30. } // namespace FileDialog
  31. } // namespace Platform
  32. // Platform dependent implementations.
  33. #if defined Q_OS_WINRT || defined Q_OS_WIN
  34. #include "platform/win/file_utilities_win.h"
  35. #elif defined Q_OS_MAC // Q_OS_WINRT || Q_OS_WIN
  36. #include "platform/mac/file_utilities_mac.h"
  37. #else // Q_OS_WINRT || Q_OS_WIN || Q_OS_MAC
  38. #include "platform/linux/file_utilities_linux.h"
  39. #endif // else for Q_OS_WINRT || Q_OS_WIN || Q_OS_MAC