2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 22:55:11 +00:00

Move icon name getter to cross-platform header

This commit is contained in:
Ilya Fedin
2022-09-19 06:58:27 +04:00
committed by John Preston
parent 5132fd5010
commit d9318c9935
7 changed files with 37 additions and 31 deletions

View File

@@ -26,6 +26,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <KUrlMimeData>
#endif
#if __has_include(<KSandbox>)
#include <KSandbox>
#endif
#define qsl(s) QStringLiteral(s)
namespace base {
@@ -45,6 +49,27 @@ inline auto GetMimeUrls(const QMimeData *data) {
#endif
}
#if __has_include(<KSandbox>) && defined DeclareReadSetting
inline QString FlatpakID() {
static const auto Result = [] {
if (!qEnvironmentVariableIsEmpty("FLATPAK_ID")) {
return qEnvironmentVariable("FLATPAK_ID");
} else {
return cExeName();
}
}();
return Result;
}
inline QString IconName() {
static const auto Result = KSandbox::isFlatpak()
? FlatpakID()
: qsl("telegram");
return Result;
}
#endif
} // namespace base
static const int32 ScrollMax = INT_MAX;