remove superfluous 'and'
[kdepim.git] / calendarviews / helper.h
blob00b012d7e5f8528890cd1a7b4638043862567051
1 /*
2 Copyright (C) 2005 Reinhold Kainhofer <reinhold@kainhofer.com>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License along
15 with this program; if not, write to the Free Software Foundation, Inc.,
16 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 As a special exception, permission is given to link this program
19 with any edition of Qt, and distribute the resulting executable,
20 without including the source code for Qt in the source distribution.
22 #ifndef EVENTVIEWS_HELPER_H
23 #define EVENTVIEWS_HELPER_H
25 #include "eventviews_export.h"
27 #include <QColor>
29 namespace boost {
30 template <typename T> class shared_ptr;
33 namespace Akonadi {
34 class Collection;
35 class Item;
38 class QPixmap;
39 class QDate;
41 // Provides static methods that are useful to all views.
43 namespace EventViews
46 class Prefs;
47 typedef boost::shared_ptr<Prefs> PrefsPtr;
49 /**
50 Returns a nice QColor for text, give the input color &c.
52 EVENTVIEWS_EXPORT QColor getTextColor( const QColor &c );
54 /**
55 This method returns the proper resource / subresource color for the view.
56 @return The resource color for the incidence. If the incidence belongs
57 to a subresource, the color for the subresource is returned (if set).
58 @param calendar the calendar for which the resource color should be obtained
59 @param incidence the incidence for which the color is needed (to
60 determine which subresource needs to be used)
62 EVENTVIEWS_EXPORT QColor resourceColor( const Akonadi::Item &incidence,
63 const PrefsPtr &preferences );
65 EVENTVIEWS_EXPORT QColor resourceColor( const Akonadi::Collection &collection,
66 const PrefsPtr &preferences );
68 /**
69 Returns the number of years between the @p start QDate and the @p end QDate
70 (i.e. the difference in the year number of both dates)
72 EVENTVIEWS_EXPORT int yearDiff( const QDate &start, const QDate &end );
74 /**
75 Equivalent to SmallIcon( name ), but uses QPixmapCache.
76 KIconLoader already uses a cache, but it's 20x slower on my tests.
78 @return A new pixmap if it isn't yet in cache, otherwise returns the
79 cached one.
81 EVENTVIEWS_EXPORT QPixmap cachedSmallIcon( const QString &name );
85 #endif