X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=code%2Ffamily-shop-mgr%2FFamilyShoppingManagerMainWindow.cpp;fp=code%2Ffamily-shop-mgr%2FFamilyShoppingManagerMainWindow.cpp;h=269c3fed764172af962e26e87942efaa0aa63703;hb=f1ecd585f7e35faf5618ada92d04e23986f9d742;hp=6407261f81da529222e4dc7d10cb9323f4b721c5;hpb=a8793819a1b567a099c3f9a8f1132a0aca485e60;p=family-shop-mgr diff --git a/code/family-shop-mgr/FamilyShoppingManagerMainWindow.cpp b/code/family-shop-mgr/FamilyShoppingManagerMainWindow.cpp index 6407261..269c3fe 100644 --- a/code/family-shop-mgr/FamilyShoppingManagerMainWindow.cpp +++ b/code/family-shop-mgr/FamilyShoppingManagerMainWindow.cpp @@ -34,6 +34,7 @@ FamilyShoppingManagerMainWindow::FamilyShoppingManagerMainWindow(QWidget *parent showCheckedItemsAction(NULL), goShoppingAction(NULL), endShoppingAction(NULL) { aboutAction = new QAction(tr("&About"), this); + aboutAction->setSoftKeyRole(QAction::PositiveSoftKey); connect(aboutAction, SIGNAL(triggered()), this, SLOT(showAbout())); menuBar()->addAction(aboutAction); @@ -58,29 +59,29 @@ void FamilyShoppingManagerMainWindow::showListManager() delete activityView; activityView = new ListManagerView("ShoppingList.xml", this); -// editMenu = new QMenu(tr("&Edit"), this); addCategoryAction = new QAction(tr("Add category"), this); + addCategoryAction->setSoftKeyRole(QAction::PositiveSoftKey); connect(addCategoryAction, SIGNAL(triggered()), this, SLOT(addCategory())); -// editMenu->addAction(addCategoryAction); + menuBar()->addAction(addCategoryAction); removeCategoryAction = new QAction(tr("Remove category"), this); + removeCategoryAction->setSoftKeyRole(QAction::NegativeSoftKey); connect(removeCategoryAction, SIGNAL(triggered()), this, SLOT(removeCategoryOrItem())); -// editMenu->addAction(removeCategoryAction); + menuBar()->addAction(removeCategoryAction); addItemAction = new QAction(tr("Add item"), this); + addItemAction->setSoftKeyRole(QAction::PositiveSoftKey); connect(addItemAction, SIGNAL(triggered()), this, SLOT(addItem())); -// editMenu->addAction(addItemAction); + menuBar()->addAction(addItemAction); removeItemAction = new QAction(tr("Remove item"), this); + removeItemAction->setSoftKeyRole(QAction::NegativeSoftKey); connect(removeItemAction, SIGNAL(triggered()), this, SLOT(removeCategoryOrItem())); -// editMenu->addAction(removeItemAction); - menuBar()->addAction(addCategoryAction); - activityView->addAction(removeCategoryAction); - activityView->addAction(addItemAction); - activityView->addAction(removeItemAction); + menuBar()->addAction(removeItemAction); goShoppingAction = new QAction(tr("Go shopping!"), this); + goShoppingAction->setSoftKeyRole(QAction::PositiveSoftKey); connect(goShoppingAction, SIGNAL(triggered()), this, SLOT(showGoShopping())); menuBar()->addAction(goShoppingAction); @@ -95,7 +96,11 @@ void FamilyShoppingManagerMainWindow::showListManager() void FamilyShoppingManagerMainWindow::showGoShopping() { menuBar()->clear(); -// delete editMenu; + + delete addCategoryAction; + delete addItemAction; + delete removeCategoryAction; + delete removeItemAction; delete goShoppingAction; delete activityView; @@ -104,11 +109,13 @@ void FamilyShoppingManagerMainWindow::showGoShopping() showCheckedItemsAction = new QAction(tr("&Show checked"), this); showCheckedItemsAction->setCheckable(true); + showCheckedItemsAction->setSoftKeyRole(QAction::PositiveSoftKey); connect(showCheckedItemsAction, SIGNAL(toggled(bool)), activityView, SLOT(showChecked(bool))); menuBar()->addAction(showCheckedItemsAction); endShoppingAction = new QAction(tr("&End shopping"), this); + endShoppingAction->setSoftKeyRole(QAction::NegativeSoftKey); connect(endShoppingAction, SIGNAL(triggered()), this, SLOT(showListManager())); menuBar()->addAction(endShoppingAction); @@ -121,45 +128,18 @@ void FamilyShoppingManagerMainWindow::showGoShopping() void FamilyShoppingManagerMainWindow::showAbout() { QString text; - text = "Application name: Family shopping manager\n"; - text += "Author: Unai IRIGOYEN\n\n"; - text += "Licence: GPL"; + text = tr("Application name:") + " Family shopping manager\n\n"; + text += tr("Project maintainer:") + "\n"; + text += "\tUnai IRIGOYEN"; + text += "\n\n"; + text += tr("Developers:") + "\n"; + text += "\tUnai IRIGOYEN"; + text += "\n\n"; + text += tr("Licence:") + " GPLv3"; QMessageBox::about(this,tr("About"), text); } /*******************************************************************/ -/* -void FamilyShoppingManagerMainWindow::insertChild() -{ - QModelIndex index = ((ListManagerView*) activityView)-> - selectionModel()->currentIndex(); - QAbstractItemModel *model = ((ListManagerView*) activityView)->model(); - - if (model->columnCount(index) == 0) { - if (!model->insertColumn(0, index)) - return; - } - - if (!model->insertRow(0, index)) - return; - - for (int column = 0; column < model->columnCount(index); ++column) - { - QModelIndex child = model->index(0, column, index); - model->setData(child, QVariant("[No data]"), Qt::EditRole); - if (!model->headerData(column, Qt::Horizontal).isValid()) - model->setHeaderData(column, Qt::Horizontal, - QVariant("[No header]"), Qt::EditRole); - } - - ((ListManagerView*) activityView)->selectionModel()-> - setCurrentIndex(model->index(0, 0, index), - QItemSelectionModel::ClearAndSelect); - ((ListManagerView*) activityView)->updateActions(); - } - */ - -/*******************************************************************/ void FamilyShoppingManagerMainWindow::addCategory() { ShoppingTreeModel *model = (ShoppingTreeModel*)