/***************************************************************************
 *   Copyright (C) 2008 by Andreas Silberstorff   *
 *   ml@andreas-silberstorff.de   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

#include "daysoftheweek.h"

#include <QString>

namespace KalvaData {

DaysOfTheWeek::DaysOfTheWeek()
{
}

DaysOfTheWeek::~DaysOfTheWeek()
{
}

QString DaysOfTheWeek::getDaysOfTheWeekString()
{
	int size = m_daysoftheweek.size();
	QString* dotwstr = new QString();
	
        for (int i = 0; i < size; i++) {
             dotwstr->append(m_daysoftheweek.at(i));
             dotwstr->append(",");
	}
	return *dotwstr;
}

QList<int> DaysOfTheWeek::getDaysOfTheWeekList()
{
	return m_daysoftheweek;
}

void DaysOfTheWeek::setSundayActive(bool active)
{
	m_sunday = active;
	if (active) {
		m_daysoftheweek.append( KalvaData::SUNDAY );
	} else {
		m_daysoftheweek.removeOne( KalvaData::SUNDAY );
	}
}

void DaysOfTheWeek::setMondayActive(bool active)
{
	m_monday = active;
	if (active) {
		m_daysoftheweek.append( KalvaData::MONDAY );
	} else {
		m_daysoftheweek.removeOne( KalvaData::MONDAY );
	}
}

void DaysOfTheWeek::setTuesdayActive(bool active)
{
	m_tuesday = active;
	if (active) {
		m_daysoftheweek.append( KalvaData::TUESDAY );
	} else {
		m_daysoftheweek.removeOne( KalvaData::TUESDAY );
	}
}

void DaysOfTheWeek::setWednesdayActive(bool active)
{
	m_wednesday = active;
	if (active) {
		m_daysoftheweek.append( KalvaData::WEDNESDAY );
	} else {
		m_daysoftheweek.removeOne( KalvaData::WEDNESDAY );
	}
}

void DaysOfTheWeek::setThursdayActive(bool active)
{
	m_thursday = active;
	if (active) {
		m_daysoftheweek.append( KalvaData::THURSDAY );
	} else {
		m_daysoftheweek.removeOne( KalvaData::THURSDAY );
	}
}

void DaysOfTheWeek::setFrydayActive(bool active)
{
	m_fryday = active;
	if (active) {
		m_daysoftheweek.append( KalvaData::FRYDAY );
	} else {
		m_daysoftheweek.removeOne( KalvaData::FRYDAY );
	}
}

void DaysOfTheWeek::setSaturdayActive(bool active)
{
	m_saturday = active;
	if (active) {
		m_daysoftheweek.append( KalvaData::SATURDAY );
	} else {
		m_daysoftheweek.removeOne( KalvaData::SATURDAY );
	}
}

} // end of namespace