summaryrefslogtreecommitdiffabout
path: root/kabc/stdaddressbook.cpp
Unidiff
Diffstat (limited to 'kabc/stdaddressbook.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/stdaddressbook.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/kabc/stdaddressbook.cpp b/kabc/stdaddressbook.cpp
index 075f12f..1e00cc6 100644
--- a/kabc/stdaddressbook.cpp
+++ b/kabc/stdaddressbook.cpp
@@ -123,65 +123,65 @@ StdAddressBook::StdAddressBook( bool onlyFastResources )
123//US : AddressBook( "kabcrc" ) 123//US : AddressBook( "kabcrc" )
124 : AddressBook( locateLocal( "config", "kabcrc") ) 124 : AddressBook( locateLocal( "config", "kabcrc") )
125{ 125{
126 126
127 init( onlyFastResources ); 127 init( onlyFastResources );
128} 128}
129 129
130StdAddressBook::~StdAddressBook() 130StdAddressBook::~StdAddressBook()
131{ 131{
132 if ( mAutomaticSave ) 132 if ( mAutomaticSave )
133 save(); 133 save();
134} 134}
135 135
136void StdAddressBook::init( bool ) 136void StdAddressBook::init( bool )
137{ 137{
138 KRES::Manager<Resource> *manager = resourceManager(); 138 KRES::Manager<Resource> *manager = resourceManager();
139 KRES::Manager<Resource>::ActiveIterator it; 139 KRES::Manager<Resource>::ActiveIterator it;
140 140
141 for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { 141 for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) {
142 (*it)->setAddressBook( this ); 142 (*it)->setAddressBook( this );
143 if ( !(*it)->open() ) 143 if ( !(*it)->open() )
144 error( QString( "Unable to open resource '%1'!" ).arg( (*it)->resourceName() ) ); 144 error( QString( "Unable to open resource '%1'!" ).arg( (*it)->resourceName() ) );
145 } 145 }
146 146
147 Resource *res = standardResource(); 147 Resource *res = standardResource();
148 if ( !res ) { 148 if ( !res ) {
149 res = manager->createResource( "file" ); 149 res = manager->createResource( "file" );
150 if ( res ) 150 if ( res )
151 { 151 {
152 addResource( res ); 152 addResource( res );
153 } 153 }
154 else 154 else
155 kdDebug(5700) << "No resource available!!!" << endl; 155 qDebug(" No resource available!!!");
156 } 156 }
157 157
158 setStandardResource( res ); 158 setStandardResource( res );
159 manager->writeConfig(); 159 manager->writeConfig();
160 160
161 load(); 161 load();
162} 162}
163 163
164bool StdAddressBook::save() 164bool StdAddressBook::save()
165{ 165{
166 kdDebug(5700) << "StdAddressBook::save()" << endl; 166 kdDebug(5700) << "StdAddressBook::save()" << endl;
167 167
168 bool ok = true; 168 bool ok = true;
169 AddressBook *ab = self(); 169 AddressBook *ab = self();
170 170
171 ab->deleteRemovedAddressees(); 171 ab->deleteRemovedAddressees();
172 172
173 KRES::Manager<Resource>::ActiveIterator it; 173 KRES::Manager<Resource>::ActiveIterator it;
174 KRES::Manager<Resource> *manager = ab->resourceManager(); 174 KRES::Manager<Resource> *manager = ab->resourceManager();
175 for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { 175 for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) {
176 if ( !(*it)->readOnly() && (*it)->isOpen() ) { 176 if ( !(*it)->readOnly() && (*it)->isOpen() ) {
177 Ticket *ticket = ab->requestSaveTicket( *it ); 177 Ticket *ticket = ab->requestSaveTicket( *it );
178// qDebug("StdAddressBook::save '%s'", (*it)->resourceName().latin1() ); 178// qDebug("StdAddressBook::save '%s'", (*it)->resourceName().latin1() );
179 if ( !ticket ) { 179 if ( !ticket ) {
180 ab->error( i18n( "Unable to save to resource '%1'. It is locked." ) 180 ab->error( i18n( "Unable to save to resource '%1'. It is locked." )
181 .arg( (*it)->resourceName() ) ); 181 .arg( (*it)->resourceName() ) );
182 return false; 182 return false;
183 } 183 }
184 184
185 if ( !ab->save( ticket ) ) 185 if ( !ab->save( ticket ) )
186 ok = false; 186 ok = false;
187 } 187 }