[apps/calculation] EXE and OK have same behaviour on history controller

Change-Id: I4fed572db45e4604a1b44e5343f14b50db8cfcc6
This commit is contained in:
Émilie Feral
2017-05-02 11:42:01 +02:00
parent 17502373a8
commit 40aa86ccb7

View File

@@ -35,7 +35,7 @@ bool HistoryController::handleEvent(Ion::Events::Event event) {
if (event == Ion::Events::Up) {
return true;
}
if (event == Ion::Events::OK) {
if (event == Ion::Events::OK || event == Ion::Events::EXE) {
int focusRow = selectedRow();
HistoryViewCell * selectedCell = (HistoryViewCell *)selectableTableView()->selectedCell();
HistoryViewCell::SubviewType subviewType = selectedCell->selectedSubviewType();
@@ -50,26 +50,6 @@ bool HistoryController::handleEvent(Ion::Events::Event event) {
}
return true;
}
if (event == Ion::Events::EXE) {
int focusRow = selectedRow();
HistoryViewCell * selectedCell = (HistoryViewCell *)selectableTableView()->selectedCell();
HistoryViewCell::SubviewType subviewType = selectedCell->selectedSubviewType();
EditExpressionController * editController = (EditExpressionController *)parentResponder();
Calculation * calculation = m_calculationStore->calculationAtIndex(focusRow);
const char * text;
if (subviewType == HistoryViewCell::SubviewType::Input) {
text = calculation->inputText();
} else {
text = calculation->outputText();
}
selectableTableView()->deselectTable();
App * calculationApp = (App *)app();
m_calculationStore->push(text, calculationApp->localContext());
reload();
selectableTableView()->scrollToCell(0, numberOfRows()-1);
app()->setFirstResponder(editController);
return true;
}
if (event == Ion::Events::Backspace) {
int focusRow = selectedRow();
HistoryViewCell * selectedCell = (HistoryViewCell *)selectableTableView()->selectedCell();