author | zecke <zecke> | 2002-11-15 15:31:47 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-11-15 15:31:47 (UTC) |
commit | 5a6e66edad1070f624d54320278d00372f112213 (patch) (unidiff) | |
tree | ab1028759194edace4c79cf90d18dc1362a84aa9 /libopie2/opiepim/core/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 'libopie2/opiepim/core/opimxrefmanager.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiepim/core/opimxrefmanager.cpp | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/libopie2/opiepim/core/opimxrefmanager.cpp b/libopie2/opiepim/core/opimxrefmanager.cpp new file mode 100644 index 0000000..d49f5f5 --- a/dev/null +++ b/libopie2/opiepim/core/opimxrefmanager.cpp | |||
@@ -0,0 +1,69 @@ | |||
1 | #include "opimxrefmanager.h" | ||
2 | |||
3 | |||
4 | OPimXRefManager::OPimXRefManager() { | ||
5 | } | ||
6 | OPimXRefManager::OPimXRefManager( const OPimXRefManager& ref) { | ||
7 | m_list = ref.m_list; | ||
8 | } | ||
9 | OPimXRefManager &OPimXRefManager::operator=( const OPimXRefManager& ref) { | ||
10 | m_list = ref.m_list; | ||
11 | return *this; | ||
12 | } | ||
13 | bool OPimXRefManager::operator==( const OPimXRefManager& /*ref*/) { | ||
14 | // if ( m_list == ref.m_list ) return true; | ||
15 | |||
16 | return false; | ||
17 | } | ||
18 | void OPimXRefManager::add( const OPimXRef& ref) { | ||
19 | m_list.append( ref ); | ||
20 | } | ||
21 | void OPimXRefManager::remove( const OPimXRef& ref) { | ||
22 | m_list.remove( ref ); | ||
23 | } | ||
24 | void OPimXRefManager::replace( const OPimXRef& ref) { | ||
25 | m_list.remove( ref ); | ||
26 | m_list.append( ref ); | ||
27 | } | ||
28 | void OPimXRefManager::clear() { | ||
29 | m_list.clear(); | ||
30 | } | ||
31 | QStringList OPimXRefManager::apps()const { | ||
32 | OPimXRef::ValueList::ConstIterator it; | ||
33 | QStringList list; | ||
34 | |||
35 | QString str; | ||
36 | for ( it = m_list.begin(); it != m_list.end(); ++it ) { | ||
37 | str = (*it).partner( OPimXRef::One ).appName(); | ||
38 | if ( !list.contains( str ) ) list << str; | ||
39 | |||
40 | str = (*it).partner( OPimXRef::Two ).appName(); | ||
41 | if ( !list.contains( str ) ) list << str; | ||
42 | } | ||
43 | return list; | ||
44 | } | ||
45 | OPimXRef::ValueList OPimXRefManager::list()const { | ||
46 | return m_list; | ||
47 | } | ||
48 | OPimXRef::ValueList OPimXRefManager::list( const QString& appName )const{ | ||
49 | OPimXRef::ValueList list; | ||
50 | OPimXRef::ValueList::ConstIterator it; | ||
51 | |||
52 | for ( it = m_list.begin(); it != m_list.end(); ++it ) { | ||
53 | if ( (*it).containsString( appName ) ) | ||
54 | list.append( (*it) ); | ||
55 | } | ||
56 | |||
57 | return list; | ||
58 | } | ||
59 | OPimXRef::ValueList OPimXRefManager::list( int uid )const { | ||
60 | OPimXRef::ValueList list; | ||
61 | OPimXRef::ValueList::ConstIterator it; | ||
62 | |||
63 | for ( it = m_list.begin(); it != m_list.end(); ++it ) { | ||
64 | if ( (*it).containsUid( uid ) ) | ||
65 | list.append( (*it) ); | ||
66 | } | ||
67 | |||
68 | return list; | ||
69 | } | ||