We only need the local .desktop files in Verla and earlier :)

This commit is contained in:
Sebastian Wolf 2021-11-07 19:53:23 +01:00
parent a88abbb20f
commit f3242bf7db
No known key found for this signature in database
GPG key ID: CEA9522B5F38A90A
3 changed files with 39 additions and 32 deletions

View file

@ -12,7 +12,7 @@ Name: harbour-fernschreiber
Summary: Fernschreiber is a Telegram client for Sailfish OS
Version: 0.10
Release: 2
Release: 3
Group: Qt/Qt
License: LICENSE
URL: http://werkwolf.eu/

View file

@ -1,7 +1,7 @@
Name: harbour-fernschreiber
Summary: Fernschreiber is a Telegram client for Sailfish OS
Version: 0.10
Release: 2
Release: 3
# The contents of the Group field should be one of the groups listed here:
# https://github.com/mer-tools/spectacle/blob/master/data/GROUPS
Group: Qt/Qt

View file

@ -1901,7 +1901,10 @@ void TDLibWrapper::initializeOpenWith()
if (QFile::exists(openUrlFilePath)) {
LOG("Old open URL file exists, that needs to go away...!");
QFile::remove(openUrlFilePath);
QProcess::startDetached("update-desktop-database " + applicationsLocation);
}
// Something special for Verla...
if (sailfishOSMajorVersion == 4 && sailfishOSMinorVersion == 2) {
const QString sailfishBrowserFilePath(applicationsLocation + "/sailfish-browser.desktop");
if (!QFile::exists(sailfishBrowserFilePath)) {
LOG("Copying standard Sailfish Browser desktop file to " << sailfishBrowserFilePath);
@ -1913,13 +1916,16 @@ void TDLibWrapper::initializeOpenWith()
}
}
}
}
const QString desktopFilePath(applicationsLocation + "/harbour-fernschreiber-open-url.desktop");
QFile desktopFile(desktopFilePath);
if (desktopFile.exists()) {
LOG("Fernschreiber open-with file existing, removing and re-creating...");
LOG("Fernschreiber open-with file existing, removing...");
desktopFile.remove();
QProcess::startDetached("update-desktop-database " + applicationsLocation);
}
if (sailfishOSMajorVersion < 4 || (sailfishOSMajorVersion == 4 && sailfishOSMinorVersion < 3)) {
LOG("Creating Fernschreiber open-with file at " << desktopFile.fileName());
if (desktopFile.open(QIODevice::WriteOnly | QIODevice::Text)) {
QTextStream fileOut(&desktopFile);
@ -1942,6 +1948,7 @@ void TDLibWrapper::initializeOpenWith()
desktopFile.close();
QProcess::startDetached("update-desktop-database " + applicationsLocation);
}
}
QString dbusPathName = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/dbus-1/services";
QDir dbusPath(dbusPathName);