2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Show choose file box over the passport panel.

This commit is contained in:
John Preston
2018-04-17 19:19:34 +04:00
parent 6c2a39f1fc
commit 67ea175fc6
21 changed files with 170 additions and 47 deletions

View File

@@ -139,8 +139,14 @@ bool PreviewSupported() {
&& (Libs::gdk_pixbuf_new_from_file_at_size != nullptr);
}
bool GetNative(QStringList &files, QByteArray &remoteContent, const QString &caption, const QString &filter, Type type, QString startFile) {
auto parent = Messenger::Instance().getFileDialogParent();
bool GetNative(
QPointer<QWidget> parent,
QStringList &files,
QByteArray &remoteContent,
const QString &caption,
const QString &filter,
Type type,
QString startFile) {
internal::GtkFileDialog dialog(parent, caption, QString(), filter);
dialog.setModal(true);
@@ -185,13 +191,34 @@ bool GetNative(QStringList &files, QByteArray &remoteContent, const QString &cap
} // namespace
bool Get(QStringList &files, QByteArray &remoteContent, const QString &caption, const QString &filter, Type type, QString startFile) {
bool Get(
QPointer<QWidget> parent,
QStringList &files,
QByteArray &remoteContent,
const QString &caption,
const QString &filter,
Type type,
QString startFile) {
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION
if (NativeSupported()) {
return GetNative(files, remoteContent, caption, filter, type, startFile);
return GetNative(
parent,
files,
remoteContent,
caption,
filter,
type,
startFile);
}
#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION
return ::FileDialog::internal::GetDefault(files, remoteContent, caption, filter, type, startFile);
return ::FileDialog::internal::GetDefault(
parent,
files,
remoteContent,
caption,
filter,
type,
startFile);
}
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION