akonadi
agentinstance.cpp
00001 /* 00002 Copyright (c) 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 "agentinstance.h" 00021 #include "agentinstance_p.h" 00022 00023 #include "agentmanager.h" 00024 #include "agentmanager_p.h" 00025 00026 using namespace Akonadi; 00027 00028 AgentInstance::AgentInstance() 00029 : d( new Private ) 00030 { 00031 } 00032 00033 AgentInstance::AgentInstance( const AgentInstance &other ) 00034 : d( other.d ) 00035 { 00036 } 00037 00038 AgentInstance::~AgentInstance() 00039 { 00040 } 00041 00042 bool AgentInstance::isValid() const 00043 { 00044 return !d->mIdentifier.isEmpty(); 00045 } 00046 00047 00048 AgentType AgentInstance::type() const 00049 { 00050 return d->mType; 00051 } 00052 00053 QString AgentInstance::identifier() const 00054 { 00055 return d->mIdentifier; 00056 } 00057 00058 void AgentInstance::setName( const QString &name ) 00059 { 00060 AgentManager::self()->d->setName( *this, name ); 00061 } 00062 00063 QString AgentInstance::name() const 00064 { 00065 return d->mName; 00066 } 00067 00068 AgentInstance::Status AgentInstance::status() const 00069 { 00070 switch ( d->mStatus ) { 00071 case 0: 00072 return Idle; 00073 case 1: 00074 return Running; 00075 case 2: 00076 default: 00077 return Broken; 00078 } 00079 } 00080 00081 QString AgentInstance::statusMessage() const 00082 { 00083 return d->mStatusMessage; 00084 } 00085 00086 int AgentInstance::progress() const 00087 { 00088 return d->mProgress; 00089 } 00090 00091 bool AgentInstance::isOnline() const 00092 { 00093 return d->mIsOnline; 00094 } 00095 00096 void AgentInstance::setIsOnline( bool online ) 00097 { 00098 AgentManager::self()->d->setOnline( *this, online ); 00099 } 00100 00101 void AgentInstance::configure( QWidget *parent ) 00102 { 00103 AgentManager::self()->d->configure( *this, parent ); 00104 } 00105 00106 void AgentInstance::synchronize() 00107 { 00108 AgentManager::self()->d->synchronize( *this ); 00109 } 00110 00111 void AgentInstance::synchronizeCollectionTree() 00112 { 00113 AgentManager::self()->d->synchronizeCollectionTree( *this ); 00114 } 00115 00116 AgentInstance& AgentInstance::operator=( const AgentInstance &other ) 00117 { 00118 if ( this != &other ) 00119 d = other.d; 00120 00121 return *this; 00122 } 00123 00124 bool AgentInstance::operator==( const AgentInstance &other ) const 00125 { 00126 return (d->mIdentifier == other.d->mIdentifier); 00127 }