X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=code%2Ffamily-shop-mgr%2FFamilyShoppingManagerMainWindow.cpp;h=e962014b7460e5b6fc3bf0881639b86b194faa1e;hb=6ba7d4dd07f22ac39175e04f60e0f4f4fdccedab;hp=bb4a8c9a834d3108eb465c6cacd6f7497278be72;hpb=ab38c571edb4309976ef06a51d2cfb3425b771b4;p=family-shop-mgr diff --git a/code/family-shop-mgr/FamilyShoppingManagerMainWindow.cpp b/code/family-shop-mgr/FamilyShoppingManagerMainWindow.cpp index bb4a8c9..e962014 100644 --- a/code/family-shop-mgr/FamilyShoppingManagerMainWindow.cpp +++ b/code/family-shop-mgr/FamilyShoppingManagerMainWindow.cpp @@ -27,28 +27,15 @@ #include "GoShoppingView.h" FamilyShoppingManagerMainWindow::FamilyShoppingManagerMainWindow(QWidget *parent) - : QMainWindow(parent), activityView(NULL) + : QMainWindow(parent), activityView(NULL), showCheckedItemsAction(NULL), + endShoppingAction(NULL), goShoppingAction(NULL), editMenu(NULL) { - showListManager(); - - editMenu = new QMenu(tr("&Edit"), this); - editMenu->addAction(tr("Add category")); - editMenu->addAction(tr("Remove category")); - editMenu->addAction(tr("Add item")); - editMenu->addAction(tr("Remove item")); - menuBar()->addMenu(editMenu); - - goShoppingAction = new QAction(tr("Go shopping!"), this); - connect(goShoppingAction, SIGNAL(triggered()), - this, SLOT(showGoShopping())); - menuBar()->addAction(goShoppingAction); - aboutAction = new QAction(tr("&About"), this); connect(aboutAction, SIGNAL(triggered()), this, SLOT(showAbout())); menuBar()->addAction(aboutAction); - setCentralWidget(activityView); - update(); + + showListManager(); } FamilyShoppingManagerMainWindow::~FamilyShoppingManagerMainWindow() @@ -59,11 +46,13 @@ FamilyShoppingManagerMainWindow::~FamilyShoppingManagerMainWindow() void FamilyShoppingManagerMainWindow::showListManager() { menuBar()->clear(); - (showCheckedItemsAction) ? delete showCheckedItemsAction:; - (endShoppingAction) ? delete endShoppingAction:; + + delete showCheckedItemsAction; + delete endShoppingAction; delete activityView; activityView = new ListManagerView("ShoppingList.xml", this); + setCentralWidget(activityView); editMenu = new QMenu(tr("&Edit"), this); editMenu->addAction(tr("Add category")); @@ -78,6 +67,7 @@ void FamilyShoppingManagerMainWindow::showListManager() menuBar()->addAction(goShoppingAction); menuBar()->addAction(aboutAction); + update(); } void FamilyShoppingManagerMainWindow::showGoShopping() @@ -88,6 +78,7 @@ void FamilyShoppingManagerMainWindow::showGoShopping() delete activityView; activityView = new GoShoppingView("ShoppingList.xml", this); + setCentralWidget(activityView); showCheckedItemsAction = new QAction(tr("&Show checked"), this); showCheckedItemsAction->setCheckable(true); @@ -101,6 +92,7 @@ void FamilyShoppingManagerMainWindow::showGoShopping() menuBar()->addAction(endShoppingAction); menuBar()->addAction(aboutAction); + update(); } void FamilyShoppingManagerMainWindow::showAbout()