summaryrefslogtreecommitdiff
path: root/noncore/unsupported/libopie/pim/opimxrefmanager.cpp
blob: 58bfd24232bc67367a89f2a59ef523fe36ce4ee9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include "opimxrefmanager.h"


OPimXRefManager::OPimXRefManager() {
}
OPimXRefManager::OPimXRefManager( const OPimXRefManager& ref) {
    m_list = ref.m_list;
}
OPimXRefManager::~OPimXRefManager() {
}
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 ).service();
        if ( !list.contains( str ) ) list << str;

        str = (*it).partner( OPimXRef::Two ).service();
        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;
}