diff --git a/src/incidenceattachmentmodel.h b/src/incidenceattachmentmodel.h --- a/src/incidenceattachmentmodel.h +++ b/src/incidenceattachmentmodel.h @@ -44,7 +44,6 @@ enum Roles { AttachmentDataRole = Qt::UserRole, MimeTypeRole, - AttachmentUrl, AttachmentCountRole, UserRole = Qt::UserRole + 100 diff --git a/src/incidenceattachmentmodel.cpp b/src/incidenceattachmentmodel.cpp --- a/src/incidenceattachmentmodel.cpp +++ b/src/incidenceattachmentmodel.cpp @@ -199,8 +199,6 @@ return attachment->decodedData(); case MimeTypeRole: return attachment->mimeType(); - case AttachmentUrl: - return d->m_incidence->writeAttachmentToTempFile(attachment); } return QVariant(); } @@ -215,7 +213,6 @@ { QHash roleNames = QAbstractListModel::roleNames(); roleNames.insert(IncidenceAttachmentModel::MimeTypeRole, "mimeType"); - roleNames.insert(IncidenceAttachmentModel::AttachmentUrl, "attachmentUrl"); return roleNames; } diff --git a/src/utils.h b/src/utils.h --- a/src/utils.h +++ b/src/utils.h @@ -247,8 +247,6 @@ */ CALENDARSUPPORT_EXPORT QStringList holiday(const QDate &date); -CALENDARSUPPORT_EXPORT void saveAttachments(const Akonadi::Item &item, QWidget *widget = nullptr); - CALENDARSUPPORT_EXPORT QStringList categories(const KCalCore::Incidence::List &incidences); CALENDARSUPPORT_EXPORT bool mergeCalendar(const QString &srcFilename, diff --git a/src/utils.cpp b/src/utils.cpp --- a/src/utils.cpp +++ b/src/utils.cpp @@ -790,65 +790,6 @@ return hdays; } -void CalendarSupport::saveAttachments(const Akonadi::Item &item, QWidget *parentWidget) -{ - Incidence::Ptr incidence = CalendarSupport::incidence(item); - - if (!incidence) { - KMessageBox::sorry( - parentWidget, - i18n("No item selected.")); - return; - } - - Attachment::List attachments = incidence->attachments(); - - if (attachments.empty()) { - return; - } - - QString targetFile, targetDir; - if (attachments.count() > 1) { - // get the dir - targetDir = QFileDialog::getExistingDirectory(parentWidget, i18n("Save Attachments To")); - if (targetDir.isEmpty()) { - return; - } - - // we may not get a slash-terminated url out of KFileDialog - if (!targetDir.endsWith(QLatin1Char('/'))) { - targetDir.append(QLatin1Char('/')); - } - } else { - // only one item, get the desired filename - QString fileName = attachments.first()->label(); - if (fileName.isEmpty()) { - fileName = i18nc("filename for an unnamed attachment", "attachment.1"); - } - targetFile = QFileDialog::getSaveFileName(parentWidget, i18n("Save Attachment"), fileName); - if (targetFile.isEmpty()) { - return; - } - - targetDir = QFileInfo(targetFile).absolutePath() + QLatin1Char('/'); - } - - for (const Attachment::Ptr &attachment : qAsConst(attachments)) { - targetFile = targetDir + attachment->label(); - QUrl sourceUrl; - if (attachment->isUri()) { - sourceUrl = QUrl(attachment->uri()); - } else { - sourceUrl = QUrl::fromLocalFile(incidence->writeAttachmentToTempFile(attachment)); - } - // save the attachment url - auto job = KIO::file_copy(sourceUrl, QUrl::fromLocalFile(targetFile)); - if (!job->exec() && job->error()) { - KMessageBox::error(parentWidget, job->errorString()); - } - } -} - QStringList CalendarSupport::categories(const KCalCore::Incidence::List &incidences) { QStringList cats, thisCats;