Compatibility with earlier SFOS versions is hard...
This commit is contained in:
parent
db655d766f
commit
a88abbb20f
1 changed files with 31 additions and 12 deletions
|
@ -1882,8 +1882,22 @@ void TDLibWrapper::setLogVerbosityLevel()
|
|||
void TDLibWrapper::initializeOpenWith()
|
||||
{
|
||||
LOG("Initialize open-with");LOG("Checking standard open URL file...");
|
||||
|
||||
const QStringList sailfishOSVersion = QSysInfo::productVersion().split(".");
|
||||
int sailfishOSMajorVersion = sailfishOSVersion.value(0).toInt();
|
||||
int sailfishOSMinorVersion = sailfishOSVersion.value(1).toInt();
|
||||
|
||||
const QString applicationsLocation(QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation));
|
||||
const QString openUrlFilePath(applicationsLocation + "/open-url.desktop");
|
||||
if (sailfishOSMajorVersion < 4 || ( sailfishOSMajorVersion == 4 && sailfishOSMinorVersion < 2 )) {
|
||||
if (QFile::exists(openUrlFilePath)) {
|
||||
LOG("Standard open URL file exists, good!");
|
||||
} else {
|
||||
LOG("Copying standard open URL file to " << openUrlFilePath);
|
||||
QFile::copy("/usr/share/applications/open-url.desktop", openUrlFilePath);
|
||||
QProcess::startDetached("update-desktop-database " + applicationsLocation);
|
||||
}
|
||||
} else {
|
||||
if (QFile::exists(openUrlFilePath)) {
|
||||
LOG("Old open URL file exists, that needs to go away...!");
|
||||
QFile::remove(openUrlFilePath);
|
||||
|
@ -1898,6 +1912,7 @@ void TDLibWrapper::initializeOpenWith()
|
|||
LOG("ERROR copying standard Sailfish Browser desktop file to " << sailfishBrowserFilePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const QString desktopFilePath(applicationsLocation + "/harbour-fernschreiber-open-url.desktop");
|
||||
QFile desktopFile(desktopFilePath);
|
||||
|
@ -1914,7 +1929,11 @@ void TDLibWrapper::initializeOpenWith()
|
|||
fileOut << QString("Name=Fernschreiber").toUtf8() << "\n";
|
||||
fileOut << QString("Icon=harbour-fernschreiber").toUtf8() << "\n";
|
||||
fileOut << QString("NotShowIn=X-MeeGo;").toUtf8() << "\n";
|
||||
if (sailfishOSMajorVersion < 4 || ( sailfishOSMajorVersion == 4 && sailfishOSMinorVersion < 1 )) {
|
||||
fileOut << QString("MimeType=text/html;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/tg;").toUtf8() << "\n";
|
||||
} else {
|
||||
fileOut << QString("MimeType=x-url-handler/t.me;x-scheme-handler/tg;").toUtf8() << "\n";
|
||||
}
|
||||
fileOut << QString("X-Maemo-Service=de.ygriega.fernschreiber").toUtf8() << "\n";
|
||||
fileOut << QString("X-Maemo-Object-Path=/de/ygriega/fernschreiber").toUtf8() << "\n";
|
||||
fileOut << QString("X-Maemo-Method=de.ygriega.fernschreiber.openUrl").toUtf8() << "\n";
|
||||
|
|
Loading…
Reference in a new issue