#include "FamilyShoppingManagerMainWindow.h"
#include <QMenuBar>
#include <QMessageBox>
+#include <QInputDialog>
#include "ListManagerView.h"
#include "GoShoppingView.h"
ShoppingTreeModel *model = (ShoppingTreeModel*)
((ListManagerView*) activityView)->model();
- if(model->addCategory("New category"))
+ bool* ok = new bool(false);
+ QString name = QInputDialog::getText(this, tr("Enter category name"),
+ tr("Category name:"),
+ QLineEdit::Normal, QString(), ok);
+ if(!ok)
+ return;
+
+ if(model->addCategory(name))
((ListManagerView*) activityView)->updateActions();
+ delete ok;
}
/*******************************************************************/
ShoppingTreeModel *model = (ShoppingTreeModel*)
((ListManagerView*) activityView)->model();
- if(model->addSubCategory("New sub-category", index.row()+1, index))
+ bool* ok = new bool(false);
+ QString name = QInputDialog::getText(this, tr("Enter category name"),
+ tr("Category name:"),
+ QLineEdit::Normal, QString(), ok);
+ if(!ok)
+ return;
+
+ if(model->addSubCategory(name, index.row()+1, index))
((ListManagerView*) activityView)->updateActions();
+
+ delete ok;
}
/*******************************************************************/
ShoppingTreeModel *model = (ShoppingTreeModel*)
((ListManagerView*) activityView)->model();
- if(model->addItem("New item", index.row()+1, index))
+ bool* ok = new bool(false);
+ QString name = QInputDialog::getText(this, tr("Enter item name"),
+ tr("Item name:"),
+ QLineEdit::Normal, QString(), ok);
+ if(!ok)
+ return;
+
+ if(model->addItem(name, index.row()+1, index))
((ListManagerView*) activityView)->updateActions();
+
+ delete ok;
}
/*******************************************************************/