From: onil Date: Wed, 10 Mar 2010 13:01:39 +0000 (+0000) Subject: git-svn-id: file:///svnroot/family-shop-mgr@24 26eb2498-383b-47a6-be48-5d6f36779e85 X-Git-Url: http://vcs.maemo.org/git/?p=family-shop-mgr;a=commitdiff_plain;h=af6e773e8d38a499f5063f98e2751aabbaa0662f git-svn-id: file:///svnroot/family-shop-mgr@24 26eb2498-383b-47a6-be48-5d6f36779e85 --- diff --git a/code/family-shop-mgr/FamilyShoppingManagerMainWindow.cpp b/code/family-shop-mgr/FamilyShoppingManagerMainWindow.cpp index 4b821f7..393639b 100644 --- a/code/family-shop-mgr/FamilyShoppingManagerMainWindow.cpp +++ b/code/family-shop-mgr/FamilyShoppingManagerMainWindow.cpp @@ -22,6 +22,7 @@ #include "FamilyShoppingManagerMainWindow.h" #include #include +#include #include "ListManagerView.h" #include "GoShoppingView.h" @@ -160,8 +161,16 @@ void FamilyShoppingManagerMainWindow::addCategory() 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; } /*******************************************************************/ @@ -172,8 +181,17 @@ void FamilyShoppingManagerMainWindow::addSubCategory() 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; } /*******************************************************************/ @@ -184,8 +202,17 @@ void FamilyShoppingManagerMainWindow::addItem() 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; } /*******************************************************************/