• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

korganizer

  • sources
  • kde-4.12
  • kdepim
  • korganizer
  • plugins
  • hebrew
hebrew.cpp
Go to the documentation of this file.
1 /*
2  This file is part of KOrganizer.
3 
4  Copyright (c) 2003 Jonathan Singer <jsinger@leeta.net>
5  Copyright (C) 2007 Loïc Corbasson <loic.corbasson@gmail.com>
6 
7  This program is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation; either version 2 of the License, or
10  (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License along
18  with this program; if not, write to the Free Software Foundation, Inc.,
19  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 */
21 
22 #include "hebrew.h"
23 #include "configdialog.h"
24 #include "converter.h"
25 #include "holiday.h"
26 
27 #include <KCalendarSystem>
28 
29 using namespace EventViews::CalendarDecoration;
30 
31 class HebrewFactory : public DecorationFactory
32 {
33  public:
34  Decoration *createPluginFactory() { return new Hebrew; }
35 };
36 
37 K_EXPORT_PLUGIN( HebrewFactory )
38 
39 Hebrew::Hebrew()
40 {
41  KConfig config( QLatin1String("korganizerrc"), KConfig::NoGlobals );
42 
43  KConfigGroup group( &config, "Hebrew Calendar Plugin" );
44  areWeInIsrael = group.readEntry(
45  "UseIsraelSettings", ( KGlobal::locale()->country() == QLatin1String( ".il" ) ) );
46  showParsha = group.readEntry( "ShowParsha", true );
47  showChol = group.readEntry( "ShowChol_HaMoed", true );
48  showOmer = group.readEntry( "ShowOmer", true );
49 }
50 
51 Hebrew::~Hebrew()
52 {
53 }
54 
55 void Hebrew::configure( QWidget *parent )
56 {
57  ConfigDialog dlg( parent );
58  dlg.exec();
59 }
60 
61 Element::List Hebrew::createDayElements( const QDate &date )
62 {
63  Element::List el;
64  QString text;
65 
66  HebrewDate hd = HebrewDate::fromSecular( date.year(), date.month(), date.day() );
67 
68  QStringList holidays = Holiday::findHoliday( hd, areWeInIsrael, showParsha,
69  showChol, showOmer );
70 
71  KCalendarSystem *cal = KCalendarSystem::create( KLocale::HebrewCalendar );
72 
73  text = cal->formatDate( date, KLocale::Day, KLocale::LongNumber ) + QLatin1Char(' ') + cal->monthName( date );
74 
75  foreach ( const QString &holiday, holidays ) {
76  text += QLatin1String("<br/>\n") + holiday;
77  }
78 
79  text = i18nc( "Change the next two strings if emphasis is done differently in your language.",
80  "<qt><p align=\"center\"><i>\n%1\n</i></p></qt>", text );
81  el.append( new StoredElement( QLatin1String("main element"), text ) );
82 
83  return el;
84 }
85 
86 QString Hebrew::info() const
87 {
88  return i18n( "This plugin provides the date in the Jewish calendar." );
89 }
hebrew.h
Holiday::findHoliday
static QStringList findHoliday(HebrewDate hd, bool useIsraelSettings, bool showParsha, bool showChol, bool showOmer)
Given a day of a Hebrew month, figures out all the interesting holidays that correspond to that date...
Definition: holiday.cpp:33
configdialog.h
Hebrew::info
QString info() const
Definition: hebrew.cpp:86
QWidget
HebrewDate::fromSecular
static HebrewDate fromSecular(int year, int month, int day)
Definition: converter.cpp:40
StoredElement
HebrewDate
This class converts dates between the Hebrew and Gregorian (secular) calendars.
Definition: converter.h:45
Hebrew::configure
void configure(QWidget *parent)
Definition: hebrew.cpp:55
Hebrew::~Hebrew
~Hebrew()
Definition: hebrew.cpp:51
ConfigDialog
Definition: datenums/configdialog.h:28
converter.h
Hebrew::createDayElements
Element::List createDayElements(const QDate &)
Definition: hebrew.cpp:61
Hebrew
Definition: hebrew.h:29
Decoration
K_EXPORT_PLUGIN
K_EXPORT_PLUGIN(KOrganizerFactory(createAboutData())) KOrganizerPart
Definition: korganizer_part.cpp:49
holiday.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:56:19 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

korganizer

Skip menu "korganizer"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal