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 // start initial fetch of the new item 00051 ItemFetchJob* job = new ItemFetchJob( d->mItem ); 00052 job->setFetchScope( fetchScope() ); 00053 00054 d->connect( job, SIGNAL( result( KJob* ) ), d, SLOT( initialFetchDone( KJob* ) ) ); 00055 } 00056 00057 Item ItemMonitor::item() const 00058 { 00059 return d->mItem; 00060 } 00061 00062 void ItemMonitor::itemChanged( const Item& ) 00063 { 00064 } 00065 00066 void ItemMonitor::itemRemoved() 00067 { 00068 } 00069 00070 void ItemMonitor::setFetchScope( const ItemFetchScope &fetchScope ) 00071 { 00072 d->mMonitor->setItemFetchScope( fetchScope ); 00073 } 00074 00075 ItemFetchScope &ItemMonitor::fetchScope() 00076 { 00077 return d->mMonitor->itemFetchScope(); 00078 } 00079 00080 #include "itemmonitor_p.moc"