diff options
Diffstat (limited to 'launcher/src/homescreenhandler.cpp')
-rw-r--r-- | launcher/src/homescreenhandler.cpp | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/launcher/src/homescreenhandler.cpp b/launcher/src/homescreenhandler.cpp index 9f15b6a..99ced2e 100644 --- a/launcher/src/homescreenhandler.cpp +++ b/launcher/src/homescreenhandler.cpp @@ -18,8 +18,15 @@ #include <QFileInfo> #include "homescreenhandler.h" #include <functional> +#include <QProcess> +#include <dirent.h> +#include <stdio.h> #include "hmi-debug.h" +#include "afm_user_daemon_proxy.h" +extern org::AGL::afm::user *afm_user_daemon_proxy; + +#define BUF_SIZE 1024 void* HomescreenHandler::myThis = 0; HomescreenHandler::HomescreenHandler(QObject *parent) : @@ -145,6 +152,51 @@ void HomescreenHandler::onRep(struct json_object* reply_contents) } } +void HomescreenHandler::hideWindow(QString application_id) +{ + mp_hs->hideWindow(application_id.section('@', 0, 0).toStdString().c_str()); +} + +void HomescreenHandler::registerShortcut(QString shortcut_id, QString shortcut_name, QString position) +{ + struct json_object* j_obj = json_object_new_object(); + struct json_object* val_id = json_object_new_string(shortcut_id.toStdString().c_str()); + struct json_object* val_name = json_object_new_string(shortcut_name.toStdString().c_str()); + struct json_object* val_position = json_object_new_string(position.toStdString().c_str()); + json_object_object_add(j_obj, "shortcut_id", val_id); + json_object_object_add(j_obj, "shortcut_name", val_name); + json_object_object_add(j_obj, "position", val_position); + + mp_hs->registerShortcut(j_obj); +} + +int HomescreenHandler::uninstallApplication(QString application_id) +{ + int result = -1; + HMI_DEBUG("launcher","Application uninstall %s.", application_id.toStdString().c_str()); + + result = afm_user_daemon_proxy->uninstall(application_id).value().toInt(); + HMI_DEBUG("launcher","ApplicationUninstall pid: %d.", result); + +// QProcess *process = new QProcess(); +// QString command = "/usr/bin/pkill " + application_id.section('@', 0, 0); +// HMI_DEBUG("launcher", "command is %s", command.toStdString().c_str()); +// process->start(command); + + return result; +} + +void HomescreenHandler::sendAppToMeter(QString application_id) +{ + HMI_DEBUG("Launcher","sendAppToMeter %s", application_id.toStdString().c_str()); + struct json_object* j_json = json_object_new_object(); + struct json_object* value; + value = json_object_new_string("master.split.sub"); + json_object_object_add(j_json, "area", value); + + mp_hs->showWindow(application_id.section('@', 0, 0).toStdString().c_str(), j_json); +} + void HomescreenHandler::getRunnables(void) { mp_hs->getRunnables(); |