From 5953b4b44922c5068ff589a2ba82273338201993 Mon Sep 17 00:00:00 2001 From: suhyung Eom Date: Thu, 23 Jun 2016 13:16:10 +0900 Subject: [PATCH] Temporary implement copy/paste text Signed-off-by: suhyung Eom Change-Id: Ia340ea9d4279d2172551c372ee2337870ce754d7 --- adaptors/ecore/wayland/clipboard-impl-ecore-wl.cpp | 58 ++++++++++++---------- 1 file changed, 33 insertions(+), 25 deletions(-) diff --git a/adaptors/ecore/wayland/clipboard-impl-ecore-wl.cpp b/adaptors/ecore/wayland/clipboard-impl-ecore-wl.cpp index cea687c..513ec21 100644 --- a/adaptors/ecore/wayland/clipboard-impl-ecore-wl.cpp +++ b/adaptors/ecore/wayland/clipboard-impl-ecore-wl.cpp @@ -24,21 +24,12 @@ #include #include #include +#include // INTERNAL INCLUDES #include -namespace //unnamed namespace -{ -const char* const CBHM_WINDOW = "CBHM_XWIN"; -const char* const CBHM_MSG = "CBHM_MSG"; -const char* const CBHM_ITEM = "CBHM_ITEM"; -const char* const CBHM_cCOUNT = "CBHM_cCOUNT"; -const char* const CBHM_ERROR = "CBHM_ERROR"; -const char* const SET_ITEM = "SET_ITEM"; -const char* const SHOW = "show0"; -const char* const HIDE = "cbhm_hide"; -} +#define CLIPBOARD_STR "CLIPBOARD_STR" /////////////////////////////////////////////////////////////////////////////////////////////////// // Clipboard @@ -55,7 +46,33 @@ namespace Adaptor struct Clipboard::Impl { - // Put implementation here. + Impl() + { + mBundle = bundle_create(); + } + + void SetItem(const char *data) + { + bundle_add_str(mBundle, CLIPBOARD_STR, data); + } + + char *GetItem() + { + char *data = NULL; + + if ( bundle_get_count(mBundle) ) + { + bundle_get_str(mBundle, CLIPBOARD_STR, &data); + } + return data; + } + + int GetCount() + { + return bundle_get_count(mBundle); + } + + bundle *mBundle; }; Clipboard::Clipboard(Impl* impl) @@ -94,6 +111,7 @@ Dali::Clipboard Clipboard::Get() bool Clipboard::SetItem(const std::string &itemData ) { + mImpl->SetItem( const_cast( itemData.c_str()) ); return true; } @@ -102,16 +120,8 @@ bool Clipboard::SetItem(const std::string &itemData ) */ std::string Clipboard::GetItem( unsigned int index ) // change string to a Dali::Text object. { - if ( index >= NumberOfItems() ) - { - return ""; - } - - std::string emptyString( "" ); - char sendBuf[20]; - - snprintf( sendBuf, 20, "%s%d", CBHM_ITEM, index ); - return emptyString; + std::string clipboardString(mImpl->GetItem()); + return clipboardString; } /* @@ -119,9 +129,7 @@ std::string Clipboard::GetItem( unsigned int index ) // change string to a Dali */ unsigned int Clipboard::NumberOfItems() { - int count = -1; - - return count; + return mImpl->GetCount(); } /** -- 2.7.4