-rw-r--r-- | kabc/resource.cpp | 32 |
1 files changed, 2 insertions, 30 deletions
diff --git a/kabc/resource.cpp b/kabc/resource.cpp index 7b91239..267cdaf 100644 --- a/kabc/resource.cpp +++ b/kabc/resource.cpp | |||
@@ -1,144 +1,116 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <kdebug.h> | 28 | #include <kdebug.h> |
29 | 29 | ||
30 | #include <ksyncprofile.h> | ||
31 | |||
32 | #include "resource.h" | 30 | #include "resource.h" |
33 | 31 | ||
34 | using namespace KABC; | 32 | using namespace KABC; |
35 | 33 | ||
36 | Resource::Resource( const KConfig *config, bool syncable ) | 34 | Resource::Resource( const KConfig *config ) |
37 | : KRES::Resource( config ), mAddressBook( 0 ), mSyncProfile( 0 ) | 35 | : KRES::Resource( config ), mAddressBook( 0 ) |
38 | { | 36 | { |
39 | if(syncable == true) { | ||
40 | mSyncProfile = new KSyncProfile( ); | ||
41 | mSyncProfile->setName("pending" /*resourceName()*/); | ||
42 | mSyncProfile->readConfig( (KConfig *)config ); | ||
43 | } | ||
44 | } | 37 | } |
45 | 38 | ||
46 | Resource::~Resource() | 39 | Resource::~Resource() |
47 | { | 40 | { |
48 | if (mSyncProfile != 0) { | ||
49 | delete mSyncProfile; | ||
50 | } | ||
51 | } | 41 | } |
52 | 42 | ||
53 | void Resource::writeConfig( KConfig *config ) | 43 | void Resource::writeConfig( KConfig *config ) |
54 | { | 44 | { |
55 | KRES::Resource::writeConfig( config ); | 45 | KRES::Resource::writeConfig( config ); |
56 | |||
57 | if(mSyncProfile != 0) | ||
58 | mSyncProfile->writeConfig( config ); | ||
59 | } | 46 | } |
60 | 47 | ||
61 | 48 | ||
62 | void Resource::setAddressBook( AddressBook *ab ) | 49 | void Resource::setAddressBook( AddressBook *ab ) |
63 | { | 50 | { |
64 | mAddressBook = ab; | 51 | mAddressBook = ab; |
65 | } | 52 | } |
66 | 53 | ||
67 | AddressBook *Resource::addressBook() | 54 | AddressBook *Resource::addressBook() |
68 | { | 55 | { |
69 | return mAddressBook; | 56 | return mAddressBook; |
70 | } | 57 | } |
71 | 58 | ||
72 | bool Resource::doOpen() | 59 | bool Resource::doOpen() |
73 | { | 60 | { |
74 | return true; | 61 | return true; |
75 | } | 62 | } |
76 | 63 | ||
77 | void Resource::doClose() | 64 | void Resource::doClose() |
78 | { | 65 | { |
79 | } | 66 | } |
80 | 67 | ||
81 | Ticket *Resource::requestSaveTicket() | 68 | Ticket *Resource::requestSaveTicket() |
82 | { | 69 | { |
83 | return 0; | 70 | return 0; |
84 | } | 71 | } |
85 | 72 | ||
86 | bool Resource::load() | 73 | bool Resource::load() |
87 | { | 74 | { |
88 | return true; | 75 | return true; |
89 | } | 76 | } |
90 | 77 | ||
91 | bool Resource::save( Ticket * ) | 78 | bool Resource::save( Ticket * ) |
92 | { | 79 | { |
93 | return false; | 80 | return false; |
94 | } | 81 | } |
95 | 82 | ||
96 | Ticket *Resource::createTicket( Resource *resource ) | 83 | Ticket *Resource::createTicket( Resource *resource ) |
97 | { | 84 | { |
98 | return new Ticket( resource ); | 85 | return new Ticket( resource ); |
99 | } | 86 | } |
100 | 87 | ||
101 | void Resource::removeAddressee( const Addressee& ) | 88 | void Resource::removeAddressee( const Addressee& ) |
102 | { | 89 | { |
103 | // do nothing | 90 | // do nothing |
104 | } | 91 | } |
105 | 92 | ||
106 | void Resource::cleanUp() | 93 | void Resource::cleanUp() |
107 | { | 94 | { |
108 | // do nothing | 95 | // do nothing |
109 | } | 96 | } |
110 | 97 | ||
111 | bool Resource::isSyncable() const | ||
112 | { | ||
113 | return (mSyncProfile != 0); | ||
114 | } | ||
115 | |||
116 | KSyncProfile* Resource::getSyncProfile() | ||
117 | { | ||
118 | return mSyncProfile; | ||
119 | } | ||
120 | |||
121 | |||
122 | QString Resource::fileName() const | 98 | QString Resource::fileName() const |
123 | { | 99 | { |
124 | return mFileName; | 100 | return mFileName; |
125 | } | 101 | } |
126 | 102 | ||
127 | void Resource::setFileName( const QString &fileName ) | 103 | void Resource::setFileName( const QString &fileName ) |
128 | { | 104 | { |
129 | mFileName = fileName; | 105 | mFileName = fileName; |
130 | } | 106 | } |
131 | 107 | ||
132 | /** | 108 | /** |
133 | * Set the name of resource.You can override this method, | 109 | * Set the name of resource.You can override this method, |
134 | * but also remember to call Resource::setResourceName(). | 110 | * but also remember to call Resource::setResourceName(). |
135 | */ | 111 | */ |
136 | void Resource::setResourceName( const QString &name ) | 112 | void Resource::setResourceName( const QString &name ) |
137 | { | 113 | { |
138 | KRES::Resource::setResourceName(name); | 114 | KRES::Resource::setResourceName(name); |
139 | if(mSyncProfile != 0) { | ||
140 | mSyncProfile->setName( name ); | ||
141 | } | ||
142 | |||
143 | } | 115 | } |
144 | 116 | ||