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

KCal Library

exceptions.cpp
Go to the documentation of this file.
00001 /*
00002     This file is part of the kcal library.
00003 
00004     Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License as published by the Free Software Foundation; either
00009     version 2 of the License, or (at your option) any later version.
00010 
00011     This library is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     Library General Public License for more details.
00015 
00016     You should have received a copy of the GNU Library General Public License
00017     along with this library; see the file COPYING.LIB.  If not, write to
00018     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019     Boston, MA 02110-1301, USA.
00020 */
00036 #include "exceptions.h"
00037 #include "calformat.h"
00038 
00039 #include <klocale.h>
00040 
00041 using namespace KCal;
00042 
00043 Exception::Exception( const QString &message )
00044 {
00045   mMessage = message;
00046 }
00047 
00048 Exception::~Exception()
00049 {
00050 }
00051 
00052 QString Exception::message()
00053 {
00054   if ( mMessage.isEmpty() ) {
00055     return i18n( "%1 Error", CalFormat::application() );
00056   } else {
00057     return mMessage;
00058   }
00059 }
00060 
00065 //@cond PRIVATE
00066 class KCal::ErrorFormat::Private
00067 {
00068   public:
00069     ErrorCodeFormat mCode;
00070 };
00071 //@endcond
00072 
00073 ErrorFormat::ErrorFormat( ErrorCodeFormat code, const QString &message )
00074   : Exception( message ), d( new KCal::ErrorFormat::Private )
00075 {
00076   d->mCode = code;
00077 }
00078 
00079 ErrorFormat::~ErrorFormat()
00080 {
00081   delete d;
00082 }
00083 
00084 QString ErrorFormat::message()
00085 {
00086   QString message = "";
00087 
00088   switch ( d->mCode ) {
00089   case LoadError:
00090     message = i18n( "Load Error" );
00091     break;
00092   case SaveError:
00093     message = i18n( "Save Error" );
00094     break;
00095   case ParseErrorIcal:
00096     message = i18n( "Parse Error in libical" );
00097     break;
00098   case ParseErrorKcal:
00099     message = i18n( "Parse Error in libkcal" );
00100     break;
00101   case NoCalendar:
00102     message = i18n( "No calendar component found." );
00103     break;
00104   case CalVersion1:
00105     message = i18n( "vCalendar Version 1.0 detected." );
00106     break;
00107   case CalVersion2:
00108     message = i18n( "iCalendar Version 2.0 detected." );
00109     break;
00110   case CalVersionUnknown:
00111     message = i18n( "Unknown calendar format detected." );
00112     break;
00113   case Restriction:
00114     message = i18n( "Restriction violation" );
00115     break;
00116   case NoWritableFound:
00117     message = i18n( "No writable resource found" );
00118     break;
00119   case UserCancel:
00120     // no real error; the user canceled the operation
00121     break;
00122   }
00123 
00124   if ( !mMessage.isEmpty() ) {
00125     message += ": " + mMessage;
00126   }
00127 
00128   return message;
00129 }
00130 
00131 ErrorFormat::ErrorCodeFormat ErrorFormat::errorCode()
00132 {
00133   return d->mCode;
00134 }
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon May 14 2012 05:05:29 by doxygen 1.7.5 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KCal Library

Skip menu "KCal 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