• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • Sitemap
  • 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 
00165     void reset();
00166 
00167     //static methods
00182     static QString formatDate( DateFormatter::FormatType ftype, time_t t,
00183                                const QString &data=QString(),
00184                                bool shortFormat=true,
00185                                bool includeSecs=false );
00186 
00201     static QString formatCurrentDate( DateFormatter::FormatType ftype,
00202                                       const QString &data=QString(),
00203                                       bool shortFormat=true,
00204                                       bool includeSecs=false );
00205 
00209     static bool isDaylight();
00210 
00211   protected:
00218     QString fancy( time_t t ) const ;
00219 
00229     QString localized( time_t t, bool shortFormat=true,
00230                        bool includeSecs=false,
00231                        const QString &lang=QString() ) const;
00232 
00239     QString cTime( time_t t ) const;
00240 
00247     QString isoDate( time_t t ) const;
00248 
00255     QString rfc2822( time_t t ) const;
00256 
00263     QString custom( time_t t ) const;
00264 
00271     QByteArray zone( time_t t ) const;
00272 
00279     time_t qdateToTimeT( const QDateTime &dt ) const;
00280 
00281   private:
00282     //@cond PRIVATE
00283     FormatType          mFormat;
00284     mutable time_t      mCurrentTime;
00285     mutable QDateTime   mDate;
00286     QString             mCustomFormat;
00287     static int          mDaylight;
00288     //@endcond
00289 };
00290 
00291 } // namespace KMime
00292 
00293 #endif /* __KMIME_DATEFORMATTER_H__ */

KMIME Library

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

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • akonadi
  • kabc
  • kblog
  • kcal
  • kimap
  • kioslave
  •   imap4
  •   mbox
  • kldap
  • kmime
  • kpimidentities
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.5.6
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal