diff --git a/src/KJotsMain.cpp b/src/KJotsMain.cpp --- a/src/KJotsMain.cpp +++ b/src/KJotsMain.cpp @@ -51,8 +51,6 @@ component = new KJotsWidget(this, this); setCentralWidget(component); - //QT5 statusBar()->insertItem(QString(), 0, 1); - //QT5 statusBar()->setItemAlignment(0, Qt::AlignLeft | Qt::AlignVCenter); connect(component, SIGNAL(activeAnchorChanged(QString,QString)), SLOT(activeAnchorChanged(QString,QString))); @@ -73,9 +71,9 @@ void KJotsMain::activeAnchorChanged(const QString &anchorTarget, const QString &anchorText) { if (!anchorTarget.isEmpty()) { - //QT5 statusBar()->changeItem(anchorText + QLatin1String(" -> ") + anchorTarget, 0); + statusBar()->showMessage(QStringLiteral("%1 -> %2").arg(anchorText, anchorTarget)); } else { - //QT5 statusBar()->changeItem(QString(), 0); + statusBar()->clearMessage(); } } diff --git a/src/akonadi_next/CMakeLists.txt b/src/akonadi_next/CMakeLists.txt --- a/src/akonadi_next/CMakeLists.txt +++ b/src/akonadi_next/CMakeLists.txt @@ -1,5 +1,4 @@ set(akonadi_next_SRCS - note.cpp notecreatorandselector.cpp ) diff --git a/src/akonadi_next/note.h b/src/akonadi_next/note.h deleted file mode 100644 --- a/src/akonadi_next/note.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - 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 KJOTS_NOTE_H -#define KJOTS_NOTE_H - -#include - -namespace Akonotes -{ - -/** - This is to become a convenience wrapper around KMime::MessageComposer::Ptr. -*/ -class Note -{ -public: - - static QString mimeType(); - -}; - -} - -#endif diff --git a/src/akonadi_next/note.cpp b/src/akonadi_next/note.cpp deleted file mode 100644 --- a/src/akonadi_next/note.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - 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 "note.h" - -using namespace Akonotes; - -QString Note::mimeType() -{ - return QString::fromLatin1( "text/x-vnd.akonadi.note" ); -} - diff --git a/src/kjotsmodel.cpp b/src/kjotsmodel.cpp --- a/src/kjotsmodel.cpp +++ b/src/kjotsmodel.cpp @@ -27,8 +27,8 @@ #include #include +#include -#include "akonadi_next/note.h" #include "noteshared/notelockattribute.h" #include @@ -107,7 +107,7 @@ Collection col = m_index.data(EntityTreeModel::CollectionRole).value(); if (col.isValid()) { - return col.contentMimeTypes().contains(Akonotes::Note::mimeType()); + return col.contentMimeTypes().contains(Akonadi::NoteUtils::noteMimeType()); } return false; } @@ -123,23 +123,22 @@ QVariantList KJotsEntity::entities() const { + const QAbstractItemModel *model = m_index.model(); QVariantList list; int row = 0; const int column = 0; - QModelIndex childIndex = m_index.child(row++, column); + QModelIndex childIndex = model->index(row++, column, m_index); while (childIndex.isValid()) { - QObject *obj = new KJotsEntity(childIndex); + auto obj = new KJotsEntity(childIndex); list << QVariant::fromValue(obj); - childIndex = m_index.child(row++, column); + childIndex = model->index(row++, column, m_index); } return list; } QVariantList KJotsEntity::breadcrumbs() const { QVariantList list; - int row = 0; - const int column = 0; QModelIndex parent = m_index.parent(); while (parent.isValid()) { diff --git a/src/kjotspart.cpp b/src/kjotspart.cpp --- a/src/kjotspart.cpp +++ b/src/kjotspart.cpp @@ -99,9 +99,9 @@ void KJotsPart::activeAnchorChanged(const QString &anchorTarget, const QString &anchorText) { if (!anchorTarget.isEmpty()) { - mStatusBar->statusBar()->showMessage(anchorText + QLatin1String(" -> ") + anchorTarget); + mStatusBar->statusBar()->showMessage(QStringLiteral("%1 -> %2").arg(anchorText, anchorTarget)); } else { - mStatusBar->statusBar()->showMessage(QString()); + mStatusBar->statusBar()->clearMessage(); } } diff --git a/src/kjotswidget.cpp b/src/kjotswidget.cpp --- a/src/kjotswidget.cpp +++ b/src/kjotswidget.cpp @@ -62,8 +62,8 @@ #include #include #include +#include -#include "akonadi_next/note.h" #include "akonadi_next/notecreatorandselector.h" // Grantlee @@ -157,7 +157,7 @@ monitor->fetchCollection(true); monitor->setItemFetchScope(scope); monitor->setCollectionMonitored(Collection::root()); - monitor->setMimeTypeMonitored(Akonotes::Note::mimeType()); + monitor->setMimeTypeMonitored(Akonadi::NoteUtils::noteMimeType()); m_kjotsModel = new KJotsModel(monitor, this); @@ -330,7 +330,7 @@ connect(browser, &KJotsBrowser::copyAvailable, action, &QAction::setEnabled); action->setEnabled(false); - KStandardAction::pasteText(editor, SLOT(paste()), actionCollection); + KStandardAction::paste(editor, SLOT(paste()), actionCollection); KStandardAction::undo(editor, SLOT(undo()), actionCollection); KStandardAction::redo(editor, SLOT(redo()), actionCollection); @@ -840,7 +840,7 @@ QString title = i18nc("The default name for new books.", "New Book"); newCollection.setName(KRandom::randomString(10)); - newCollection.setContentMimeTypes(QStringList() << Akonadi::Collection::mimeType() << Akonotes::Note::mimeType()); + newCollection.setContentMimeTypes({Akonadi::Collection::mimeType(), Akonadi::NoteUtils::noteMimeType()}); Akonadi::EntityDisplayAttribute *eda = new Akonadi::EntityDisplayAttribute(); eda->setIconName(QLatin1String("x-office-address-book")); @@ -1224,7 +1224,7 @@ p.setFont(QFont(doc->defaultFont())); const QString pageString = QString::number(page); - p.drawText(qRound(pageNumberPos.x() - p.fontMetrics().width(pageString)), + p.drawText(qRound(pageNumberPos.x() - p.fontMetrics().horizontalAdvance(pageString)), qRound(pageNumberPos.y() + view.top()), pageString); } @@ -1819,7 +1819,7 @@ return; } - KJotsLockJob *job = new KJotsLockJob(collections, items, this); + new KJotsLockJob(collections, items, this); } void KJotsWidget::actionUnlock() @@ -1847,7 +1847,7 @@ return; } - KJotsLockJob *job = new KJotsLockJob(collections, items, KJotsLockJob::UnlockJob, this); + new KJotsLockJob(collections, items, KJotsLockJob::UnlockJob, this); } void KJotsWidget::actionSortChildrenAlpha() diff --git a/src/localresourcecreator.cpp b/src/localresourcecreator.cpp --- a/src/localresourcecreator.cpp +++ b/src/localresourcecreator.cpp @@ -21,8 +21,6 @@ #include "localresourcecreator.h" -#include "akonadi_next/note.h" - #include #include @@ -35,6 +33,7 @@ #include #include #include +#include #include @@ -112,7 +111,7 @@ collection.setParentCollection(Akonadi::Collection(id)); QString title = i18nc("The default name for new books.", "New Book"); collection.setName(KRandom::randomString(10)); - collection.setContentMimeTypes(QStringList() << Akonadi::Collection::mimeType() << Akonotes::Note::mimeType()); + collection.setContentMimeTypes({Akonadi::Collection::mimeType(), Akonadi::NoteUtils::noteMimeType()}); Akonadi::EntityDisplayAttribute *eda = new Akonadi::EntityDisplayAttribute(); eda->setIconName(QLatin1String("x-office-address-book")); @@ -140,7 +139,7 @@ Akonadi::Item item; item.setParentCollection(collectionCreateJob->collection()); - item.setMimeType(Akonotes::Note::mimeType()); + item.setMimeType(Akonadi::NoteUtils::noteMimeType()); KMime::Message::Ptr note(new KMime::Message());