akonadi
itemmonitor.cpp
00001 /* 00002 Copyright (c) 2007-2008 Tobias Koenig <tokoe@kde.org> 00003 00004 This library is free software; you can redistribute it and/or modify it 00005 under the terms of the GNU Library General Public License as published by 00006 the Free Software Foundation; either version 2 of the License, or (at your 00007 option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, but WITHOUT 00010 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00011 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00012 License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to the 00016 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00017 02110-1301, USA. 00018 */ 00019 00020 #include "itemmonitor.h" 00021 #include "itemmonitor_p.h" 00022 00023 #include "itemfetchscope.h" 00024 00025 #include <QtCore/QStringList> 00026 00027 using namespace Akonadi; 00028 00029 ItemMonitor::ItemMonitor() 00030 : d( new Private( this ) ) 00031 { 00032 } 00033 00034 ItemMonitor::~ItemMonitor() 00035 { 00036 delete d; 00037 } 00038 00039 void ItemMonitor::setItem( const Item &item ) 00040 { 00041 if ( item == d->mItem ) 00042 return; 00043 00044 d->mMonitor->setItemMonitored( d->mItem, false ); 00045 00046 d->mItem = item; 00047 00048 d->mMonitor->setItemMonitored( d->mItem, true ); 00049 00050 if ( !d->mItem.isValid() ) { 00051 itemRemoved(); 00052 return; 00053 } 00054 00055 // start initial fetch of the new item 00056 ItemFetchJob* job = new ItemFetchJob( d->mItem ); 00057 job->setFetchScope( fetchScope() ); 00058 00059 d->connect( job, SIGNAL(result(KJob*)), d, SLOT(initialFetchDone(KJob*)) ); 00060 } 00061 00062 Item ItemMonitor::item() const 00063 { 00064 return d->mItem; 00065 } 00066 00067 void ItemMonitor::itemChanged( const Item& ) 00068 { 00069 } 00070 00071 void ItemMonitor::itemRemoved() 00072 { 00073 } 00074 00075 void ItemMonitor::setFetchScope( const ItemFetchScope &fetchScope ) 00076 { 00077 d->mMonitor->setItemFetchScope( fetchScope ); 00078 } 00079 00080 ItemFetchScope &ItemMonitor::fetchScope() 00081 { 00082 return d->mMonitor->itemFetchScope(); 00083 } 00084 00085 #include "itemmonitor_p.moc"
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon May 14 2012 04:52:57 by doxygen 1.7.5 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon May 14 2012 04:52:57 by doxygen 1.7.5 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.