Remove double margin
[kdepim.git] / korganizer / kohelper.h
blobfaba99add7cbf7d3805ccded9775e6bc683d8c15
1 /*
2 This file is part of KOrganizer.
4 Copyright (C) 2005 Reinhold Kainhofer <reinhold@kainhofer.com>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License along
17 with this program; if not, write to the Free Software Foundation, Inc.,
18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution.
25 #ifndef KORG_KOHELPER_H
26 #define KORG_KOHELPER_H
28 #include "korganizerprivate_export.h"
30 #include <AkonadiCore/Collection>
32 #include <KCalCore/Incidence>
34 namespace Akonadi
36 class Collection;
37 class Item;
40 class QColor;
41 class QDate;
43 // Provides static methods that are useful to all views.
45 namespace KOHelper
47 /**
48 Returns a nice QColor for text, give the input color &c.
50 KORGANIZERPRIVATE_EXPORT QColor getTextColor(const QColor &c);
52 /**
53 This method returns the proper resource / subresource color for the view.
54 @return The resource color for the incidence. If the incidence belongs
55 to a subresource, the color for the subresource is returned (if set).
56 @param calendar the calendar for which the resource color should be obtained
57 @param incidence the incidence for which the color is needed (to
58 determine which subresource needs to be used)
60 KORGANIZERPRIVATE_EXPORT QColor resourceColor(const Akonadi::Item &incidence);
62 KORGANIZERPRIVATE_EXPORT QColor resourceColor(const Akonadi::Collection &collection);
63 KORGANIZERPRIVATE_EXPORT QColor resourceColorKnown(const Akonadi::Collection &collection);
64 KORGANIZERPRIVATE_EXPORT void setResourceColor(const Akonadi::Collection &collection, const QColor &color);
66 /**
67 Returns the number of years between the @p start QDate and the @p end QDate
68 (i.e. the difference in the year number of both dates)
70 KORGANIZERPRIVATE_EXPORT int yearDiff(const QDate &start, const QDate &end);
72 /**
73 Return true if it's the standard calendar
75 KORGANIZERPRIVATE_EXPORT bool isStandardCalendar(Akonadi::Collection::Id id);
77 KORGANIZERPRIVATE_EXPORT void showSaveIncidenceErrorMsg(
78 QWidget *parent, const KCalCore::Incidence::Ptr &incidence);
81 #endif