git-svn-id: file:///svnroot/family-shop-mgr@31 26eb2498-383b-47a6-be48-5d6f36779e85
[family-shop-mgr] / code / family-shop-mgr / FamilyShoppingManagerMainWindow.cpp
index 6407261..269c3fe 100644 (file)
@@ -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*)