mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 06:35:14 +00:00
Fix QGuiApplication::desktopFileName usage
The Qt documentation says: This is the file name, without the full path or the trailing ".desktop" extension of the desktop entry that represents this application according to the freedesktop desktop entry specification. Qt 6.5.2 also automatically fixes it breaking all the current tdesktop and desktop-app usage expecting the file extension.
This commit is contained in:
@@ -209,9 +209,7 @@ void LinuxIntegration::initInhibit() {
|
||||
}
|
||||
|
||||
void LinuxIntegration::LaunchNativeApplication() {
|
||||
const auto appId = QGuiApplication::desktopFileName()
|
||||
.chopped(8)
|
||||
.toStdString();
|
||||
const auto appId = QGuiApplication::desktopFileName().toStdString();
|
||||
|
||||
const auto app = Glib::wrap(
|
||||
G_APPLICATION(
|
||||
|
@@ -118,9 +118,7 @@ void XCBSetDesktopFileName(QWindow *window) {
|
||||
base::Platform::XCB::GetAtom(connection, "_KDE_NET_WM_DESKTOP_FILE"),
|
||||
};
|
||||
|
||||
const auto filename = QGuiApplication::desktopFileName()
|
||||
.chopped(8)
|
||||
.toUtf8();
|
||||
const auto filename = QGuiApplication::desktopFileName().toUtf8();
|
||||
|
||||
for (const auto atom : filenameAtoms) {
|
||||
if (atom.has_value()) {
|
||||
@@ -244,7 +242,8 @@ void MainWindow::updateUnityCounter() {
|
||||
|
||||
const auto launcherUrl = Glib::ustring(
|
||||
"application://"
|
||||
+ QGuiApplication::desktopFileName().toStdString());
|
||||
+ QGuiApplication::desktopFileName().toStdString()
|
||||
+ ".desktop");
|
||||
const auto counterSlice = std::min(Core::App().unreadBadge(), 9999);
|
||||
std::map<Glib::ustring, Glib::VariantBase> dbusUnityProperties;
|
||||
|
||||
|
@@ -591,7 +591,7 @@ bool NotificationData::init(
|
||||
_hints["category"] = Glib::Variant<Glib::ustring>::create("im.received");
|
||||
|
||||
_hints["desktop-entry"] = Glib::Variant<Glib::ustring>::create(
|
||||
QGuiApplication::desktopFileName().chopped(8).toStdString());
|
||||
QGuiApplication::desktopFileName().toStdString());
|
||||
|
||||
_notificationClosedSignalId = _dbusConnection->signal_subscribe(
|
||||
signalEmitted,
|
||||
|
@@ -191,7 +191,9 @@ bool GenerateDesktopFile(
|
||||
if (!QDir(targetPath).exists()) QDir().mkpath(targetPath);
|
||||
|
||||
const auto sourceFile = kDesktopFile.utf16();
|
||||
const auto targetFile = targetPath + QGuiApplication::desktopFileName();
|
||||
const auto targetFile = targetPath
|
||||
+ QGuiApplication::desktopFileName()
|
||||
+ u".desktop"_q;
|
||||
|
||||
const auto sourceText = [&] {
|
||||
QFile source(sourceFile);
|
||||
@@ -332,7 +334,7 @@ bool GenerateServiceFile(bool silent = false) {
|
||||
QStandardPaths::GenericDataLocation) + u"/dbus-1/services/"_q;
|
||||
|
||||
const auto targetFile = targetPath
|
||||
+ QGuiApplication::desktopFileName().chopped(8)
|
||||
+ QGuiApplication::desktopFileName()
|
||||
+ u".service"_q;
|
||||
|
||||
DEBUG_LOG(("App Info: placing .service file to %1").arg(targetPath));
|
||||
@@ -344,7 +346,7 @@ bool GenerateServiceFile(bool silent = false) {
|
||||
target->set_string(
|
||||
group,
|
||||
"Name",
|
||||
QGuiApplication::desktopFileName().chopped(8).toStdString());
|
||||
QGuiApplication::desktopFileName().toStdString());
|
||||
|
||||
target->set_string(
|
||||
group,
|
||||
@@ -455,7 +457,9 @@ void AutostartToggle(bool enabled, Fn<void(bool)> done) {
|
||||
|
||||
if (!enabled) {
|
||||
return QFile::remove(
|
||||
autostart + QGuiApplication::desktopFileName());
|
||||
autostart
|
||||
+ QGuiApplication::desktopFileName()
|
||||
+ u".desktop"_q);
|
||||
}
|
||||
|
||||
return GenerateDesktopFile(
|
||||
@@ -557,14 +561,13 @@ void start() {
|
||||
|
||||
QGuiApplication::setDesktopFileName([&] {
|
||||
if (KSandbox::isFlatpak()) {
|
||||
return qEnvironmentVariable("FLATPAK_ID") + u".desktop"_q;
|
||||
return qEnvironmentVariable("FLATPAK_ID");
|
||||
}
|
||||
|
||||
if (KSandbox::isSnap()) {
|
||||
return qEnvironmentVariable("SNAP_INSTANCE_NAME")
|
||||
+ '_'
|
||||
+ cExeName()
|
||||
+ u".desktop"_q;
|
||||
+ cExeName();
|
||||
}
|
||||
|
||||
if (!Core::UpdaterDisabled()) {
|
||||
@@ -579,14 +582,13 @@ void start() {
|
||||
md5Hash.data());
|
||||
}
|
||||
|
||||
return u"org.telegram.desktop._%1.desktop"_q.arg(
|
||||
md5Hash.constData());
|
||||
return u"org.telegram.desktop._%1"_q.arg(md5Hash.constData());
|
||||
}
|
||||
|
||||
return u"org.telegram.desktop.desktop"_q;
|
||||
return u"org.telegram.desktop"_q;
|
||||
}());
|
||||
|
||||
LOG(("Launcher filename: %1").arg(QGuiApplication::desktopFileName()));
|
||||
LOG(("App ID: %1").arg(QGuiApplication::desktopFileName()));
|
||||
|
||||
if (!qEnvironmentVariableIsSet("XDG_ACTIVATION_TOKEN")
|
||||
&& qEnvironmentVariableIsSet("DESKTOP_STARTUP_ID")) {
|
||||
|
Submodule Telegram/lib_base updated: 9aaee89076...4efa613fe3
Submodule Telegram/lib_webview updated: 5c3e82bfe7...ec24c7a960
Reference in New Issue
Block a user