KDECore
kcalendarsystemfactory.cpp
Go to the documentation of this file.00001 /* 00002 Copyright (c) 2002 Carlos Moro <cfmoro@correo.uniovi.es> 00003 Copyright (c) 2002-2003 Hans Petter Bieker <bieker@kde.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library 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 GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 00019 */ 00020 00021 // Gregorian calendar system implementation factory for creation of kde 00022 // calendar systems. 00023 // Also default gregorian and factory classes 00024 00025 #include <kdebug.h> 00026 00027 #include "kcalendarsystemfactory.h" 00028 00029 #include "kcalendarsystemgregorian.h" 00030 #include "kcalendarsystemhijri.h" 00031 #include "kcalendarsystemhebrew.h" 00032 #include "kcalendarsystemjalali.h" 00033 00034 KCalendarSystemFactory::KCalendarSystemFactory() 00035 { 00036 kdDebug(5400) << "Created factory calendar" << endl; 00037 } 00038 00039 KCalendarSystemFactory::~KCalendarSystemFactory() 00040 { 00041 } 00042 00043 KCalendarSystem *KCalendarSystemFactory::create( const QString &calType, 00044 const KLocale * locale ) 00045 { 00046 if ( calType == "hebrew" ) 00047 return new KCalendarSystemHebrew(locale); 00048 if ( calType == "hijri" ) 00049 return new KCalendarSystemHijri(locale); 00050 if ( calType == "gregorian" ) 00051 return new KCalendarSystemGregorian(locale); 00052 if ( calType == "jalali" ) 00053 return new KCalendarSystemJalali(locale); 00054 00055 kdDebug(5400) << "Calendar " << calType << " not found, defaulting to gregorian" << endl; 00056 00057 // ### HPB: Should it really be a default here? 00058 return new KCalendarSystemGregorian(locale); 00059 } 00060 00061 QStringList KCalendarSystemFactory::calendarSystems() 00062 { 00063 QStringList lst; 00064 lst.append("hebrew"); 00065 lst.append("hijri"); 00066 lst.append("gregorian"); 00067 lst.append("jalali"); 00068 00069 return lst; 00070 }