kitchensync Library API Documentation

opiedesktopsyncee.cpp

00001 /*
00002     This file is part of KitchenSync.
00003 
00004     Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
00005     Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
00006 
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Library General Public
00009     License as published by the Free Software Foundation; either
00010     version 2 of the License, or (at your option) any later version.
00011 
00012     This library is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015     Library General Public License for more details.
00016 
00017     You should have received a copy of the GNU Library General Public License
00018     along with this library; see the file COPYING.LIB.  If not, write to
00019     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00020     Boston, MA 02111-1307, USA.
00021 */
00022 
00023 #include "opiedesktopsyncee.h"
00024 
00025 using namespace KSync;
00026 
00027 OpieDesktopSyncEntry::OpieDesktopSyncEntry( const QStringList& category,
00028                                             const QString& file,
00029                                             const QString& name,
00030                                             const QString& type,
00031                                             const QString& size,
00032                                             Syncee *parent )
00033     : SyncEntry( parent ), mCategory( category ),  mFile( file ),
00034       mName( name ), mType( type ), mSize( size )
00035 {
00036 }
00037 
00038 OpieDesktopSyncEntry::OpieDesktopSyncEntry( const OpieDesktopSyncEntry& opie )
00039     : SyncEntry( opie )
00040 {
00041     mName = opie.mName;
00042     mType = opie.mType;
00043     mSize = opie.mSize;
00044     mFile = opie.mFile;
00045     mCategory = opie.mCategory;
00046 }
00047 
00048 OpieDesktopSyncEntry::~OpieDesktopSyncEntry()
00049 {
00050 }
00051 
00052 QString OpieDesktopSyncEntry::name()
00053 {
00054     return mName;
00055 }
00056 
00057 QString OpieDesktopSyncEntry::file() const
00058 {
00059     return mFile;
00060 }
00061 
00062 QString OpieDesktopSyncEntry::fileType() const
00063 {
00064     return mType;
00065 }
00066 
00067 QString OpieDesktopSyncEntry::size() const
00068 {
00069     return mSize;
00070 }
00071 
00072 QStringList OpieDesktopSyncEntry::category() const
00073 {
00074     return mCategory;
00075 }
00076 
00077 QString OpieDesktopSyncEntry::id()
00078 {
00079     return mFile;
00080 }
00081 
00082 QString OpieDesktopSyncEntry::type() const
00083 {
00084     return QString::fromLatin1("OpieDesktopSyncEntry");
00085 }
00086 
00087 QString OpieDesktopSyncEntry::timestamp()
00088 {
00089     return QString::null;
00090 }
00091 
00092 bool OpieDesktopSyncEntry::equals( SyncEntry* entry )
00093 {
00094     OpieDesktopSyncEntry* opEntry;
00095     opEntry = dynamic_cast<OpieDesktopSyncEntry*> (entry );
00096     if (opEntry == 0 )
00097         return false;
00098     if ( mFile == opEntry->mFile &&
00099          mName == opEntry->mName &&
00100          mType == opEntry->mType &&
00101          mSize == opEntry->mSize &&
00102          mCategory == opEntry->mCategory )
00103         return true;
00104     else
00105         return false;
00106 }
00107 
00108 SyncEntry* OpieDesktopSyncEntry::clone()
00109 {
00110     return new OpieDesktopSyncEntry( *this );
00111 }
00112 
00113 OpieDesktopSyncee::OpieDesktopSyncee()
00114     : Syncee()
00115 {
00116     mList.setAutoDelete( true );
00117 }
00118 
00119 OpieDesktopSyncee::~OpieDesktopSyncee()
00120 {
00121 }
00122 
00123 QString OpieDesktopSyncee::type() const
00124 {
00125     return QString::fromLatin1("OpieDesktopSyncee");
00126 }
00127 
00128 Syncee* OpieDesktopSyncee::clone()
00129 {
00130     OpieDesktopSyncee* syncee = new OpieDesktopSyncee();
00131     syncee->setSyncMode( syncMode() );
00132     syncee->setFirstSync( firstSync() );
00133     syncee->setSupports( bitArray() );
00134     syncee->setSource( source() );
00135     OpieDesktopSyncEntry* entry;
00136     for ( entry = mList.first(); entry != 0; entry =mList.next() ) {
00137         syncee->addEntry( entry->clone() );
00138     }
00139     return syncee;
00140 }
00141 
00142 void OpieDesktopSyncee::addEntry( SyncEntry* entry )
00143 {
00144     OpieDesktopSyncEntry* opEntry;
00145     opEntry = dynamic_cast<OpieDesktopSyncEntry*> (entry );
00146     if (opEntry == 0l )
00147         return;
00148     opEntry->setSyncee( this);
00149     mList.append( opEntry );
00150 }
00151 
00152 void OpieDesktopSyncee::removeEntry( SyncEntry* entry )
00153 {
00154     OpieDesktopSyncEntry* opEntry;
00155     opEntry = dynamic_cast<OpieDesktopSyncEntry*> (entry );
00156     if ( opEntry == 0l )
00157         return;
00158     mList.remove( opEntry ); // is the case useless?
00159 }
00160 
00161 SyncEntry* OpieDesktopSyncee::firstEntry()
00162 {
00163     return mList.first();
00164 }
00165 
00166 SyncEntry* OpieDesktopSyncee::nextEntry()
00167 {
00168     return mList.next();
00169 }
00170 
00171 SyncEntry::PtrList OpieDesktopSyncee::added()
00172 {
00173     return voidi();
00174 }
00175 
00176 SyncEntry::PtrList OpieDesktopSyncee::modified()
00177 {
00178     return voidi();
00179 }
00180 
00181 SyncEntry::PtrList OpieDesktopSyncee::removed()
00182 {
00183     return voidi();
00184 }
00185 
00186 SyncEntry::PtrList OpieDesktopSyncee::voidi()
00187 {
00188     SyncEntry::PtrList list;
00189     return list;
00190 }
KDE Logo
This file is part of the documentation for kitchensync Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Aug 2 09:54:00 2007 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003