From 37333bf25ad9a4c538250f5af2f9f1d666362883 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeadmin@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kcron/ctdom.cpp | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 kcron/ctdom.cpp (limited to 'kcron/ctdom.cpp') diff --git a/kcron/ctdom.cpp b/kcron/ctdom.cpp new file mode 100644 index 0000000..b1d7f5e --- /dev/null +++ b/kcron/ctdom.cpp @@ -0,0 +1,73 @@ +/*************************************************************************** + * CT Day of Month Implementation * + * -------------------------------------------------------------------- * + * Copyright (C) 1999, Gary Meyer * + * -------------------------------------------------------------------- * + * 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. * + ***************************************************************************/ + +// Do not introduce any Qt or KDE dependencies into the "CT"-prefixed classes. +// I want to be able to reuse these classes with another GUI toolkit. -GM 11/99 + +#include "ctdom.h" +#include "cti18n.h" + +string CTDayOfMonth::shortName[32] = +{ + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" +}; + +CTDayOfMonth::CTDayOfMonth(const string& tokStr) : + CTUnit<1,31>(tokStr) +{ +} + +string CTDayOfMonth::describe() const +{ + initializeNames(); + return (count() == 31) ? + (const char*)i18n("every day ").local8Bit() : + CTUnit<1,31>::describe(shortName); +} + +string CTDayOfMonth::getName(const int ndx) +{ + initializeNames(); + return shortName[ndx]; +} + +void CTDayOfMonth::initializeNames() +{ + if (shortName[1].empty()) + { + const string shortDOMName[32] = + { + "", + (const char*)i18n("1st").local8Bit(), (const char*)i18n("2nd").local8Bit(), + (const char*)i18n("3rd").local8Bit(), (const char*)i18n("4th").local8Bit(), + (const char*)i18n("5th").local8Bit(), (const char*)i18n("6th").local8Bit(), + (const char*)i18n("7th").local8Bit(), (const char*)i18n("8th").local8Bit(), + (const char*)i18n("9th").local8Bit(), (const char*)i18n("10th").local8Bit(), + (const char*)i18n("11th").local8Bit(), (const char*)i18n("12th").local8Bit(), + (const char*)i18n("13th").local8Bit(), (const char*)i18n("14th").local8Bit(), + (const char*)i18n("15th").local8Bit(), (const char*)i18n("16th").local8Bit(), + (const char*)i18n("17th").local8Bit(), (const char*)i18n("18th").local8Bit(), + (const char*)i18n("19th").local8Bit(), (const char*)i18n("20th").local8Bit(), + (const char*)i18n("21st").local8Bit(), (const char*)i18n("22nd").local8Bit(), + (const char*)i18n("23rd").local8Bit(), (const char*)i18n("24th").local8Bit(), + (const char*)i18n("25th").local8Bit(), (const char*)i18n("26th").local8Bit(), + (const char*)i18n("27th").local8Bit(), (const char*)i18n("28th").local8Bit(), + (const char*)i18n("29th").local8Bit(), (const char*)i18n("30th").local8Bit(), + (const char*)i18n("31st").local8Bit() + }; + + for (int i = 1; i <= 31; i++) + { + shortName[i] = shortDOMName[i]; + } + } +} -- cgit v1.2.1