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

KMIME Library

kmime_dateformatter.h
Go to the documentation of this file.
00001 /*  -*- c++ -*-
00002     kmime_dateformatter.h
00003 
00004     KMime, the KDE Internet mail/usenet news message library.
00005     Copyright (c) 2001 the KMime authors.
00006     See file AUTHORS for details
00007 
00008     This library is free software; you can redistribute it and/or
00009     modify it under the terms of the GNU Library General Public
00010     License as published by the Free Software Foundation; either
00011     version 2 of the License, or (at your option) any later version.
00012 
00013     This library is distributed in the hope that it will be useful,
00014     but WITHOUT ANY WARRANTY; without even the implied warranty of
00015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016     Library General Public License for more details.
00017 
00018     You should have received a copy of the GNU Library General Public License
00019     along with this library; see the file COPYING.LIB.  If not, write to
00020     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00021     Boston, MA 02110-1301, USA.
00022 */
00047 #ifndef __KMIME_DATEFORMATTER_H__
00048 #define __KMIME_DATEFORMATTER_H__
00049 
00050 #include <time.h>
00051 #include <QtCore/QDateTime>
00052 #include <QtCore/QString>
00053 #include "kmime_export.h"
00054 
00055 namespace KMime {
00056 
00070 class KMIME_EXPORT DateFormatter
00071 {
00072   public:
00076     enum FormatType {
00077       CTime,      
00078       Localized,  
00079       Fancy,      
00080       Iso,        
00081       Rfc,        
00082       Custom      
00083     };
00084 
00090     explicit DateFormatter( FormatType ftype=DateFormatter::Fancy );
00091 
00095     ~DateFormatter();
00096 
00102     FormatType format() const;
00103 
00111     void setFormat( FormatType ftype );
00112 
00125     QString dateString( time_t t, const QString &lang=QString(),
00126                         bool shortFormat=true, bool includeSecs=false ) const;
00127 
00140     QString dateString( const QDateTime &dtime, const QString &lang=QString(),
00141                         bool shortFormat=true, bool includeSecs=false ) const;
00142 
00153     void setCustomFormat( const QString &format );
00154 
00160     QString customFormat() const;
00161 
00167     void reset();
00168 
00169     //static methods
00184     static QString formatDate( DateFormatter::FormatType ftype, time_t t,
00185                                const QString &data=QString(),
00186                                bool shortFormat=true,
00187                                bool includeSecs=false );
00188 
00203     static QString formatCurrentDate( DateFormatter::FormatType ftype,
00204                                       const QString &data=QString(),
00205                                       bool shortFormat=true,
00206                                       bool includeSecs=false );
00207 
00211     static bool isDaylight();
00212 
00213   protected:
00220     QString fancy( time_t t ) const ;
00221 
00231     QString localized( time_t t, bool shortFormat=true,
00232                        bool includeSecs=false,
00233                        const QString &lang=QString() ) const;
00234 
00241     QString cTime( time_t t ) const;
00242 
00249     QString isoDate( time_t t ) const;
00250 
00257     QString rfc2822( time_t t ) const;
00258 
00265     QString custom( time_t t ) const;
00266 
00273     QByteArray zone( time_t t ) const;
00274 
00281     time_t qdateToTimeT( const QDateTime &dt ) const;
00282 
00283   private:
00284     //@cond PRIVATE
00285     FormatType          mFormat;
00286     mutable time_t      mTodayOneSecondBeforeMidnight;
00287     mutable QDateTime   mUnused; // KDE5: remove
00288     QString             mCustomFormat;
00289     static int          mDaylight;
00290     //@endcond
00291 };
00292 
00293 } // namespace KMime
00294 
00295 #endif /* __KMIME_DATEFORMATTER_H__ */
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Thu May 10 2012 22:17:28 by doxygen 1.8.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KMIME Library

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

kdepimlibs-4.8.3 API Reference

Skip menu "kdepimlibs-4.8.3 API Reference"
  • akonadi
  •   contact
  •   kmime
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  •   richtextbuilders
  • 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