TextController Paste button functional 13/42113/3
authorAgnelo Vaz <agnelo.vaz@samsung.com>
Tue, 23 Jun 2015 12:55:49 +0000 (13:55 +0100)
committerAgnelo Vaz <agnelo.vaz@samsung.com>
Tue, 23 Jun 2015 12:55:49 +0000 (13:55 +0100)
Change-Id: Ic62265c2e17551374e9774829e5f491ca21cf807
Signed-off-by: Agnelo Vaz <agnelo.vaz@samsung.com>
dali-toolkit/internal/text/text-controller-impl.cpp
dali-toolkit/internal/text/text-controller-impl.h
dali-toolkit/internal/text/text-controller.cpp
dali-toolkit/internal/text/text-controller.h

index cef33eb..f05ffda 100644 (file)
@@ -799,9 +799,12 @@ void Controller::Impl::SendSelectionToClipboard( bool deleteAfterSending )
   ChangeState( EventData::EDITING );
 }
 
-void Controller::Impl::PasteTextFromClipboard()
+void Controller::Impl::GetTextFromClipboard( unsigned int itemIndex, std::string& retreivedString )
 {
-  // Not supported
+  if ( mClipboard )
+  {
+    retreivedString =  mClipboard.GetItem( itemIndex );
+  }
 }
 
 void Controller::Impl::RepositionSelectionHandles( CharacterIndex selectionStart, CharacterIndex selectionEnd )
index dc5d3a6..8e84d3c 100644 (file)
@@ -345,7 +345,7 @@ struct Controller::Impl
 
   void SendSelectionToClipboard( bool deleteAfterSending );
 
-  void PasteTextFromClipboard();
+  void GetTextFromClipboard( unsigned int itemIndex, std::string& retreivedString );
 
   void RepositionSelectionHandles( CharacterIndex selectionStart, CharacterIndex selectionEnd );
   void RepositionSelectionHandles( float visualX, float visualY );
index 55ece1c..886327f 100644 (file)
@@ -1227,7 +1227,7 @@ void Controller::InsertText( const std::string& text, Controller::InsertType typ
     DALI_LOG_INFO( gLogFilter, Debug::Verbose, "UTF8 size %d, UTF32 size %d\n", text.size(), utf32Characters.Count() );
   }
 
-  if( 0u != utf32Characters.Count() )
+  if( 0u != utf32Characters.Count() ) // Check if Utf8ToUtf32 conversion succeeded
   {
     // Handle the IMF (predicitive text) state changes
     if( mImpl->mEventData )
@@ -1490,7 +1490,11 @@ void Controller::TextPopupButtonTouched( Dali::Toolkit::TextSelectionPopup::Butt
     }
     case Toolkit::TextSelectionPopup::PASTE:
     {
-      mImpl->PasteTextFromClipboard();
+      std::string stringToPaste("");
+      mImpl->GetTextFromClipboard( 0, stringToPaste ); // Paste latest item from system clipboard
+      InsertText( stringToPaste, Text::Controller::CLIPBOARD );
+      mImpl->ChangeState( EventData::EDITING );
+      mImpl->RequestRelayout();
       break;
     }
     case Toolkit::TextSelectionPopup::SELECT:
index 69c210d..f1e1d28 100644 (file)
@@ -103,7 +103,8 @@ public:
   enum InsertType
   {
     COMMIT,
-    PRE_EDIT
+    PRE_EDIT,
+    CLIPBOARD
   };
 
   /**