2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Sami Rämö - sami.ramo@ixonos.com
7 Situare is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 version 2 as published by the Free Software Foundation.
11 Situare is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with Situare; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
27 #include "updatelocation.h"
29 const QString UNSENT_MESSAGE_SETTING = "UNSENT_MESSAGE";
30 const QString UNSENT_MESSAGE_PUBLISH_SETTING = "UNSENT_MESSAGE_PUBLISH";
32 UpdateLocation::UpdateLocation(QObject *parent) :
36 qWarning() << __PRETTY_FUNCTION__;
38 QSettings settings(SETTINGS_ORGANIZATION_NAME, SETTINGS_APPLICATION_NAME);
39 m_message = settings.value(UNSENT_MESSAGE_SETTING).toString();
40 m_publish = settings.value(UNSENT_MESSAGE_PUBLISH_SETTING, false).toBool();
43 UpdateLocation::~UpdateLocation()
45 qWarning() << __PRETTY_FUNCTION__;
47 QSettings settings(SETTINGS_ORGANIZATION_NAME, SETTINGS_APPLICATION_NAME);
49 if (!m_message.isEmpty()) {
50 settings.setValue(UNSENT_MESSAGE_SETTING, m_message);
51 settings.setValue(UNSENT_MESSAGE_PUBLISH_SETTING, m_publish);
53 settings.remove(UNSENT_MESSAGE_SETTING);
54 settings.remove(UNSENT_MESSAGE_PUBLISH_SETTING);
58 void UpdateLocation::clear()
60 qWarning() << __PRETTY_FUNCTION__;
66 QString UpdateLocation::message() const
68 qWarning() << __PRETTY_FUNCTION__;
73 void UpdateLocation::send()
75 qWarning() << __PRETTY_FUNCTION__;
77 emit locationUpdate(m_message, m_publish);
80 void UpdateLocation::setMessage(const QString &message)
82 qWarning() << __PRETTY_FUNCTION__;
84 if (message != m_message) {
86 emit messageChanged();
90 bool UpdateLocation::publish() const
92 qWarning() << __PRETTY_FUNCTION__;
97 void UpdateLocation::setPublish(bool publish)
99 qWarning() << __PRETTY_FUNCTION__;
101 if (publish != m_publish) {
103 emit publishChanged();