kohelper.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include <qcolor.h>
00026
00027 #include <kdebug.h>
00028
00029 #include <libkcal/incidence.h>
00030 #include <libkcal/calendar.h>
00031 #include <libkcal/calendarresources.h>
00032 #include <libkcal/resourcecalendar.h>
00033
00034 #include "koprefs.h"
00035 #include "kohelper.h"
00036
00037 QColor KOHelper::resourceColor( KCal::Calendar*calendar, KCal::Incidence*incidence )
00038 {
00039 QColor resourceColor = QColor();
00040
00041
00042 KCal::CalendarResources *calendarResource = dynamic_cast<KCal::CalendarResources*>( calendar );
00043
00044 if ( calendarResource ) {
00045 KCal::ResourceCalendar *resourceCalendar = calendarResource->resource( incidence );
00046
00047 if( resourceCalendar )
00048 {
00049 QString identifier = resourceCalendar->identifier();
00050 resourceColor = *KOPrefs::instance()->resourceColor( identifier );
00051
00052 if ( !resourceCalendar->subresources().isEmpty() ) {
00053 identifier = resourceCalendar->subresourceIdentifier( incidence );
00054 if ( identifier.isEmpty() )
00055 identifier = resourceCalendar->identifier();
00056 QColor subrescolor( *KOPrefs::instance()->resourceColor( identifier ) );
00057 if ( subrescolor.isValid() )
00058 resourceColor = subrescolor;
00059 }
00060 }
00061
00062
00063 }
00064 return resourceColor;
00065 }
This file is part of the documentation for korganizer Library Version 3.3.2.