From fb86d72c41a7e121ade7ec380d5a60bd0b696db9 Mon Sep 17 00:00:00 2001 From: "Uwe L. Korn" Date: Tue, 28 Jan 2014 22:40:02 +0000 Subject: [PATCH] Add sendJsonOk --- src/libtomahawk-playdarapi/Api_v1.cpp | 8 ++++++++ src/libtomahawk-playdarapi/Api_v1.h | 1 + 2 files changed, 9 insertions(+) diff --git a/src/libtomahawk-playdarapi/Api_v1.cpp b/src/libtomahawk-playdarapi/Api_v1.cpp index 3b4e835df..96f339931 100644 --- a/src/libtomahawk-playdarapi/Api_v1.cpp +++ b/src/libtomahawk-playdarapi/Api_v1.cpp @@ -515,6 +515,14 @@ Api_v1::apiCallFailed( QxtWebRequestEvent* event, const QString& method ) sendPlain404( event, QString( "Method \"%1\" for API 1.5 not found" ).arg( method ), "Method in API 1.5 not found" ); } +void +Api_v1::sendJsonOk( QxtWebRequestEvent* event ) +{ + QxtWebPageEvent * e = new QxtWebPageEvent( event->sessionID, event->requestID, "{ result: \"ok\" }" ); + e->contentType = "application/json"; + postEvent( e ); +} + void Api_v1::sendJsonError( QxtWebRequestEvent* event, const QString& message ) diff --git a/src/libtomahawk-playdarapi/Api_v1.h b/src/libtomahawk-playdarapi/Api_v1.h index c835f9179..88b12b2f5 100644 --- a/src/libtomahawk-playdarapi/Api_v1.h +++ b/src/libtomahawk-playdarapi/Api_v1.h @@ -83,6 +83,7 @@ public slots: // load an html template from a file, replace args from map // then serve void sendJsonError( QxtWebRequestEvent* event, const QString& message ); + void sendJsonOk( QxtWebRequestEvent* event ); void sendWebpageWithArgs( QxtWebRequestEvent* event, const QString& filenameSource, const QHash< QString, QString >& args ); void index( QxtWebRequestEvent* event );