summaryrefslogtreecommitdiffabout
path: root/kabc/plugins
authorzautrix <zautrix>2004-10-14 09:28:50 (UTC)
committer zautrix <zautrix>2004-10-14 09:28:50 (UTC)
commit3d79ab275374292196c7d032ffd2e321841c8cb0 (patch) (unidiff)
tree6ceaba2a5f375cfebc88189000221fe456e6f9d2 /kabc/plugins
parent57bd80b04dddd40a897dce8b6902d1046d71c631 (diff)
downloadkdepimpi-3d79ab275374292196c7d032ffd2e321841c8cb0.zip
kdepimpi-3d79ab275374292196c7d032ffd2e321841c8cb0.tar.gz
kdepimpi-3d79ab275374292196c7d032ffd2e321841c8cb0.tar.bz2
umlaute phone fixes
Diffstat (limited to 'kabc/plugins') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/plugins/sharpdtm/resourcesharpdtm.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/kabc/plugins/sharpdtm/resourcesharpdtm.cpp b/kabc/plugins/sharpdtm/resourcesharpdtm.cpp
index 2cdf4bf..ba17c50 100644
--- a/kabc/plugins/sharpdtm/resourcesharpdtm.cpp
+++ b/kabc/plugins/sharpdtm/resourcesharpdtm.cpp
@@ -1,204 +1,204 @@
1/* 1/*
2 This file is part of libkabc. 2 This file is part of libkabc.
3 Copyright (c) 2004 Ulf Schenk 3 Copyright (c) 2004 Ulf Schenk
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/*
22Enhanced Version of the file for platform independent KDE tools. 22Enhanced Version of the file for platform independent KDE tools.
23Copyright (c) 2004 Ulf Schenk 23Copyright (c) 2004 Ulf Schenk
24 24
25$Id$ 25$Id$
26*/ 26*/
27 27
28#include <sys/types.h> 28#include <sys/types.h>
29#include <sys/stat.h> 29#include <sys/stat.h>
30#include <unistd.h> 30#include <unistd.h>
31 31
32#include <qdir.h> 32#include <qdir.h>
33#include <qfile.h> 33#include <qfile.h>
34#include <qfileinfo.h> 34#include <qfileinfo.h>
35#include <qregexp.h> 35#include <qregexp.h>
36//US #include <qtimer.h> 36//US #include <qtimer.h>
37 37
38#include <kapplication.h> 38#include <kapplication.h>
39#include <kconfig.h> 39#include <kconfig.h>
40#include <kdebug.h> 40#include <kdebug.h>
41#include <klocale.h> 41#include <klocale.h>
42//US #include <ksavefile.h> 42//US #include <ksavefile.h>
43#include <kstandarddirs.h> 43#include <kstandarddirs.h>
44#include <kmessagebox.h> 44#include <kmessagebox.h>
45 45
46#include <sl/slzdb.h> 46#include <sl/slzdb.h>
47 47
48#include <libkdepim/ksyncprofile.h> 48#include <libkdepim/ksyncprofile.h>
49 49
50#include "resourcesharpdtmconfig.h" 50#include "resourcesharpdtmconfig.h"
51#include "resourcesharpdtm.h" 51#include "resourcesharpdtm.h"
52 52
53#include "stdaddressbook.h" 53#include "stdaddressbook.h"
54 54
55#include "sharpdtmconverter.h" 55#include "sharpdtmconverter.h"
56//#define ALLOW_LOCKING 56//#define ALLOW_LOCKING
57using namespace KABC; 57using namespace KABC;
58extern "C" 58extern "C"
59{ 59{
60 void *init_microkabc_sharpdtm() 60 void *init_microkabc_sharpdtm()
61 { 61 {
62 return new KRES::PluginFactory<ResourceSharpDTM,ResourceSharpDTMConfig>(); 62 return new KRES::PluginFactory<ResourceSharpDTM,ResourceSharpDTMConfig>();
63 } 63 }
64} 64}
65 65
66ResourceSharpDTM::ResourceSharpDTM( const KConfig *config ) 66ResourceSharpDTM::ResourceSharpDTM( const KConfig *config )
67 : Resource( config ), mConverter (0) 67 : Resource( config ), mConverter (0)
68{ 68{
69 // we can not choose the filename. Therefore use the default to display 69 // we can not choose the filename. Therefore use the default to display
70 70
71 QString fileName = SlZDataBase::addressbookFileName(); 71 QString fileName = SlZDataBase::addressbookFileName();
72 init( fileName ); 72 init( fileName );
73} 73}
74 74
75ResourceSharpDTM::ResourceSharpDTM( const QString &fileName, bool syncable ) 75ResourceSharpDTM::ResourceSharpDTM( const QString &fileName )
76 : Resource( 0, syncable ) 76 : Resource( 0 )
77{ 77{
78 init( fileName ); 78 init( fileName );
79} 79}
80 80
81void ResourceSharpDTM::init( const QString &fileName ) 81void ResourceSharpDTM::init( const QString &fileName )
82{ 82{
83 83
84 connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) ); 84 connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) );
85 connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) ); 85 connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) );
86 connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) ); 86 connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) );
87 87
88 setFileName( fileName ); 88 setFileName( fileName );
89} 89}
90 90
91ResourceSharpDTM::~ResourceSharpDTM() 91ResourceSharpDTM::~ResourceSharpDTM()
92{ 92{
93 if (mConverter != 0) 93 if (mConverter != 0)
94 delete mConverter; 94 delete mConverter;
95 95
96 if(mAccess != 0) 96 if(mAccess != 0)
97 delete mAccess; 97 delete mAccess;
98} 98}
99 99
100void ResourceSharpDTM::writeConfig( KConfig *config ) 100void ResourceSharpDTM::writeConfig( KConfig *config )
101{ 101{
102 Resource::writeConfig( config ); 102 Resource::writeConfig( config );
103} 103}
104 104
105Ticket *ResourceSharpDTM::requestSaveTicket() 105Ticket *ResourceSharpDTM::requestSaveTicket()
106{ 106{
107 107
108 108
109 qDebug("ResourceSharpDTM::requestSaveTicket: %s", fileName().latin1()); 109 qDebug("ResourceSharpDTM::requestSaveTicket: %s", fileName().latin1());
110 110
111 if ( !addressBook() ) return 0; 111 if ( !addressBook() ) return 0;
112 112
113#ifdef ALLOW_LOCKING 113#ifdef ALLOW_LOCKING
114 if ( !lock( fileName() ) ) { 114 if ( !lock( fileName() ) ) {
115 qDebug("ResourceSharpDTM::requestSaveTicket(): Unable to lock file "); 115 qDebug("ResourceSharpDTM::requestSaveTicket(): Unable to lock file ");
116 return 0; 116 return 0;
117 } 117 }
118#endif 118#endif
119 return createTicket( this ); 119 return createTicket( this );
120} 120}
121 121
122 122
123bool ResourceSharpDTM::doOpen() 123bool ResourceSharpDTM::doOpen()
124{ 124{
125 qDebug("ResourceSharpDTM::doOpen: %s", fileName().latin1()); 125 qDebug("ResourceSharpDTM::doOpen: %s", fileName().latin1());
126 126
127 // the last parameter in the SlZDataBase constructor means "readonly" 127 // the last parameter in the SlZDataBase constructor means "readonly"
128 mAccess = new SlZDataBase(fileName(), 128 mAccess = new SlZDataBase(fileName(),
129 SlZDataBase::addressbookItems(), 129 SlZDataBase::addressbookItems(),
130 NULL, false); 130 NULL, false);
131 131
132 if ( !mAccess ) { 132 if ( !mAccess ) {
133 qDebug("Unable to load file() %s", fileName().latin1()); 133 qDebug("Unable to load file() %s", fileName().latin1());
134 return false; 134 return false;
135 } 135 }
136 136
137 if (mConverter == 0) 137 if (mConverter == 0)
138 { 138 {
139 mConverter = new SharpDTMConverter(); 139 mConverter = new SharpDTMConverter();
140 bool res = mConverter->init(); 140 bool res = mConverter->init();
141 if ( !res ) 141 if ( !res )
142 { 142 {
143 QString msg("Unable to initialize sharp converter. Most likely a problem with the category file"); 143 QString msg("Unable to initialize sharp converter. Most likely a problem with the category file");
144 144
145 qDebug(msg); 145 qDebug(msg);
146 delete mAccess; 146 delete mAccess;
147 mAccess = 0; 147 mAccess = 0;
148 return false; 148 return false;
149 } 149 }
150 } 150 }
151 151
152 return true; 152 return true;
153} 153}
154 154
155void ResourceSharpDTM::doClose() 155void ResourceSharpDTM::doClose()
156{ 156{
157 qDebug("ResourceSharpDTM::doClose: %s", fileName().latin1()); 157 qDebug("ResourceSharpDTM::doClose: %s", fileName().latin1());
158 158
159 if(mAccess) 159 if(mAccess)
160 { 160 {
161 delete mAccess; 161 delete mAccess;
162 mAccess = 0; 162 mAccess = 0;
163 } 163 }
164 // it seems so, that deletion of access deletes backend as well 164 // it seems so, that deletion of access deletes backend as well
165 //delete backend; 165 //delete backend;
166 166
167 return; 167 return;
168} 168}
169 169
170bool ResourceSharpDTM::load() 170bool ResourceSharpDTM::load()
171{ 171{
172 qDebug("ResourceSharpDTM::load: %s", fileName().latin1()); 172 qDebug("ResourceSharpDTM::load: %s", fileName().latin1());
173 173
174 bool res = false; 174 bool res = false;
175 175
176 CardId id; 176 CardId id;
177 177
178 for (bool res=mAccess->first(); res == true; res=mAccess->next()) 178 for (bool res=mAccess->first(); res == true; res=mAccess->next())
179 { 179 {
180 id = mAccess->cardId(); 180 id = mAccess->cardId();
181 181
182 KABC::Addressee addressee; 182 KABC::Addressee addressee;
183 183
184 res = mConverter->sharpToAddressee( id, mAccess, addressee ); 184 res = mConverter->sharpToAddressee( id, mAccess, addressee );
185 185
186 if ( !addressee.isEmpty() && res ) 186 if ( !addressee.isEmpty() && res )
187 { 187 {
188 addressee.setResource( this ); 188 addressee.setResource( this );
189 addressBook()->insertAddressee( addressee ); 189 addressBook()->insertAddressee( addressee );
190 } 190 }
191 } 191 }
192 192
193 return true; 193 return true;
194} 194}
195 195
196bool ResourceSharpDTM::save( Ticket *ticket ) 196bool ResourceSharpDTM::save( Ticket *ticket )
197{ 197{
198 qDebug("ResourceSharpDTM::save: %s", fileName().latin1()); 198 qDebug("ResourceSharpDTM::save: %s", fileName().latin1());
199 199
200 mDirWatch.stopScan(); 200 mDirWatch.stopScan();
201 201
202 KABC::AddressBook::Iterator it; 202 KABC::AddressBook::Iterator it;
203 bool res; 203 bool res;
204 KABC::Addressee::List changedAddressees; 204 KABC::Addressee::List changedAddressees;