Diffstat (limited to 'kaddressbook/xxport/sharpdtm/sharpdtm_xxport.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | kaddressbook/xxport/sharpdtm/sharpdtm_xxport.cpp | 51 |
1 files changed, 22 insertions, 29 deletions
diff --git a/kaddressbook/xxport/sharpdtm/sharpdtm_xxport.cpp b/kaddressbook/xxport/sharpdtm/sharpdtm_xxport.cpp index 4e6a504..8593814 100644 --- a/kaddressbook/xxport/sharpdtm/sharpdtm_xxport.cpp +++ b/kaddressbook/xxport/sharpdtm/sharpdtm_xxport.cpp | |||
@@ -55,3 +55,3 @@ $Id$ | |||
55 | #include "xxportmanager.h" | 55 | #include "xxportmanager.h" |
56 | //#include "qtopiaconverter.h" | 56 | #include "sharpdtmconverter.h" |
57 | 57 | ||
@@ -102,6 +102,5 @@ bool SharpDTMXXPort::exportContacts( const KABC::AddresseeList &list, const QStr | |||
102 | 102 | ||
103 | // KABC::QtopiaConverter mConverter; | 103 | KABC::SharpDTMConverter mConverter; |
104 | 104 | ||
105 | // bool res = mConverter.init(); | 105 | bool res = mConverter.init(); |
106 | bool res = true; | ||
107 | if (!res) | 106 | if (!res) |
@@ -116,7 +115,3 @@ bool SharpDTMXXPort::exportContacts( const KABC::AddresseeList &list, const QStr | |||
116 | //Now check if the file has already entries, and ask the user if he wants to delete them first. | 115 | //Now check if the file has already entries, and ask the user if he wants to delete them first. |
117 | /*US | 116 | if (access->count() > 0) |
118 | { //create a new scope | ||
119 | AddressBookIterator it(*access); | ||
120 | const PimContact* firstcontact = it.toFirst(); | ||
121 | if (firstcontact) | ||
122 | { | 117 | { |
@@ -125,8 +120,3 @@ bool SharpDTMXXPort::exportContacts( const KABC::AddresseeList &list, const QStr | |||
125 | // Clean the database.. | 120 | // Clean the database.. |
126 | 121 | access->deleteCard(0, SlZDataBase::AllCard ); | |
127 | AddressBookIterator it2(*access); | ||
128 | for (it2.toFirst(); it2.current(); ++it2) { | ||
129 | access->removeContact(*it2.current()); | ||
130 | } | ||
131 | } | ||
132 | } | 122 | } |
@@ -136,12 +126,16 @@ bool SharpDTMXXPort::exportContacts( const KABC::AddresseeList &list, const QStr | |||
136 | for ( it = list.begin(); it != list.end(); ++it ) { | 126 | for ( it = list.begin(); it != list.end(); ++it ) { |
137 | PimContact c; | 127 | CardId c; |
138 | KABC::Addressee addressee = (*it); | 128 | res = access->editNewCard(); |
139 | 129 | ||
140 | res = mConverter.addresseeToQtopia( *it, c ); | ||
141 | if (res == true) | 130 | if (res == true) |
142 | { | 131 | { |
143 | access->addContact(c); | 132 | res = mConverter.addresseeToSharp( *it, access, c ); |
133 | |||
134 | if (res == true) | ||
135 | access->finishEditCard(&c); | ||
136 | else | ||
137 | access->cancelEditCard(); | ||
144 | } | 138 | } |
145 | } | 139 | } |
146 | */ | 140 | |
147 | delete access; | 141 | delete access; |
@@ -157,4 +151,5 @@ KABC::AddresseeList SharpDTMXXPort::importContacts( const QString& ) const | |||
157 | 151 | ||
152 | // the last parameter in the SlZDataBase constructor means "readonly" | ||
158 | SlZDataBase* access = new SlZDataBase(fileName, | 153 | SlZDataBase* access = new SlZDataBase(fileName, |
159 | SlZDataBase::addressbookItems()); | 154 | SlZDataBase::addressbookItems(), NULL, true); |
160 | 155 | ||
@@ -168,4 +163,4 @@ KABC::AddresseeList SharpDTMXXPort::importContacts( const QString& ) const | |||
168 | } | 163 | } |
169 | /*US | 164 | |
170 | KABC::QtopiaConverter mConverter; | 165 | KABC::SharpDTMConverter mConverter; |
171 | 166 | ||
@@ -182,8 +177,7 @@ KABC::AddresseeList SharpDTMXXPort::importContacts( const QString& ) const | |||
182 | 177 | ||
183 | |||
184 | { //create a new scope | 178 | { //create a new scope |
185 | AddressBookIterator it(*access); | 179 | CardId id; |
186 | 180 | ||
187 | for (it.toFirst(); it.current(); ++it) { | 181 | for (bool res=access->first(); res == true; res=access->next()) { |
188 | const PimContact*contact = it.current(); | 182 | id = access->cardId(); |
189 | 183 | ||
@@ -191,3 +185,3 @@ KABC::AddresseeList SharpDTMXXPort::importContacts( const QString& ) const | |||
191 | 185 | ||
192 | res = mConverter.qtopiaToAddressee( (*contact), addressee ); | 186 | res = mConverter.sharpToAddressee( id, access, addressee ); |
193 | 187 | ||
@@ -199,3 +193,2 @@ KABC::AddresseeList SharpDTMXXPort::importContacts( const QString& ) const | |||
199 | } | 193 | } |
200 | */ | ||
201 | 194 | ||