diff --git a/escher/include/escher/text_field.h b/escher/include/escher/text_field.h index 27eb28114..92c05a2fd 100644 --- a/escher/include/escher/text_field.h +++ b/escher/include/escher/text_field.h @@ -91,7 +91,7 @@ private: bool privateHandleMoveEvent(Ion::Events::Event event); bool privateHandleSelectEvent(Ion::Events::Event event); virtual void removeWholeText(); - void storeInClipboard() const; + bool storeInClipboard() const; TextFieldDelegate * m_delegate; }; diff --git a/escher/src/text_field.cpp b/escher/src/text_field.cpp index 872acc5f9..a7769d614 100644 --- a/escher/src/text_field.cpp +++ b/escher/src/text_field.cpp @@ -358,8 +358,7 @@ bool TextField::privateHandleEvent(Ion::Events::Event event) { return true; } if (event == Ion::Events::Copy || event == Ion::Events::Cut) { - storeInClipboard(); - if (event == Ion::Events::Cut) { + if (storeInClipboard() && event == Ion::Events::Cut) { if (!m_contentView.selectionIsEmpty()) { deleteSelection(); } else { @@ -542,11 +541,14 @@ void TextField::removeWholeText() { reloadScroll(); } -void TextField::storeInClipboard() const { +bool TextField::storeInClipboard() const { if (!isEditing()) { Clipboard::sharedClipboard()->store(text()); + return true; } else if (!m_contentView.selectionIsEmpty()) { const char * start = m_contentView.selectionStart(); Clipboard::sharedClipboard()->store(start, m_contentView.selectionEnd() - start); + return true; } + return false; }