From f43f47c306c09648c8cc7a52f6256173b355c00d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Tue, 25 Apr 2017 15:29:12 +0200 Subject: [PATCH] [apps/sequence][apps/graph] Implement copy paste in values controller Change-Id: Id4283e75c5e42debc4e6983aa1d7499acffbfc26 --- apps/shared/values_controller.cpp | 5 +++++ escher/include/escher/even_odd_buffer_text_cell.h | 1 + escher/src/even_odd_buffer_text_cell.cpp | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/apps/shared/values_controller.cpp b/apps/shared/values_controller.cpp index 926d0eb10..6ba138f54 100644 --- a/apps/shared/values_controller.cpp +++ b/apps/shared/values_controller.cpp @@ -75,6 +75,11 @@ bool ValuesController::handleEvent(Ion::Events::Event event) { if (selectableTableView()->selectedRow() == -1) { return header()->handleEvent(event); } + if (event == Ion::Events::Copy && selectableTableView()->selectedRow() > 0 && selectableTableView()->selectedColumn() > 0) { + EvenOddBufferTextCell * cell = (EvenOddBufferTextCell *)selectableTableView()->selectedCell(); + Clipboard::sharedClipboard()->store(cell->text()); + return true; + } return false; } diff --git a/escher/include/escher/even_odd_buffer_text_cell.h b/escher/include/escher/even_odd_buffer_text_cell.h index eebdc7d4e..653350a23 100644 --- a/escher/include/escher/even_odd_buffer_text_cell.h +++ b/escher/include/escher/even_odd_buffer_text_cell.h @@ -7,6 +7,7 @@ class EvenOddBufferTextCell : public EvenOddCell { public: EvenOddBufferTextCell(KDText::FontSize size = KDText::FontSize::Small, float horizontalAlignment = 1.0f, float verticalAlignment = 0.5f); + const char * text(); void setEven(bool even) override; void setHighlighted(bool highlight) override; void setText(const char * textContent); diff --git a/escher/src/even_odd_buffer_text_cell.cpp b/escher/src/even_odd_buffer_text_cell.cpp index 0dd1f4b9e..d83e7b399 100644 --- a/escher/src/even_odd_buffer_text_cell.cpp +++ b/escher/src/even_odd_buffer_text_cell.cpp @@ -7,6 +7,10 @@ EvenOddBufferTextCell::EvenOddBufferTextCell(KDText::FontSize size, float horizo { } +const char * EvenOddBufferTextCell::text() { + return m_bufferTextView.text(); +} + void EvenOddBufferTextCell::setHighlighted(bool highlight) { EvenOddCell::setHighlighted(highlight); m_bufferTextView.setBackgroundColor(backgroundColor());