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 - Suite 330, Boston, MA 02111-1307, USA. * 00019 ***************************************************************************/ 00020 #ifndef __DAILY_TIMESLOT_ITEM_H 00021 #define __DAILY_TIMESLOT_ITEM_H 00022 00023 #include "RootItem.h" 00024 00025 #include "TimeSlot.h" 00026 00027 class DailyTimeSlotItem : public RootItem 00028 { 00029 private: // Properties 00030 QString dow; // The day of the week 00031 // database manipulation 00032 inline void dbDelete(){} // use deleteItem instead 00033 public: // Constructor 00034 DailyTimeSlotItem(RootItem *parent = 0); 00035 ~DailyTimeSlotItem(){}; 00036 // Get Methods 00037 inline virtual TimeSlot * getItemData()const {return static_cast<TimeSlot * >(itemData);} 00038 inline virtual TimeSlot * getItemData(int col)const {return static_cast<TimeSlot * >(childItems[col]->getItemData());} 00039 inline QString getDescription()const{return "Daily Time Slot Item";} 00040 inline QString getDOW()const{return dow;} 00041 inline void setDOW(const QString &pDOW){dow = pDOW;} 00042 QVariant data(int column) const; 00043 // Set Methods 00044 bool insertItem(RootItem * tsObj, int posn); 00045 bool setData(int column, const QVariant & value); 00046 // data display 00047 virtual QColor bgColour(int column); 00048 // database manipulation 00049 void deleteItem(int column); 00050 inline void dbSave(); 00051 }; 00052 00053 void DailyTimeSlotItem::dbSave() 00054 { 00055 getItemData()->save(TimeSlot::insertSQL, TimeSlot::updateSQL, TimeSlot::errorSQL); 00056 } 00057 00058 #endif