-rw-r--r-- | bin/kdepim/WhatsNew.txt | 6 | ||||
-rw-r--r-- | kaddressbook/kaimportoldialog.cpp | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index 0474b0c..89a6d7f 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt | |||
@@ -1,49 +1,55 @@ | |||
1 | Info about the changes in new versions of KDE-Pim/Pi | 1 | Info about the changes in new versions of KDE-Pim/Pi |
2 | 2 | ||
3 | ********** VERSION 2.1.2 ************ | ||
4 | |||
5 | Fixed a problem closing the alarm dialog on Zaurus with "OK" button. | ||
6 | |||
7 | Fixed a problem when importing data from Outlook with mutiple categories set. | ||
8 | |||
3 | 9 | ||
4 | ********** VERSION 2.1.1 ************ | 10 | ********** VERSION 2.1.1 ************ |
5 | 11 | ||
6 | Stable release 2.1.1! | 12 | Stable release 2.1.1! |
7 | 13 | ||
8 | KO/Pi: | 14 | KO/Pi: |
9 | Fixed one problem in the layout of the edit dialogs on the Zaurus with 640x480 display. | 15 | Fixed one problem in the layout of the edit dialogs on the Zaurus with 640x480 display. |
10 | 16 | ||
11 | ********** VERSION 2.1.0 ************ | 17 | ********** VERSION 2.1.0 ************ |
12 | 18 | ||
13 | Stable release 2.1.0! | 19 | Stable release 2.1.0! |
14 | 20 | ||
15 | Summary of changes/fixes compared to version 2.0.6: | 21 | Summary of changes/fixes compared to version 2.0.6: |
16 | 22 | ||
17 | Many bugs of version 2.0.6 fixed. | 23 | Many bugs of version 2.0.6 fixed. |
18 | Most of them were small bugs, but some of them were important. | 24 | Most of them were small bugs, but some of them were important. |
19 | It is recommended to use version 2.1.0 and not version 2.0.6. | 25 | It is recommended to use version 2.1.0 and not version 2.0.6. |
20 | 26 | ||
21 | Important changes: | 27 | Important changes: |
22 | 28 | ||
23 | Added recurring todos to KO/Pi. | 29 | Added recurring todos to KO/Pi. |
24 | 30 | ||
25 | Added global application font settings (for all KDE-Pim/Pi apps) to the general settings. | 31 | Added global application font settings (for all KDE-Pim/Pi apps) to the general settings. |
26 | 32 | ||
27 | Made Passwordmanager PwM/Pi more userfriendly: Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more. | 33 | Made Passwordmanager PwM/Pi more userfriendly: Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more. |
28 | 34 | ||
29 | Datenavigator can now display many months. Very useful on the desktop. | 35 | Datenavigator can now display many months. Very useful on the desktop. |
30 | 36 | ||
31 | KO/Pi alarm applet changed: Made buttons in alarm dialog much bigger and other usebility enhancements. | 37 | KO/Pi alarm applet changed: Made buttons in alarm dialog much bigger and other usebility enhancements. |
32 | 38 | ||
33 | Made alarm sound working on Linux desktop. | 39 | Made alarm sound working on Linux desktop. |
34 | 40 | ||
35 | Made KO/Pi and KA/Pi running from a memory stick. Please read storage HowTo for details. | 41 | Made KO/Pi and KA/Pi running from a memory stick. Please read storage HowTo for details. |
36 | 42 | ||
37 | Added timetracking feature in KO/Pi todo view. Please read timetraker HowTo for details. | 43 | Added timetracking feature in KO/Pi todo view. Please read timetraker HowTo for details. |
38 | 44 | ||
39 | Many other usebility enhancements. | 45 | Many other usebility enhancements. |
40 | Special thanks to Ben for his suggestions! | 46 | Special thanks to Ben for his suggestions! |
41 | 47 | ||
42 | You can find the complete changelog | 48 | You can find the complete changelog |
43 | from version 1.7.7 to 2.1.0 | 49 | from version 1.7.7 to 2.1.0 |
44 | in the source package or on | 50 | in the source package or on |
45 | 51 | ||
46 | http://www.pi-sync.net/html/changelog.html | 52 | http://www.pi-sync.net/html/changelog.html |
47 | 53 | ||
48 | 54 | ||
49 | 55 | ||
diff --git a/kaddressbook/kaimportoldialog.cpp b/kaddressbook/kaimportoldialog.cpp index 848d8af..7bb8bd8 100644 --- a/kaddressbook/kaimportoldialog.cpp +++ b/kaddressbook/kaimportoldialog.cpp | |||
@@ -1,733 +1,734 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressbook/Pi. | 2 | This file is part of KAddressbook/Pi. |
3 | Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org> | 3 | Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program 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 | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qtooltip.h> | 24 | #include <qtooltip.h> |
25 | #include <qframe.h> | 25 | #include <qframe.h> |
26 | #include <qpixmap.h> | 26 | #include <qpixmap.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qprogressbar.h> | 28 | #include <qprogressbar.h> |
29 | #include <qwidgetstack.h> | 29 | #include <qwidgetstack.h> |
30 | #include <qdatetime.h> | 30 | #include <qdatetime.h> |
31 | #include <qdir.h> | 31 | #include <qdir.h> |
32 | #include <qregexp.h> | 32 | #include <qregexp.h> |
33 | #include <qapplication.h> | 33 | #include <qapplication.h> |
34 | #include <qhbox.h> | 34 | #include <qhbox.h> |
35 | #include <qheader.h> | 35 | #include <qheader.h> |
36 | #include <qdatetime.h> | 36 | #include <qdatetime.h> |
37 | #include <qlistview.h> | 37 | #include <qlistview.h> |
38 | 38 | ||
39 | #include <kdebug.h> | 39 | #include <kdebug.h> |
40 | #include <klocale.h> | 40 | #include <klocale.h> |
41 | #include <kstandarddirs.h> | 41 | #include <kstandarddirs.h> |
42 | #include <kmessagebox.h> | 42 | #include <kmessagebox.h> |
43 | #include <kfiledialog.h> | 43 | #include <kfiledialog.h> |
44 | 44 | ||
45 | #include <libkdepim/categoryselectdialog.h> | 45 | #include <libkdepim/categoryselectdialog.h> |
46 | #include <libkdepim/kinputdialog.h> | 46 | #include <libkdepim/kinputdialog.h> |
47 | 47 | ||
48 | #include <libkcal/calendarlocal.h> | 48 | #include <libkcal/calendarlocal.h> |
49 | #include <libkcal/icalformat.h> | 49 | #include <libkcal/icalformat.h> |
50 | 50 | ||
51 | #include <kabc/addresseelist.h> | 51 | #include <kabc/addresseelist.h> |
52 | #include <kabc/phonenumber.h> | 52 | #include <kabc/phonenumber.h> |
53 | 53 | ||
54 | #include "kaimportoldialog.h" | 54 | #include "kaimportoldialog.h" |
55 | 55 | ||
56 | #include "../outport/msoutl9.h" | 56 | #include "../outport/msoutl9.h" |
57 | #include <ole2.h> | 57 | #include <ole2.h> |
58 | #include <comutil.h> | 58 | #include <comutil.h> |
59 | _Application gOlAppAB; | 59 | _Application gOlAppAB; |
60 | 60 | ||
61 | QDateTime mDdate2Qdtr( DATE dt) | 61 | QDateTime mDdate2Qdtr( DATE dt) |
62 | { | 62 | { |
63 | COleDateTime odt; | 63 | COleDateTime odt; |
64 | SYSTEMTIME st; | 64 | SYSTEMTIME st; |
65 | odt = dt; | 65 | odt = dt; |
66 | if ( odt.GetStatus() != 0 ) | 66 | if ( odt.GetStatus() != 0 ) |
67 | return QDateTime(); | 67 | return QDateTime(); |
68 | odt.GetAsSystemTime(st); | 68 | odt.GetAsSystemTime(st); |
69 | if ( st.wYear > 4000 ) // this program as a year 4000 bug! | 69 | if ( st.wYear > 4000 ) // this program as a year 4000 bug! |
70 | return QDateTime(); | 70 | return QDateTime(); |
71 | // it seems so, that 1.1.4501 indicates: DATE invalid | 71 | // it seems so, that 1.1.4501 indicates: DATE invalid |
72 | QDateTime qdt (QDate(st.wYear, st.wMonth,st.wDay ),QTime( st.wHour, st.wMinute,st.wSecond ) ); | 72 | QDateTime qdt (QDate(st.wYear, st.wMonth,st.wDay ),QTime( st.wHour, st.wMinute,st.wSecond ) ); |
73 | return qdt; | 73 | return qdt; |
74 | } | 74 | } |
75 | 75 | ||
76 | class OLEListViewItem : public QCheckListItem | 76 | class OLEListViewItem : public QCheckListItem |
77 | { | 77 | { |
78 | public: | 78 | public: |
79 | OLEListViewItem( QListView *parent, QString text ) : | 79 | OLEListViewItem( QListView *parent, QString text ) : |
80 | QCheckListItem( parent, text, QCheckListItem::CheckBox ) { ; }; | 80 | QCheckListItem( parent, text, QCheckListItem::CheckBox ) { ; }; |
81 | OLEListViewItem( QListViewItem *after, QString text ) : | 81 | OLEListViewItem( QListViewItem *after, QString text ) : |
82 | QCheckListItem( after, text, QCheckListItem::CheckBox ) { ; }; | 82 | QCheckListItem( after, text, QCheckListItem::CheckBox ) { ; }; |
83 | ~OLEListViewItem() {}; | 83 | ~OLEListViewItem() {}; |
84 | void setData( DWORD data ) {mData= data; }; | 84 | void setData( DWORD data ) {mData= data; }; |
85 | DWORD data() { return mData ;}; | 85 | DWORD data() { return mData ;}; |
86 | private: | 86 | private: |
87 | DWORD mData; | 87 | DWORD mData; |
88 | }; | 88 | }; |
89 | 89 | ||
90 | KAImportOLdialog::KAImportOLdialog( const QString &caption, | 90 | KAImportOLdialog::KAImportOLdialog( const QString &caption, |
91 | KABC::AddressBook * aBook, QWidget *parent ) : | 91 | KABC::AddressBook * aBook, QWidget *parent ) : |
92 | KDialogBase( Plain, caption, User1 | Close, Ok, | 92 | KDialogBase( Plain, caption, User1 | Close, Ok, |
93 | parent, caption, true, false, i18n("Import!") ) | 93 | parent, caption, true, false, i18n("Import!") ) |
94 | { | 94 | { |
95 | QHBox * mw = new QHBox( this ); | 95 | QHBox * mw = new QHBox( this ); |
96 | setMainWidget( mw ); | 96 | setMainWidget( mw ); |
97 | mListView = new QListView( mw ); | 97 | mListView = new QListView( mw ); |
98 | mListView->addColumn(i18n("Select Folder to import")); | 98 | mListView->addColumn(i18n("Select Folder to import")); |
99 | mListView->addColumn(i18n("Content Type")); | 99 | mListView->addColumn(i18n("Content Type")); |
100 | mABook = aBook; | 100 | mABook = aBook; |
101 | connect( this, SIGNAL( user1Clicked() ),SLOT ( slotApply())); | 101 | connect( this, SIGNAL( user1Clicked() ),SLOT ( slotApply())); |
102 | setupFolderView(); | 102 | setupFolderView(); |
103 | resize( sizeHint().width()+50, sizeHint().height()+50 ); | 103 | resize( sizeHint().width()+50, sizeHint().height()+50 ); |
104 | } | 104 | } |
105 | 105 | ||
106 | KAImportOLdialog::~KAImportOLdialog() | 106 | KAImportOLdialog::~KAImportOLdialog() |
107 | { | 107 | { |
108 | 108 | ||
109 | } | 109 | } |
110 | 110 | ||
111 | KABC::Addressee::List KAImportOLdialog::getAddressList() | 111 | KABC::Addressee::List KAImportOLdialog::getAddressList() |
112 | { | 112 | { |
113 | return mAList; | 113 | return mAList; |
114 | } | 114 | } |
115 | void KAImportOLdialog::setupFolderView() | 115 | void KAImportOLdialog::setupFolderView() |
116 | { | 116 | { |
117 | SCODE sc = ::OleInitialize(NULL); | 117 | SCODE sc = ::OleInitialize(NULL); |
118 | if ( FAILED ( sc ) ) { | 118 | if ( FAILED ( sc ) ) { |
119 | KMessageBox::information(this,"OLE initialisation failed"); | 119 | KMessageBox::information(this,"OLE initialisation failed"); |
120 | return; | 120 | return; |
121 | } | 121 | } |
122 | 122 | ||
123 | if(!gOlAppAB.CreateDispatch(_T("Outlook.Application"),NULL)){ | 123 | if(!gOlAppAB.CreateDispatch(_T("Outlook.Application"),NULL)){ |
124 | KMessageBox::information(this,"Sorry, cannot access Outlook"); | 124 | KMessageBox::information(this,"Sorry, cannot access Outlook"); |
125 | return ; | 125 | return ; |
126 | } | 126 | } |
127 | MAPIFolder mfInbox; | 127 | MAPIFolder mfInbox; |
128 | MAPIFolder mfRoot; | 128 | MAPIFolder mfRoot; |
129 | CString szName; | 129 | CString szName; |
130 | _NameSpace olNS; | 130 | _NameSpace olNS; |
131 | olNS = gOlAppAB.GetNamespace(_T("MAPI")); | 131 | olNS = gOlAppAB.GetNamespace(_T("MAPI")); |
132 | mfInbox = olNS.GetDefaultFolder(6); | 132 | mfInbox = olNS.GetDefaultFolder(6); |
133 | mfRoot = mfInbox.GetParent(); | 133 | mfRoot = mfInbox.GetParent(); |
134 | szName = mfRoot.GetName(); | 134 | szName = mfRoot.GetName(); |
135 | long iType = mfRoot.GetDefaultItemType(); | 135 | long iType = mfRoot.GetDefaultItemType(); |
136 | QString mes; | 136 | QString mes; |
137 | mes = QString::fromUcs2( szName.GetBuffer() ); | 137 | mes = QString::fromUcs2( szName.GetBuffer() ); |
138 | OLEListViewItem * root = new OLEListViewItem( mListView, mes ); | 138 | OLEListViewItem * root = new OLEListViewItem( mListView, mes ); |
139 | mfRoot.m_lpDispatch->AddRef(); | 139 | mfRoot.m_lpDispatch->AddRef(); |
140 | addFolder( root, mfRoot.m_lpDispatch ); | 140 | addFolder( root, mfRoot.m_lpDispatch ); |
141 | root->setOpen( true ); | 141 | root->setOpen( true ); |
142 | mListView->setSortColumn( 0 ); | 142 | mListView->setSortColumn( 0 ); |
143 | mListView->sort( ); | 143 | mListView->sort( ); |
144 | } | 144 | } |
145 | 145 | ||
146 | 146 | ||
147 | void KAImportOLdialog::addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent) | 147 | void KAImportOLdialog::addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent) |
148 | { | 148 | { |
149 | MAPIFolder mfParent(dispParent), mfChild; | 149 | MAPIFolder mfParent(dispParent), mfChild; |
150 | _Folders folders; | 150 | _Folders folders; |
151 | _variant_t fndx((long)0); | 151 | _variant_t fndx((long)0); |
152 | CString szName; | 152 | CString szName; |
153 | long iType; | 153 | long iType; |
154 | OLEListViewItem* hChild; | 154 | OLEListViewItem* hChild; |
155 | 155 | ||
156 | folders = mfParent.GetFolders(); | 156 | folders = mfParent.GetFolders(); |
157 | for(int i=1; i <= folders.GetCount(); ++i) | 157 | for(int i=1; i <= folders.GetCount(); ++i) |
158 | { | 158 | { |
159 | fndx = (long)i; | 159 | fndx = (long)i; |
160 | mfChild = folders.Item(fndx.Detach()); | 160 | mfChild = folders.Item(fndx.Detach()); |
161 | mfChild.m_lpDispatch->AddRef(); | 161 | mfChild.m_lpDispatch->AddRef(); |
162 | szName = mfChild.GetName(); | 162 | szName = mfChild.GetName(); |
163 | iType = mfChild.GetDefaultItemType(); | 163 | iType = mfChild.GetDefaultItemType(); |
164 | hChild = new OLEListViewItem( iParent , QString::fromUcs2( szName.GetBuffer() ) ); | 164 | hChild = new OLEListViewItem( iParent , QString::fromUcs2( szName.GetBuffer() ) ); |
165 | if ( iType != 2) | 165 | if ( iType != 2) |
166 | hChild->setEnabled( false ); | 166 | hChild->setEnabled( false ); |
167 | QString ts; | 167 | QString ts; |
168 | switch( iType ) { | 168 | switch( iType ) { |
169 | case 0: | 169 | case 0: |
170 | ts = i18n("Mail"); | 170 | ts = i18n("Mail"); |
171 | break; | 171 | break; |
172 | case 1: | 172 | case 1: |
173 | ts = i18n("Calendar"); | 173 | ts = i18n("Calendar"); |
174 | break; | 174 | break; |
175 | case 2: | 175 | case 2: |
176 | ts = i18n("Contacts"); | 176 | ts = i18n("Contacts"); |
177 | break; | 177 | break; |
178 | case 3: | 178 | case 3: |
179 | ts = i18n("Todos"); | 179 | ts = i18n("Todos"); |
180 | break; | 180 | break; |
181 | case 4: | 181 | case 4: |
182 | ts = i18n("Journals"); | 182 | ts = i18n("Journals"); |
183 | break; | 183 | break; |
184 | case 5: | 184 | case 5: |
185 | ts = i18n("Notes"); | 185 | ts = i18n("Notes"); |
186 | break; | 186 | break; |
187 | default: | 187 | default: |
188 | ts = i18n("Unknown"); | 188 | ts = i18n("Unknown"); |
189 | } | 189 | } |
190 | hChild->setText( 1,ts); | 190 | hChild->setText( 1,ts); |
191 | hChild->setData( (DWORD) mfChild.m_lpDispatch ); | 191 | hChild->setData( (DWORD) mfChild.m_lpDispatch ); |
192 | mfChild.m_lpDispatch->AddRef(); | 192 | mfChild.m_lpDispatch->AddRef(); |
193 | addFolder(hChild, mfChild.m_lpDispatch); | 193 | addFolder(hChild, mfChild.m_lpDispatch); |
194 | } | 194 | } |
195 | } | 195 | } |
196 | 196 | ||
197 | void KAImportOLdialog::slotApply() | 197 | void KAImportOLdialog::slotApply() |
198 | { | 198 | { |
199 | importedItems = 0; | 199 | importedItems = 0; |
200 | OLEListViewItem* child = (OLEListViewItem*) mListView->firstChild(); | 200 | OLEListViewItem* child = (OLEListViewItem*) mListView->firstChild(); |
201 | while ( child ) { | 201 | while ( child ) { |
202 | if ( child->isOn() ) | 202 | if ( child->isOn() ) |
203 | readContactData( child->data() ); | 203 | readContactData( child->data() ); |
204 | child = (OLEListViewItem*) child->itemBelow(); | 204 | child = (OLEListViewItem*) child->itemBelow(); |
205 | } | 205 | } |
206 | QString mes = i18n("Importing complete.\n\n%1 items imported.").arg( importedItems); | 206 | QString mes = i18n("Importing complete.\n\n%1 items imported.").arg( importedItems); |
207 | KMessageBox::information(this,mes); | 207 | KMessageBox::information(this,mes); |
208 | } | 208 | } |
209 | void KAImportOLdialog::readContactData( DWORD folder ) | 209 | void KAImportOLdialog::readContactData( DWORD folder ) |
210 | { | 210 | { |
211 | 211 | ||
212 | LPDISPATCH dispItem = (LPDISPATCH)folder; | 212 | LPDISPATCH dispItem = (LPDISPATCH)folder; |
213 | dispItem->AddRef(); | 213 | dispItem->AddRef(); |
214 | MAPIFolder mf(dispItem); | 214 | MAPIFolder mf(dispItem); |
215 | mf.m_lpDispatch->AddRef(); | 215 | mf.m_lpDispatch->AddRef(); |
216 | _Items folderItems; | 216 | _Items folderItems; |
217 | _variant_t indx((long)0); | 217 | _variant_t indx((long)0); |
218 | LPDISPATCH itm; | 218 | LPDISPATCH itm; |
219 | int i; | 219 | int i; |
220 | folderItems = mf.GetItems(); | 220 | folderItems = mf.GetItems(); |
221 | QProgressBar bar( folderItems.GetCount(),0 ); | 221 | QProgressBar bar( folderItems.GetCount(),0 ); |
222 | bar.setCaption (i18n("Importing - close to abort!") ); | 222 | bar.setCaption (i18n("Importing - close to abort!") ); |
223 | int h = bar.sizeHint().height() ; | 223 | int h = bar.sizeHint().height() ; |
224 | int w = 300; | 224 | int w = 300; |
225 | int dw = QApplication::desktop()->width(); | 225 | int dw = QApplication::desktop()->width(); |
226 | int dh = QApplication::desktop()->height(); | 226 | int dh = QApplication::desktop()->height(); |
227 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 227 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
228 | bar.show(); | 228 | bar.show(); |
229 | for(i=1; i <= folderItems.GetCount(); ++i) | 229 | for(i=1; i <= folderItems.GetCount(); ++i) |
230 | { | 230 | { |
231 | qApp->processEvents(); | 231 | qApp->processEvents(); |
232 | if ( ! bar.isVisible() ) | 232 | if ( ! bar.isVisible() ) |
233 | return ; | 233 | return ; |
234 | bar.setProgress( i ); | 234 | bar.setProgress( i ); |
235 | indx = (long)i; | 235 | indx = (long)i; |
236 | itm = folderItems.Item(indx.Detach()); | 236 | itm = folderItems.Item(indx.Detach()); |
237 | _ContactItem * pItem = (_ContactItem *)&itm; | 237 | _ContactItem * pItem = (_ContactItem *)&itm; |
238 | ol2kapiContact( pItem ); | 238 | ol2kapiContact( pItem ); |
239 | itm->Release(); | 239 | itm->Release(); |
240 | } | 240 | } |
241 | } | 241 | } |
242 | void KAImportOLdialog::slotOk() | 242 | void KAImportOLdialog::slotOk() |
243 | { | 243 | { |
244 | QDialog::accept(); | 244 | QDialog::accept(); |
245 | } | 245 | } |
246 | 246 | ||
247 | void KAImportOLdialog::ol2kapiContact( _ContactItem * aItem ) | 247 | void KAImportOLdialog::ol2kapiContact( _ContactItem * aItem ) |
248 | { | 248 | { |
249 | KABC::Addressee addressee; | 249 | KABC::Addressee addressee; |
250 | 250 | ||
251 | addressee.setUid( QString::fromUcs2(aItem->GetEntryID().GetBuffer())); | 251 | addressee.setUid( QString::fromUcs2(aItem->GetEntryID().GetBuffer())); |
252 | //GetLastModificationTime() | 252 | //GetLastModificationTime() |
253 | //addressee.setName( const QString &name ); | 253 | //addressee.setName( const QString &name ); |
254 | //addressee.setFormattedName( const QString &formattedName ); | 254 | //addressee.setFormattedName( const QString &formattedName ); |
255 | addressee.setFamilyName( QString::fromUcs2(aItem->GetLastName().GetBuffer()) ); | 255 | addressee.setFamilyName( QString::fromUcs2(aItem->GetLastName().GetBuffer()) ); |
256 | addressee.setGivenName( QString::fromUcs2(aItem->GetFirstName().GetBuffer()) ); | 256 | addressee.setGivenName( QString::fromUcs2(aItem->GetFirstName().GetBuffer()) ); |
257 | addressee.setAdditionalName( QString::fromUcs2(aItem->GetMiddleName().GetBuffer()) ); | 257 | addressee.setAdditionalName( QString::fromUcs2(aItem->GetMiddleName().GetBuffer()) ); |
258 | addressee.setPrefix(QString::fromUcs2(aItem->GetTitle().GetBuffer()) ); | 258 | addressee.setPrefix(QString::fromUcs2(aItem->GetTitle().GetBuffer()) ); |
259 | addressee.setSuffix( QString::fromUcs2(aItem->GetSuffix().GetBuffer()) ); | 259 | addressee.setSuffix( QString::fromUcs2(aItem->GetSuffix().GetBuffer()) ); |
260 | addressee.setNickName( QString::fromUcs2(aItem->GetNickName().GetBuffer()) ); | 260 | addressee.setNickName( QString::fromUcs2(aItem->GetNickName().GetBuffer()) ); |
261 | QDateTime dtb = mDdate2Qdtr(aItem->GetBirthday()); | 261 | QDateTime dtb = mDdate2Qdtr(aItem->GetBirthday()); |
262 | if ( dtb.isValid() ) | 262 | if ( dtb.isValid() ) |
263 | addressee.setBirthday( mDdate2Qdtr(aItem->GetBirthday())); | 263 | addressee.setBirthday( mDdate2Qdtr(aItem->GetBirthday())); |
264 | 264 | ||
265 | //QString::fromUcs2(aItem->.GetBuffer()) | 265 | //QString::fromUcs2(aItem->.GetBuffer()) |
266 | //addressee.setMailer( const QString &mailer ); | 266 | //addressee.setMailer( const QString &mailer ); |
267 | //addressee.setTimeZone( const TimeZone &timeZone ); | 267 | //addressee.setTimeZone( const TimeZone &timeZone ); |
268 | //addressee.setGeo( const Geo &geo ); | 268 | //addressee.setGeo( const Geo &geo ); |
269 | //addressee.setTitle( QString::fromUcs2(aItem->GetJobTitle().GetBuffer()) );// titel is the prefix | 269 | //addressee.setTitle( QString::fromUcs2(aItem->GetJobTitle().GetBuffer()) );// titel is the prefix |
270 | addressee.setRole( QString::fromUcs2(aItem->GetJobTitle().GetBuffer()) ); | 270 | addressee.setRole( QString::fromUcs2(aItem->GetJobTitle().GetBuffer()) ); |
271 | addressee.setOrganization( QString::fromUcs2(aItem->GetCompanyName().GetBuffer()).replace( QRegExp("\\r"), "") ); | 271 | addressee.setOrganization( QString::fromUcs2(aItem->GetCompanyName().GetBuffer()).replace( QRegExp("\\r"), "") ); |
272 | QString notesStr = QString::fromUcs2(aItem->GetBody().GetBuffer()); | 272 | QString notesStr = QString::fromUcs2(aItem->GetBody().GetBuffer()); |
273 | notesStr.replace( QRegExp("\\r"), ""); | 273 | notesStr.replace( QRegExp("\\r"), ""); |
274 | 274 | ||
275 | addressee.setProductId( QString::fromUcs2(aItem->GetCustomerID().GetBuffer()) ); | 275 | addressee.setProductId( QString::fromUcs2(aItem->GetCustomerID().GetBuffer()) ); |
276 | //addressee.setRevision( const QDateTime &revision ); | 276 | //addressee.setRevision( const QDateTime &revision ); |
277 | // addressee.setSortString( const QString &sortString ); | 277 | // addressee.setSortString( const QString &sortString ); |
278 | addressee.setUrl( QString::fromUcs2(aItem->GetWebPage().GetBuffer()) ); | 278 | addressee.setUrl( QString::fromUcs2(aItem->GetWebPage().GetBuffer()) ); |
279 | 279 | ||
280 | QString tempS; | 280 | QString tempS; |
281 | tempS = QString::fromUcs2(aItem->GetNetMeetingAlias().GetBuffer())+" AT SERVER: " +QString::fromUcs2(aItem->GetNetMeetingServer().GetBuffer()); | 281 | tempS = QString::fromUcs2(aItem->GetNetMeetingAlias().GetBuffer())+" AT SERVER: " +QString::fromUcs2(aItem->GetNetMeetingServer().GetBuffer()); |
282 | if ( tempS.length() > 12 ) | 282 | if ( tempS.length() > 12 ) |
283 | addressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", tempS ); | 283 | addressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", tempS ); |
284 | tempS = QString::fromUcs2(aItem->GetSpouse().GetBuffer()); | 284 | tempS = QString::fromUcs2(aItem->GetSpouse().GetBuffer()); |
285 | if ( !tempS.isEmpty() ) | 285 | if ( !tempS.isEmpty() ) |
286 | addressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", tempS ); | 286 | addressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", tempS ); |
287 | tempS = QString::fromUcs2(aItem->GetManagerName().GetBuffer()); | 287 | tempS = QString::fromUcs2(aItem->GetManagerName().GetBuffer()); |
288 | if ( !tempS.isEmpty() ) | 288 | if ( !tempS.isEmpty() ) |
289 | addressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", tempS ); | 289 | addressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", tempS ); |
290 | tempS = QString::fromUcs2(aItem->GetAssistantName().GetBuffer()); | 290 | tempS = QString::fromUcs2(aItem->GetAssistantName().GetBuffer()); |
291 | if ( !tempS.isEmpty() ) | 291 | if ( !tempS.isEmpty() ) |
292 | addressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", tempS ); | 292 | addressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", tempS ); |
293 | tempS = QString::fromUcs2(aItem->GetDepartment().GetBuffer()); | 293 | tempS = QString::fromUcs2(aItem->GetDepartment().GetBuffer()); |
294 | if ( !tempS.isEmpty() ) | 294 | if ( !tempS.isEmpty() ) |
295 | addressee.insertCustom( "KADDRESSBOOK", "X-Department", tempS ); | 295 | addressee.insertCustom( "KADDRESSBOOK", "X-Department", tempS ); |
296 | tempS = QString::fromUcs2(aItem->GetOfficeLocation().GetBuffer()).replace( QRegExp("\\r"), ""); | 296 | tempS = QString::fromUcs2(aItem->GetOfficeLocation().GetBuffer()).replace( QRegExp("\\r"), ""); |
297 | if ( !tempS.isEmpty() ) | 297 | if ( !tempS.isEmpty() ) |
298 | addressee.insertCustom( "KADDRESSBOOK", "X-Office",tempS ); | 298 | addressee.insertCustom( "KADDRESSBOOK", "X-Office",tempS ); |
299 | tempS = QString::fromUcs2(aItem->GetProfession().GetBuffer()); | 299 | tempS = QString::fromUcs2(aItem->GetProfession().GetBuffer()); |
300 | if ( !tempS.isEmpty() ) | 300 | if ( !tempS.isEmpty() ) |
301 | addressee.insertCustom( "KADDRESSBOOK", "X-Profession", tempS ); | 301 | addressee.insertCustom( "KADDRESSBOOK", "X-Profession", tempS ); |
302 | dtb = mDdate2Qdtr(aItem->GetAnniversary()); | 302 | dtb = mDdate2Qdtr(aItem->GetAnniversary()); |
303 | if (dtb.isValid() ) { | 303 | if (dtb.isValid() ) { |
304 | QString dt = KGlobal::locale()->formatDate( dtb.date() , true, KLocale::ISODate); | 304 | QString dt = KGlobal::locale()->formatDate( dtb.date() , true, KLocale::ISODate); |
305 | addressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt); | 305 | addressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt); |
306 | } | 306 | } |
307 | int sec = aItem->GetSensitivity() ; | 307 | int sec = aItem->GetSensitivity() ; |
308 | if ( sec > 1 )// mapping pers -> private | 308 | if ( sec > 1 )// mapping pers -> private |
309 | --sec; | 309 | --sec; |
310 | addressee.setSecrecy( sec ); | 310 | addressee.setSecrecy( sec ); |
311 | //addressee.setLogo( const Picture &logo ); | 311 | //addressee.setLogo( const Picture &logo ); |
312 | //addressee.setPhoto( const Picture &photo ); | 312 | //addressee.setPhoto( const Picture &photo ); |
313 | //addressee.setSound( const Sound &sound ); | 313 | //addressee.setSound( const Sound &sound ); |
314 | //addressee.setAgent( const Agent &agent ); | 314 | //addressee.setAgent( const Agent &agent ); |
315 | QString cat = QString::fromUcs2( aItem->GetCategories().GetBuffer()).replace( QRegExp("\\r"), ""); | 315 | QString cat = QString::fromUcs2( aItem->GetCategories().GetBuffer()).replace( QRegExp("\\r"), ""); |
316 | cat = cat.replace( QRegExp("; "), ";"); | ||
316 | addressee.setCategories( QStringList::split( ";", cat )); | 317 | addressee.setCategories( QStringList::split( ";", cat )); |
317 | 318 | ||
318 | QString phoneS; | 319 | QString phoneS; |
319 | 320 | ||
320 | phoneS = QString::fromUcs2( aItem->GetAssistantTelephoneNumber().GetBuffer()); | 321 | phoneS = QString::fromUcs2( aItem->GetAssistantTelephoneNumber().GetBuffer()); |
321 | if ( ! phoneS.isEmpty()) | 322 | if ( ! phoneS.isEmpty()) |
322 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work + KABC::PhoneNumber::Voice ) ); | 323 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work + KABC::PhoneNumber::Voice ) ); |
323 | phoneS = QString::fromUcs2( aItem->GetBusinessTelephoneNumber().GetBuffer()); | 324 | phoneS = QString::fromUcs2( aItem->GetBusinessTelephoneNumber().GetBuffer()); |
324 | if ( ! phoneS.isEmpty()) | 325 | if ( ! phoneS.isEmpty()) |
325 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work ) ); | 326 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work ) ); |
326 | phoneS = QString::fromUcs2( aItem->GetBusiness2TelephoneNumber().GetBuffer()); | 327 | phoneS = QString::fromUcs2( aItem->GetBusiness2TelephoneNumber().GetBuffer()); |
327 | if ( ! phoneS.isEmpty()) | 328 | if ( ! phoneS.isEmpty()) |
328 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work ) ); | 329 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work ) ); |
329 | phoneS = QString::fromUcs2( aItem->GetBusinessFaxNumber().GetBuffer()); | 330 | phoneS = QString::fromUcs2( aItem->GetBusinessFaxNumber().GetBuffer()); |
330 | if ( ! phoneS.isEmpty()) | 331 | if ( ! phoneS.isEmpty()) |
331 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work + KABC::PhoneNumber::Fax ) ); | 332 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work + KABC::PhoneNumber::Fax ) ); |
332 | phoneS = QString::fromUcs2( aItem->GetCarTelephoneNumber().GetBuffer()); | 333 | phoneS = QString::fromUcs2( aItem->GetCarTelephoneNumber().GetBuffer()); |
333 | if ( ! phoneS.isEmpty()) | 334 | if ( ! phoneS.isEmpty()) |
334 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Car ) ); | 335 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Car ) ); |
335 | phoneS = QString::fromUcs2( aItem->GetHomeTelephoneNumber().GetBuffer()); | 336 | phoneS = QString::fromUcs2( aItem->GetHomeTelephoneNumber().GetBuffer()); |
336 | if ( ! phoneS.isEmpty()) | 337 | if ( ! phoneS.isEmpty()) |
337 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Home ) ); | 338 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Home ) ); |
338 | phoneS = QString::fromUcs2( aItem->GetHome2TelephoneNumber().GetBuffer()); | 339 | phoneS = QString::fromUcs2( aItem->GetHome2TelephoneNumber().GetBuffer()); |
339 | if ( ! phoneS.isEmpty()) | 340 | if ( ! phoneS.isEmpty()) |
340 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Home ) ); | 341 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Home ) ); |
341 | phoneS = QString::fromUcs2( aItem->GetHomeFaxNumber().GetBuffer()); | 342 | phoneS = QString::fromUcs2( aItem->GetHomeFaxNumber().GetBuffer()); |
342 | if ( ! phoneS.isEmpty()) | 343 | if ( ! phoneS.isEmpty()) |
343 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Home + KABC::PhoneNumber::Fax ) ); | 344 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Home + KABC::PhoneNumber::Fax ) ); |
344 | phoneS = QString::fromUcs2( aItem->GetISDNNumber().GetBuffer()); | 345 | phoneS = QString::fromUcs2( aItem->GetISDNNumber().GetBuffer()); |
345 | if ( ! phoneS.isEmpty()) | 346 | if ( ! phoneS.isEmpty()) |
346 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Isdn ) ); | 347 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Isdn ) ); |
347 | phoneS = QString::fromUcs2( aItem->GetMobileTelephoneNumber().GetBuffer()); | 348 | phoneS = QString::fromUcs2( aItem->GetMobileTelephoneNumber().GetBuffer()); |
348 | if ( ! phoneS.isEmpty()) | 349 | if ( ! phoneS.isEmpty()) |
349 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Cell ) ); | 350 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Cell ) ); |
350 | phoneS = QString::fromUcs2( aItem->GetOtherFaxNumber().GetBuffer()); | 351 | phoneS = QString::fromUcs2( aItem->GetOtherFaxNumber().GetBuffer()); |
351 | if ( ! phoneS.isEmpty()) | 352 | if ( ! phoneS.isEmpty()) |
352 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Fax ) ); | 353 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Fax ) ); |
353 | phoneS = QString::fromUcs2( aItem->GetOtherTelephoneNumber().GetBuffer()); | 354 | phoneS = QString::fromUcs2( aItem->GetOtherTelephoneNumber().GetBuffer()); |
354 | if ( ! phoneS.isEmpty()) | 355 | if ( ! phoneS.isEmpty()) |
355 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Voice ) ); | 356 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Voice ) ); |
356 | phoneS = QString::fromUcs2( aItem->GetPagerNumber().GetBuffer()); | 357 | phoneS = QString::fromUcs2( aItem->GetPagerNumber().GetBuffer()); |
357 | if ( ! phoneS.isEmpty()) | 358 | if ( ! phoneS.isEmpty()) |
358 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Pager ) ); | 359 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Pager ) ); |
359 | phoneS = QString::fromUcs2( aItem->GetPrimaryTelephoneNumber().GetBuffer()); | 360 | phoneS = QString::fromUcs2( aItem->GetPrimaryTelephoneNumber().GetBuffer()); |
360 | if ( ! phoneS.isEmpty()) | 361 | if ( ! phoneS.isEmpty()) |
361 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Pref ) ); | 362 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Pref ) ); |
362 | phoneS = QString::fromUcs2( aItem->GetTTYTDDTelephoneNumber().GetBuffer()); | 363 | phoneS = QString::fromUcs2( aItem->GetTTYTDDTelephoneNumber().GetBuffer()); |
363 | if ( ! phoneS.isEmpty()) | 364 | if ( ! phoneS.isEmpty()) |
364 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Modem ) ); | 365 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Modem ) ); |
365 | phoneS = QString::fromUcs2( aItem->GetTelexNumber().GetBuffer()); | 366 | phoneS = QString::fromUcs2( aItem->GetTelexNumber().GetBuffer()); |
366 | if ( ! phoneS.isEmpty()) | 367 | if ( ! phoneS.isEmpty()) |
367 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Fax + KABC::PhoneNumber::Bbs ) ); | 368 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Fax + KABC::PhoneNumber::Bbs ) ); |
368 | phoneS = QString::fromUcs2( aItem->GetCompanyMainTelephoneNumber().GetBuffer()); | 369 | phoneS = QString::fromUcs2( aItem->GetCompanyMainTelephoneNumber().GetBuffer()); |
369 | if ( ! phoneS.isEmpty()) | 370 | if ( ! phoneS.isEmpty()) |
370 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work + KABC::PhoneNumber::Pref ) ); | 371 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work + KABC::PhoneNumber::Pref ) ); |
371 | phoneS = QString::fromUcs2( aItem->GetRadioTelephoneNumber().GetBuffer()); | 372 | phoneS = QString::fromUcs2( aItem->GetRadioTelephoneNumber().GetBuffer()); |
372 | if ( ! phoneS.isEmpty()) | 373 | if ( ! phoneS.isEmpty()) |
373 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Video ) ); | 374 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Video ) ); |
374 | phoneS = QString::fromUcs2( aItem->GetCallbackTelephoneNumber().GetBuffer()); | 375 | phoneS = QString::fromUcs2( aItem->GetCallbackTelephoneNumber().GetBuffer()); |
375 | if ( ! phoneS.isEmpty()) | 376 | if ( ! phoneS.isEmpty()) |
376 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Voice + KABC::PhoneNumber::Pref ) ); | 377 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Voice + KABC::PhoneNumber::Pref ) ); |
377 | 378 | ||
378 | bool preferred = true; | 379 | bool preferred = true; |
379 | phoneS = QString::fromUcs2( aItem->GetEmail1Address().GetBuffer()); | 380 | phoneS = QString::fromUcs2( aItem->GetEmail1Address().GetBuffer()); |
380 | if ( ! phoneS.isEmpty()) { | 381 | if ( ! phoneS.isEmpty()) { |
381 | addressee.insertEmail(phoneS , preferred ); | 382 | addressee.insertEmail(phoneS , preferred ); |
382 | preferred = false; | 383 | preferred = false; |
383 | } | 384 | } |
384 | phoneS = QString::fromUcs2( aItem->GetEmail2Address().GetBuffer()); | 385 | phoneS = QString::fromUcs2( aItem->GetEmail2Address().GetBuffer()); |
385 | if ( ! phoneS.isEmpty()) { | 386 | if ( ! phoneS.isEmpty()) { |
386 | addressee.insertEmail(phoneS , preferred ); | 387 | addressee.insertEmail(phoneS , preferred ); |
387 | preferred = false; | 388 | preferred = false; |
388 | } | 389 | } |
389 | phoneS = QString::fromUcs2( aItem->GetEmail3Address().GetBuffer()); | 390 | phoneS = QString::fromUcs2( aItem->GetEmail3Address().GetBuffer()); |
390 | if ( ! phoneS.isEmpty()) { | 391 | if ( ! phoneS.isEmpty()) { |
391 | addressee.insertEmail(phoneS , preferred ); | 392 | addressee.insertEmail(phoneS , preferred ); |
392 | preferred = false; | 393 | preferred = false; |
393 | } | 394 | } |
394 | // is this the number of the preferred email? | 395 | // is this the number of the preferred email? |
395 | //long GetSelectedMailingAddress();??? | 396 | //long GetSelectedMailingAddress();??? |
396 | 397 | ||
397 | KABC::Address addressHome; | 398 | KABC::Address addressHome; |
398 | KABC::Address* addressAdd = &addressHome; | 399 | KABC::Address* addressAdd = &addressHome; |
399 | bool insert = false; | 400 | bool insert = false; |
400 | phoneS = QString::fromUcs2( aItem->GetHomeAddressCountry().GetBuffer()); | 401 | phoneS = QString::fromUcs2( aItem->GetHomeAddressCountry().GetBuffer()); |
401 | phoneS.replace( QRegExp("\\r"), ""); | 402 | phoneS.replace( QRegExp("\\r"), ""); |
402 | if ( ! phoneS.isEmpty()) { | 403 | if ( ! phoneS.isEmpty()) { |
403 | addressAdd->setCountry(phoneS ); | 404 | addressAdd->setCountry(phoneS ); |
404 | insert = true; | 405 | insert = true; |
405 | } | 406 | } |
406 | phoneS = QString::fromUcs2( aItem->GetHomeAddressState().GetBuffer()); | 407 | phoneS = QString::fromUcs2( aItem->GetHomeAddressState().GetBuffer()); |
407 | phoneS.replace( QRegExp("\\r"), ""); | 408 | phoneS.replace( QRegExp("\\r"), ""); |
408 | if ( ! phoneS.isEmpty()) { | 409 | if ( ! phoneS.isEmpty()) { |
409 | addressAdd->setRegion(phoneS ); | 410 | addressAdd->setRegion(phoneS ); |
410 | insert = true; | 411 | insert = true; |
411 | } | 412 | } |
412 | phoneS = QString::fromUcs2( aItem->GetHomeAddressCity().GetBuffer()); | 413 | phoneS = QString::fromUcs2( aItem->GetHomeAddressCity().GetBuffer()); |
413 | phoneS.replace( QRegExp("\\r"), ""); | 414 | phoneS.replace( QRegExp("\\r"), ""); |
414 | if ( ! phoneS.isEmpty()) { | 415 | if ( ! phoneS.isEmpty()) { |
415 | addressAdd->setLocality(phoneS ); | 416 | addressAdd->setLocality(phoneS ); |
416 | insert = true; | 417 | insert = true; |
417 | } | 418 | } |
418 | phoneS = QString::fromUcs2( aItem->GetHomeAddressPostalCode().GetBuffer()); | 419 | phoneS = QString::fromUcs2( aItem->GetHomeAddressPostalCode().GetBuffer()); |
419 | phoneS.replace( QRegExp("\\r"), ""); | 420 | phoneS.replace( QRegExp("\\r"), ""); |
420 | if ( ! phoneS.isEmpty()) { | 421 | if ( ! phoneS.isEmpty()) { |
421 | addressAdd->setPostalCode(phoneS ); | 422 | addressAdd->setPostalCode(phoneS ); |
422 | insert = true; | 423 | insert = true; |
423 | } | 424 | } |
424 | phoneS = QString::fromUcs2( aItem->GetHomeAddressPostOfficeBox().GetBuffer()); | 425 | phoneS = QString::fromUcs2( aItem->GetHomeAddressPostOfficeBox().GetBuffer()); |
425 | phoneS.replace( QRegExp("\\r"), ""); | 426 | phoneS.replace( QRegExp("\\r"), ""); |
426 | if ( ! phoneS.isEmpty()) { | 427 | if ( ! phoneS.isEmpty()) { |
427 | addressAdd->setPostOfficeBox(phoneS ); | 428 | addressAdd->setPostOfficeBox(phoneS ); |
428 | insert = true; | 429 | insert = true; |
429 | } | 430 | } |
430 | phoneS = QString::fromUcs2( aItem->GetHomeAddressStreet().GetBuffer()); | 431 | phoneS = QString::fromUcs2( aItem->GetHomeAddressStreet().GetBuffer()); |
431 | phoneS.replace( QRegExp("\\r"), ""); | 432 | phoneS.replace( QRegExp("\\r"), ""); |
432 | if ( ! phoneS.isEmpty()) { | 433 | if ( ! phoneS.isEmpty()) { |
433 | addressAdd->setStreet(phoneS ); | 434 | addressAdd->setStreet(phoneS ); |
434 | insert = true; | 435 | insert = true; |
435 | } | 436 | } |
436 | phoneS = QString::fromUcs2( aItem->GetHomeAddress().GetBuffer()); | 437 | phoneS = QString::fromUcs2( aItem->GetHomeAddress().GetBuffer()); |
437 | phoneS.replace( QRegExp("\\r"), ""); | 438 | phoneS.replace( QRegExp("\\r"), ""); |
438 | if ( ! phoneS.isEmpty()) { | 439 | if ( ! phoneS.isEmpty()) { |
439 | // redundant !addressAdd->setExtended(phoneS ); | 440 | // redundant !addressAdd->setExtended(phoneS ); |
440 | // insert = true; | 441 | // insert = true; |
441 | } | 442 | } |
442 | addressAdd->setType( KABC::Address::Home ); | 443 | addressAdd->setType( KABC::Address::Home ); |
443 | if ( insert ) | 444 | if ( insert ) |
444 | addressee.insertAddress( *addressAdd ); | 445 | addressee.insertAddress( *addressAdd ); |
445 | // ++++++++++++++++++++++ end of address | 446 | // ++++++++++++++++++++++ end of address |
446 | 447 | ||
447 | KABC::Address addressWork; | 448 | KABC::Address addressWork; |
448 | addressAdd = &addressWork; | 449 | addressAdd = &addressWork; |
449 | insert = false; | 450 | insert = false; |
450 | phoneS = QString::fromUcs2( aItem->GetBusinessAddressCountry().GetBuffer()); | 451 | phoneS = QString::fromUcs2( aItem->GetBusinessAddressCountry().GetBuffer()); |
451 | phoneS.replace( QRegExp("\\r"), ""); | 452 | phoneS.replace( QRegExp("\\r"), ""); |
452 | if ( ! phoneS.isEmpty()) { | 453 | if ( ! phoneS.isEmpty()) { |
453 | addressAdd->setCountry(phoneS ); | 454 | addressAdd->setCountry(phoneS ); |
454 | insert = true; | 455 | insert = true; |
455 | } | 456 | } |
456 | phoneS = QString::fromUcs2( aItem->GetBusinessAddressState().GetBuffer()); | 457 | phoneS = QString::fromUcs2( aItem->GetBusinessAddressState().GetBuffer()); |
457 | phoneS.replace( QRegExp("\\r"), ""); | 458 | phoneS.replace( QRegExp("\\r"), ""); |
458 | if ( ! phoneS.isEmpty()) { | 459 | if ( ! phoneS.isEmpty()) { |
459 | addressAdd->setRegion(phoneS ); | 460 | addressAdd->setRegion(phoneS ); |
460 | insert = true; | 461 | insert = true; |
461 | } | 462 | } |
462 | phoneS = QString::fromUcs2( aItem->GetBusinessAddressCity().GetBuffer()); | 463 | phoneS = QString::fromUcs2( aItem->GetBusinessAddressCity().GetBuffer()); |
463 | phoneS.replace( QRegExp("\\r"), ""); | 464 | phoneS.replace( QRegExp("\\r"), ""); |
464 | if ( ! phoneS.isEmpty()) { | 465 | if ( ! phoneS.isEmpty()) { |
465 | addressAdd->setLocality(phoneS ); | 466 | addressAdd->setLocality(phoneS ); |
466 | insert = true; | 467 | insert = true; |
467 | } | 468 | } |
468 | phoneS = QString::fromUcs2( aItem->GetBusinessAddressPostalCode().GetBuffer()); | 469 | phoneS = QString::fromUcs2( aItem->GetBusinessAddressPostalCode().GetBuffer()); |
469 | phoneS.replace( QRegExp("\\r"), ""); | 470 | phoneS.replace( QRegExp("\\r"), ""); |
470 | if ( ! phoneS.isEmpty()) { | 471 | if ( ! phoneS.isEmpty()) { |
471 | addressAdd->setPostalCode(phoneS ); | 472 | addressAdd->setPostalCode(phoneS ); |
472 | insert = true; | 473 | insert = true; |
473 | } | 474 | } |
474 | phoneS = QString::fromUcs2( aItem->GetBusinessAddressPostOfficeBox().GetBuffer()); | 475 | phoneS = QString::fromUcs2( aItem->GetBusinessAddressPostOfficeBox().GetBuffer()); |
475 | phoneS.replace( QRegExp("\\r"), ""); | 476 | phoneS.replace( QRegExp("\\r"), ""); |
476 | if ( ! phoneS.isEmpty()) { | 477 | if ( ! phoneS.isEmpty()) { |
477 | addressAdd->setPostOfficeBox(phoneS ); | 478 | addressAdd->setPostOfficeBox(phoneS ); |
478 | insert = true; | 479 | insert = true; |
479 | } | 480 | } |
480 | phoneS = QString::fromUcs2( aItem->GetBusinessAddressStreet().GetBuffer()); | 481 | phoneS = QString::fromUcs2( aItem->GetBusinessAddressStreet().GetBuffer()); |
481 | phoneS.replace( QRegExp("\\r"), ""); | 482 | phoneS.replace( QRegExp("\\r"), ""); |
482 | if ( ! phoneS.isEmpty()) { | 483 | if ( ! phoneS.isEmpty()) { |
483 | addressAdd->setStreet(phoneS ); | 484 | addressAdd->setStreet(phoneS ); |
484 | insert = true; | 485 | insert = true; |
485 | } | 486 | } |
486 | phoneS = QString::fromUcs2( aItem->GetBusinessAddress().GetBuffer()); | 487 | phoneS = QString::fromUcs2( aItem->GetBusinessAddress().GetBuffer()); |
487 | phoneS.replace( QRegExp("\\r"), ""); | 488 | phoneS.replace( QRegExp("\\r"), ""); |
488 | if ( ! phoneS.isEmpty()) { | 489 | if ( ! phoneS.isEmpty()) { |
489 | // redundant !addressAdd->setExtended(phoneS ); | 490 | // redundant !addressAdd->setExtended(phoneS ); |
490 | // insert = true; | 491 | // insert = true; |
491 | } | 492 | } |
492 | addressAdd->setType( KABC::Address::Work ); | 493 | addressAdd->setType( KABC::Address::Work ); |
493 | if ( insert ) | 494 | if ( insert ) |
494 | addressee.insertAddress( *addressAdd ); | 495 | addressee.insertAddress( *addressAdd ); |
495 | // ++++++++++++++++++++++ end of address | 496 | // ++++++++++++++++++++++ end of address |
496 | 497 | ||
497 | KABC::Address addressOther; | 498 | KABC::Address addressOther; |
498 | addressAdd = &addressOther; | 499 | addressAdd = &addressOther; |
499 | insert = false; | 500 | insert = false; |
500 | phoneS = QString::fromUcs2( aItem->GetOtherAddressCountry().GetBuffer()); | 501 | phoneS = QString::fromUcs2( aItem->GetOtherAddressCountry().GetBuffer()); |
501 | phoneS.replace( QRegExp("\\r"), ""); | 502 | phoneS.replace( QRegExp("\\r"), ""); |
502 | if ( ! phoneS.isEmpty()) { | 503 | if ( ! phoneS.isEmpty()) { |
503 | addressAdd->setCountry(phoneS ); | 504 | addressAdd->setCountry(phoneS ); |
504 | insert = true; | 505 | insert = true; |
505 | } | 506 | } |
506 | phoneS = QString::fromUcs2( aItem->GetOtherAddressState().GetBuffer()); | 507 | phoneS = QString::fromUcs2( aItem->GetOtherAddressState().GetBuffer()); |
507 | phoneS.replace( QRegExp("\\r"), ""); | 508 | phoneS.replace( QRegExp("\\r"), ""); |
508 | if ( ! phoneS.isEmpty()) { | 509 | if ( ! phoneS.isEmpty()) { |
509 | addressAdd->setRegion(phoneS ); | 510 | addressAdd->setRegion(phoneS ); |
510 | insert = true; | 511 | insert = true; |
511 | } | 512 | } |
512 | phoneS = QString::fromUcs2( aItem->GetOtherAddressCity().GetBuffer()); | 513 | phoneS = QString::fromUcs2( aItem->GetOtherAddressCity().GetBuffer()); |
513 | phoneS.replace( QRegExp("\\r"), ""); | 514 | phoneS.replace( QRegExp("\\r"), ""); |
514 | if ( ! phoneS.isEmpty()) { | 515 | if ( ! phoneS.isEmpty()) { |
515 | addressAdd->setLocality(phoneS ); | 516 | addressAdd->setLocality(phoneS ); |
516 | insert = true; | 517 | insert = true; |
517 | } | 518 | } |
518 | phoneS = QString::fromUcs2( aItem->GetOtherAddressPostalCode().GetBuffer()); | 519 | phoneS = QString::fromUcs2( aItem->GetOtherAddressPostalCode().GetBuffer()); |
519 | phoneS.replace( QRegExp("\\r"), ""); | 520 | phoneS.replace( QRegExp("\\r"), ""); |
520 | if ( ! phoneS.isEmpty()) { | 521 | if ( ! phoneS.isEmpty()) { |
521 | addressAdd->setPostalCode(phoneS ); | 522 | addressAdd->setPostalCode(phoneS ); |
522 | insert = true; | 523 | insert = true; |
523 | } | 524 | } |
524 | phoneS = QString::fromUcs2( aItem->GetOtherAddressPostOfficeBox().GetBuffer()); | 525 | phoneS = QString::fromUcs2( aItem->GetOtherAddressPostOfficeBox().GetBuffer()); |
525 | phoneS.replace( QRegExp("\\r"), ""); | 526 | phoneS.replace( QRegExp("\\r"), ""); |
526 | if ( ! phoneS.isEmpty()) { | 527 | if ( ! phoneS.isEmpty()) { |
527 | addressAdd->setPostOfficeBox(phoneS ); | 528 | addressAdd->setPostOfficeBox(phoneS ); |
528 | insert = true; | 529 | insert = true; |
529 | } | 530 | } |
530 | phoneS = QString::fromUcs2( aItem->GetOtherAddressStreet().GetBuffer()); | 531 | phoneS = QString::fromUcs2( aItem->GetOtherAddressStreet().GetBuffer()); |
531 | phoneS.replace( QRegExp("\\r"), ""); | 532 | phoneS.replace( QRegExp("\\r"), ""); |
532 | if ( ! phoneS.isEmpty()) { | 533 | if ( ! phoneS.isEmpty()) { |
533 | addressAdd->setStreet(phoneS ); | 534 | addressAdd->setStreet(phoneS ); |
534 | insert = true; | 535 | insert = true; |
535 | } | 536 | } |
536 | phoneS = QString::fromUcs2( aItem->GetOtherAddress().GetBuffer()); | 537 | phoneS = QString::fromUcs2( aItem->GetOtherAddress().GetBuffer()); |
537 | if ( ! phoneS.isEmpty()) { | 538 | if ( ! phoneS.isEmpty()) { |
538 | // redundant !addressAdd->setExtended(phoneS ); | 539 | // redundant !addressAdd->setExtended(phoneS ); |
539 | //insert = true; | 540 | //insert = true; |
540 | } | 541 | } |
541 | //addressAdd->setId( ); | 542 | //addressAdd->setId( ); |
542 | if ( insert ) | 543 | if ( insert ) |
543 | addressee.insertAddress( *addressAdd ); | 544 | addressee.insertAddress( *addressAdd ); |
544 | // ++++++++++++++++++++++ end of address | 545 | // ++++++++++++++++++++++ end of address |
545 | KABC::Address addressMail; | 546 | KABC::Address addressMail; |
546 | addressAdd = &addressMail; | 547 | addressAdd = &addressMail; |
547 | insert = false; | 548 | insert = false; |
548 | phoneS = QString::fromUcs2( aItem->GetMailingAddressCountry().GetBuffer()); | 549 | phoneS = QString::fromUcs2( aItem->GetMailingAddressCountry().GetBuffer()); |
549 | phoneS.replace( QRegExp("\\r"), ""); | 550 | phoneS.replace( QRegExp("\\r"), ""); |
550 | if ( ! phoneS.isEmpty()) { | 551 | if ( ! phoneS.isEmpty()) { |
551 | addressAdd->setCountry(phoneS ); | 552 | addressAdd->setCountry(phoneS ); |
552 | insert = true; | 553 | insert = true; |
553 | } | 554 | } |
554 | phoneS = QString::fromUcs2( aItem->GetMailingAddressState().GetBuffer()); | 555 | phoneS = QString::fromUcs2( aItem->GetMailingAddressState().GetBuffer()); |
555 | phoneS.replace( QRegExp("\\r"), ""); | 556 | phoneS.replace( QRegExp("\\r"), ""); |
556 | if ( ! phoneS.isEmpty()) { | 557 | if ( ! phoneS.isEmpty()) { |
557 | addressAdd->setRegion(phoneS ); | 558 | addressAdd->setRegion(phoneS ); |
558 | insert = true; | 559 | insert = true; |
559 | } | 560 | } |
560 | phoneS = QString::fromUcs2( aItem->GetMailingAddressCity().GetBuffer()); | 561 | phoneS = QString::fromUcs2( aItem->GetMailingAddressCity().GetBuffer()); |
561 | phoneS.replace( QRegExp("\\r"), ""); | 562 | phoneS.replace( QRegExp("\\r"), ""); |
562 | if ( ! phoneS.isEmpty()) { | 563 | if ( ! phoneS.isEmpty()) { |
563 | addressAdd->setLocality(phoneS ); | 564 | addressAdd->setLocality(phoneS ); |
564 | insert = true; | 565 | insert = true; |
565 | } | 566 | } |
566 | phoneS = QString::fromUcs2( aItem->GetMailingAddressPostalCode().GetBuffer()); | 567 | phoneS = QString::fromUcs2( aItem->GetMailingAddressPostalCode().GetBuffer()); |
567 | phoneS.replace( QRegExp("\\r"), ""); | 568 | phoneS.replace( QRegExp("\\r"), ""); |
568 | if ( ! phoneS.isEmpty()) { | 569 | if ( ! phoneS.isEmpty()) { |
569 | addressAdd->setPostalCode(phoneS ); | 570 | addressAdd->setPostalCode(phoneS ); |
570 | insert = true; | 571 | insert = true; |
571 | } | 572 | } |
572 | phoneS = QString::fromUcs2( aItem->GetMailingAddressPostOfficeBox().GetBuffer()); | 573 | phoneS = QString::fromUcs2( aItem->GetMailingAddressPostOfficeBox().GetBuffer()); |
573 | phoneS.replace( QRegExp("\\r"), ""); | 574 | phoneS.replace( QRegExp("\\r"), ""); |
574 | if ( ! phoneS.isEmpty()) { | 575 | if ( ! phoneS.isEmpty()) { |
575 | addressAdd->setPostOfficeBox(phoneS ); | 576 | addressAdd->setPostOfficeBox(phoneS ); |
576 | insert = true; | 577 | insert = true; |
577 | } | 578 | } |
578 | phoneS = QString::fromUcs2( aItem->GetMailingAddressStreet().GetBuffer()); | 579 | phoneS = QString::fromUcs2( aItem->GetMailingAddressStreet().GetBuffer()); |
579 | phoneS.replace( QRegExp("\\r"), ""); | 580 | phoneS.replace( QRegExp("\\r"), ""); |
580 | if ( ! phoneS.isEmpty()) { | 581 | if ( ! phoneS.isEmpty()) { |
581 | addressAdd->setStreet(phoneS ); | 582 | addressAdd->setStreet(phoneS ); |
582 | insert = true; | 583 | insert = true; |
583 | } | 584 | } |
584 | phoneS = QString::fromUcs2( aItem->GetMailingAddress().GetBuffer()); | 585 | phoneS = QString::fromUcs2( aItem->GetMailingAddress().GetBuffer()); |
585 | phoneS.replace( QRegExp("\\r"), ""); | 586 | phoneS.replace( QRegExp("\\r"), ""); |
586 | if ( ! phoneS.isEmpty()) { | 587 | if ( ! phoneS.isEmpty()) { |
587 | // redundant ! addressAdd->setExtended(phoneS ); | 588 | // redundant ! addressAdd->setExtended(phoneS ); |
588 | // insert = true; | 589 | // insert = true; |
589 | } | 590 | } |
590 | addressAdd->setType( KABC::Address::Postal ); | 591 | addressAdd->setType( KABC::Address::Postal ); |
591 | if ( insert ) { | 592 | if ( insert ) { |
592 | addressee.insertAddress( *addressAdd ); | 593 | addressee.insertAddress( *addressAdd ); |
593 | } | 594 | } |
594 | // the following code is disabled | 595 | // the following code is disabled |
595 | // it does not seem to be useful | 596 | // it does not seem to be useful |
596 | #if 0 | 597 | #if 0 |
597 | if ( insert ) { | 598 | if ( insert ) { |
598 | addressAdd->setType( KABC::Address::Home ); | 599 | addressAdd->setType( KABC::Address::Home ); |
599 | if ( addressMail == addressHome ) { | 600 | if ( addressMail == addressHome ) { |
600 | addressHome.setType( KABC::Address::Postal+ KABC::Address::Home ); | 601 | addressHome.setType( KABC::Address::Postal+ KABC::Address::Home ); |
601 | addressee.insertAddress( addressHome ); | 602 | addressee.insertAddress( addressHome ); |
602 | } else { | 603 | } else { |
603 | addressAdd->setType( KABC::Address::Work ); | 604 | addressAdd->setType( KABC::Address::Work ); |
604 | if ( addressMail == addressWork ){ | 605 | if ( addressMail == addressWork ){ |
605 | addressWork.setType( KABC::Address::Postal+ KABC::Address::Work ); | 606 | addressWork.setType( KABC::Address::Postal+ KABC::Address::Work ); |
606 | addressee.insertAddress( addressWork ); | 607 | addressee.insertAddress( addressWork ); |
607 | 608 | ||
608 | } else { | 609 | } else { |
609 | addressAdd->setType( 0 ); | 610 | addressAdd->setType( 0 ); |
610 | if ( addressOther == addressMail ){ | 611 | if ( addressOther == addressMail ){ |
611 | addressOther.setType( KABC::Address::Postal ); | 612 | addressOther.setType( KABC::Address::Postal ); |
612 | addressee.insertAddress( addressOther ); | 613 | addressee.insertAddress( addressOther ); |
613 | } else { | 614 | } else { |
614 | addressee.insertAddress( *addressAdd ); | 615 | addressee.insertAddress( *addressAdd ); |
615 | } | 616 | } |
616 | } | 617 | } |
617 | } | 618 | } |
618 | } | 619 | } |
619 | #endif | 620 | #endif |
620 | // ++++++++++++++++++++++ end of ALL addresses | 621 | // ++++++++++++++++++++++ end of ALL addresses |
621 | //GetUserProperties(); | 622 | //GetUserProperties(); |
622 | tempS = QString::fromUcs2(aItem->GetInternetFreeBusyAddress().GetBuffer()); | 623 | tempS = QString::fromUcs2(aItem->GetInternetFreeBusyAddress().GetBuffer()); |
623 | phoneS.replace( QRegExp("\\r"), ""); | 624 | phoneS.replace( QRegExp("\\r"), ""); |
624 | if ( !tempS.isEmpty() ) | 625 | if ( !tempS.isEmpty() ) |
625 | addressee.insertCustom( "KADDRESSBOOK", "X-FreeBusyUrl", tempS ); | 626 | addressee.insertCustom( "KADDRESSBOOK", "X-FreeBusyUrl", tempS ); |
626 | tempS = QString::fromUcs2(aItem->GetChildren().GetBuffer()); | 627 | tempS = QString::fromUcs2(aItem->GetChildren().GetBuffer()); |
627 | if ( !tempS.isEmpty() ) | 628 | if ( !tempS.isEmpty() ) |
628 | addressee.insertCustom( "KADDRESSBOOK", "X-Children", tempS ); | 629 | addressee.insertCustom( "KADDRESSBOOK", "X-Children", tempS ); |
629 | int gen = aItem->GetGender(); | 630 | int gen = aItem->GetGender(); |
630 | if ( gen != 0 ) { // 0 undef - 1 female - 2 male | 631 | if ( gen != 0 ) { // 0 undef - 1 female - 2 male |
631 | if ( gen == 1 ) | 632 | if ( gen == 1 ) |
632 | addressee.insertCustom( "KADDRESSBOOK", "X-Gender", "female" ); | 633 | addressee.insertCustom( "KADDRESSBOOK", "X-Gender", "female" ); |
633 | else | 634 | else |
634 | addressee.insertCustom( "KADDRESSBOOK", "X-Gender", "male" ); | 635 | addressee.insertCustom( "KADDRESSBOOK", "X-Gender", "male" ); |
635 | } | 636 | } |
636 | QString additionalInfo; | 637 | QString additionalInfo; |
637 | QString tempAdd; | 638 | QString tempAdd; |
638 | tempAdd = QString::fromUcs2(aItem->GetLanguage().GetBuffer()); | 639 | tempAdd = QString::fromUcs2(aItem->GetLanguage().GetBuffer()); |
639 | if ( ! tempAdd.isEmpty() ) { | 640 | if ( ! tempAdd.isEmpty() ) { |
640 | additionalInfo += i18n("\nLanguage: "); | 641 | additionalInfo += i18n("\nLanguage: "); |
641 | additionalInfo += tempAdd; | 642 | additionalInfo += tempAdd; |
642 | } | 643 | } |
643 | tempAdd = QString::fromUcs2(aItem->GetHobby().GetBuffer()); | 644 | tempAdd = QString::fromUcs2(aItem->GetHobby().GetBuffer()); |
644 | phoneS.replace( QRegExp("\\r"), ""); | 645 | phoneS.replace( QRegExp("\\r"), ""); |
645 | if ( ! tempAdd.isEmpty() ) { | 646 | if ( ! tempAdd.isEmpty() ) { |
646 | additionalInfo += i18n("\nHobby: "); | 647 | additionalInfo += i18n("\nHobby: "); |
647 | additionalInfo += tempAdd;; | 648 | additionalInfo += tempAdd;; |
648 | } | 649 | } |
649 | tempAdd =QString::fromUcs2(aItem->GetPersonalHomePage().GetBuffer()); | 650 | tempAdd =QString::fromUcs2(aItem->GetPersonalHomePage().GetBuffer()); |
650 | phoneS.replace( QRegExp("\\r"), ""); | 651 | phoneS.replace( QRegExp("\\r"), ""); |
651 | if ( ! tempAdd.isEmpty() ) { | 652 | if ( ! tempAdd.isEmpty() ) { |
652 | additionalInfo += i18n("\nHomepage: "); | 653 | additionalInfo += i18n("\nHomepage: "); |
653 | additionalInfo += tempAdd;; | 654 | additionalInfo += tempAdd;; |
654 | } | 655 | } |
655 | tempAdd = QString::fromUcs2(aItem->GetBillingInformation().GetBuffer()); | 656 | tempAdd = QString::fromUcs2(aItem->GetBillingInformation().GetBuffer()); |
656 | phoneS.replace( QRegExp("\\r"), ""); | 657 | phoneS.replace( QRegExp("\\r"), ""); |
657 | if ( ! tempAdd.isEmpty() ) { | 658 | if ( ! tempAdd.isEmpty() ) { |
658 | additionalInfo += i18n("\nBilling information: "); | 659 | additionalInfo += i18n("\nBilling information: "); |
659 | additionalInfo += tempAdd;; | 660 | additionalInfo += tempAdd;; |
660 | } | 661 | } |
661 | tempAdd = QString::fromUcs2(aItem->GetCustomerID().GetBuffer()); | 662 | tempAdd = QString::fromUcs2(aItem->GetCustomerID().GetBuffer()); |
662 | phoneS.replace( QRegExp("\\r"), ""); | 663 | phoneS.replace( QRegExp("\\r"), ""); |
663 | if ( ! tempAdd.isEmpty() ) { | 664 | if ( ! tempAdd.isEmpty() ) { |
664 | additionalInfo += i18n("\nCustomer ID: "); | 665 | additionalInfo += i18n("\nCustomer ID: "); |
665 | additionalInfo += tempAdd;; | 666 | additionalInfo += tempAdd;; |
666 | } | 667 | } |
667 | tempAdd = QString::fromUcs2(aItem->GetUser1().GetBuffer()); | 668 | tempAdd = QString::fromUcs2(aItem->GetUser1().GetBuffer()); |
668 | phoneS.replace( QRegExp("\\r"), ""); | 669 | phoneS.replace( QRegExp("\\r"), ""); |
669 | if ( ! tempAdd.isEmpty() ) { | 670 | if ( ! tempAdd.isEmpty() ) { |
670 | additionalInfo += i18n("\nUser1: "); | 671 | additionalInfo += i18n("\nUser1: "); |
671 | additionalInfo += tempAdd;; | 672 | additionalInfo += tempAdd;; |
672 | } | 673 | } |
673 | tempAdd = QString::fromUcs2(aItem->GetUser2().GetBuffer()); | 674 | tempAdd = QString::fromUcs2(aItem->GetUser2().GetBuffer()); |
674 | phoneS.replace( QRegExp("\\r"), ""); | 675 | phoneS.replace( QRegExp("\\r"), ""); |
675 | if ( ! tempAdd.isEmpty() ) { | 676 | if ( ! tempAdd.isEmpty() ) { |
676 | additionalInfo += i18n("\nUser2: "); | 677 | additionalInfo += i18n("\nUser2: "); |
677 | additionalInfo += tempAdd;; | 678 | additionalInfo += tempAdd;; |
678 | } | 679 | } |
679 | tempAdd = QString::fromUcs2(aItem->GetUser3().GetBuffer()); | 680 | tempAdd = QString::fromUcs2(aItem->GetUser3().GetBuffer()); |
680 | phoneS.replace( QRegExp("\\r"), ""); | 681 | phoneS.replace( QRegExp("\\r"), ""); |
681 | if ( ! tempAdd.isEmpty() ) { | 682 | if ( ! tempAdd.isEmpty() ) { |
682 | additionalInfo += i18n("\nUser3: "); | 683 | additionalInfo += i18n("\nUser3: "); |
683 | additionalInfo += tempAdd;; | 684 | additionalInfo += tempAdd;; |
684 | } | 685 | } |
685 | tempAdd = QString::fromUcs2(aItem->GetUser4().GetBuffer()); | 686 | tempAdd = QString::fromUcs2(aItem->GetUser4().GetBuffer()); |
686 | phoneS.replace( QRegExp("\\r"), ""); | 687 | phoneS.replace( QRegExp("\\r"), ""); |
687 | if ( ! tempAdd.isEmpty() ) { | 688 | if ( ! tempAdd.isEmpty() ) { |
688 | additionalInfo += i18n("\nUser4: "); | 689 | additionalInfo += i18n("\nUser4: "); |
689 | additionalInfo += tempAdd;; | 690 | additionalInfo += tempAdd;; |
690 | } | 691 | } |
691 | if (!additionalInfo.isEmpty() ) { | 692 | if (!additionalInfo.isEmpty() ) { |
692 | tempAdd = notesStr; | 693 | tempAdd = notesStr; |
693 | notesStr = "+++++++++++++++++++++++++++\n"; | 694 | notesStr = "+++++++++++++++++++++++++++\n"; |
694 | notesStr += i18n("Additonal fields created\nby KA/Pi Outlook import:"); | 695 | notesStr += i18n("Additonal fields created\nby KA/Pi Outlook import:"); |
695 | notesStr += additionalInfo; | 696 | notesStr += additionalInfo; |
696 | notesStr += i18n("\nEnd additonal fields created\nby KA/Pi Outlook import!\n"); | 697 | notesStr += i18n("\nEnd additonal fields created\nby KA/Pi Outlook import!\n"); |
697 | notesStr += "+++++++++++++++++++++++++++\n"; | 698 | notesStr += "+++++++++++++++++++++++++++\n"; |
698 | notesStr += tempAdd; | 699 | notesStr += tempAdd; |
699 | } | 700 | } |
700 | addressee.setNote( notesStr ); | 701 | addressee.setNote( notesStr ); |
701 | #if 0 | 702 | #if 0 |
702 | // pending | 703 | // pending |
703 | - IM address: no clue where to get info about the helper ID | 704 | - IM address: no clue where to get info about the helper ID |
704 | -custom fields: difficult to implement - not implemented | 705 | -custom fields: difficult to implement - not implemented |
705 | -keys: makes no sense | 706 | -keys: makes no sense |
706 | #endif | 707 | #endif |
707 | 708 | ||
708 | if ( addAddressee( addressee )) | 709 | if ( addAddressee( addressee )) |
709 | ++importedItems; | 710 | ++importedItems; |
710 | } | 711 | } |
711 | void KAImportOLdialog::slotCancel() | 712 | void KAImportOLdialog::slotCancel() |
712 | { | 713 | { |
713 | reject(); | 714 | reject(); |
714 | } | 715 | } |
715 | 716 | ||
716 | bool KAImportOLdialog::addAddressee( KABC::Addressee a ) | 717 | bool KAImportOLdialog::addAddressee( KABC::Addressee a ) |
717 | { | 718 | { |
718 | bool add = true; | 719 | bool add = true; |
719 | KABC::Addressee::List::Iterator it; | 720 | KABC::Addressee::List::Iterator it; |
720 | for ( it = mAList.begin(); it != mAList.end(); ++it ) { | 721 | for ( it = mAList.begin(); it != mAList.end(); ++it ) { |
721 | if ( (*it).uid() == a.uid() ) { | 722 | if ( (*it).uid() == a.uid() ) { |
722 | add = false; | 723 | add = false; |
723 | break; | 724 | break; |
724 | } | 725 | } |
725 | } | 726 | } |
726 | if ( add ) { | 727 | if ( add ) { |
727 | if ( mABook->findByUid(a.uid() ).isEmpty()) | 728 | if ( mABook->findByUid(a.uid() ).isEmpty()) |
728 | mAList.append ( a ); | 729 | mAList.append ( a ); |
729 | else | 730 | else |
730 | add = false; | 731 | add = false; |
731 | } | 732 | } |
732 | return add; | 733 | return add; |
733 | } | 734 | } |