MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / GetOpenPath

Function GetOpenPath

Telegram/SourceFiles/core/file_utilities.cpp:203–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

201namespace FileDialog {
202
203void GetOpenPath(
204 QPointer<QWidget> parent,
205 const QString &caption,
206 const QString &filter,
207 Fn<void(OpenResult &&result)> callback,
208 Fn<void()> failed) {
209 InvokeQueued(QCoreApplication::instance(), [=] {
210 auto files = QStringList();
211 auto remoteContent = QByteArray();
212 Ui::PreventDelayedActivation();
213 const auto success = Platform::FileDialog::Get(
214 parent,
215 files,
216 remoteContent,
217 caption,
218 filter,
219 FileDialog::internal::Type::ReadFile);
220 if (success
221 && ((!files.isEmpty() && !files[0].isEmpty())
222 || !remoteContent.isEmpty())) {
223 if (callback) {
224 auto result = OpenResult();
225 if (!files.isEmpty() && !files[0].isEmpty()) {
226 result.paths.push_back(files[0]);
227 }
228 result.remoteContent = remoteContent;
229 callback(std::move(result));
230 }
231 } else if (failed) {
232 failed();
233 }
234 });
235}
236
237void GetOpenPaths(
238 QPointer<QWidget> parent,

Callers 15

performSwitchToCustomMethod · 0.85
ImportFromFileFunction · 0.85
importThemeMethod · 0.85
pushBlockMethod · 0.85
setupContentMethod · 0.85
RingtonesBoxFunction · 0.85
OpenCreateStickerFlowFunction · 0.85
chooseFromFileMethod · 0.85
ChooseReplacementFunction · 0.85
setupEditCoverHandlerMethod · 0.85
GenerateCodesFunction · 0.85

Calls 5

QByteArrayClass · 0.85
OpenResultClass · 0.85
instanceFunction · 0.50
GetFunction · 0.50
isEmptyMethod · 0.45

Tested by

no test coverage detected