summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/core/opimresolver.cpp
Unidiff
Diffstat (limited to 'libopie2/opiepim/core/opimresolver.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiepim/core/opimresolver.cpp38
1 files changed, 35 insertions, 3 deletions
diff --git a/libopie2/opiepim/core/opimresolver.cpp b/libopie2/opiepim/core/opimresolver.cpp
index 4ebbd6e..eceabcb 100644
--- a/libopie2/opiepim/core/opimresolver.cpp
+++ b/libopie2/opiepim/core/opimresolver.cpp
@@ -1,33 +1,63 @@
1/*
2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l.
6 .>+-=
7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more
20++= -. .` .: details.
21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28*/
1#include <qcopchannel_qws.h> 29#include <qcopchannel_qws.h>
2 30
3#include <qpe/qcopenvelope_qws.h> 31#include <qpe/qcopenvelope_qws.h>
4 32
5#include "otodoaccess.h" 33#include <opie2/otodoaccess.h>
6#include "ocontactaccess.h" 34#include <opie2/ocontactaccess.h>
7 35
8//#include "opimfactory.h" 36//#include "opimfactory.h"
9#include "opimresolver.h" 37#include <opie2/opimresolver.h>
38
39namespace Opie {
10 40
11OPimResolver* OPimResolver::m_self = 0l; 41OPimResolver* OPimResolver::m_self = 0l;
12 42
13OPimResolver::OPimResolver() { 43OPimResolver::OPimResolver() {
14 /* the built in channels */ 44 /* the built in channels */
15 m_builtIns << "Todolist" << "Addressbook" << "Datebook"; 45 m_builtIns << "Todolist" << "Addressbook" << "Datebook";
16} 46}
17OPimResolver* OPimResolver::self() { 47OPimResolver* OPimResolver::self() {
18 if (!m_self) 48 if (!m_self)
19 m_self = new OPimResolver(); 49 m_self = new OPimResolver();
20 50
21 return m_self; 51 return m_self;
22} 52}
23 53
24/* 54/*
25 * FIXME use a cache here too 55 * FIXME use a cache here too
26 */ 56 */
27OPimRecord* OPimResolver::record( const QString& service, int uid ) { 57OPimRecord* OPimResolver::record( const QString& service, int uid ) {
28 OPimRecord* rec = 0l; 58 OPimRecord* rec = 0l;
29 OPimBase* base = backend( service ); 59 OPimBase* base = backend( service );
30 60
31 if ( base ) 61 if ( base )
32 rec = base->record( uid ); 62 rec = base->record( uid );
33 delete base; 63 delete base;
@@ -175,24 +205,26 @@ bool OPimResolver::add( const QString& service, const OPimRecord& rec) {
175} 205}
176OPimBase* OPimResolver::backend( const QString& service ) { 206OPimBase* OPimResolver::backend( const QString& service ) {
177 return backend( serviceId( service ) ); 207 return backend( serviceId( service ) );
178} 208}
179OPimBase* OPimResolver::backend( int rtti ) { 209OPimBase* OPimResolver::backend( int rtti ) {
180 OPimBase* base = 0l; 210 OPimBase* base = 0l;
181 switch( rtti ) { 211 switch( rtti ) {
182 case TodoList: 212 case TodoList:
183 base = new OTodoAccess(); 213 base = new OTodoAccess();
184 break; 214 break;
185 case DateBook: 215 case DateBook:
186 break; 216 break;
187 case AddressBook: 217 case AddressBook:
188 base = new OContactAccess("Resolver"); 218 base = new OContactAccess("Resolver");
189 break; 219 break;
190 default: 220 default:
191 break; 221 break;
192 } 222 }
193 // FIXME for 3rd party 223 // FIXME for 3rd party
194 if (!base ) 224 if (!base )
195 ; 225 ;
196 226
197 return base; 227 return base;
198} 228}
229
230}