Diffstat (limited to 'libopie2/opiepim/core/opimxrefmanager.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiepim/core/opimxrefmanager.cpp | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/libopie2/opiepim/core/opimxrefmanager.cpp b/libopie2/opiepim/core/opimxrefmanager.cpp index bf6fed6..e7c6c5a 100644 --- a/libopie2/opiepim/core/opimxrefmanager.cpp +++ b/libopie2/opiepim/core/opimxrefmanager.cpp | |||
@@ -1,102 +1,114 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) The Main Author <main-author@whereever.org> | 3 | Copyright (C) The Main Author <main-author@whereever.org> |
4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> | 4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | #include <opie2/opimxrefmanager.h> | 29 | #include "opimxrefmanager.h" |
30 | 30 | ||
31 | namespace Opie { | 31 | namespace Opie { |
32 | 32 | ||
33 | OPimXRefManager::OPimXRefManager() { | 33 | OPimXRefManager::OPimXRefManager() { |
34 | } | 34 | } |
35 | |||
35 | OPimXRefManager::OPimXRefManager( const OPimXRefManager& ref) { | 36 | OPimXRefManager::OPimXRefManager( const OPimXRefManager& ref) { |
36 | m_list = ref.m_list; | 37 | m_list = ref.m_list; |
37 | } | 38 | } |
39 | |||
38 | OPimXRefManager::~OPimXRefManager() { | 40 | OPimXRefManager::~OPimXRefManager() { |
39 | } | 41 | } |
42 | |||
40 | OPimXRefManager &OPimXRefManager::operator=( const OPimXRefManager& ref) { | 43 | OPimXRefManager &OPimXRefManager::operator=( const OPimXRefManager& ref) { |
41 | m_list = ref.m_list; | 44 | m_list = ref.m_list; |
42 | return *this; | 45 | return *this; |
43 | } | 46 | } |
47 | |||
44 | bool OPimXRefManager::operator==( const OPimXRefManager& /*ref*/) { | 48 | bool OPimXRefManager::operator==( const OPimXRefManager& /*ref*/) { |
45 | // if ( m_list == ref.m_list ) return true; | 49 | // if ( m_list == ref.m_list ) return true; |
46 | 50 | ||
47 | return false; | 51 | return false; |
48 | } | 52 | } |
53 | |||
49 | void OPimXRefManager::add( const OPimXRef& ref) { | 54 | void OPimXRefManager::add( const OPimXRef& ref) { |
50 | m_list.append( ref ); | 55 | m_list.append( ref ); |
51 | } | 56 | } |
57 | |||
52 | void OPimXRefManager::remove( const OPimXRef& ref) { | 58 | void OPimXRefManager::remove( const OPimXRef& ref) { |
53 | m_list.remove( ref ); | 59 | m_list.remove( ref ); |
54 | } | 60 | } |
61 | |||
55 | void OPimXRefManager::replace( const OPimXRef& ref) { | 62 | void OPimXRefManager::replace( const OPimXRef& ref) { |
56 | m_list.remove( ref ); | 63 | m_list.remove( ref ); |
57 | m_list.append( ref ); | 64 | m_list.append( ref ); |
58 | } | 65 | } |
66 | |||
59 | void OPimXRefManager::clear() { | 67 | void OPimXRefManager::clear() { |
60 | m_list.clear(); | 68 | m_list.clear(); |
61 | } | 69 | } |
62 | QStringList OPimXRefManager::apps()const { | 70 | |
71 | QStringList OPimXRefManager::apps() const { | ||
63 | OPimXRef::ValueList::ConstIterator it; | 72 | OPimXRef::ValueList::ConstIterator it; |
64 | QStringList list; | 73 | QStringList list; |
65 | 74 | ||
66 | QString str; | 75 | QString str; |
67 | for ( it = m_list.begin(); it != m_list.end(); ++it ) { | 76 | for ( it = m_list.begin(); it != m_list.end(); ++it ) { |
68 | str = (*it).partner( OPimXRef::One ).service(); | 77 | str = (*it).partner( OPimXRef::One ).service(); |
69 | if ( !list.contains( str ) ) list << str; | 78 | if ( !list.contains( str ) ) list << str; |
70 | 79 | ||
71 | str = (*it).partner( OPimXRef::Two ).service(); | 80 | str = (*it).partner( OPimXRef::Two ).service(); |
72 | if ( !list.contains( str ) ) list << str; | 81 | if ( !list.contains( str ) ) list << str; |
73 | } | 82 | } |
74 | return list; | 83 | return list; |
75 | } | 84 | } |
76 | OPimXRef::ValueList OPimXRefManager::list()const { | 85 | |
86 | OPimXRef::ValueList OPimXRefManager::list() const { | ||
77 | return m_list; | 87 | return m_list; |
78 | } | 88 | } |
79 | OPimXRef::ValueList OPimXRefManager::list( const QString& appName )const{ | 89 | |
90 | OPimXRef::ValueList OPimXRefManager::list( const QString& appName ) const{ | ||
80 | OPimXRef::ValueList list; | 91 | OPimXRef::ValueList list; |
81 | OPimXRef::ValueList::ConstIterator it; | 92 | OPimXRef::ValueList::ConstIterator it; |
82 | 93 | ||
83 | for ( it = m_list.begin(); it != m_list.end(); ++it ) { | 94 | for ( it = m_list.begin(); it != m_list.end(); ++it ) { |
84 | if ( (*it).containsString( appName ) ) | 95 | if ( (*it).containsString( appName ) ) |
85 | list.append( (*it) ); | 96 | list.append( (*it) ); |
86 | } | 97 | } |
87 | 98 | ||
88 | return list; | 99 | return list; |
89 | } | 100 | } |
90 | OPimXRef::ValueList OPimXRefManager::list( int uid )const { | 101 | |
102 | OPimXRef::ValueList OPimXRefManager::list( int uid ) const { | ||
91 | OPimXRef::ValueList list; | 103 | OPimXRef::ValueList list; |
92 | OPimXRef::ValueList::ConstIterator it; | 104 | OPimXRef::ValueList::ConstIterator it; |
93 | 105 | ||
94 | for ( it = m_list.begin(); it != m_list.end(); ++it ) { | 106 | for ( it = m_list.begin(); it != m_list.end(); ++it ) { |
95 | if ( (*it).containsUid( uid ) ) | 107 | if ( (*it).containsUid( uid ) ) |
96 | list.append( (*it) ); | 108 | list.append( (*it) ); |
97 | } | 109 | } |
98 | 110 | ||
99 | return list; | 111 | return list; |
100 | } | 112 | } |
101 | 113 | ||
102 | } | 114 | } |