mobile-widgets: remove setTimeThreshold from system

Use qPrefLocationService::set_time_threshold and remove from
qmlprefs.cpp and qmlmanager.cpp

Remark: mobile UI shows time in minutes, while it is stored (and calculated)
in seconds. Therefore a /60 when reading and *60 when setting.

Signed-off-by: Jan Iversen <jani@apache.org>
This commit is contained in:
jan Iversen 2018-09-12 13:40:59 +02:00 committed by Dirk Hohndel
parent 504e912512
commit 51bc41b517
5 changed files with 3 additions and 34 deletions

View file

@ -293,11 +293,10 @@ Kirigami.ScrollablePage {
Controls.TextField { Controls.TextField {
id: timeThreshold id: timeThreshold
text: prefs.timeThreshold text: PrefLocationService.time_threshold / 60
Layout.preferredWidth: gridWidth * 0.25 Layout.preferredWidth: gridWidth * 0.25
onEditingFinished: { onEditingFinished: {
prefs.timeThreshold = timeThreshold.text PrefLocationService.time_threshold = timeThreshold.text * 60
manager.savePreferences()
} }
} }

View file

@ -406,7 +406,6 @@ void QMLManager::finishSetup()
appendTextToLog(tr("no cloud credentials")); appendTextToLog(tr("no cloud credentials"));
setStartPageText(RED_FONT + tr("Please enter valid cloud credentials.") + END_FONT); setStartPageText(RED_FONT + tr("Please enter valid cloud credentials.") + END_FONT);
} }
QMLPrefs::instance()->setTimeThreshold(qPrefLocationService::time_threshold() / 60);
} }
QMLManager::~QMLManager() QMLManager::~QMLManager()
@ -423,11 +422,6 @@ QMLManager *QMLManager::instance()
return m_instance; return m_instance;
} }
void QMLManager::savePreferences()
{
qPrefLocationService::set_time_threshold(QMLPrefs::instance()->timeThreshold() * 60);
}
#define CLOUDURL QString(prefs.cloud_base_url) #define CLOUDURL QString(prefs.cloud_base_url)
#define CLOUDREDIRECTURL CLOUDURL + "/cgi-bin/redirect.pl" #define CLOUDREDIRECTURL CLOUDURL + "/cgi-bin/redirect.pl"

View file

@ -146,7 +146,6 @@ public:
public slots: public slots:
void appInitialized(); void appInitialized();
void applicationStateChanged(Qt::ApplicationState state); void applicationStateChanged(Qt::ApplicationState state);
void savePreferences();
void saveCloudCredentials(); void saveCloudCredentials();
void tryRetrieveDataFromBackend(); void tryRetrieveDataFromBackend();
void handleError(QNetworkReply::NetworkError nError); void handleError(QNetworkReply::NetworkError nError);

View file

@ -12,8 +12,7 @@ QMLPrefs *QMLPrefs::m_instance = NULL;
QMLPrefs::QMLPrefs() : QMLPrefs::QMLPrefs() :
m_credentialStatus(qPrefCloudStorage::CS_UNKNOWN), m_credentialStatus(qPrefCloudStorage::CS_UNKNOWN),
m_oldStatus(qPrefCloudStorage::CS_UNKNOWN), m_oldStatus(qPrefCloudStorage::CS_UNKNOWN),
m_showPin(false), m_showPin(false)
m_timeThreshold(60)
{ {
// This strange construct is needed because QMLEngine calls new and that // This strange construct is needed because QMLEngine calls new and that
// cannot be overwritten // cannot be overwritten
@ -109,18 +108,6 @@ void QMLPrefs::setShowPin(bool enable)
emit showPinChanged(); emit showPinChanged();
} }
int QMLPrefs::timeThreshold() const
{
return m_timeThreshold;
}
void QMLPrefs::setTimeThreshold(int time)
{
m_timeThreshold = time;
GpsLocation::instance()->setGpsTimeThreshold(m_timeThreshold * 60);
emit timeThresholdChanged();
}
const QString QMLPrefs::theme() const const QString QMLPrefs::theme() const
{ {
return qPrefDisplay::theme(); return qPrefDisplay::theme();

View file

@ -37,11 +37,6 @@ class QMLPrefs : public QObject {
READ theme READ theme
WRITE setTheme WRITE setTheme
NOTIFY themeChanged) NOTIFY themeChanged)
Q_PROPERTY(int timeThreshold
MEMBER m_timeThreshold
WRITE setTimeThreshold
NOTIFY timeThresholdChanged)
public: public:
QMLPrefs(); QMLPrefs();
~QMLPrefs(); ~QMLPrefs();
@ -66,9 +61,6 @@ public:
bool showPin() const; bool showPin() const;
void setShowPin(bool enable); void setShowPin(bool enable);
int timeThreshold() const;
void setTimeThreshold(int time);
const QString theme() const; const QString theme() const;
void setTheme(QString theme); void setTheme(QString theme);
@ -84,7 +76,6 @@ private:
static QMLPrefs *m_instance; static QMLPrefs *m_instance;
qPrefCloudStorage::cloud_status m_oldStatus; qPrefCloudStorage::cloud_status m_oldStatus;
bool m_showPin; bool m_showPin;
int m_timeThreshold;
signals: signals:
void cloudPasswordChanged(); void cloudPasswordChanged();
@ -94,7 +85,6 @@ signals:
void oldStatusChanged(); void oldStatusChanged();
void showPinChanged(); void showPinChanged();
void themeChanged(); void themeChanged();
void timeThresholdChanged();
}; };
#endif #endif