Fix build without systemd support

This commit is contained in:
Martchus 2019-07-13 12:57:35 +02:00
parent 2112b00347
commit 335913c8ca
4 changed files with 14 additions and 2 deletions

View File

@ -32,7 +32,9 @@ class MiscTests : public TestFixture {
CPPUNIT_TEST(testParsingConfig);
CPPUNIT_TEST(testSplittingArguments);
CPPUNIT_TEST(testUtils);
#ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD
CPPUNIT_TEST(testService);
#endif
CPPUNIT_TEST(testConnectionSettingsAndLoadingSelfSignedCert);
CPPUNIT_TEST(testSyncthingDir);
CPPUNIT_TEST_SUITE_END();
@ -43,7 +45,9 @@ public:
void testParsingConfig();
void testSplittingArguments();
void testUtils();
#ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD
void testService();
#endif
void testConnectionSettingsAndLoadingSelfSignedCert();
void testSyncthingDir();
@ -137,6 +141,7 @@ void MiscTests::testUtils()
CPPUNIT_ASSERT(!isLocal(QUrl(QStringLiteral("http://157.3.52.34"))));
}
#ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD
/*!
* \brief Tests SyncthingService class, but error case with non-existant service so far.
*/
@ -152,6 +157,7 @@ void MiscTests::testService()
service.toggleRunning();
service.setEnabled(true);
}
#endif
void MiscTests::testConnectionSettingsAndLoadingSelfSignedCert()
{

View File

@ -62,7 +62,9 @@ SyncthingApplet::SyncthingApplet(QObject *parent, const QVariantList &data)
, m_currentConnectionConfig(-1)
, m_initialized(false)
{
#ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD
m_notifier.setService(&m_service);
#endif
qmlRegisterUncreatableMetaObject(Data::staticMetaObject, "martchus.syncthingplasmoid", 0, 6, "Data", QStringLiteral("only enums"));
}
@ -221,7 +223,11 @@ void SyncthingApplet::setCurrentConnectionConfigIndex(int index)
bool SyncthingApplet::isStartStopEnabled() const
{
#ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD
return Settings::values().systemd.showButton;
#else
return false;
#endif
}
bool SyncthingApplet::areNotificationsAvailable() const

View File

@ -578,7 +578,7 @@ Settings::Launcher::LauncherStatus TrayWidget::handleLauncherStatusChanged()
const auto launcherStatus = applyLauncherSettings(false, systemdStatus.relevant, systemdStatus.showStartStopButton);
const auto showStartStopButton = systemdStatus.showStartStopButton || launcherStatus.showStartStopButton;
#else
const auto launcherStatus = applyLauncherSettings(reconnectRequired);
const auto launcherStatus = applyLauncherSettings(false);
const auto showStartStopButton = launcherStatus.showStartStopButton;
#endif
m_ui->startStopPushButton->setVisible(showStartStopButton);

View File

@ -5,8 +5,8 @@
#include "../../connector/syncthingnotifier.h"
#include "../../connector/syncthingprocess.h"
#ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD
#include "../../connector/syncthingconnection.h"
#ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD
#include "../../connector/syncthingservice.h"
#endif