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

kalarm/lib

  • sources
  • kde-4.14
  • kdepim
  • kalarm
  • lib
kalocale.cpp
Go to the documentation of this file.
1 /*
2  * kalocale.cpp - miscellaneous locale functions
3  * Program: kalarm
4  * Copyright © 2003-2009 by David Jarvie <djarvie@kde.org>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  */
20 
21 #include "kalarm.h" //krazy:exclude=includes (kalarm.h must be first)
22 #include "kalocale.h"
23 
24 #include <kglobal.h>
25 #include <klocale.h>
26 #include <kdebug.h>
27 
28 
29 namespace KAlarm
30 {
31 
32 /******************************************************************************
33 * Return the first day of the week for the user's locale.
34 * Reply = 1 (Mon) .. 7 (Sun).
35 */
36 int localeFirstDayOfWeek()
37 {
38  static int firstDay = 0;
39  if (!firstDay)
40  firstDay = KGlobal::locale()->weekStartDay();
41  return firstDay;
42 }
43 
44 /******************************************************************************
45 * Return the week day name (Monday = 1).
46 */
47 QString weekDayName(int day, const KLocale* locale)
48 {
49  switch (day)
50  {
51  case 1: return ki18nc("@option Name of the weekday", "Monday").toString(locale);
52  case 2: return ki18nc("@option Name of the weekday", "Tuesday").toString(locale);
53  case 3: return ki18nc("@option Name of the weekday", "Wednesday").toString(locale);
54  case 4: return ki18nc("@option Name of the weekday", "Thursday").toString(locale);
55  case 5: return ki18nc("@option Name of the weekday", "Friday").toString(locale);
56  case 6: return ki18nc("@option Name of the weekday", "Saturday").toString(locale);
57  case 7: return ki18nc("@option Name of the weekday", "Sunday").toString(locale);
58  }
59  return QString();
60 }
61 
62 /******************************************************************************
63 * Return the default work days in the week, as a bit mask.
64 * They are determined by the start and end work days in system settings.
65 */
66 uint defaultWorkDays()
67 {
68  KLocale* locale = KGlobal::locale();
69  int end = locale->workingWeekEndDay() - 1;
70  uint days = 0;
71  for (int day = locale->workingWeekStartDay() - 1; ; )
72  {
73  days |= 1 << day;
74  if (day == end)
75  break;
76  ++day;
77  if (day >= 7)
78  day = 0;
79  }
80  return days;
81 }
82 
83 } // namespace KAlarm
84 
85 // vim: et sw=4:
KAlarm::weekDayName
QString weekDayName(int day, const KLocale *locale)
Return the week day name (Monday = 1).
Definition: kalocale.cpp:47
KAlarm::defaultWorkDays
uint defaultWorkDays()
Definition: kalocale.cpp:66
kalocale.h
QString
KAlarm::localeFirstDayOfWeek
int localeFirstDayOfWeek()
Return the first day of the week for the user's locale.
Definition: kalocale.cpp:36
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:35:02 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kalarm/lib

Skip menu "kalarm/lib"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

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
  • pimprint

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