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

korganizer

  • sources
  • kde-4.14
  • kdepim
  • korganizer
  • views
  • todoview
kotodoview.cpp
Go to the documentation of this file.
1 /*
2  This file is part of KOrganizer.
3 
4  Copyright (c) 2000,2001,2003 Cornelius Schumacher <schumacher@kde.org>
5  Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
6  Copyright (c) 2005 Rafal Rzepecki <divide@users.sourceforge.net>
7  Copyright (c) 2008 Thomas Thrainer <tom_t@gmx.at>
8 
9  This program is free software; you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation; either version 2 of the License, or
12  (at your option) any later version.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License along
20  with this program; if not, write to the Free Software Foundation, Inc.,
21  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 
23  As a special exception, permission is given to link this program
24  with any edition of Qt, and distribute the resulting executable,
25  without including the source code for Qt in the source distribution.
26 */
27 
28 #include "kotodoview.h"
29 #include "prefs/koprefs.h"
30 
31 #include <calendarsupport/printing/calprinter.h>
32 
33 #include <calendarviews/todo/todoview.h>
34 
35 #include <Akonadi/EntityTreeModel>
36 
37 #include <QVBoxLayout>
38 
39 KOTodoView::KOTodoView( bool sidebarView, QWidget *parent )
40  : BaseView( parent )
41 {
42  mView = new EventViews::TodoView( KOPrefs::instance()->eventViewsPreferences(),
43  sidebarView, parent );
44  QVBoxLayout *layout = new QVBoxLayout( this );
45  layout->addWidget( mView );
46  connect( mView, SIGNAL(printTodo()), SLOT(printTodo()) );
47  connect( mView, SIGNAL(printPreviewTodo()), SLOT(printPreviewTodo()) );
48  connect( mView, SIGNAL(purgeCompletedSignal()), SIGNAL(purgeCompletedSignal()) );
49 
50  connect( mView, SIGNAL(incidenceSelected(Akonadi::Item,QDate)),
51  SIGNAL(incidenceSelected(Akonadi::Item,QDate)) );
52 
53  connect( mView, SIGNAL(showIncidenceSignal(Akonadi::Item)),
54  SIGNAL(showIncidenceSignal(Akonadi::Item)) );
55 
56  connect( mView, SIGNAL(editIncidenceSignal(Akonadi::Item)),
57  SIGNAL(editIncidenceSignal(Akonadi::Item)) );
58 
59  connect( mView, SIGNAL(deleteIncidenceSignal(Akonadi::Item)),
60  SIGNAL(deleteIncidenceSignal(Akonadi::Item)) );
61 
62  connect( mView, SIGNAL(cutIncidenceSignal(Akonadi::Item)),
63  SIGNAL(cutIncidenceSignal(Akonadi::Item)) );
64 
65  connect( mView, SIGNAL(copyIncidenceSignal(Akonadi::Item)),
66  SIGNAL(copyIncidenceSignal(Akonadi::Item)) );
67 
68  connect( mView, SIGNAL(pasteIncidenceSignal()),
69  SIGNAL(pasteIncidenceSignal()) );
70 
71  connect( mView, SIGNAL(toggleAlarmSignal(Akonadi::Item)),
72  SIGNAL(toggleAlarmSignal(Akonadi::Item)) );
73 
74  connect( mView, SIGNAL(toggleTodoCompletedSignal(Akonadi::Item)),
75  SIGNAL(toggleTodoCompletedSignal(Akonadi::Item)) );
76 
77  connect( mView, SIGNAL(copyIncidenceToResourceSignal(Akonadi::Item,Akonadi::Collection)),
78  SIGNAL(copyIncidenceToResourceSignal(Akonadi::Item,Akonadi::Collection)) );
79 
80  connect( mView, SIGNAL(moveIncidenceToResourceSignal(Akonadi::Item,Akonadi::Collection)),
81  SIGNAL(moveIncidenceToResourceSignal(Akonadi::Item,Akonadi::Collection)) );
82 
83  connect( mView, SIGNAL(dissociateOccurrencesSignal(Akonadi::Item,QDate)),
84  SIGNAL(dissociateOccurrencesSignal(Akonadi::Item,QDate)) );
85 
86  connect( mView, SIGNAL(newEventSignal()),
87  SIGNAL(newEventSignal()) );
88 
89  connect( mView, SIGNAL(newEventSignal(QDate)),
90  SIGNAL(newEventSignal(QDate)) );
91 
92  connect( mView, SIGNAL(newEventSignal(QDateTime)),
93  SIGNAL(newEventSignal(QDateTime)) );
94 
95  connect( mView, SIGNAL(newEventSignal(QDateTime,QDateTime)),
96  SIGNAL(newEventSignal(QDateTime,QDateTime)) );
97 
98  connect( mView, SIGNAL(newTodoSignal(QDate)),
99  SIGNAL(newTodoSignal(QDate)) );
100 
101  connect( mView, SIGNAL(newSubTodoSignal(Akonadi::Item)),
102  SIGNAL(newSubTodoSignal(Akonadi::Item)) );
103 
104  connect( mView, SIGNAL(fullViewChanged(bool)),
105  SIGNAL(fullViewChanged(bool)) );
106 
107  connect( mView, SIGNAL(unSubTodoSignal()),
108  SIGNAL(unSubTodoSignal()) );
109  connect( mView, SIGNAL(unAllSubTodoSignal()),
110  SIGNAL(unAllSubTodoSignal()) );
111 }
112 
113 KOTodoView::~KOTodoView()
114 {
115 }
116 
117 void KOTodoView::setCalendar( const Akonadi::ETMCalendar::Ptr &calendar )
118 {
119  BaseView::setCalendar( calendar );
120  mView->setCalendar( calendar );
121 }
122 
123 Akonadi::Item::List KOTodoView::selectedIncidences()
124 {
125  return mView->selectedIncidences();
126 }
127 
128 KCalCore::DateList KOTodoView::selectedIncidenceDates()
129 {
130  return KCalCore::DateList();
131 }
132 
133 void KOTodoView::setIncidenceChanger( Akonadi::IncidenceChanger *changer )
134 {
135  BaseView::setIncidenceChanger( changer );
136  mView->setIncidenceChanger( changer );
137 }
138 
139 void KOTodoView::showDates( const QDate &start, const QDate &end, const QDate & )
140 {
141  // There is nothing to do here for the Todo View
142  Q_UNUSED( start );
143  Q_UNUSED( end );
144 }
145 
146 void KOTodoView::showIncidences( const Akonadi::Item::List &incidenceList, const QDate &date )
147 {
148  Q_UNUSED( incidenceList );
149  Q_UNUSED( date );
150 }
151 
152 void KOTodoView::updateView()
153 {
154  // View is always updated, it's connected to ETM.
155 }
156 
157 void KOTodoView::changeIncidenceDisplay( const Akonadi::Item &, Akonadi::IncidenceChanger::ChangeType )
158 {
159  // Don't do anything, model is connected to ETM, it's up to date
160 }
161 
162 void KOTodoView::updateConfig()
163 {
164  mView->updateConfig();
165 }
166 
167 void KOTodoView::clearSelection()
168 {
169  mView->clearSelection();
170 }
171 
172 void KOTodoView::printTodo()
173 {
174  printTodo( false );
175 }
176 
177 void KOTodoView::printPreviewTodo()
178 {
179  printTodo( true );
180 }
181 
182 void KOTodoView::printTodo( bool preview )
183 {
184  Akonadi::Item::List selectedItems = mView->selectedIncidences();
185  if ( selectedItems.count() != 1 ) {
186  return;
187  }
188 
189  Akonadi::Item todoItem = selectedItems.first();
190  KCalCore::Todo::Ptr todo = CalendarSupport::todo( todoItem );
191  Q_ASSERT( todo );
192 
193  CalendarSupport::CalPrinter printer( this, calendar(), true );
194  connect( this, SIGNAL(configChanged()), &printer, SLOT(updateConfig()) );
195 
196  KCalCore::Incidence::List selectedIncidences;
197  selectedIncidences.append( todo );
198 
199  KDateTime todoDate;
200  if ( todo->hasStartDate() ) {
201  todoDate = todo->dtStart();
202  } else {
203  todoDate = todo->dtDue();
204  }
205 
206  printer.print( CalendarSupport::CalPrinterBase::Incidence,
207  todoDate.date(), todoDate.date(), selectedIncidences, preview );
208 
209 }
210 
211 void KOTodoView::getHighlightMode( bool &highlightEvents,
212  bool &highlightTodos,
213  bool &highlightJournals )
214 {
215  highlightTodos = KOPrefs::instance()->mHighlightTodos;
216  highlightEvents = !highlightTodos;
217  highlightJournals = false;
218 }
219 
220 void KOTodoView::saveViewState()
221 {
222  mView->saveViewState();
223 }
224 
225 void KOTodoView::restoreViewState()
226 {
227  mView->restoreViewState();
228 }
229 
230 void KOTodoView::restoreLayout( KConfig *config, const QString &group, bool minimalDefaults )
231 {
232  mView->restoreLayout( config, group, minimalDefaults );
233 }
234 
235 void KOTodoView::saveLayout( KConfig *config, const QString &group ) const
236 {
237  mView->saveLayout( config, group );
238 }
239 
240 bool KOTodoView::usesFullWindow()
241 {
242  return mView->usesFullWindow();
243 }
244 
245 CalendarSupport::CalPrinterBase::PrintType KOTodoView::printType() const
246 {
247  return CalendarSupport::CalPrinterBase::Todolist;
248 }
249 
QWidget::layout
QLayout * layout() const
QWidget
KOTodoView::unSubTodoSignal
void unSubTodoSignal()
KOTodoView::updateView
virtual void updateView()
Definition: kotodoview.cpp:152
KOrg::BaseView::incidenceSelected
void incidenceSelected(const Akonadi::Item &, const QDate)
KOTodoView::printType
virtual CalendarSupport::CalPrinterBase::PrintType printType() const
Definition: kotodoview.cpp:245
KOTodoView::selectedIncidences
virtual Akonadi::Item::List selectedIncidences()
Definition: kotodoview.cpp:123
KOTodoView::updateConfig
virtual void updateConfig()
Definition: kotodoview.cpp:162
KOrg::BaseView::toggleAlarmSignal
void toggleAlarmSignal(const Akonadi::Item &)
instructs the receiver to toggle the alarms of the Incidence.
KOTodoView::saveViewState
void saveViewState()
Definition: kotodoview.cpp:220
kotodoview.h
KOTodoView::showDates
virtual void showDates(const QDate &start, const QDate &end, const QDate &preferredMonth=QDate())
Definition: kotodoview.cpp:139
KOrg::BaseView::newTodoSignal
void newTodoSignal(const QDate &)
KOTodoView::clearSelection
virtual void clearSelection()
Definition: kotodoview.cpp:167
QBoxLayout::addWidget
void addWidget(QWidget *widget, int stretch, QFlags< Qt::AlignmentFlag > alignment)
KOrg::BaseView::dissociateOccurrencesSignal
void dissociateOccurrencesSignal(const Akonadi::Item &, const QDate &)
Dissociate from a recurring incidence the occurrence on the given date to a new incidence or dissocia...
KOTodoView::restoreViewState
void restoreViewState()
Definition: kotodoview.cpp:225
KOTodoView::purgeCompletedSignal
void purgeCompletedSignal()
KOTodoView::showIncidences
virtual void showIncidences(const Akonadi::Item::List &incidenceList, const QDate &date)
Definition: kotodoview.cpp:146
koprefs.h
KOTodoView::KOTodoView
KOTodoView(bool sidebarView, QWidget *parent)
Definition: kotodoview.cpp:39
KOrg::BaseView::editIncidenceSignal
void editIncidenceSignal(const Akonadi::Item &)
instructs the receiver to begin editing the incidence specified in some manner.
KOrg::BaseView::showIncidenceSignal
void showIncidenceSignal(const Akonadi::Item &)
instructs the receiver to show the incidence in read-only mode.
QVBoxLayout
QDate
KOrg::BaseView::copyIncidenceSignal
void copyIncidenceSignal(const Akonadi::Item &)
instructs the receiver to copy the incidence
KOrg::BaseView::newSubTodoSignal
void newSubTodoSignal(const Akonadi::Item &)
KOrg::BaseView::cutIncidenceSignal
void cutIncidenceSignal(const Akonadi::Item &)
instructs the receiver to cut the Incidence
KOTodoView::selectedIncidenceDates
virtual KCalCore::DateList selectedIncidenceDates()
Returns a list of the dates of selected events.
Definition: kotodoview.cpp:128
KOTodoView::setCalendar
virtual void setCalendar(const Akonadi::ETMCalendar::Ptr &)
Definition: kotodoview.cpp:117
QString
KOrg::BaseView::toggleTodoCompletedSignal
void toggleTodoCompletedSignal(const Akonadi::Item &)
instructs the receiver to toggle the completion state of the Incidence (which must be a Todo type)...
KOTodoView::saveLayout
void saveLayout(KConfig *config, const QString &group) const
Definition: kotodoview.cpp:235
KOrg::BaseView::deleteIncidenceSignal
void deleteIncidenceSignal(const Akonadi::Item &)
instructs the receiver to delete the Incidence in some manner; some possibilities include automatical...
KOrg::BaseView::copyIncidenceToResourceSignal
void copyIncidenceToResourceSignal(const Akonadi::Item &, const Akonadi::Collection &)
Copy the incidence to the specified resource.
KOrg::BaseView::moveIncidenceToResourceSignal
void moveIncidenceToResourceSignal(const Akonadi::Item &, const Akonadi::Collection &)
Move the incidence to the specified resource.
KOrg::BaseView::calendar
virtual Akonadi::ETMCalendar::Ptr calendar()
Return calendar object of this view.
Definition: baseview.cpp:80
KOrg::BaseView
This class provides an interface for all views being displayed within the main calendar view...
Definition: baseview.h:52
KOTodoView::usesFullWindow
bool usesFullWindow()
returns whether this view should be displayed full window.
Definition: kotodoview.cpp:240
KOTodoView::~KOTodoView
~KOTodoView()
Definition: kotodoview.cpp:113
KOrg::BaseView::newEventSignal
void newEventSignal()
instructs the receiver to create a new event in given collection.
KOTodoView::fullViewChanged
void fullViewChanged(bool enabled)
KOPrefs::instance
static KOPrefs * instance()
Get instance of KOPrefs.
Definition: koprefs.cpp:68
KOTodoView::changeIncidenceDisplay
virtual void changeIncidenceDisplay(const Akonadi::Item &incidence, Akonadi::IncidenceChanger::ChangeType changeType)
Definition: kotodoview.cpp:157
KOTodoView::restoreLayout
void restoreLayout(KConfig *config, const QString &group, bool minimalDefaults)
Definition: kotodoview.cpp:230
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
KOTodoView::configChanged
void configChanged()
KOTodoView::unAllSubTodoSignal
void unAllSubTodoSignal()
KOTodoView::getHighlightMode
void getHighlightMode(bool &highlightEvents, bool &highlightTodos, bool &highlightJournals)
documentation in baseview.h
Definition: kotodoview.cpp:211
QDateTime
KOrg::BaseView::pasteIncidenceSignal
void pasteIncidenceSignal()
instructs the receiver to paste the incidence
KOTodoView::setIncidenceChanger
virtual void setIncidenceChanger(Akonadi::IncidenceChanger *changer)
Definition: kotodoview.cpp:133
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:32:59 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

korganizer

Skip menu "korganizer"
  • Main Page
  • Namespace List
  • Namespace Members
  • 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