libkcal Library API Documentation

compat.cpp

00001 /*
00002     This file is part of libkcal.
00003     Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public License
00016     along with this library; see the file COPYING.LIB.  If not, write to
00017     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018     Boston, MA 02111-1307, USA.
00019 */
00020 
00021 #include "compat.h"
00022 
00023 #include <kdebug.h>
00024 
00025 #include <qregexp.h>
00026 
00027 using namespace KCal;
00028 
00029 Compat *CompatFactory::createCompat( const QString &productId )
00030 {
00031 //  kdDebug(5800) << "CompatFactory::createCompat(): '" << productId << "'"
00032 //                << endl;
00033 
00034   Compat *compat = 0;
00035 
00036   int korg = productId.find( "KOrganizer" );
00037   if ( korg >= 0 ) {
00038     int versionStart = productId.find( " ", korg );
00039     if ( versionStart >= 0 ) {
00040       int versionStop = productId.find( QRegExp( "[ /]" ), versionStart + 1 );
00041       if ( versionStop >= 0 ) {
00042         QString version = productId.mid( versionStart + 1,
00043                                          versionStop - versionStart - 1 );
00044         kdDebug(5800) << "Found KOrganizer version: " << version << endl;
00045         
00046         int versionNum = version.section( ".", 0, 0 ).toInt() * 10000 +
00047                          version.section( ".", 1, 1 ).toInt() * 100 +
00048                          version.section( ".", 2, 2 ).toInt();
00049                          
00050         kdDebug(5800) << "Numerical version: " << versionNum << endl;
00051         
00052         if ( versionNum < 30100 ) {
00053           compat = new CompatPre31;
00054         }
00055       }
00056     }
00057   }
00058   
00059   if ( !compat ) compat = new Compat;
00060 
00061   return compat;
00062 }
00063 
00064 void CompatPre31::fixFloatingEnd( QDate &endDate )
00065 {
00066   endDate = endDate.addDays( 1 );
00067 }
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.4.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sat Oct 18 02:47:03 2003 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001