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 cef33ebf12a69e645f695942b956bde530b0ef92..f05ffdaa705ddfdfe199d3480800600087935474 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 dc5d3a63ba39b003fe96405102d27d519731da4a..8e84d3c039e8b8c2bfedd24de88ba49b867f0122 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 55ece1c6aa95f71aaefc69a86e94c85e6cbd31f2..886327facb2e7b655c3583ee4e7f747386bf1f55 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 69c210d997a6bcfbba382ebb3848160bb21b7f64..f1e1d28a979700ab8ffe3e55b8388501d7510796 100644 (file)
@@ -103,7 +103,8 @@ public:
   enum InsertType
   {
     COMMIT,
-    PRE_EDIT
+    PRE_EDIT,
+    CLIPBOARD
   };
 
   /**