flatpak switch
This commit is contained in:
parent
4348a51d67
commit
4ddee5d32d
@ -21,6 +21,7 @@
|
|||||||
# Variables:
|
# Variables:
|
||||||
# BUILD_WITH_QT6 - Build either with Qt 6 or Qt 5.
|
# BUILD_WITH_QT6 - Build either with Qt 6 or Qt 5.
|
||||||
# NO_UPDATE_CHECK - Disable automatic checking for new application updates.
|
# NO_UPDATE_CHECK - Disable automatic checking for new application updates.
|
||||||
|
# IS_FLATPAK_BUILD - Set to "ON" when building RSS Guard with Flatpak.
|
||||||
# USE_WEBENGINE - if specified, then QtWebEngine module for internal web browser is used.
|
# USE_WEBENGINE - if specified, then QtWebEngine module for internal web browser is used.
|
||||||
# Otherwise simple text component is used and some features will be disabled.
|
# Otherwise simple text component is used and some features will be disabled.
|
||||||
# Default value is "false". If QtWebEngine is installed during compilation, then
|
# Default value is "false". If QtWebEngine is installed during compilation, then
|
||||||
@ -108,6 +109,7 @@ option(UPDATE_TRANSLATIONS "Call lupdate to update translation files from source
|
|||||||
option(FORCE_COLORED_OUTPUT "Always produce ANSI-colored output (GCC/Clang only)" OFF)
|
option(FORCE_COLORED_OUTPUT "Always produce ANSI-colored output (GCC/Clang only)" OFF)
|
||||||
option(REVISION_FROM_GIT "Get revision using `git rev-parse`" ON)
|
option(REVISION_FROM_GIT "Get revision using `git rev-parse`" ON)
|
||||||
option(NO_UPDATE_CHECK "Disable automatic checking for new application updates" OFF)
|
option(NO_UPDATE_CHECK "Disable automatic checking for new application updates" OFF)
|
||||||
|
option(IS_FLATPAK_BUILD "Set to 'ON' when building RSS Guard with Flatpak." OFF)
|
||||||
|
|
||||||
# Import Qt libraries.
|
# Import Qt libraries.
|
||||||
set(QT6_MIN_VERSION 6.3.0)
|
set(QT6_MIN_VERSION 6.3.0)
|
||||||
@ -197,6 +199,7 @@ add_compile_definitions(
|
|||||||
APP_URL="${APP_URL}"
|
APP_URL="${APP_URL}"
|
||||||
APP_LONG_NAME="${APP_NAME} ${CMAKE_PROJECT_VERSION}"
|
APP_LONG_NAME="${APP_NAME} ${CMAKE_PROJECT_VERSION}"
|
||||||
APP_LOW_NAME="${CMAKE_PROJECT_NAME}"
|
APP_LOW_NAME="${CMAKE_PROJECT_NAME}"
|
||||||
|
APP_REVERSE_NAME="com.github.${CMAKE_PROJECT_NAME}"
|
||||||
|
|
||||||
QT_USE_QSTRINGBUILDER
|
QT_USE_QSTRINGBUILDER
|
||||||
QT_USE_FAST_CONCATENATION
|
QT_USE_FAST_CONCATENATION
|
||||||
@ -209,6 +212,10 @@ if(NO_UPDATE_CHECK)
|
|||||||
add_compile_definitions(NO_UPDATE_CHECK)
|
add_compile_definitions(NO_UPDATE_CHECK)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(IS_FLATPAK_BUILD)
|
||||||
|
add_compile_definitions(IS_FLATPAK_BUILD)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Configure and copy some needed files.
|
# Configure and copy some needed files.
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
configure_file(
|
configure_file(
|
||||||
|
@ -3,8 +3,8 @@ Version=1.0
|
|||||||
Type=Application
|
Type=Application
|
||||||
Terminal=false
|
Terminal=false
|
||||||
Name=RSS Guard
|
Name=RSS Guard
|
||||||
TryExec=rssguard
|
TryExec=%1
|
||||||
Exec=rssguard
|
Exec=%1
|
||||||
Hidden=false
|
Hidden=false
|
||||||
X-GNOME-Autostart-Delay=15
|
X-GNOME-Autostart-Delay=15
|
||||||
X-LXQt-Need-Tray=true
|
X-LXQt-Need-Tray=true
|
@ -6,6 +6,7 @@
|
|||||||
#include "gui/dialogs/formupdate.h"
|
#include "gui/dialogs/formupdate.h"
|
||||||
#include "miscellaneous/application.h"
|
#include "miscellaneous/application.h"
|
||||||
#include "miscellaneous/systemfactory.h"
|
#include "miscellaneous/systemfactory.h"
|
||||||
|
#include "exceptions/applicationexception.h"
|
||||||
#include "network-web/networkfactory.h"
|
#include "network-web/networkfactory.h"
|
||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
@ -157,7 +158,22 @@ bool SystemFactory::setAutoStartStatus(AutoStartStatus new_status) {
|
|||||||
const QString source_autostart_desktop_file =
|
const QString source_autostart_desktop_file =
|
||||||
QString(APP_DESKTOP_ENTRY_PATH) + QDir::separator() + APP_DESKTOP_SOURCE_ENTRY_FILE;
|
QString(APP_DESKTOP_ENTRY_PATH) + QDir::separator() + APP_DESKTOP_SOURCE_ENTRY_FILE;
|
||||||
|
|
||||||
return QFile::copy(source_autostart_desktop_file, destination_file);
|
try {
|
||||||
|
QString desktop_file_contents = QString::fromUtf8(IOFactory::readFile(source_autostart_desktop_file));
|
||||||
|
|
||||||
|
#if defined(IS_FLATPAK_BUILD)
|
||||||
|
desktop_file_contents = desktop_file_contents.arg(QSL("flatpak run %1").arg(QSL(APP_REVERSE_NAME)));
|
||||||
|
#else
|
||||||
|
desktop_file_contents = desktop_file_contents.arg(QSL(APP_LOW_NAME));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
IOFactory::writeFile(destination_file, desktop_file_contents.toUtf8());
|
||||||
|
}
|
||||||
|
catch (const ApplicationException& ex) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
case AutoStartStatus::Disabled:
|
case AutoStartStatus::Disabled:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user