00001 /* 00002 This file is part of the Opie Project 00003 Copyright (C) The Main Author <main-author@whereever.org> 00004 =. Copyright (C) The Opie Team <opie-devel@handhelds.org> 00005 .=l. 00006 .>+-= 00007 _;:, .> :=|. This program is free software; you can 00008 .> <`_, > . <= redistribute it and/or modify it under 00009 :`=1 )Y*s>-.-- : the terms of the GNU Library General Public 00010 .="- .-=="i, .._ License as published by the Free Software 00011 - . .-<_> .<> Foundation; either version 2 of the License, 00012 ._= =} : or (at your option) any later version. 00013 .%`+i> _;_. 00014 .i_,=:_. -<s. This program is distributed in the hope that 00015 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 00016 : .. .:, . . . without even the implied warranty of 00017 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 00018 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU 00019 ..}^=.= = ; Library General Public License for more 00020 ++= -. .` .: details. 00021 : = ...= . :.=- 00022 -. .:....=;==+<; You should have received a copy of the GNU 00023 -_. . . )=. = Library General Public License along with 00024 -- :-=` this library; see the file COPYING.LIB. 00025 If not, write to the Free Software Foundation, 00026 Inc., 59 Temple Place - Suite 330, 00027 Boston, MA 02111-1307, USA. 00028 */ 00029 #include "opimxrefmanager.h" 00030 00031 namespace Opie { 00032 00033 OPimXRefManager::OPimXRefManager() { 00034 } 00035 00036 OPimXRefManager::OPimXRefManager( const OPimXRefManager& ref) { 00037 m_list = ref.m_list; 00038 } 00039 00040 OPimXRefManager::~OPimXRefManager() { 00041 } 00042 00043 OPimXRefManager &OPimXRefManager::operator=( const OPimXRefManager& ref) { 00044 m_list = ref.m_list; 00045 return *this; 00046 } 00047 00048 bool OPimXRefManager::operator==( const OPimXRefManager& /*ref*/) { 00049 // if ( m_list == ref.m_list ) return true; 00050 00051 return false; 00052 } 00053 00054 void OPimXRefManager::add( const OPimXRef& ref) { 00055 m_list.append( ref ); 00056 } 00057 00058 void OPimXRefManager::remove( const OPimXRef& ref) { 00059 m_list.remove( ref ); 00060 } 00061 00062 void OPimXRefManager::replace( const OPimXRef& ref) { 00063 m_list.remove( ref ); 00064 m_list.append( ref ); 00065 } 00066 00067 void OPimXRefManager::clear() { 00068 m_list.clear(); 00069 } 00070 00071 QStringList OPimXRefManager::apps() const { 00072 OPimXRef::ValueList::ConstIterator it; 00073 QStringList list; 00074 00075 QString str; 00076 for ( it = m_list.begin(); it != m_list.end(); ++it ) { 00077 str = (*it).partner( OPimXRef::One ).service(); 00078 if ( !list.contains( str ) ) list << str; 00079 00080 str = (*it).partner( OPimXRef::Two ).service(); 00081 if ( !list.contains( str ) ) list << str; 00082 } 00083 return list; 00084 } 00085 00086 OPimXRef::ValueList OPimXRefManager::list() const { 00087 return m_list; 00088 } 00089 00090 OPimXRef::ValueList OPimXRefManager::list( const QString& appName ) const{ 00091 OPimXRef::ValueList list; 00092 OPimXRef::ValueList::ConstIterator it; 00093 00094 for ( it = m_list.begin(); it != m_list.end(); ++it ) { 00095 if ( (*it).containsString( appName ) ) 00096 list.append( (*it) ); 00097 } 00098 00099 return list; 00100 } 00101 00102 OPimXRef::ValueList OPimXRefManager::list( int uid ) const { 00103 OPimXRef::ValueList list; 00104 OPimXRef::ValueList::ConstIterator it; 00105 00106 for ( it = m_list.begin(); it != m_list.end(); ++it ) { 00107 if ( (*it).containsUid( uid ) ) 00108 list.append( (*it) ); 00109 } 00110 00111 return list; 00112 } 00113 00114 }
1.4.2