add registerShortCut
authorwang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>
Sat, 13 Apr 2019 02:42:23 +0000 (10:42 +0800)
committerwang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>
Sat, 13 Apr 2019 02:42:23 +0000 (10:42 +0800)
Change-Id: I1a1f433e4d788765f5214a948ea44f3c779ff965

include/libhomescreen.hpp
src/libhomescreen.cpp

index 0fed49f..b7aae77 100644 (file)
@@ -47,7 +47,8 @@ public:
                Event_HideWindow,
                Event_ReplyShowWindow,
                Event_ShowNotification,
-               Event_ShowInformation
+               Event_ShowInformation,
+               Event_RegisterShortCut
        };
 
        /* Key for json obejct */
index 121def7..f302c3b 100644 (file)
@@ -47,7 +47,8 @@ const std::vector<std::string> LibHomeScreen::api_list {
        std::string("hideWindow"),
        std::string("replyShowWindow"),
        std::string("showNotification"),
-       std::string("showInformation")
+       std::string("showInformation"),
+       std::string("registerShortcut")
 };
 
 const std::vector<std::string> LibHomeScreen::event_list {
@@ -59,6 +60,7 @@ const std::vector<std::string> LibHomeScreen::event_list {
        std::string("replyShowWindow"),
        std::string("showNotification"),
        std::string("showInformation"),
+       std::string("registerShortcut"),
        std::string("none")
 };
 
@@ -326,6 +328,9 @@ void LibHomeScreen::set_event_handler(enum EventType et, handler_func f)
                        case Event_ShowInformation:
                                this->subscribe(LibHomeScreen::event_list[6]);
                                break;
+                       case Event_RegisterShortCut:
+                               this->subscribe(LibHomeScreen::event_list[7]);
+                               break;
                }
 
                this->handlers[et] = std::move(f);
@@ -692,6 +697,12 @@ void LibHomeScreen::on_event(void *closure, const char *event, struct afb_wsj1_m
                        i->second(json_data);
                }
        }
+       else if (strcasecmp(event_type, LibHomeScreen::event_list[7].c_str()) == 0) {
+               auto i = this->handlers.find(Event_RegisterShortCut);
+               if ( i != this->handlers.end() ) {
+                       i->second(json_data);
+               }
+       }
 }
 
 /**