diff --git a/src/akonadi_next/notecreatorandselector.cpp b/src/akonadi_next/notecreatorandselector.cpp index 8b9def2..e5832f5 100644 --- a/src/akonadi_next/notecreatorandselector.cpp +++ b/src/akonadi_next/notecreatorandselector.cpp @@ -1,141 +1,130 @@ /* Copyright (C) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.net, author Stephen Kelly This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "notecreatorandselector.h" #include #include #include #include #include #include #include "akonadinext_debug.h" using namespace Akonadi; using namespace Akonotes; NoteCreatorAndSelector::NoteCreatorAndSelector(QItemSelectionModel *primaryModel, QItemSelectionModel *secondaryModel, QObject *parent) : QObject(parent), m_primarySelectionModel(primaryModel), m_secondarySelectionModel(secondaryModel == 0 ? primaryModel : secondaryModel), m_containerCollectionId(-1), m_newNoteId(-1), m_giveupTimer(new QTimer(this)) { // If the note doesn't exist after 5 seconds, give up waiting for it. m_giveupTimer->setInterval(5000); connect(m_giveupTimer, &QTimer::timeout, this, &NoteCreatorAndSelector::deleteLater); } NoteCreatorAndSelector::~NoteCreatorAndSelector() { } void NoteCreatorAndSelector::createNote(const Akonadi::Collection &containerCollection) { m_containerCollectionId = containerCollection.id(); if (m_primarySelectionModel == m_secondarySelectionModel) { doCreateNote(); } else { m_giveupTimer->start(); connect(m_primarySelectionModel->model(), &QAbstractItemModel::rowsInserted, this, &NoteCreatorAndSelector::trySelectCollection); trySelectCollection(); } } void NoteCreatorAndSelector::trySelectCollection() { QModelIndex idx = EntityTreeModel::modelIndexForCollection(m_primarySelectionModel->model(), Collection(m_containerCollectionId)); if (!idx.isValid()) { return; } m_giveupTimer->stop(); m_primarySelectionModel->select(QItemSelection(idx, idx), QItemSelectionModel::Select); disconnect(m_primarySelectionModel->model(), &QAbstractItemModel::rowsInserted, this, &NoteCreatorAndSelector::trySelectCollection); doCreateNote(); } void NoteCreatorAndSelector::doCreateNote() { Item newItem; newItem.setMimeType(Akonadi::NoteUtils::noteMimeType()); - KMime::Message::Ptr newPage = KMime::Message::Ptr(new KMime::Message()); - - QString title = i18nc("The default name for new pages.", "New Page"); - QByteArray encoding("utf-8"); - - newPage->subject(true)->fromUnicodeString(title, encoding); - newPage->contentType(true)->setMimeType("text/plain"); - newPage->contentType()->setCharset("utf-8"); - newPage->contentTransferEncoding(true)->setEncoding(KMime::Headers::CEquPr); - newPage->date(true)->setDateTime(QDateTime::currentDateTime()); - newPage->from(true)->fromUnicodeString(QString::fromLatin1("Kjots@kde4"), encoding); + Akonadi::NoteUtils::NoteMessageWrapper note(KMime::Message::Ptr(new KMime::Message)); + note.setFrom(QStringLiteral("KJots@KDE5")); + note.setTitle(i18nc("The default name for new pages.", "New Page")); + note.setCreationDate(QDateTime::currentDateTime()); + note.setLastModifiedDate(QDateTime::currentDateTime()); // Need a non-empty body part so that the serializer regards this as a valid message. - newPage->mainBodyPart()->fromUnicodeString(QString::fromLatin1(" ")); - - newPage->assemble(); - - newItem.setPayload(newPage); + note.setText(QStringLiteral(" ")); - Akonadi::EntityDisplayAttribute *eda = new Akonadi::EntityDisplayAttribute(); - eda->setIconName(QStringLiteral("text-plain")); - newItem.addAttribute(eda); + newItem.setPayload(note.message()); + newItem.attribute(Akonadi::Item::AddIfMissing)->setIconName(QStringLiteral("text-plain")); Akonadi::ItemCreateJob *job = new Akonadi::ItemCreateJob(newItem, Collection(m_containerCollectionId), this); connect(job, &Akonadi::ItemCreateJob::result, this, &NoteCreatorAndSelector::noteCreationFinished); } void NoteCreatorAndSelector::noteCreationFinished(KJob *job) { if (job->error()) { qCWarning(AKONADINEXT_LOG) << job->errorString(); return; } Akonadi::ItemCreateJob *createJob = qobject_cast(job); Q_ASSERT(createJob); Item newItem = createJob->item(); m_newNoteId = newItem.id(); m_giveupTimer->start(); connect(m_primarySelectionModel->model(), &QAbstractItemModel::rowsInserted, this, &NoteCreatorAndSelector::trySelectNote); trySelectNote(); } void NoteCreatorAndSelector::trySelectNote() { QModelIndexList list = EntityTreeModel::modelIndexesForItem(m_secondarySelectionModel->model(), Item(m_newNoteId)); if (list.isEmpty()) { return; } const QModelIndex idx = list.first(); m_secondarySelectionModel->select(QItemSelection(idx, idx), QItemSelectionModel::ClearAndSelect); } diff --git a/src/kjotsmodel.cpp b/src/kjotsmodel.cpp index ca827ae..b03f6c3 100644 --- a/src/kjotsmodel.cpp +++ b/src/kjotsmodel.cpp @@ -1,308 +1,289 @@ /* This file is part of KJots. Copyright (c) 2009 Stephen Kelly This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "kjotsmodel.h" #include #include #include #include #include #include #include "noteshared/notelockattribute.h" #include #include #include #include #include Q_DECLARE_METATYPE(QTextDocument *) KJotsEntity::KJotsEntity(const QModelIndex &index, QObject *parent) : QObject(parent) { m_index = QPersistentModelIndex(index); } void KJotsEntity::setIndex(const QModelIndex &index) { m_index = QPersistentModelIndex(index); } QString KJotsEntity::title() const { return m_index.data().toString(); } QString KJotsEntity::content() const { QTextDocument *document = m_index.data(KJotsModel::DocumentRole).value(); if (!document) { return QString(); } Grantlee::TextHTMLBuilder builder; Grantlee::MarkupDirector director(&builder); director.processDocument(document); QString result = builder.getResult(); return result; } QString KJotsEntity::plainContent() const { QTextDocument *document = m_index.data(KJotsModel::DocumentRole).value(); if (!document) { return QString(); } Grantlee::PlainTextMarkupBuilder builder; Grantlee::MarkupDirector director(&builder); director.processDocument(document); QString result = builder.getResult(); return result; } QString KJotsEntity::url() const { return m_index.data(KJotsModel::EntityUrlRole).toString(); } qint64 KJotsEntity::entityId() const { Item item = m_index.data(EntityTreeModel::ItemRole).value(); if (!item.isValid()) { Collection col = m_index.data(EntityTreeModel::CollectionRole).value(); if (!col.isValid()) { return -1; } return col.id(); } return item.id(); } bool KJotsEntity::isBook() const { Collection col = m_index.data(EntityTreeModel::CollectionRole).value(); if (col.isValid()) { return col.contentMimeTypes().contains(Akonadi::NoteUtils::noteMimeType()); } return false; } bool KJotsEntity::isPage() const { Item item = m_index.data(EntityTreeModel::ItemRole).value(); if (item.isValid()) { return item.hasPayload(); } return false; } QVariantList KJotsEntity::entities() const { const QAbstractItemModel *model = m_index.model(); QVariantList list; int row = 0; const int column = 0; QModelIndex childIndex = model->index(row++, column, m_index); while (childIndex.isValid()) { auto obj = new KJotsEntity(childIndex); list << QVariant::fromValue(obj); childIndex = model->index(row++, column, m_index); } return list; } QVariantList KJotsEntity::breadcrumbs() const { QVariantList list; QModelIndex parent = m_index.parent(); while (parent.isValid()) { QObject *obj = new KJotsEntity(parent); list << QVariant::fromValue(obj); parent = parent.parent(); } return list; } KJotsModel::KJotsModel(ChangeRecorder *monitor, QObject *parent) : EntityTreeModel(monitor, parent) { } KJotsModel::~KJotsModel() { qDeleteAll(m_documents); } bool KJotsModel::setData(const QModelIndex &index, const QVariant &value, int role) { if (role == Qt::EditRole) { Item item = index.data(ItemRole).value(); if (!item.isValid()) { Collection col = index.data(CollectionRole).value(); col.setName(value.toString()); if (col.hasAttribute()) { EntityDisplayAttribute *eda = col.attribute(); eda->setDisplayName(value.toString()); } return EntityTreeModel::setData(index, QVariant::fromValue(col), CollectionRole); } - KMime::Message::Ptr m = item.payload(); - - m->subject(true)->fromUnicodeString(value.toString(), "utf-8"); - m->assemble(); - item.setPayload(m); + NoteUtils::NoteMessageWrapper note(item.payload()); + note.setTitle(value.toString()); + note.setLastModifiedDate(QDateTime::currentDateTime()); + item.setPayload(note.message()); if (item.hasAttribute()) { EntityDisplayAttribute *displayAttribute = item.attribute(); displayAttribute->setDisplayName(value.toString()); } - return EntityTreeModel::setData(index, QVariant::fromValue(item), ItemRole); + return EntityTreeModel::setData(index, QVariant::fromValue(item), ItemRole); } if (role == KJotsModel::DocumentRole) { Item item = EntityTreeModel::data(index, ItemRole).value(); if (!item.hasPayload()) { return false; } - KMime::Message::Ptr note = item.payload(); QTextDocument *document = value.value(); + NoteUtils::NoteMessageWrapper note(item.payload()); bool isRichText = KPIMTextEdit::TextUtils::containsFormatting(document); - - note->contentType()->setMimeType(isRichText ? "text/html" : "text/plain"); - note->contentType()->setCharset("utf-8"); - note->contentTransferEncoding(true)->setEncoding(KMime::Headers::CEquPr); - note->mainBodyPart()->fromUnicodeString(isRichText ? document->toHtml() : document->toPlainText()); - note->assemble(); - item.setPayload(note); - return EntityTreeModel::setData(index, QVariant::fromValue(item), ItemRole); - } - - if (role == KJotsModel::DocumentCursorPositionRole) { - Item item = index.data(ItemRole).value(); - m_cursorPositions.insert(item.id(), value.toInt()); - return true; + if (isRichText) { + note.setText( document->toHtml(), Qt::RichText ); + } else { + note.setText( document->toPlainText(), Qt::PlainText ); + } + note.setLastModifiedDate(QDateTime::currentDateTime()); + item.setPayload(note.message()); + return EntityTreeModel::setData(index, QVariant::fromValue(item), ItemRole); } return EntityTreeModel::setData(index, value, role); } QVariant KJotsModel::data(const QModelIndex &index, int role) const { if (GrantleeObjectRole == role) { QObject *obj = new KJotsEntity(index); return QVariant::fromValue(obj); } if (role == KJotsModel::DocumentRole) { const Item item = index.data(ItemRole).value(); Item::Id itemId = item.id(); if (m_documents.contains(itemId)) { return QVariant::fromValue(m_documents.value(itemId)); } if (!item.hasPayload()) { return QVariant(); } - KMime::Message::Ptr note = item.payload(); - QTextDocument *document = new QTextDocument; - const QString decodedText = note->mainBodyPart()->decodedText(); - if (note->contentType()->isHTMLText() - || decodedText.startsWith(QLatin1String(""))) { - document->setHtml(decodedText); + NoteUtils::NoteMessageWrapper note(item.payload()); + const QString doc = note.text(); + auto document = new QTextDocument(); + if (note.textFormat() == Qt::RichText + || doc.startsWith(u"")) + { + document->setHtml(doc); } else { - document->setPlainText(decodedText); + document->setPlainText(doc); } m_documents.insert(itemId, document); return QVariant::fromValue(document); } - if (role == KJotsModel::DocumentCursorPositionRole) { - const Item item = index.data(ItemRole).value(); - if (!item.isValid()) { - return 0; - } - - if (m_cursorPositions.contains(item.id())) { - return m_cursorPositions.value(item.id()); - } - - return 0; - } - if (role == Qt::DecorationRole) { const Item item = index.data(ItemRole).value(); if (item.isValid() && item.hasAttribute()) { return QIcon::fromTheme(QLatin1String("emblem-locked")); } else { const Collection col = index.data(CollectionRole).value(); if (col.isValid() && col.hasAttribute()) { return QIcon::fromTheme(QLatin1String("emblem-locked")); } } } return EntityTreeModel::data(index, role); } QVariant KJotsModel::entityData(const Akonadi::Item &item, int column, int role) const { if ((role == Qt::EditRole || role == Qt::DisplayRole) && item.hasPayload()) { - KMime::Message::Ptr page = item.payload(); - return page->subject()->asUnicodeString(); + NoteUtils::NoteMessageWrapper note(item.payload()); + return note.title(); } return EntityTreeModel::entityData(item, column, role); } QModelIndex KJotsModel::modelIndexForUrl(const QAbstractItemModel *model, const QUrl &url) { if (url.scheme() != QStringLiteral("akonadi")) { return QModelIndex(); } const auto item = Item::fromUrl(url); const auto col = Collection::fromUrl(url); if (item.isValid()) { const QModelIndexList idxs = EntityTreeModel::modelIndexesForItem(model, item); if (!idxs.isEmpty()) { return idxs.first(); } } else if (col.isValid()) { return EntityTreeModel::modelIndexForCollection(model, col); } return QModelIndex(); } diff --git a/src/kjotsmodel.h b/src/kjotsmodel.h index df401af..09b6c4b 100644 --- a/src/kjotsmodel.h +++ b/src/kjotsmodel.h @@ -1,107 +1,104 @@ /* This file is part of KJots. Copyright (c) 2009 Stephen Kelly This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KJOTSMODEL_H #define KJOTSMODEL_H #include class QTextDocument; namespace Akonadi { class ChangeRecorder; } using namespace Akonadi; /** * A wrapper QObject making some book and page properties available to Grantlee. */ class KJotsEntity : public QObject { Q_OBJECT Q_PROPERTY(QString title READ title) Q_PROPERTY(QString content READ content) Q_PROPERTY(QString plainContent READ plainContent) Q_PROPERTY(QString url READ url) Q_PROPERTY(qint64 entityId READ entityId) Q_PROPERTY(bool isBook READ isBook) Q_PROPERTY(bool isPage READ isPage) Q_PROPERTY(QVariantList entities READ entities) Q_PROPERTY(QVariantList breadcrumbs READ breadcrumbs) public: explicit KJotsEntity(const QModelIndex &index, QObject *parent = nullptr); void setIndex(const QModelIndex &index); bool isBook() const; bool isPage() const; QString title() const; QString content() const; QString plainContent() const; QString url() const; qint64 entityId() const; QVariantList entities() const; QVariantList breadcrumbs() const; private: QPersistentModelIndex m_index; }; class KJotsModel : public EntityTreeModel { Q_OBJECT public: explicit KJotsModel(ChangeRecorder *monitor, QObject *parent = nullptr); ~KJotsModel() override; enum KJotsRoles { GrantleeObjectRole = EntityTreeModel::UserRole, - DocumentRole, - DocumentCursorPositionRole + DocumentRole }; // We don't reimplement the Collection overload. using EntityTreeModel::entityData; QVariant entityData(const Akonadi::Item &item, int column, int role = Qt::DisplayRole) const override; QVariant data(const QModelIndex &index, int role) const override; bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; static QModelIndex modelIndexForUrl(const QAbstractItemModel *model, const QUrl &url); private: QHash m_colors; mutable QHash m_documents; - QHash m_cursorPositions; - }; #endif diff --git a/src/localresourcecreator.cpp b/src/localresourcecreator.cpp index cef4bce..7a33411 100644 --- a/src/localresourcecreator.cpp +++ b/src/localresourcecreator.cpp @@ -1,174 +1,163 @@ /* Copyright (C) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.net, author Stephen Kelly This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "localresourcecreator.h" #include #include #include #include #include #include #include #include #include #include #include #include LocalResourceCreator::LocalResourceCreator(QObject *parent) : NoteShared::LocalResourceCreator(parent) { } void LocalResourceCreator::finishCreateResource() { Akonadi::CollectionFetchJob *collectionFetchJob = new Akonadi::CollectionFetchJob(Akonadi::Collection::root(), Akonadi::CollectionFetchJob::FirstLevel, this); connect(collectionFetchJob, &Akonadi::CollectionFetchJob::result, this, &LocalResourceCreator::rootFetchFinished); } void LocalResourceCreator::rootFetchFinished(KJob *job) { if (job->error()) { qWarning() << job->errorString(); deleteLater(); return; } Akonadi::CollectionFetchJob *lastCollectionFetchJob = qobject_cast(job); if (!lastCollectionFetchJob) { deleteLater(); return; } Akonadi::Collection::List list = lastCollectionFetchJob->collections(); if (list.isEmpty()) { qWarning() << "Couldn't find new collection in resource"; deleteLater(); return; } for (const Akonadi::Collection &col : qAsConst(list)) { Akonadi::AgentInstance instance = Akonadi::AgentManager::self()->instance(col.resource()); if (instance.type().identifier() == akonadiNotesInstanceName()) { Akonadi::CollectionFetchJob *collectionFetchJob = new Akonadi::CollectionFetchJob(col, Akonadi::CollectionFetchJob::FirstLevel, this); collectionFetchJob->setProperty("FetchedCollection", col.id()); connect(collectionFetchJob, &Akonadi::CollectionFetchJob::result, this, &LocalResourceCreator::topLevelFetchFinished); return; } } Q_ASSERT(!"Couldn't find new collection"); deleteLater(); } void LocalResourceCreator::topLevelFetchFinished(KJob *job) { if (job->error()) { qWarning() << job->errorString(); deleteLater(); return; } Akonadi::CollectionFetchJob *lastCollectionFetchJob = qobject_cast(job); if (!lastCollectionFetchJob) { deleteLater(); return; } Akonadi::Collection::List list = lastCollectionFetchJob->collections(); if (!list.isEmpty()) { deleteLater(); return; } Akonadi::Collection::Id id = lastCollectionFetchJob->property("FetchedCollection").toLongLong(); Akonadi::Collection collection; collection.setParentCollection(Akonadi::Collection(id)); QString title = i18nc("The default name for new books.", "New Book"); collection.setName(KRandom::randomString(10)); collection.setContentMimeTypes({Akonadi::Collection::mimeType(), Akonadi::NoteUtils::noteMimeType()}); Akonadi::EntityDisplayAttribute *eda = new Akonadi::EntityDisplayAttribute(); eda->setIconName(QLatin1String("x-office-address-book")); eda->setDisplayName(title); collection.addAttribute(eda); Akonadi::CollectionCreateJob *createJob = new Akonadi::CollectionCreateJob(collection, this); connect(createJob, &Akonadi::CollectionCreateJob::result, this, &LocalResourceCreator::createFinished); } void LocalResourceCreator::createFinished(KJob *job) { if (job->error()) { qWarning() << job->errorString(); deleteLater(); return; } Akonadi::CollectionCreateJob *collectionCreateJob = qobject_cast(job); if (!collectionCreateJob) { deleteLater(); return; } Akonadi::Item item; item.setParentCollection(collectionCreateJob->collection()); item.setMimeType(Akonadi::NoteUtils::noteMimeType()); - KMime::Message::Ptr note(new KMime::Message()); - - QString title = i18nc("The default name for new pages.", "New Page"); - QByteArray encoding("utf-8"); - - note->subject(true)->fromUnicodeString(title, encoding); - note->contentType(true)->setMimeType("text/plain"); - note->date(true)->setDateTime(QDateTime::currentDateTime()); - note->from(true)->fromUnicodeString(QLatin1String("Kjots@kde4"), encoding); + Akonadi::NoteUtils::NoteMessageWrapper note(KMime::Message::Ptr(new KMime::Message)); + note.setFrom(QStringLiteral("KJots@KDE5")); + note.setTitle(i18nc("The default name for new pages.", "New Page")); + note.setCreationDate(QDateTime::currentDateTime()); + note.setLastModifiedDate(QDateTime::currentDateTime()); // Need a non-empty body part so that the serializer regards this as a valid message. - note->mainBodyPart()->fromUnicodeString(QLatin1String(" ")); - - note->assemble(); - - item.setPayload(note); - Akonadi::EntityDisplayAttribute *eda = new Akonadi::EntityDisplayAttribute(); - eda->setIconName(QLatin1String("text-plain")); - item.addAttribute(eda); - - Akonadi::ItemCreateJob *itemCreateJob = new Akonadi::ItemCreateJob(item, collectionCreateJob->collection(), this); - connect(itemCreateJob, &Akonadi::ItemCreateJob::result, this, &LocalResourceCreator::itemCreateFinished); -} - -void LocalResourceCreator::itemCreateFinished(KJob *job) -{ - if (job->error()) { - qWarning() << job->errorString(); - } - deleteLater(); + note.setText(QStringLiteral(" ")); + + item.setPayload(note.message()); + item.attribute(Akonadi::Item::AddIfMissing)->setIconName(QStringLiteral("text-plain")); + + auto itemJob = new Akonadi::ItemCreateJob(item, collectionCreateJob->collection(), this); + connect(itemJob, &Akonadi::ItemCreateJob::result, this, [this, itemJob](KJob*){ + if (itemJob->error()) { + qWarning() << "Failed to create a note:" << itemJob->errorString(); + } + deleteLater(); + }); } diff --git a/src/localresourcecreator.h b/src/localresourcecreator.h index d212ed7..832df40 100644 --- a/src/localresourcecreator.h +++ b/src/localresourcecreator.h @@ -1,51 +1,50 @@ /* Copyright (C) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.net, author Stephen Kelly This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef LOCALRESOURCECREATOR_H #define LOCALRESOURCECREATOR_H #include #include "noteshared/localresourcecreator.h" class KJob; /** * @brief Creates a notes resource, a book and a page if one does not already exist. */ class LocalResourceCreator : public NoteShared::LocalResourceCreator { Q_OBJECT public: explicit LocalResourceCreator(QObject *parent = nullptr); protected: void finishCreateResource() override; private Q_SLOTS: void rootFetchFinished(KJob *job); void topLevelFetchFinished(KJob *job); void createFinished(KJob *job); - void itemCreateFinished(KJob *job); }; #endif