[apps/shared] Do no display button to add a new cell when the maximum

number of functions is reached

Change-Id: I0717998ee3ae9ca575462ee0139182c698ea6c02
This commit is contained in:
Émilie Feral
2017-02-07 15:20:15 +01:00
parent 4f16289bd7
commit 20c13c172c
2 changed files with 11 additions and 5 deletions

View File

@@ -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);