-rw-r--r-- | kaddressbook/xxport/opie/opie_xxport.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kaddressbook/xxport/opie/opie_xxport.cpp b/kaddressbook/xxport/opie/opie_xxport.cpp index 616eec1..90d05cd 100644 --- a/kaddressbook/xxport/opie/opie_xxport.cpp +++ b/kaddressbook/xxport/opie/opie_xxport.cpp | |||
@@ -79,65 +79,65 @@ extern "C" | |||
79 | OpieXXPort::OpieXXPort( KABC::AddressBook *ab, QWidget *parent, const char *name ) | 79 | OpieXXPort::OpieXXPort( KABC::AddressBook *ab, QWidget *parent, const char *name ) |
80 | : XXPortObject( ab, parent, name ) | 80 | : XXPortObject( ab, parent, name ) |
81 | { | 81 | { |
82 | createImportAction( i18n( "Import Opie..." ) ); | 82 | createImportAction( i18n( "Import Opie..." ) ); |
83 | createExportAction( i18n( "Export Opie..." ) ); | 83 | createExportAction( i18n( "Export Opie..." ) ); |
84 | } | 84 | } |
85 | 85 | ||
86 | bool OpieXXPort::exportContacts( const KABC::AddresseeList &list, const QString &data ) | 86 | bool OpieXXPort::exportContacts( const KABC::AddresseeList &list, const QString &data ) |
87 | { | 87 | { |
88 | QString name = QDir::homeDirPath() + "/Applications/addressbook/addressbook.xml"; | 88 | QString name = QDir::homeDirPath() + "/Applications/addressbook/addressbook.xml"; |
89 | 89 | ||
90 | #ifndef KAB_EMBEDDED | 90 | #ifndef KAB_EMBEDDED |
91 | QString fileName = KFileDialog::getSaveFileName( name ); | 91 | QString fileName = KFileDialog::getSaveFileName( name ); |
92 | #else //KAB_EMBEDDED | 92 | #else //KAB_EMBEDDED |
93 | QString fileName = KFileDialog::getSaveFileName( name, i18n("Save file"), parentWidget() ); | 93 | QString fileName = KFileDialog::getSaveFileName( name, i18n("Save file"), parentWidget() ); |
94 | #endif //KAB_EMBEDDED | 94 | #endif //KAB_EMBEDDED |
95 | 95 | ||
96 | if ( fileName.isEmpty() ) | 96 | if ( fileName.isEmpty() ) |
97 | return true; | 97 | return true; |
98 | 98 | ||
99 | OContactAccess* access = new OContactAccess("KA/Pi", fileName, 0l, false); | 99 | OContactAccess* access = new OContactAccess("KA/Pi", fileName, 0l, false); |
100 | 100 | ||
101 | if ( !access ) { | 101 | if ( !access ) { |
102 | qDebug("Unable to access file() %s", fileName.latin1()); | 102 | qDebug("Unable to access file() %s", fileName.latin1()); |
103 | addressBook()->error( i18n( "Unable to access file '%1'." ).arg( fileName ) ); | 103 | addressBook()->error( i18n( "Unable to access file '%1'." ).arg( fileName ) ); |
104 | return false; | 104 | return false; |
105 | } | 105 | } |
106 | 106 | ||
107 | //Now check if the file has already entries, and ask the user if he wants to delete them first. | 107 | //Now check if the file has already entries, and ask the user if he wants to delete them first. |
108 | OContactAccess::List contactList = access->allRecords(); | 108 | OContactAccess::List contactList = access->allRecords(); |
109 | if (contactList.count() > 0) | 109 | if (contactList.count() > 0) |
110 | { | 110 | { |
111 | QString text( i18n( "<qt>Do you want to remove all existing entries from <b>%1</b> before exporting.?</qt>" ) ); | 111 | QString text( i18n( "Do you want to remove<br>all existing entries from<br>%1<br>before exporting.?" ) ); |
112 | if ( KMessageBox::questionYesNo( parentWidget(), text.arg( fileName ) ) == KMessageBox::Yes ) { | 112 | if ( KMessageBox::questionYesNo( parentWidget(), text.arg( fileName ) ) == KMessageBox::Yes ) { |
113 | // Clean the database.. | 113 | // Clean the database.. |
114 | access->clear(); | 114 | access->clear(); |
115 | } | 115 | } |
116 | } | 116 | } |
117 | 117 | ||
118 | KABC::OpieConverter mConverter; | 118 | KABC::OpieConverter mConverter; |
119 | bool res; | 119 | bool res; |
120 | 120 | ||
121 | KABC::Addressee::List::ConstIterator it; | 121 | KABC::Addressee::List::ConstIterator it; |
122 | for ( it = list.begin(); it != list.end(); ++it ) { | 122 | for ( it = list.begin(); it != list.end(); ++it ) { |
123 | OContact c; | 123 | OContact c; |
124 | KABC::Addressee addressee = (*it); | 124 | KABC::Addressee addressee = (*it); |
125 | 125 | ||
126 | res = mConverter.addresseeToOpie( *it, c ); | 126 | res = mConverter.addresseeToOpie( *it, c ); |
127 | if (res == true) | 127 | if (res == true) |
128 | { | 128 | { |
129 | res = access->add(c); | 129 | res = access->add(c); |
130 | if (res == false) | 130 | if (res == false) |
131 | qDebug("Unable to append Contact %s", c.fullName().latin1()); | 131 | qDebug("Unable to append Contact %s", c.fullName().latin1()); |
132 | } | 132 | } |
133 | else | 133 | else |
134 | { | 134 | { |
135 | qDebug("Unable to convert Addressee %s", addressee.formattedName().latin1()); | 135 | qDebug("Unable to convert Addressee %s", addressee.formattedName().latin1()); |
136 | } | 136 | } |
137 | } | 137 | } |
138 | 138 | ||
139 | access->save(); | 139 | access->save(); |
140 | 140 | ||
141 | delete access; | 141 | delete access; |
142 | 142 | ||
143 | return true; | 143 | return true; |