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 #include <QStringList> 00021 00022 #include "DailyTimeSlotItem.h" 00023 #include "TimeSlotItem.h" 00024 00025 DailyTimeSlotItem::DailyTimeSlotItem(RootItem *parent) 00026 :RootItem(parent) 00027 { 00028 RTTI = DAILY_TIME_SLOT_ITEM; 00029 GUIPref * pref = GUIPref::Instance(); 00030 setTextColour(1 00031 ,pref->getColour(GUIPref::CT_TIMESLOT_TEXT,0)); 00032 setBGColour(1 00033 ,pref->getColour(GUIPref::CT_TIMESLOT_BG,0)); 00034 } 00035 00036 QVariant DailyTimeSlotItem::data(int column) const 00037 { 00038 if (column >= childCount()) 00039 return ""; 00040 if (childItems[column]->getItemData() == 0) 00041 return ""; 00042 else 00043 return "Selected"; 00044 } 00045 00046 QColor DailyTimeSlotItem::bgColour(int column) 00047 { 00048 if (column >= childCount()) 00049 return QColor("White"); 00050 if (child(column)->getItemData() == 0) 00051 return QColor("White"); 00052 else 00053 return backgroundColour[row()%2]; 00054 } 00055 00056 bool DailyTimeSlotItem::setData(int column, const QVariant & value) 00057 { 00058 if (column >= columnCount()) 00059 return false; 00060 } 00061 00062 bool DailyTimeSlotItem::insertItem(RootItem * tsObj, int posn) 00063 { 00064 if (posn >= columnCount()) 00065 return false; 00066 childItems.replace(posn, tsObj); 00067 return true; 00068 } 00069 00070 void DailyTimeSlotItem::deleteItem(int column) 00071 { 00072 // Get the TimeSlotItem 00073 TimeSlotItem * tsItem; 00074 tsItem = static_cast<TimeSlotItem *>(childItems[column]); 00075 tsItem->dbDelete(); 00076 childItems[column] = new TimeSlotItem(0); 00077 }