diff --git a/apps/graph/list/list_controller.cpp b/apps/graph/list/list_controller.cpp index 1e1154ce5..e774d2ba1 100644 --- a/apps/graph/list/list_controller.cpp +++ b/apps/graph/list/list_controller.cpp @@ -38,7 +38,8 @@ bool ListController::handleEnter() { switch (m_selectableTableView.selectedColumn()) { case 0: { - if (m_selectableTableView.selectedRow() == numberOfRows() - 1) { + if (m_functionStore->numberOfFunctions() < m_functionStore->maxNumberOfFunctions() && + m_selectableTableView.selectedRow() == numberOfRows() - 1) { return true; } configureFunction(m_functionStore->functionAtIndex(m_selectableTableView.selectedRow())); @@ -46,7 +47,8 @@ bool ListController::handleEnter() { } case 1: { - if (m_selectableTableView.selectedRow() == numberOfRows() - 1) { + if (m_functionStore->numberOfFunctions() < m_functionStore->maxNumberOfFunctions() && + m_selectableTableView.selectedRow() == numberOfRows() - 1) { return addFunction(); } FunctionExpressionCell * functionCell = (FunctionExpressionCell *)(m_selectableTableView.cellAtLocation(m_selectableTableView.selectedColumn(), m_selectableTableView.selectedRow())); diff --git a/apps/shared/list_controller.cpp b/apps/shared/list_controller.cpp index b9d4b16ad..9605c651f 100644 --- a/apps/shared/list_controller.cpp +++ b/apps/shared/list_controller.cpp @@ -18,6 +18,9 @@ View * ListController::view() { } int ListController::numberOfRows() { + if (m_functionStore->numberOfFunctions() == m_functionStore->maxNumberOfFunctions()) { + return m_functionStore->numberOfFunctions(); + } return 1 + m_functionStore->numberOfFunctions(); }; @@ -26,7 +29,7 @@ int ListController::numberOfColumns() { }; KDCoordinate ListController::rowHeight(int j) { - if (j == numberOfRows() - 1) { + if (m_functionStore->numberOfFunctions() < m_functionStore->maxNumberOfFunctions() && j == numberOfRows() - 1) { return k_emptyRowHeight; } Function * function = m_functionStore->functionAtIndex(j); @@ -93,7 +96,8 @@ int ListController::indexFromCumulatedHeight(KDCoordinate offsetY) { } int ListController::typeAtLocation(int i, int j) { - if (j == numberOfRows() - 1) { + if (m_functionStore->numberOfFunctions() < m_functionStore->maxNumberOfFunctions() + && j == numberOfRows() - 1) { return i + 2; } return i; @@ -125,7 +129,7 @@ int ListController::reusableCellCount(int type) { } void ListController::willDisplayCellAtLocation(TableViewCell * cell, int i, int j) { - if (j < numberOfRows() - 1) { + if (j < numberOfRows() - 1 || m_functionStore->numberOfFunctions() == m_functionStore->maxNumberOfFunctions()) { if (i == 0) { FunctionTitleCell * myFunctionCell = (FunctionTitleCell *)cell; Function * function = m_functionStore->functionAtIndex(j);