author | ulf69 <ulf69> | 2004-07-20 21:28:10 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-07-20 21:28:10 (UTC) |
commit | 6f2ccd235ef49d5606ecf4e540e8884f7a9b7ec4 (patch) (unidiff) | |
tree | 8ce4d24be2dfd04c386665723530435b66701286 /kaddressbook/xxport/csv_xxport.cpp | |
parent | fba0c028ac0ce15d0f7473439e025c56f108145e (diff) | |
download | kdepimpi-6f2ccd235ef49d5606ecf4e540e8884f7a9b7ec4.zip kdepimpi-6f2ccd235ef49d5606ecf4e540e8884f7a9b7ec4.tar.gz kdepimpi-6f2ccd235ef49d5606ecf4e540e8884f7a9b7ec4.tar.bz2 |
remove the export was successfull dialog if the user canceled the operation
Diffstat (limited to 'kaddressbook/xxport/csv_xxport.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/xxport/csv_xxport.cpp | 6 |
1 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 | |||
@@ -93,71 +93,71 @@ bool CSVXXPort::exportContacts( const KABC::AddresseeList &list, const QString& | |||
93 | if ( tmpFile.status() != 0 ) { | 93 | if ( tmpFile.status() != 0 ) { |
94 | QString txt = i18n( "<qt>Unable to open file <b>%1</b>.%2.</qt>" ); | 94 | QString txt = i18n( "<qt>Unable to open file <b>%1</b>.%2.</qt>" ); |
95 | KMessageBox::error( parentWidget(), txt.arg( url.url() ) | 95 | KMessageBox::error( parentWidget(), txt.arg( url.url() ) |
96 | .arg( strerror( tmpFile.status() ) ) ); | 96 | .arg( strerror( tmpFile.status() ) ) ); |
97 | return false; | 97 | return false; |
98 | } | 98 | } |
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 |
148 | return KABC::AddresseeList(); | 148 | return KABC::AddresseeList(); |
149 | } | 149 | } |
150 | 150 | ||
151 | void CSVXXPort::doExport( QFile *fp, const KABC::AddresseeList &list ) | 151 | void CSVXXPort::doExport( QFile *fp, const KABC::AddresseeList &list ) |
152 | { | 152 | { |
153 | QTextStream t( fp ); | 153 | QTextStream t( fp ); |
154 | 154 | ||
155 | KABC::AddresseeList::ConstIterator iter; | 155 | KABC::AddresseeList::ConstIterator iter; |
156 | KABC::Field::List fields = addressBook()->fields(); | 156 | KABC::Field::List fields = addressBook()->fields(); |
157 | KABC::Field::List::Iterator fieldIter; | 157 | KABC::Field::List::Iterator fieldIter; |
158 | bool first = true; | 158 | bool first = true; |
159 | 159 | ||
160 | // First output the column headings | 160 | // First output the column headings |
161 | for ( fieldIter = fields.begin(); fieldIter != fields.end(); ++fieldIter ) { | 161 | for ( fieldIter = fields.begin(); fieldIter != fields.end(); ++fieldIter ) { |
162 | if ( !first ) | 162 | if ( !first ) |
163 | t << ","; | 163 | t << ","; |