• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.10.5 API Reference
  • KDE Home
  • Contact Us
 

akonadi

  • akonadi
  • calendar
fetchjobcalendar.cpp
1 /*
2  Copyright (C) 2011 Sérgio Martins <sergio.martins@kdab.com>
3  Copyright (C) 2012 Sérgio Martins <iamsergio@gmail.com>
4 
5  This library is free software; you can redistribute it and/or modify it
6  under the terms of the GNU Library General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or (at your
8  option) any later version.
9 
10  This library is distributed in the hope that it will be useful, but WITHOUT
11  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13  License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to the
17  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18  02110-1301, USA.
19 */
20 
21 #include "fetchjobcalendar.h"
22 #include "fetchjobcalendar_p.h"
23 #include "incidencefetchjob_p.h"
24 
25 #include <akonadi/item.h>
26 #include <akonadi/collection.h>
27 
28 using namespace Akonadi;
29 using namespace KCalCore;
30 
31 FetchJobCalendarPrivate::FetchJobCalendarPrivate( FetchJobCalendar *qq ) : CalendarBasePrivate( qq )
32  , m_isLoaded( false )
33  , q( qq )
34 {
35  IncidenceFetchJob *job = new IncidenceFetchJob();
36  connect( job, SIGNAL(result(KJob*)),
37  SLOT(slotSearchJobFinished(KJob*)) );
38 }
39 
40 FetchJobCalendarPrivate::~FetchJobCalendarPrivate()
41 {
42 }
43 
44 void FetchJobCalendarPrivate::slotSearchJobFinished( KJob *job )
45 {
46  IncidenceFetchJob *searchJob = static_cast<Akonadi::IncidenceFetchJob*>( job );
47  bool success = true;
48  QString errorMessage;
49  if ( searchJob->error() ) {
50  success = false;
51  errorMessage = searchJob->errorText();
52  kWarning() << "Unable to fetch incidences:" << searchJob->errorText();
53  } else {
54  foreach( const Akonadi::Item &item, searchJob->items() ) {
55  internalInsert( item );
56  }
57  }
58  m_isLoaded = true;
59  // emit loadFinished() in a delayed manner, due to freezes because of execs.
60  QMetaObject::invokeMethod( q, "loadFinished", Qt::QueuedConnection,
61  Q_ARG( bool, success ), Q_ARG( QString, errorMessage ) );
62 }
63 
64 FetchJobCalendar::FetchJobCalendar() : CalendarBase( new FetchJobCalendarPrivate( this ) )
65 {
66 }
67 
68 FetchJobCalendar::~FetchJobCalendar()
69 {
70 }
71 
72 bool FetchJobCalendar::isLoaded() const
73 {
74  FetchJobCalendarPrivate *d = static_cast<FetchJobCalendarPrivate*>( d_ptr.data() );
75  return d->m_isLoaded;
76 }
77 
78 #include "fetchjobcalendar.moc"
79 #include "fetchjobcalendar_p.moc"
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Sat Jul 13 2013 01:27:36 by doxygen 1.8.3.1 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

akonadi

Skip menu "akonadi"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Modules
  • Related Pages

kdepimlibs-4.10.5 API Reference

Skip menu "kdepimlibs-4.10.5 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
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