Commit 33e6bbfa authored by Volker Krause's avatar Volker Krause

Connect settings to live data manager

parent 7ab650d1
......@@ -51,7 +51,9 @@ using namespace KItinerary;
LiveDataManager::LiveDataManager(QObject *parent)
: QObject(parent)
{
m_ptMgr.reset(new KPublicTransport::Manager);
}
LiveDataManager::~LiveDataManager() = default;
......@@ -83,6 +85,16 @@ void LiveDataManager::setPkPassManager(PkPassManager *pkPassMgr)
m_pkPassMgr = pkPassMgr;
}
void LiveDataManager::setPollingEnabled(bool pollingEnabled)
{
// TODO
}
void LiveDataManager::setAllowInsecureServices(bool allowInsecure)
{
m_ptMgr->setAllowInsecureBackends(allowInsecure);
}
QVariant LiveDataManager::arrival(const QString &resId)
{
return QVariant::fromValue(m_arrivals.value(resId).change);
......@@ -152,10 +164,6 @@ static KPublicTransport::Location locationFromStation(const TrainStation &statio
void LiveDataManager::checkTrainTrip(const TrainTrip& trip, const QString& resId)
{
qCDebug(Log) << trip.trainName() << trip.trainNumber() << trip.departureTime();
if (!m_ptMgr) {
m_ptMgr.reset(new KPublicTransport::Manager);
}
using namespace KPublicTransport;
DepartureRequest req(locationFromStation(trip.departureStation()));
......
......@@ -50,6 +50,9 @@ public:
void setReservationManager(ReservationManager *resMgr);
void setPkPassManager(PkPassManager *pkPassMgr);
void setPollingEnabled(bool pollingEnabled);
void setAllowInsecureServices(bool allowInsecure);
Q_INVOKABLE QVariant arrival(const QString &resId);
Q_INVOKABLE QVariant departure(const QString &resId);
......
......@@ -138,6 +138,10 @@ int main(int argc, char **argv)
LiveDataManager liveDataMgr;
liveDataMgr.setPkPassManager(&passMgr);
liveDataMgr.setReservationManager(&resMgr);
liveDataMgr.setPollingEnabled(settings.queryLiveData());
liveDataMgr.setAllowInsecureServices(settings.allowInsecureServices());
QObject::connect(&settings, &Settings::queryLiveDataChanged, &liveDataMgr, &LiveDataManager::setPollingEnabled);
QObject::connect(&settings, &Settings::allowInsecureServicesChanged, &liveDataMgr, &LiveDataManager::setAllowInsecureServices);
#ifndef Q_OS_ANDROID
QObject::connect(&service, &KDBusService::activateRequested, [&parser, &appController](const QStringList &args, const QString &workingDir) {
......
......@@ -93,7 +93,7 @@ void Settings::setQueryLiveData(bool queryLiveData)
s.beginGroup(QLatin1String("Settings"));
s.setValue(QLatin1String("QueryLiveData"), queryLiveData);
emit queryLiveDataChanged();
emit queryLiveDataChanged(queryLiveData);
}
......@@ -113,5 +113,5 @@ void Settings::setAllowInsecureServices(bool allowInsecure)
s.beginGroup(QLatin1String("Settings"));
s.setValue(QLatin1String("AllowInsecureServices"), allowInsecure);
emit allowInsecureServicesChanged();
emit allowInsecureServicesChanged(allowInsecure);
}
......@@ -46,8 +46,8 @@ public:
signals:
void weatherForecastEnabledChanged(bool enabled);
void homeCountryIsoCodeChanged(const QString &isoCode);
void queryLiveDataChanged();
void allowInsecureServicesChanged();
void queryLiveDataChanged(bool enabled);
void allowInsecureServicesChanged(bool allowed);
private:
QString m_homeCountry;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment