Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

RootPage_wdgt.cpp

00001 /***************************************************************************
00002  *   Copyright (C) 2006 by Graeme Foster                                   *
00003  *   email    foster.graeme@gmail.com                                      *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Swdgtte 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 #include "RootPage_wdgt.h"
00021 #include "control_panel.h"
00022 
00023 RootPageWidget::RootPageWidget(ControlPanel * window
00024                               ,QWidget * widgetParent
00025                               ,QBoxLayout * layoutParent
00026                               ,dbListManager * pDataLists)
00027 : QWidget(widgetParent)
00028 {
00029         mainWindow = window;
00030         vboxLayout = new QVBoxLayout();
00031         vboxLayout->setSpacing(0);
00032         vboxLayout->setMargin(0);
00033         vboxLayout->addWidget(this);
00034         layoutParent->addLayout(vboxLayout);
00035         dataLists = pDataLists;
00036 }
00037 
00038 void RootPageWidget::displayCRUDDialog(RootDlg * dlg
00039                                                                                                   ,DialogBtnAction btnAction
00040                                                                                                   ,dbList * list
00041                                                                                                   ,QString statusMsg
00042                                                                                                   ,QAbstractItemView * wdgt
00043                                                                                                   )
00044 {
00045         dlg->exec();
00046         if (dlg->result() == QDialog::Accepted)
00047         {
00048                 RootItem * item = dlg->getDataItem();
00049                 QModelIndex index = wdgt->currentIndex();
00050                 switch (btnAction)
00051                 {
00052                         case BTN_ADD:
00053                                 dataLists->insert(item, list, index, item->getItemData()->dcCompareCI);
00054                                 break;
00055                         case BTN_MODIFY:
00056                                 dataLists->update(item, list, item->riCompareCI);
00057                                 break;
00058                         case BTN_DELETE:
00059                                 dataLists->remove(item, list);
00060                                 break;
00061                 };
00062                 QString msg = statusMsg + item->getDescription();
00063                 mainWindow->statusBar()->showMessage(msg);
00064         }
00065 }

Generated on Thu Apr 6 16:27:17 2006 for time-table by  doxygen 1.4.4