-rw-r--r-- | kaddressbook/xxport/csv_xxport.cpp | 2 | ||||
-rw-r--r-- | kaddressbook/xxport/opie/opie_xxport.cpp | 2 | ||||
-rw-r--r-- | kaddressbook/xxport/vcard_xxport.cpp | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/kaddressbook/xxport/csv_xxport.cpp b/kaddressbook/xxport/csv_xxport.cpp index caee66d..d4d5475 100644 --- a/kaddressbook/xxport/csv_xxport.cpp +++ b/kaddressbook/xxport/csv_xxport.cpp | |||
@@ -99,49 +99,49 @@ bool CSVXXPort::exportContacts( const KABC::AddresseeList &list, const QString& | |||
99 | 99 | ||
100 | doExport( tmpFile.file(), list ); | 100 | doExport( tmpFile.file(), list ); |
101 | tmpFile.close(); | 101 | tmpFile.close(); |
102 | 102 | ||
103 | return KIO::NetAccess::upload( tmpFile.name(), url, parentWidget() ); | 103 | return KIO::NetAccess::upload( tmpFile.name(), url, parentWidget() ); |
104 | } else { | 104 | } else { |
105 | QFile file( url.path() ); | 105 | QFile file( url.path() ); |
106 | if ( !file.open( IO_WriteOnly ) ) { | 106 | if ( !file.open( IO_WriteOnly ) ) { |
107 | QString txt = i18n( "<qt>Unable to open file <b>%1</b>.</qt>" ); | 107 | QString txt = i18n( "<qt>Unable to open file <b>%1</b>.</qt>" ); |
108 | KMessageBox::error( parentWidget(), txt.arg( url.path() ) ); | 108 | KMessageBox::error( parentWidget(), txt.arg( url.path() ) ); |
109 | return false; | 109 | return false; |
110 | } | 110 | } |
111 | 111 | ||
112 | doExport( &file, list ); | 112 | doExport( &file, list ); |
113 | file.close(); | 113 | file.close(); |
114 | 114 | ||
115 | return true; | 115 | return true; |
116 | } | 116 | } |
117 | 117 | ||
118 | #else //KAB_EMBEDDED | 118 | #else //KAB_EMBEDDED |
119 | 119 | ||
120 | QString fileName = KFileDialog::getSaveFileName( "addressbook.csv", i18n("Save file"), parentWidget() ); | 120 | QString fileName = KFileDialog::getSaveFileName( "addressbook.csv", i18n("Save file"), parentWidget() ); |
121 | 121 | ||
122 | if ( fileName.isEmpty() ) | 122 | if ( fileName.isEmpty() ) |
123 | return true; | 123 | return false; |
124 | 124 | ||
125 | QFile file( fileName ); | 125 | QFile file( fileName ); |
126 | if ( !file.open( IO_WriteOnly ) ) { | 126 | if ( !file.open( IO_WriteOnly ) ) { |
127 | QString txt = i18n( "<qt>Unable to open file <b>%1</b>.</qt>" ); | 127 | QString txt = i18n( "<qt>Unable to open file <b>%1</b>.</qt>" ); |
128 | KMessageBox::error( parentWidget(), txt.arg( fileName ) ); | 128 | KMessageBox::error( parentWidget(), txt.arg( fileName ) ); |
129 | return false; | 129 | return false; |
130 | } | 130 | } |
131 | 131 | ||
132 | doExport( &file, list ); | 132 | doExport( &file, list ); |
133 | file.close(); | 133 | file.close(); |
134 | 134 | ||
135 | return true; | 135 | return true; |
136 | 136 | ||
137 | 137 | ||
138 | #endif //KAB_EMBEDDED | 138 | #endif //KAB_EMBEDDED |
139 | 139 | ||
140 | } | 140 | } |
141 | 141 | ||
142 | KABC::AddresseeList CSVXXPort::importContacts( const QString& ) const | 142 | KABC::AddresseeList CSVXXPort::importContacts( const QString& ) const |
143 | { | 143 | { |
144 | CSVImportDialog dlg( addressBook(), parentWidget() ); | 144 | CSVImportDialog dlg( addressBook(), parentWidget() ); |
145 | if ( dlg.exec() ) | 145 | if ( dlg.exec() ) |
146 | return dlg.contacts(); | 146 | return dlg.contacts(); |
147 | else | 147 | else |
diff --git a/kaddressbook/xxport/opie/opie_xxport.cpp b/kaddressbook/xxport/opie/opie_xxport.cpp index db30d34..c9b0163 100644 --- a/kaddressbook/xxport/opie/opie_xxport.cpp +++ b/kaddressbook/xxport/opie/opie_xxport.cpp | |||
@@ -75,49 +75,49 @@ extern "C" | |||
75 | { | 75 | { |
76 | return ( new OpieXXPortFactory() ); | 76 | return ( new OpieXXPortFactory() ); |
77 | } | 77 | } |
78 | } | 78 | } |
79 | 79 | ||
80 | 80 | ||
81 | OpieXXPort::OpieXXPort( KABC::AddressBook *ab, QWidget *parent, const char *name ) | 81 | OpieXXPort::OpieXXPort( KABC::AddressBook *ab, QWidget *parent, const char *name ) |
82 | : XXPortObject( ab, parent, name ) | 82 | : XXPortObject( ab, parent, name ) |
83 | { | 83 | { |
84 | createImportAction( i18n( "Import Opie..." ) ); | 84 | createImportAction( i18n( "Import Opie..." ) ); |
85 | createExportAction( i18n( "Export Opie..." ) ); | 85 | createExportAction( i18n( "Export Opie..." ) ); |
86 | } | 86 | } |
87 | 87 | ||
88 | bool OpieXXPort::exportContacts( const KABC::AddresseeList &list, const QString &data ) | 88 | bool OpieXXPort::exportContacts( const KABC::AddresseeList &list, const QString &data ) |
89 | { | 89 | { |
90 | QString name = QDir::homeDirPath() + "/Applications/addressbook/addressbook.xml"; | 90 | QString name = QDir::homeDirPath() + "/Applications/addressbook/addressbook.xml"; |
91 | 91 | ||
92 | #ifndef KAB_EMBEDDED | 92 | #ifndef KAB_EMBEDDED |
93 | QString fileName = KFileDialog::getSaveFileName( name ); | 93 | QString fileName = KFileDialog::getSaveFileName( name ); |
94 | #else //KAB_EMBEDDED | 94 | #else //KAB_EMBEDDED |
95 | QString fileName = KFileDialog::getSaveFileName( name, i18n("Save file"), parentWidget() ); | 95 | QString fileName = KFileDialog::getSaveFileName( name, i18n("Save file"), parentWidget() ); |
96 | #endif //KAB_EMBEDDED | 96 | #endif //KAB_EMBEDDED |
97 | 97 | ||
98 | if ( fileName.isEmpty() ) | 98 | if ( fileName.isEmpty() ) |
99 | return true; | 99 | return false; |
100 | 100 | ||
101 | OContactAccessBackend_XML* backend = new OContactAccessBackend_XML( "KA/Pi", fileName ); | 101 | OContactAccessBackend_XML* backend = new OContactAccessBackend_XML( "KA/Pi", fileName ); |
102 | OContactAccess* access = new OContactAccess("KA/Pi", 0l, backend, false); | 102 | OContactAccess* access = new OContactAccess("KA/Pi", 0l, backend, false); |
103 | 103 | ||
104 | if ( !access ) { | 104 | if ( !access ) { |
105 | qDebug("Unable to access file() %s", fileName.latin1()); | 105 | qDebug("Unable to access file() %s", fileName.latin1()); |
106 | addressBook()->error( i18n( "Unable to access file '%1'." ).arg( fileName ) ); | 106 | addressBook()->error( i18n( "Unable to access file '%1'." ).arg( fileName ) ); |
107 | return false; | 107 | return false; |
108 | } | 108 | } |
109 | 109 | ||
110 | KABC::OpieConverter mConverter; | 110 | KABC::OpieConverter mConverter; |
111 | 111 | ||
112 | bool res = mConverter.init(); | 112 | bool res = mConverter.init(); |
113 | if (!res) | 113 | if (!res) |
114 | { | 114 | { |
115 | QString text( i18n( "Unable to initialize opie converter.<br>Most likely a problem with the category file." ) ); | 115 | QString text( i18n( "Unable to initialize opie converter.<br>Most likely a problem with the category file." ) ); |
116 | qDebug(text); | 116 | qDebug(text); |
117 | KMessageBox::error( parentWidget(), text ); | 117 | KMessageBox::error( parentWidget(), text ); |
118 | delete access; | 118 | delete access; |
119 | return false; | 119 | return false; |
120 | } | 120 | } |
121 | 121 | ||
122 | //Now check if the file has already entries, and ask the user if he wants to delete them first. | 122 | //Now check if the file has already entries, and ask the user if he wants to delete them first. |
123 | OContactAccess::List contactList = access->allRecords(); | 123 | OContactAccess::List contactList = access->allRecords(); |
diff --git a/kaddressbook/xxport/vcard_xxport.cpp b/kaddressbook/xxport/vcard_xxport.cpp index adf47cd..4819341 100644 --- a/kaddressbook/xxport/vcard_xxport.cpp +++ b/kaddressbook/xxport/vcard_xxport.cpp | |||
@@ -77,49 +77,49 @@ VCardXXPort::VCardXXPort( KABC::AddressBook *ab, QWidget *parent, const char *na | |||
77 | : XXPortObject( ab, parent, name ) | 77 | : XXPortObject( ab, parent, name ) |
78 | { | 78 | { |
79 | createImportAction( i18n( "Import vCard..." ) ); | 79 | createImportAction( i18n( "Import vCard..." ) ); |
80 | //US KABC::VCardConverter does not support the export of 2.1 addressbooks. | 80 | //US KABC::VCardConverter does not support the export of 2.1 addressbooks. |
81 | //US createExportAction( i18n( "Export vCard 2.1..." ), "v21" ); | 81 | //US createExportAction( i18n( "Export vCard 2.1..." ), "v21" ); |
82 | createExportAction( i18n( "Export vCard 3.0..." ), "v30" ); | 82 | createExportAction( i18n( "Export vCard 3.0..." ), "v30" ); |
83 | } | 83 | } |
84 | 84 | ||
85 | bool VCardXXPort::exportContacts( const KABC::AddresseeList &list, const QString &data ) | 85 | bool VCardXXPort::exportContacts( const KABC::AddresseeList &list, const QString &data ) |
86 | { | 86 | { |
87 | QString name; | 87 | QString name; |
88 | 88 | ||
89 | if ( list.count() == 1 ) | 89 | if ( list.count() == 1 ) |
90 | name = list[ 0 ].givenName() + "_" + list[ 0 ].familyName() + ".vcf"; | 90 | name = list[ 0 ].givenName() + "_" + list[ 0 ].familyName() + ".vcf"; |
91 | else | 91 | else |
92 | name = "addressbook.vcf"; | 92 | name = "addressbook.vcf"; |
93 | 93 | ||
94 | #ifndef KAB_EMBEDDED | 94 | #ifndef KAB_EMBEDDED |
95 | QString fileName = KFileDialog::getSaveFileName( name ); | 95 | QString fileName = KFileDialog::getSaveFileName( name ); |
96 | #else //KAB_EMBEDDED | 96 | #else //KAB_EMBEDDED |
97 | QString fileName = KFileDialog::getSaveFileName( name, i18n("Save file"), parentWidget() ); | 97 | QString fileName = KFileDialog::getSaveFileName( name, i18n("Save file"), parentWidget() ); |
98 | #endif //KAB_EMBEDDED | 98 | #endif //KAB_EMBEDDED |
99 | 99 | ||
100 | if ( fileName.isEmpty() ) | 100 | if ( fileName.isEmpty() ) |
101 | return true; | 101 | return false; |
102 | 102 | ||
103 | QFile outFile( fileName ); | 103 | QFile outFile( fileName ); |
104 | if ( !outFile.open( IO_WriteOnly ) ) { | 104 | if ( !outFile.open( IO_WriteOnly ) ) { |
105 | QString text = i18n( "<qt>Unable to open file <b>%1</b> for export.</qt>" ); | 105 | QString text = i18n( "<qt>Unable to open file <b>%1</b> for export.</qt>" ); |
106 | KMessageBox::error( parentWidget(), text.arg( fileName ) ); | 106 | KMessageBox::error( parentWidget(), text.arg( fileName ) ); |
107 | return false; | 107 | return false; |
108 | } | 108 | } |
109 | 109 | ||
110 | QTextStream t( &outFile ); | 110 | QTextStream t( &outFile ); |
111 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 111 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
112 | 112 | ||
113 | KABC::Addressee::List::ConstIterator it; | 113 | KABC::Addressee::List::ConstIterator it; |
114 | for ( it = list.begin(); it != list.end(); ++it ) { | 114 | for ( it = list.begin(); it != list.end(); ++it ) { |
115 | KABC::VCardConverter converter; | 115 | KABC::VCardConverter converter; |
116 | QString vcard; | 116 | QString vcard; |
117 | 117 | ||
118 | KABC::VCardConverter::Version version; | 118 | KABC::VCardConverter::Version version; |
119 | if ( data == "v21" ) | 119 | if ( data == "v21" ) |
120 | version = KABC::VCardConverter::v2_1; | 120 | version = KABC::VCardConverter::v2_1; |
121 | else | 121 | else |
122 | version = KABC::VCardConverter::v3_0; | 122 | version = KABC::VCardConverter::v3_0; |
123 | 123 | ||
124 | converter.addresseeToVCard( *it, vcard, version ); | 124 | converter.addresseeToVCard( *it, vcard, version ); |
125 | t << vcard << "\r\n\r\n"; | 125 | t << vcard << "\r\n\r\n"; |