License version update and prevent issue resolved
[apps/native/ug-wifi-direct.git] / popup-wifidirect / src / wfd-app-popup-view.c
index c6459b8..2dd5c97 100755 (executable)
@@ -1,13 +1,13 @@
 /*
 *  WiFi-Direct UG
 *
-* Copyright 2012  Samsung Electronics Co., Ltd
+* Copyright 2012-2013 Samsung Electronics Co., Ltd
 
-* Licensed under the Flora License, Version 1.0 (the "License");
+* Licensed under the Flora License, Version 1.1 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 
-* http://www.tizenopensource.org/license
+* http://floralicense.org/license
 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
@@ -28,6 +28,8 @@
 #include <libintl.h>
 #include <glib.h>
 
+#include <notification.h>
+
 #include "wifi-direct.h"
 #include "wfd-app.h"
 #include "wfd-app-strings.h"
@@ -39,7 +41,6 @@ extern unsigned char g_wfd_peer_mac[6];
 extern unsigned char g_wfd_peer_name[32];
 static Ecore_Timer *pb_timer = NULL;
 
-void wfd_tickernoti_popup(char *msg);
 
 /**
  *     This function let the ug make a callback for click the button in popup
@@ -71,7 +72,7 @@ static void __popup_resp_cb(void *data, Evas_Object * obj, void *event_info)
                                result);
                if (result == WIFI_DIRECT_ERROR_NONE) {
                        /* tickernoti popup */
-                       wfd_tickernoti_popup(_("IDS_WFD_POP_CONNECTING"));
+                       notification_status_message_post(_("IDS_WFD_POP_CONNECTING"));
                } else {
                        WDPOP_LOGE(
                                        "wifi_direct_accept_connection() FAILED!!\n");
@@ -79,7 +80,7 @@ static void __popup_resp_cb(void *data, Evas_Object * obj, void *event_info)
 
                        /* tickernoti popup */
                        snprintf(msg, WFD_POP_STR_MAX_LEN, IDS_WFD_POP_CONNECT_FAILED, ad->peer_name);
-                       wfd_tickernoti_popup(msg);
+                       notification_status_message_post(msg);
                }
        }
        break;
@@ -95,7 +96,7 @@ static void __popup_resp_cb(void *data, Evas_Object * obj, void *event_info)
                                result);
                if (result == WIFI_DIRECT_ERROR_NONE) {
                        /* tickernoti popup */
-                       wfd_tickernoti_popup(_("IDS_WFD_POP_CONNECTING"));
+                       notification_status_message_post(_("IDS_WFD_POP_CONNECTING"));
                } else {
                        WDPOP_LOGE(
                                        "wifi_direct_connect() FAILED!!\n");
@@ -103,7 +104,7 @@ static void __popup_resp_cb(void *data, Evas_Object * obj, void *event_info)
 
                        /* tickernoti popup */
                        snprintf(msg, WFD_POP_STR_MAX_LEN, IDS_WFD_POP_CONNECT_FAILED, ad->peer_name);
-                       wfd_tickernoti_popup(msg);
+                       notification_status_message_post(msg);
                }
 
        break;
@@ -127,6 +128,7 @@ static void __popup_resp_cb(void *data, Evas_Object * obj, void *event_info)
                }
 
                strncpy(ad->pin_number, pin, 64);
+               ad->pin_number[63] = '\0';
                free(pin);
                pin = NULL;
                WDPOP_LOGD( "button ok: pin [%s]", ad->pin_number);
@@ -139,7 +141,7 @@ static void __popup_resp_cb(void *data, Evas_Object * obj, void *event_info)
                                "wifi_direct_accept_connection() failed. result=[%d]\n", result);
                        /* tickernoti popup */
                        snprintf(msg, WFD_POP_STR_MAX_LEN, IDS_WFD_POP_CONNECT_FAILED, ad->peer_name);
-                       wfd_tickernoti_popup(msg);
+                       notification_status_message_post(msg);
                }
        }
        break;
@@ -156,9 +158,9 @@ static void __popup_resp_cb(void *data, Evas_Object * obj, void *event_info)
 
                if (len != 8) {
                        if (len > 8)
-                               wfd_tickernoti_popup(_("IDS_CST_BODY_PASSWORD_TOO_LONG"));
+                               notification_status_message_post(_("IDS_CST_BODY_PASSWORD_TOO_LONG"));
                        else
-                               wfd_tickernoti_popup(_("IDS_ST_BODY_PASSWORD_TOO_SHORT"));
+                               notification_status_message_post(_("IDS_ST_BODY_PASSWORD_TOO_SHORT"));
                        wfd_prepare_popup(WFD_POP_PROG_CONNECT_WITH_KEYPAD, (void *) NULL);
                        return;
                }
@@ -170,7 +172,7 @@ static void __popup_resp_cb(void *data, Evas_Object * obj, void *event_info)
                if (result != WIFI_DIRECT_ERROR_NONE) {
                        /* tickernoti popup */
                        snprintf(msg, WFD_POP_STR_MAX_LEN, IDS_WFD_POP_CONNECT_FAILED, ad->peer_name);
-                       wfd_tickernoti_popup(msg);
+                       notification_status_message_post(msg);
                        return;
                }
 
@@ -186,7 +188,7 @@ static void __popup_resp_cb(void *data, Evas_Object * obj, void *event_info)
 
                        /* tickernoti popup */
                        snprintf(msg, WFD_POP_STR_MAX_LEN, IDS_WFD_POP_CONNECT_FAILED, ad->peer_name);
-                       wfd_tickernoti_popup(msg);
+                       notification_status_message_post(msg);
                }
        }
        break;
@@ -376,7 +378,9 @@ static void _smart_ime_cb(void *data, Evas_Object * obj, void *event_info)
        const char *txt = elm_entry_markup_to_utf8(elm_entry_entry_get((const Evas_Object *) imf_context));
        if (NULL != txt) {
                WDPOP_LOGD( "* text [%s], len=[%d]", txt, strlen(txt));
-               strncpy(ad->pin_number, txt, sizeof(ad->pin_number));
+               strncpy(ad->pin_number, txt, 64);
+               ad->pin_number[63] = '\0';
+               free(txt);
        } else {
                WDPOP_LOGD( "Err!");
        }
@@ -820,65 +824,4 @@ void wfd_prepare_popup(int type, void *userdata)
 
        __WDPOP_LOG_FUNC_EXIT__;
        return;
-}
-
-/**
- *     This function let the app create a tickernoti syspopup
- *     @return   void
- *     @param[in] msg the pointer to message of tickernoti
- */
-void wfd_tickernoti_popup(char *msg)
-{
-       __WDPOP_LOG_FUNC_ENTER__;
-
-       int ret = -1;
-       bundle *b = NULL;
-
-       b = bundle_create();
-       if (!b) {
-               WDPOP_LOGD( "FAIL: bundle_create()\n");
-               return;
-       }
-
-       /* tickernoti style */
-       ret = bundle_add(b, "0", "info");
-       if (ret) {
-               WDPOP_LOGD( "Fail to add tickernoti style\n");
-               bundle_free(b);
-               return;
-       }
-
-       /* popup text */
-       ret = bundle_add(b, "1", msg);
-       if (ret) {
-               WDPOP_LOGD( "Fail to add popup text\n");
-               bundle_free(b);
-               return;
-       }
-
-       /* orientation of tickernoti */
-       ret = bundle_add(b, "2", "0");
-       if (ret) {
-               WDPOP_LOGD( "Fail to add orientation of tickernoti\n");
-               bundle_free(b);
-               return;
-       }
-
-       /* timeout(second) of tickernoti */
-       ret = bundle_add(b, "3", "3");
-       if (ret) {
-               WDPOP_LOGD( "Fail to add timeout of tickernoti\n");
-               bundle_free(b);
-               return;
-       }
-
-       /* launch tickernoti */
-       ret = syspopup_launch(TICKERNOTI_SYSPOPUP, b);
-       if (ret) {
-               WDPOP_LOGD( "Fail to launch syspopup\n");
-       }
-
-       bundle_free(b);
-       __WDPOP_LOG_FUNC_EXIT__;
-}
-
+}
\ No newline at end of file