Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit bdb1ca8d authored by Laurent Montel's avatar Laurent Montel 😁

Remove this check

parent e9a990b9
......@@ -75,7 +75,7 @@ void CSVImportExportPluginInterface::importCSV()
{
KAddressBookImportExport::KAddressBookImportExportContactList contactList;
QPointer<CSVImportDialog> dlg = new CSVImportDialog(parentWidget());
if (dlg->exec() && dlg) {
if (dlg->exec()) {
contactList.setAddressList(dlg->contacts());
}
......@@ -163,7 +163,7 @@ void CSVImportExportPluginInterface::exportCSV()
= new KAddressBookImportExport::KAddressBookContactSelectionDialog(itemSelectionModel(), false, parentWidget());
dlg->setMessageText(i18n("Which contact do you want to export?"));
dlg->setDefaultAddressBook(defaultCollection());
if (!dlg->exec() || !dlg) {
if (!dlg->exec()) {
delete dlg;
return;
}
......
......@@ -620,7 +620,7 @@ void CSVImportDialog::applyTemplate()
return;
}
if (!dlg->exec() || !dlg) {
if (!dlg->exec()) {
delete dlg;
return;
}
......
......@@ -93,7 +93,7 @@ void GMXImportExportPluginInterface::exportGMX()
= new KAddressBookImportExport::KAddressBookContactSelectionDialog(itemSelectionModel(), false, parentWidget());
dlg->setMessageText(i18n("Which contact do you want to export?"));
dlg->setDefaultAddressBook(defaultCollection());
if (!dlg->exec() || !dlg) {
if (!dlg->exec()) {
delete dlg;
return;
}
......
......@@ -65,7 +65,7 @@ void LDapImportExportPluginInterface::importLdap()
KAddressBookImportExport::KAddressBookImportExportContactList contactList;
QPointer<KLDAP::LdapSearchDialog> dlg = new KLDAP::LdapSearchDialog(parentWidget());
if (dlg->exec() && dlg) {
if (dlg->exec()) {
contactList.setAddressList(dlg->selectedContacts());
}
......
......@@ -137,7 +137,7 @@ void LDifImportExportPluginInterface::exportLdif()
= new KAddressBookImportExport::KAddressBookContactSelectionDialog(itemSelectionModel(), false, parentWidget());
dlg->setMessageText(i18n("Which contact do you want to export?"));
dlg->setDefaultAddressBook(defaultCollection());
if (!dlg->exec() || !dlg) {
if (!dlg->exec()) {
delete dlg;
return;
}
......
......@@ -73,7 +73,7 @@ void ImportExportEngine::importContacts()
i18n("Select the address book the imported contact(s) shall be saved in:"));
dlg->setDefaultCollection(mDefaultAddressBook);
if (!dlg->exec() || !dlg) {
if (!dlg->exec()) {
delete dlg;
deleteLater();
return;
......
......@@ -160,76 +160,6 @@ void VCardImportExportPluginInterface::importVCard()
engine->setContactList(contactList);
engine->setDefaultAddressBook(defaultCollection());
engine->importContacts();
#if 0
KAddressBookImportExport::KAddressBookImportExportContactList contactList;
KContacts::Addressee::List addrList;
QList<QUrl> urls;
if (!option(QStringLiteral("importData")).isEmpty()) {
addrList = parseVCard(option(QStringLiteral("importData")).toUtf8());
} else {
if (!option(QStringLiteral("importUrl")).isEmpty()) {
urls.append(QUrl::fromLocalFile(option(QStringLiteral("importUrl"))));
} else {
const QString filter = i18n("*.vcf|vCard (*.vcf)\n*|all files (*)");
urls
= QFileDialog::getOpenFileUrls(parentWidget(), i18nc("@title:window", "Select vCard to Import"),
QUrl(),
filter);
}
if (urls.isEmpty()) {
return contactList;
}
const QString caption(i18nc("@title:window", "vCard Import Failed"));
bool anyFailures = false;
const int numberOfUrl(urls.count());
for (int i = 0; i < numberOfUrl; ++i) {
const QUrl url = urls.at(i);
auto job = KIO::storedGet(url);
KJobWidgets::setWindow(job, parentWidget());
if (job->exec()) {
const QByteArray data = job->data();
if (!data.isEmpty()) {
addrList += parseVCard(data);
}
} else {
const QString msg = xi18nc(
"@info",
"<para>Unable to access vCard:</para><para>%1</para>",
job->errorString());
KMessageBox::error(parentWidget(), msg, caption);
anyFailures = true;
}
}
if (!option(QStringLiteral("importUrl")).isEmpty()) { // a vcard was passed via cmd
if (addrList.isEmpty()) {
if (anyFailures && urls.count() > 1) {
KMessageBox::information(
parentWidget(),
i18nc("@info", "No contacts were imported, due to errors with the vCards."));
} else if (!anyFailures) {
KMessageBox::information(
parentWidget(),
i18nc("@info", "The vCard does not contain any contacts."));
}
} else {
QPointer<VCardViewerDialog> dlg = new VCardViewerDialog(addrList, parentWidget());
if (dlg->exec() && dlg) {
addrList = dlg->contacts();
} else {
addrList.clear();
}
delete dlg;
}
}
}
contactList.setAddressList(addrList);
#endif
}
KContacts::Addressee::List VCardImportExportPluginInterface::parseVCard(const QByteArray &data) const
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment