• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.14.10 API Reference
  • KDE Home
  • Contact Us
 

KMIME Library

  • kmime
kmime_dateformatter.h
Go to the documentation of this file.
1/* -*- c++ -*-
2 kmime_dateformatter.h
3
4 KMime, the KDE Internet mail/usenet news message library.
5 Copyright (c) 2001 the KMime authors.
6 See file AUTHORS for details
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either
11 version 2 of the License, or (at your option) any later version.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Library General Public License for more details.
17
18 You should have received a copy of the GNU Library General Public License
19 along with this library; see the file COPYING.LIB. If not, write to
20 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA.
22*/
47#ifndef __KMIME_DATEFORMATTER_H__
48#define __KMIME_DATEFORMATTER_H__
49
50#include <time.h>
51#include <QtCore/QDateTime>
52#include <QtCore/QString>
53#include "kmime_export.h"
54
55namespace KMime {
56
70class KMIME_EXPORT DateFormatter
71{
72 public:
76 enum FormatType {
77 CTime,
78 Localized,
79 Fancy,
80 Iso,
81 Rfc,
82 Custom
83 };
84
90 explicit DateFormatter( FormatType ftype=DateFormatter::Fancy );
91
95 ~DateFormatter();
96
102 FormatType format() const;
103
111 void setFormat( FormatType ftype );
112
125 QString dateString( time_t t, const QString &lang=QString(),
126 bool shortFormat=true, bool includeSecs=false ) const;
127
140 QString dateString( const QDateTime &dtime, const QString &lang=QString(),
141 bool shortFormat=true, bool includeSecs=false ) const;
142
153 void setCustomFormat( const QString &format );
154
160 QString customFormat() const;
161
167 void reset();
168
169 //static methods
184 static QString formatDate( DateFormatter::FormatType ftype, time_t t,
185 const QString &data=QString(),
186 bool shortFormat=true,
187 bool includeSecs=false );
188
203 static QString formatCurrentDate( DateFormatter::FormatType ftype,
204 const QString &data=QString(),
205 bool shortFormat=true,
206 bool includeSecs=false );
207
211 static bool isDaylight();
212
213 protected:
220 QString fancy( time_t t ) const ;
221
231 QString localized( time_t t, bool shortFormat=true,
232 bool includeSecs=false,
233 const QString &lang=QString() ) const;
234
241 QString cTime( time_t t ) const;
242
249 QString isoDate( time_t t ) const;
250
257 QString rfc2822( time_t t ) const;
258
265 QString custom( time_t t ) const;
266
273 QByteArray zone( time_t t ) const;
274
281 time_t qdateToTimeT( const QDateTime &dt ) const;
282
283 private:
284 //@cond PRIVATE
285 FormatType mFormat;
286 mutable time_t mTodayOneSecondBeforeMidnight;
287 mutable QDateTime mUnused; // KDE5: remove
288 QString mCustomFormat;
289 static int mDaylight;
290 //@endcond
291};
292
293} // namespace KMime
294
295#endif /* __KMIME_DATEFORMATTER_H__ */
KMime::DateFormatter
A class for abstracting date formatting.
Definition: kmime_dateformatter.h:71
KMime::DateFormatter::FormatType
FormatType
The different types of date formats.
Definition: kmime_dateformatter.h:76
KMime::DateFormatter::Rfc
@ Rfc
rfc "Sun, 31 Mar 2002 02:08:35 -0500"
Definition: kmime_dateformatter.h:81
KMime::DateFormatter::Localized
@ Localized
localized "2002-03-31 02:08"
Definition: kmime_dateformatter.h:78
KMime::DateFormatter::CTime
@ CTime
ctime "Sun Mar 31 02:08:35 2002"
Definition: kmime_dateformatter.h:77
KMime::DateFormatter::Iso
@ Iso
iso "2002-03-31 02:08:35"
Definition: kmime_dateformatter.h:80
KMime::DateFormatter::Fancy
@ Fancy
fancy "Today 02:08:35"
Definition: kmime_dateformatter.h:79
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Jul 21 2022 00:00:00 by doxygen 1.9.5 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KMIME Library

Skip menu "KMIME Library"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Related Pages

kdepimlibs-4.14.10 API Reference

Skip menu "kdepimlibs-4.14.10 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
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