author | zecke <zecke> | 2002-11-15 15:31:47 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-11-15 15:31:47 (UTC) |
commit | 5a6e66edad1070f624d54320278d00372f112213 (patch) (side-by-side diff) | |
tree | ab1028759194edace4c79cf90d18dc1362a84aa9 /libopie/pim/opimxrefmanager.cpp | |
parent | 05f56fbbbe9ea5546f7503f4852fcab9c5b10a00 (diff) | |
download | opie-5a6e66edad1070f624d54320278d00372f112213.zip opie-5a6e66edad1070f624d54320278d00372f112213.tar.gz opie-5a6e66edad1070f624d54320278d00372f112213.tar.bz2 |
Add the implementation for the XRef Manager
Add it to libopie.pro
Adjust OPimRecord to use the new manager
The backends do not support xref yet
Diffstat (limited to 'libopie/pim/opimxrefmanager.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie/pim/opimxrefmanager.cpp | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/libopie/pim/opimxrefmanager.cpp b/libopie/pim/opimxrefmanager.cpp new file mode 100644 index 0000000..d49f5f5 --- a/dev/null +++ b/libopie/pim/opimxrefmanager.cpp @@ -0,0 +1,69 @@ +#include "opimxrefmanager.h" + + +OPimXRefManager::OPimXRefManager() { +} +OPimXRefManager::OPimXRefManager( const OPimXRefManager& ref) { + m_list = ref.m_list; +} +OPimXRefManager &OPimXRefManager::operator=( const OPimXRefManager& ref) { + m_list = ref.m_list; + return *this; +} +bool OPimXRefManager::operator==( const OPimXRefManager& /*ref*/) { + // if ( m_list == ref.m_list ) return true; + + return false; +} +void OPimXRefManager::add( const OPimXRef& ref) { + m_list.append( ref ); +} +void OPimXRefManager::remove( const OPimXRef& ref) { + m_list.remove( ref ); +} +void OPimXRefManager::replace( const OPimXRef& ref) { + m_list.remove( ref ); + m_list.append( ref ); +} +void OPimXRefManager::clear() { + m_list.clear(); +} +QStringList OPimXRefManager::apps()const { + OPimXRef::ValueList::ConstIterator it; + QStringList list; + + QString str; + for ( it = m_list.begin(); it != m_list.end(); ++it ) { + str = (*it).partner( OPimXRef::One ).appName(); + if ( !list.contains( str ) ) list << str; + + str = (*it).partner( OPimXRef::Two ).appName(); + if ( !list.contains( str ) ) list << str; + } + return list; +} +OPimXRef::ValueList OPimXRefManager::list()const { + return m_list; +} +OPimXRef::ValueList OPimXRefManager::list( const QString& appName )const{ + OPimXRef::ValueList list; + OPimXRef::ValueList::ConstIterator it; + + for ( it = m_list.begin(); it != m_list.end(); ++it ) { + if ( (*it).containsString( appName ) ) + list.append( (*it) ); + } + + return list; +} +OPimXRef::ValueList OPimXRefManager::list( int uid )const { + OPimXRef::ValueList list; + OPimXRef::ValueList::ConstIterator it; + + for ( it = m_list.begin(); it != m_list.end(); ++it ) { + if ( (*it).containsUid( uid ) ) + list.append( (*it) ); + } + + return list; +} |