[code] The user can delete scripts.

Change-Id: I1b60a4c79a58efe5213add1b1c5d60cdfe85c1e6
This commit is contained in:
Léa Saviot
2017-10-19 14:32:11 +02:00
committed by Romain Goyet
parent 5de4b5cd67
commit 68f368fcde
4 changed files with 36 additions and 7 deletions

View File

@@ -15,7 +15,7 @@ MenuController::MenuController(Responder * parentResponder, ScriptStore * script
}, this)),
m_selectableTableView(this, this, 0, 1, 0, 0, 0, 0, this, nullptr, false),
m_consoleController(parentResponder, m_scriptStore),
m_scriptParameterController(nullptr, I18n::Message::ScriptOptions, m_scriptStore)
m_scriptParameterController(nullptr, I18n::Message::ScriptOptions, m_scriptStore, this)
{
for (int i = 0; i< k_maxNumberOfCells; i++) {
m_cells[i].setMessageFontSize(KDText::FontSize::Large);
@@ -73,6 +73,11 @@ void MenuController::addScript() {
m_selectableTableView.selectCellAtLocation(0, numberOfRows()-2);
}
void MenuController::deleteScriptAtIndex(int i) {
m_scriptStore->deleteScript(i);
m_selectableTableView.reloadData();
}
int MenuController::numberOfRows() {
return m_scriptStore->numberOfScripts() + 1;
//TODO do not add the addScript row if there can be no more scripts stored.