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

korganizer

  • sources
  • kde-4.12
  • 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 "koprefs.h"
30 #include "kocorehelper.h"
31 
32 #include <calendarviews/todo/todoview.h>
33 #include <Akonadi/EntityTreeModel>
34 #include <QVBoxLayout>
35 
36 KOTodoView::KOTodoView( bool sidebarView, QWidget *parent )
37  : BaseView( parent )
38 {
39  mView = new EventViews::TodoView( KOPrefs::instance()->eventViewsPreferences(),
40  sidebarView, parent );
41  QVBoxLayout *layout = new QVBoxLayout( this );
42  layout->addWidget( mView );
43  connect( mView, SIGNAL(printTodo()), SLOT(printTodo()) );
44  connect( mView, SIGNAL(printPreviewTodo()), SLOT(printPreviewTodo()) );
45  connect( mView, SIGNAL(purgeCompletedSignal()), SIGNAL(purgeCompletedSignal()) );
46 
47  connect( mView, SIGNAL(incidenceSelected(Akonadi::Item,QDate)),
48  SIGNAL(incidenceSelected(Akonadi::Item,QDate)) );
49 
50  connect( mView, SIGNAL(showIncidenceSignal(Akonadi::Item)),
51  SIGNAL(showIncidenceSignal(Akonadi::Item)) );
52 
53  connect( mView, SIGNAL(editIncidenceSignal(Akonadi::Item)),
54  SIGNAL(editIncidenceSignal(Akonadi::Item)) );
55 
56  connect( mView, SIGNAL(deleteIncidenceSignal(Akonadi::Item)),
57  SIGNAL(deleteIncidenceSignal(Akonadi::Item)) );
58 
59  connect( mView, SIGNAL(cutIncidenceSignal(Akonadi::Item)),
60  SIGNAL(cutIncidenceSignal(Akonadi::Item)) );
61 
62  connect( mView, SIGNAL(copyIncidenceSignal(Akonadi::Item)),
63  SIGNAL(copyIncidenceSignal(Akonadi::Item)) );
64 
65  connect( mView, SIGNAL(pasteIncidenceSignal()),
66  SIGNAL(pasteIncidenceSignal()) );
67 
68  connect( mView, SIGNAL(toggleAlarmSignal(Akonadi::Item)),
69  SIGNAL(toggleAlarmSignal(Akonadi::Item)) );
70 
71  connect( mView, SIGNAL(toggleTodoCompletedSignal(Akonadi::Item)),
72  SIGNAL(toggleTodoCompletedSignal(Akonadi::Item)) );
73 
74  connect( mView, SIGNAL(copyIncidenceToResourceSignal(Akonadi::Item,QString)),
75  SIGNAL(copyIncidenceToResourceSignal(Akonadi::Item,QString)) );
76 
77  connect( mView, SIGNAL(moveIncidenceToResourceSignal(Akonadi::Item,QString)),
78  SIGNAL(moveIncidenceToResourceSignal(Akonadi::Item,QString)) );
79 
80  connect( mView, SIGNAL(dissociateOccurrencesSignal(Akonadi::Item,QDate)),
81  SIGNAL(dissociateOccurrencesSignal(Akonadi::Item,QDate)) );
82 
83  connect( mView, SIGNAL(newEventSignal()),
84  SIGNAL(newEventSignal()) );
85 
86  connect( mView, SIGNAL(newEventSignal(QDate)),
87  SIGNAL(newEventSignal(QDate)) );
88 
89  connect( mView, SIGNAL(newEventSignal(QDateTime)),
90  SIGNAL(newEventSignal(QDateTime)) );
91 
92  connect( mView, SIGNAL(newEventSignal(QDateTime,QDateTime)),
93  SIGNAL(newEventSignal(QDateTime,QDateTime)) );
94 
95  connect( mView, SIGNAL(newTodoSignal(QDate)),
96  SIGNAL(newTodoSignal(QDate)) );
97 
98  connect( mView, SIGNAL(newSubTodoSignal(Akonadi::Item)),
99  SIGNAL(newSubTodoSignal(Akonadi::Item)) );
100 
101  connect( mView, SIGNAL(fullViewChanged(bool)),
102  SIGNAL(fullViewChanged(bool)) );
103 }
104 
105 KOTodoView::~KOTodoView()
106 {
107 }
108 
109 void KOTodoView::setCalendar( const Akonadi::ETMCalendar::Ptr &calendar )
110 {
111  BaseView::setCalendar( calendar );
112  mView->setCalendar( calendar );
113 }
114 
115 Akonadi::Item::List KOTodoView::selectedIncidences()
116 {
117  return mView->selectedIncidences();
118 }
119 
120 KCalCore::DateList KOTodoView::selectedIncidenceDates()
121 {
122  return KCalCore::DateList();
123 }
124 
125 void KOTodoView::setIncidenceChanger( Akonadi::IncidenceChanger *changer )
126 {
127  BaseView::setIncidenceChanger( changer );
128  mView->setIncidenceChanger( changer );
129 }
130 
131 void KOTodoView::showDates( const QDate &start, const QDate &end, const QDate & )
132 {
133  // There is nothing to do here for the Todo View
134  Q_UNUSED( start );
135  Q_UNUSED( end );
136 }
137 
138 void KOTodoView::showIncidences( const Akonadi::Item::List &incidenceList, const QDate &date )
139 {
140  Q_UNUSED( incidenceList );
141  Q_UNUSED( date );
142 }
143 
144 void KOTodoView::updateView()
145 {
146  // View is always updated, it's connected to ETM.
147 }
148 
149 void KOTodoView::updateCategories()
150 {
151  mView->updateCategories();
152 }
153 
154 void KOTodoView::changeIncidenceDisplay( const Akonadi::Item &, Akonadi::IncidenceChanger::ChangeType )
155 {
156  // Don't do anything, model is connected to ETM, it's up to date
157 }
158 
159 void KOTodoView::updateConfig()
160 {
161  mView->updateConfig();
162 }
163 
164 void KOTodoView::clearSelection()
165 {
166  mView->clearSelection();
167 }
168 
169 void KOTodoView::printTodo()
170 {
171  printTodo( false );
172 }
173 
174 void KOTodoView::printPreviewTodo()
175 {
176  printTodo( true );
177 }
178 
179 void KOTodoView::printTodo( bool preview )
180 {
181  Akonadi::Item::List selectedItems = mView->selectedIncidences();
182  if ( selectedItems.count() != 1 ) {
183  return;
184  }
185 
186  Akonadi::Item todoItem = selectedItems.first();
187  KCalCore::Todo::Ptr todo = CalendarSupport::todo( todoItem );
188  Q_ASSERT( todo );
189 
190  KOCoreHelper helper;
191  CalPrinter printer( this, calendar(), &helper, true );
192  connect( this, SIGNAL(configChanged()), &printer, SLOT(updateConfig()) );
193 
194  KCalCore::Incidence::List selectedIncidences;
195  selectedIncidences.append( todo );
196 
197  KDateTime todoDate;
198  if ( todo->hasStartDate() ) {
199  todoDate = todo->dtStart();
200  } else {
201  todoDate = todo->dtDue();
202  }
203 
204  printer.print( KOrg::CalPrinterBase::Incidence,
205  todoDate.date(), todoDate.date(), selectedIncidences, preview );
206 
207 }
208 
209 void KOTodoView::getHighlightMode( bool &highlightEvents,
210  bool &highlightTodos,
211  bool &highlightJournals )
212 {
213  highlightTodos = KOPrefs::instance()->mHighlightTodos;
214  highlightEvents = !highlightTodos;
215  highlightJournals = false;
216 }
217 
218 void KOTodoView::saveViewState()
219 {
220  mView->saveViewState();
221 }
222 
223 void KOTodoView::restoreViewState()
224 {
225  mView->restoreViewState();
226 }
227 
228 void KOTodoView::restoreLayout( KConfig *config, const QString &group, bool minimalDefaults )
229 {
230  mView->restoreLayout( config, group, minimalDefaults );
231 }
232 
233 void KOTodoView::saveLayout( KConfig *config, const QString &group ) const
234 {
235  mView->saveLayout( config, group );
236 }
237 
238 bool KOTodoView::usesFullWindow()
239 {
240  return mView->usesFullWindow();
241 }
242 
243 KOrg::CalPrinterBase::PrintType KOTodoView::printType() const
244 {
245  return KOrg::CalPrinterBase::Todolist;
246 }
247 
248 #include "kotodoview.moc"
KOTodoView::updateView
virtual void updateView()
Definition: kotodoview.cpp:144
KOrg::BaseView::incidenceSelected
void incidenceSelected(const Akonadi::Item &, const QDate)
KOTodoView::selectedIncidences
virtual Akonadi::Item::List selectedIncidences()
Definition: kotodoview.cpp:115
KOCoreHelper
Definition: kocorehelper.h:35
KOTodoView::updateConfig
virtual void updateConfig()
Definition: kotodoview.cpp:159
QWidget
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:218
KOPrefsBase::mHighlightTodos
bool mHighlightTodos
Definition: koprefs_base.h:3142
KOrg::CalPrinterBase::Incidence
Definition: printplugin.h:46
kotodoview.h
KOTodoView::showDates
virtual void showDates(const QDate &start, const QDate &end, const QDate &preferredMonth=QDate())
Definition: kotodoview.cpp:131
KOrg::BaseView::newTodoSignal
void newTodoSignal(const QDate &)
KOTodoView::clearSelection
virtual void clearSelection()
Definition: kotodoview.cpp:164
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:223
KOTodoView::purgeCompletedSignal
void purgeCompletedSignal()
KOTodoView::showIncidences
virtual void showIncidences(const Akonadi::Item::List &incidenceList, const QDate &date)
Definition: kotodoview.cpp:138
koprefs.h
KOTodoView::KOTodoView
KOTodoView(bool sidebarView, QWidget *parent)
Definition: kotodoview.cpp:36
KOTodoView::updateCategories
void updateCategories()
Definition: kotodoview.cpp:149
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.
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:120
KOTodoView::setCalendar
virtual void setCalendar(const Akonadi::ETMCalendar::Ptr &)
Definition: kotodoview.cpp:109
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:233
CalPrinter
CalPrinter is a class for printing Calendars.
Definition: calprinter.h:46
KOrg::BaseView::deleteIncidenceSignal
void deleteIncidenceSignal(const Akonadi::Item &)
instructs the receiver to delete the Incidence in some manner; some possibilities include automatical...
KOrg::CalPrinterBase::Todolist
Definition: printplugin.h:51
KOrg::BaseView::moveIncidenceToResourceSignal
void moveIncidenceToResourceSignal(const Akonadi::Item &, const QString &)
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:51
KOTodoView::usesFullWindow
bool usesFullWindow()
returns whether this view should be displayed full window.
Definition: kotodoview.cpp:238
KOTodoView::~KOTodoView
~KOTodoView()
Definition: kotodoview.cpp:105
KOrg::BaseView::newEventSignal
void newEventSignal()
instructs the receiver to create a new event in given collection.
KOTodoView::printType
virtual KOrg::CalPrinterBase::PrintType printType() const
Definition: kotodoview.cpp:243
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:154
KOrg::BaseView::copyIncidenceToResourceSignal
void copyIncidenceToResourceSignal(const Akonadi::Item &, const QString &)
Copy the incidence to the specified resource.
KOTodoView::restoreLayout
void restoreLayout(KConfig *config, const QString &group, bool minimalDefaults)
Definition: kotodoview.cpp:228
KOTodoView::configChanged
void configChanged()
kocorehelper.h
KOTodoView::getHighlightMode
void getHighlightMode(bool &highlightEvents, bool &highlightTodos, bool &highlightJournals)
documentation in baseview.h
Definition: kotodoview.cpp:209
KOrg::BaseView::pasteIncidenceSignal
void pasteIncidenceSignal()
instructs the receiver to paste the incidence
KOrg::CalPrinterBase::PrintType
PrintType
Definition: printplugin.h:45
KOTodoView::setIncidenceChanger
virtual void setIncidenceChanger(Akonadi::IncidenceChanger *changer)
Definition: kotodoview.cpp:125
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:56:19 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

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