summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/core/opimxrefmanager.cpp
Unidiff
Diffstat (limited to 'libopie2/opiepim/core/opimxrefmanager.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/core/opimxrefmanager.cpp69
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
4OPimXRefManager::OPimXRefManager() {
5}
6OPimXRefManager::OPimXRefManager( const OPimXRefManager& ref) {
7 m_list = ref.m_list;
8}
9OPimXRefManager &OPimXRefManager::operator=( const OPimXRefManager& ref) {
10 m_list = ref.m_list;
11 return *this;
12}
13bool OPimXRefManager::operator==( const OPimXRefManager& /*ref*/) {
14 // if ( m_list == ref.m_list ) return true;
15
16 return false;
17}
18void OPimXRefManager::add( const OPimXRef& ref) {
19 m_list.append( ref );
20}
21void OPimXRefManager::remove( const OPimXRef& ref) {
22 m_list.remove( ref );
23}
24void OPimXRefManager::replace( const OPimXRef& ref) {
25 m_list.remove( ref );
26 m_list.append( ref );
27}
28void OPimXRefManager::clear() {
29 m_list.clear();
30}
31QStringList 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}
45OPimXRef::ValueList OPimXRefManager::list()const {
46 return m_list;
47}
48OPimXRef::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}
59OPimXRef::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}