compat.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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
00032
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 }
This file is part of the documentation for kdelibs Version 3.1.5.