• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

PIMPrint Library

  • sources
  • kde-4.14
  • kdepim
  • pimprint
  • calendar
cellitem.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
3 
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.
8 
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.
13 
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.
17 
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.
21 */
22 #ifndef PIMPRINT_CELLITEM_H
23 #define PIMPRINT_CELLITEM_H
24 
25 #include "pimprint_calendar_export.h"
26 
27 #include <KCalCore/Event>
28 
29 #include <QList>
30 
31 namespace PimPrint
32 {
33 
34 namespace Calendar
35 {
36 
37 class PIMPRINT_CALENDAR_EXPORT CellItem
38 {
39 public:
40  CellItem()
41  : mSubCells(0), mSubCell(-1)
42  {
43  }
44 
45  virtual ~CellItem()
46  {
47  }
48 
49  void setSubCells(int v)
50  {
51  mSubCells = v;
52  }
53 
54  int subCells() const
55  {
56  return mSubCells;
57  }
58 
59  void setSubCell(int v)
60  {
61  mSubCell = v;
62  }
63 
64  int subCell() const
65  {
66  return mSubCell;
67  }
68 
69  virtual bool overlaps(CellItem *other) const = 0;
70 
71  virtual QString label() const;
72 
81  static QList<CellItem *> placeItem(QList<CellItem *> cells, CellItem *placeItem);
82 
83 private:
84  int mSubCells;
85  int mSubCell;
86 };
87 
88 class PIMPRINT_CALENDAR_EXPORT PrintCellItem : public CellItem
89 {
90 public:
91  PrintCellItem(const KCalCore::Event::Ptr &event,
92  const KDateTime &start, const KDateTime &end)
93  : mEvent(event), mStart(start), mEnd(end)
94  {
95  }
96 
97  KCalCore::Event::Ptr event() const
98  {
99  return mEvent;
100  }
101 
102  QString label() const
103  {
104  return mEvent->summary();
105  }
106 
107  KDateTime start() const
108  {
109  return mStart;
110  }
111 
112  KDateTime end() const
113  {
114  return mEnd;
115  }
116 
119  bool overlaps(CellItem *o) const
120  {
121  PrintCellItem *other = static_cast<PrintCellItem *>(o);
122  return !(other->start() >= end() || other->end() <= start());
123  }
124 
125 private:
126  KCalCore::Event::Ptr mEvent;
127  KDateTime mStart, mEnd;
128 };
129 
130 }
131 
132 }
133 
134 #endif
PimPrint::Calendar::CellItem
Definition: cellitem.h:37
PimPrint::Calendar::CellItem::CellItem
CellItem()
Definition: cellitem.h:40
PimPrint::Calendar::PrintCellItem::overlaps
bool overlaps(CellItem *o) const
Calculate the start and end date/time of the recurrence that happens on the given day...
Definition: cellitem.h:119
pimprint_calendar_export.h
PimPrint::Calendar::CellItem::setSubCell
void setSubCell(int v)
Definition: cellitem.h:59
PimPrint::Calendar::PrintCellItem::end
KDateTime end() const
Definition: cellitem.h:112
PimPrint::Calendar::CellItem::subCells
int subCells() const
Definition: cellitem.h:54
PimPrint::Calendar::PrintCellItem
Definition: cellitem.h:88
PimPrint::Calendar::CellItem::setSubCells
void setSubCells(int v)
Definition: cellitem.h:49
PIMPRINT_CALENDAR_EXPORT
#define PIMPRINT_CALENDAR_EXPORT
Definition: pimprint_calendar_export.h:35
QString
QList
PimPrint::Calendar::PrintCellItem::start
KDateTime start() const
Definition: cellitem.h:107
PimPrint::Calendar::CellItem::~CellItem
virtual ~CellItem()
Definition: cellitem.h:45
PimPrint::Calendar::CellItem::subCell
int subCell() const
Definition: cellitem.h:64
PimPrint::Calendar::PrintCellItem::PrintCellItem
PrintCellItem(const KCalCore::Event::Ptr &event, const KDateTime &start, const KDateTime &end)
Definition: cellitem.h:91
PimPrint::Calendar::PrintCellItem::event
KCalCore::Event::Ptr event() const
Definition: cellitem.h:97
PimPrint::Calendar::PrintCellItem::label
QString label() const
Definition: cellitem.h:102
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:32:09 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

PIMPrint Library

Skip menu "PIMPrint Library"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer
  • pimprint

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal