2014-05-30 08:53:19 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2014-05-30 08:53:19 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2017-04-06 14:38:10 +00:00
|
|
|
#include "base/observer.h"
|
2016-05-25 17:59:21 +00:00
|
|
|
|
2017-02-28 14:05:30 +00:00
|
|
|
// legacy
|
2017-12-21 16:15:37 +00:00
|
|
|
bool filedialogGetSaveFile(
|
|
|
|
QString &file,
|
|
|
|
const QString &caption,
|
|
|
|
const QString &filter,
|
|
|
|
const QString &initialPath);
|
|
|
|
|
|
|
|
QString filedialogDefaultName(
|
|
|
|
const QString &prefix,
|
|
|
|
const QString &extension,
|
|
|
|
const QString &path = QString(),
|
|
|
|
bool skipExistance = false,
|
2018-02-03 19:52:35 +00:00
|
|
|
TimeId fileTime = TimeId(0));
|
2017-12-21 16:15:37 +00:00
|
|
|
QString filedialogNextFilename(
|
|
|
|
const QString &name,
|
|
|
|
const QString &cur,
|
|
|
|
const QString &path = QString());
|
2016-05-25 17:59:21 +00:00
|
|
|
|
2017-02-28 14:05:30 +00:00
|
|
|
namespace File {
|
|
|
|
|
|
|
|
// Those functions are async wrappers to Platform::File::Unsafe* calls.
|
|
|
|
void OpenEmailLink(const QString &email);
|
|
|
|
void OpenWith(const QString &filepath, QPoint menuPosition);
|
|
|
|
void Launch(const QString &filepath);
|
|
|
|
void ShowInFolder(const QString &filepath);
|
|
|
|
|
2019-09-03 08:43:29 +00:00
|
|
|
[[nodiscard]] QString DefaultDownloadPath();
|
|
|
|
|
2017-02-28 14:05:30 +00:00
|
|
|
namespace internal {
|
|
|
|
|
|
|
|
inline QString UrlToLocalDefault(const QUrl &url) {
|
|
|
|
return url.toLocalFile();
|
|
|
|
}
|
|
|
|
|
|
|
|
void UnsafeOpenEmailLinkDefault(const QString &email);
|
|
|
|
void UnsafeLaunchDefault(const QString &filepath);
|
|
|
|
|
|
|
|
} // namespace internal
|
|
|
|
} // namespace File
|
|
|
|
|
2016-05-25 17:59:21 +00:00
|
|
|
namespace FileDialog {
|
2017-02-28 15:43:03 +00:00
|
|
|
|
|
|
|
struct OpenResult {
|
|
|
|
QStringList paths;
|
|
|
|
QByteArray remoteContent;
|
|
|
|
};
|
2017-12-21 16:15:37 +00:00
|
|
|
void GetOpenPath(
|
2018-04-17 15:19:34 +00:00
|
|
|
QPointer<QWidget> parent,
|
2017-12-21 16:15:37 +00:00
|
|
|
const QString &caption,
|
|
|
|
const QString &filter,
|
2018-06-04 15:35:11 +00:00
|
|
|
Fn<void(OpenResult &&result)> callback,
|
|
|
|
Fn<void()> failed = Fn<void()>());
|
2017-12-21 16:15:37 +00:00
|
|
|
void GetOpenPaths(
|
2018-04-17 15:19:34 +00:00
|
|
|
QPointer<QWidget> parent,
|
2017-12-21 16:15:37 +00:00
|
|
|
const QString &caption,
|
|
|
|
const QString &filter,
|
2018-06-04 15:35:11 +00:00
|
|
|
Fn<void(OpenResult &&result)> callback,
|
|
|
|
Fn<void()> failed = Fn<void()>());
|
2017-12-21 16:15:37 +00:00
|
|
|
void GetWritePath(
|
2018-04-17 15:19:34 +00:00
|
|
|
QPointer<QWidget> parent,
|
2017-12-21 16:15:37 +00:00
|
|
|
const QString &caption,
|
|
|
|
const QString &filter,
|
|
|
|
const QString &initialPath,
|
2018-06-04 15:35:11 +00:00
|
|
|
Fn<void(QString &&result)> callback,
|
|
|
|
Fn<void()> failed = Fn<void()>());
|
2017-12-21 16:15:37 +00:00
|
|
|
void GetFolder(
|
2018-04-17 15:19:34 +00:00
|
|
|
QPointer<QWidget> parent,
|
2017-12-21 16:15:37 +00:00
|
|
|
const QString &caption,
|
|
|
|
const QString &initialPath,
|
2018-06-04 15:35:11 +00:00
|
|
|
Fn<void(QString &&result)> callback,
|
|
|
|
Fn<void()> failed = Fn<void()>());
|
2017-02-28 15:43:03 +00:00
|
|
|
|
|
|
|
QString AllFilesFilter();
|
|
|
|
|
2016-07-06 18:30:14 +00:00
|
|
|
namespace internal {
|
|
|
|
|
|
|
|
enum class Type {
|
|
|
|
ReadFile,
|
|
|
|
ReadFiles,
|
|
|
|
ReadFolder,
|
|
|
|
WriteFile,
|
|
|
|
};
|
|
|
|
|
2017-02-28 14:05:30 +00:00
|
|
|
void InitLastPathDefault();
|
|
|
|
|
2017-12-21 16:15:37 +00:00
|
|
|
bool GetDefault(
|
2018-04-17 15:19:34 +00:00
|
|
|
QPointer<QWidget> parent,
|
2017-12-21 16:15:37 +00:00
|
|
|
QStringList &files,
|
|
|
|
QByteArray &remoteContent,
|
|
|
|
const QString &caption,
|
|
|
|
const QString &filter,
|
|
|
|
::FileDialog::internal::Type type,
|
|
|
|
QString startFile);
|
2017-02-28 14:05:30 +00:00
|
|
|
|
2016-07-06 18:30:14 +00:00
|
|
|
} // namespace internal
|
2016-05-25 17:59:21 +00:00
|
|
|
} // namespace FileDialog
|