diff options
author | Javier S. Pedro <maemo@javispedro.com> | 2013-04-02 18:36:21 +0200 |
---|---|---|
committer | Javier S. Pedro <maemo@javispedro.com> | 2013-04-02 18:36:21 +0200 |
commit | ea2ac1ddd74c1d97f094a4e56f2c038b5fef6351 (patch) | |
tree | 92376ef4a33ef46d9ab6d464732e0ca06d2cee1e /fetchboardconfigaction.cpp | |
parent | 70afca89b21dda18dc5e94858bec472da9130cda (diff) | |
download | tapasboard-ea2ac1ddd74c1d97f094a4e56f2c038b5fef6351.tar.gz tapasboard-ea2ac1ddd74c1d97f094a4e56f2c038b5fef6351.zip |
add some support for smilies
Diffstat (limited to 'fetchboardconfigaction.cpp')
-rw-r--r-- | fetchboardconfigaction.cpp | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/fetchboardconfigaction.cpp b/fetchboardconfigaction.cpp deleted file mode 100644 index 2364dd1..0000000 --- a/fetchboardconfigaction.cpp +++ /dev/null @@ -1,56 +0,0 @@ -#include <QtCore/QDateTime> -#include <QtCore/QDebug> -#include <QtSql/QSqlQuery> - -#include "board.h" -#include "xmlrpcinterface.h" -#include "xmlrpcreply.h" -#include "fetchboardconfigaction.h" - -FetchBoardConfigAction::FetchBoardConfigAction(Board *board) : - Action(board) -{ -} - -bool FetchBoardConfigAction::isSupersetOf(Action *action) const -{ - // If 'action' is also a fetch board config action then yes, this supersets 'action'. - return qobject_cast<FetchBoardConfigAction*>(action) != 0; -} - -void FetchBoardConfigAction::execute() -{ - _call = _board->service()->asyncCall("get_config"); - connect(_call, SIGNAL(finished(XmlRpcPendingCall*)), SLOT(handleFinishedCall())); -} - -void FetchBoardConfigAction::handleFinishedCall() -{ - XmlRpcReply<QVariantMap> result(_call); - if (result.isValid()) { - QVariantMap map = result; - QSqlDatabase db = _board->database(); - db.transaction(); - QSqlQuery query(db); - - // Let's add some of our config settings - map["last_config_fetch"] = QDateTime::currentDateTimeUtc().toString(Qt::ISODate); - map["tapasboard_db_version"] = Board::CURRENT_DB_VERSION; - - query.prepare("INSERT OR REPLACE INTO config (key, value) VALUES (:key, :value)"); - for (QVariantMap::iterator i = map.begin(); i != map.end(); i++) { - query.bindValue(":key", i.key()); - query.bindValue(":value", i.value().toString()); - if (!query.exec()) { - qWarning() << "Failed to set config key:" << i.key(); - } - } - db.commit(); - _board->notifyConfigChanged(); - } else { - qWarning() << "Could not fetch board configuration"; - // TODO emit error ... - } - emit finished(this); - _call->deleteLater(); -} |