diff --git a/containments/desktop/plugins/folder/directorypicker.cpp b/containments/desktop/plugins/folder/directorypicker.cpp --- a/containments/desktop/plugins/folder/directorypicker.cpp +++ b/containments/desktop/plugins/folder/directorypicker.cpp @@ -42,7 +42,7 @@ void DirectoryPicker::open() { if (!m_dialog) { - m_dialog = new QFileDialog(0, i18n("Select Folder"), + m_dialog = new QFileDialog(nullptr, i18n("Select Folder"), QStandardPaths::standardLocations(QStandardPaths::HomeLocation).at(0)); m_dialog->setFileMode(QFileDialog::Directory); m_dialog->setOption(QFileDialog::ShowDirsOnly, true); diff --git a/containments/desktop/plugins/folder/foldermodel.h b/containments/desktop/plugins/folder/foldermodel.h --- a/containments/desktop/plugins/folder/foldermodel.h +++ b/containments/desktop/plugins/folder/foldermodel.h @@ -125,7 +125,7 @@ explicit FolderModel(QObject *parent = nullptr); ~FolderModel(); - QHash roleNames() const Q_DECL_OVERRIDE; + QHash roleNames() const override; static QHash staticRoleNames(); QString url() const; @@ -216,11 +216,11 @@ Q_INVOKABLE void linkHere(const QUrl &sourceUrl); - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; int indexForUrl(const QUrl &url) const; KFileItem itemForIndex(const QModelIndex &index) const; bool isDir(const QModelIndex &index, const KDirModel *dirModel) const; - bool lessThan(const QModelIndex &left, const QModelIndex &right) const Q_DECL_OVERRIDE; + bool lessThan(const QModelIndex &left, const QModelIndex &right) const override; Qt::DropActions supportedDragActions() const override; Q_INVOKABLE void paste(); @@ -257,7 +257,7 @@ void popupMenuAboutToShow(KIO::DropJob *dropJob, QMimeData *mimeData, int x, int y); protected: - bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const Q_DECL_OVERRIDE; + bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override; bool matchMimeType(const KFileItem &item) const; bool matchPattern(const KFileItem &item) const; diff --git a/containments/desktop/plugins/folder/foldermodel.cpp b/containments/desktop/plugins/folder/foldermodel.cpp --- a/containments/desktop/plugins/folder/foldermodel.cpp +++ b/containments/desktop/plugins/folder/foldermodel.cpp @@ -96,11 +96,11 @@ m_dirWatch(nullptr), m_dragInProgress(false), m_urlChangedWhileDragging(false), - m_previewGenerator(0), - m_viewAdapter(0), + m_previewGenerator(nullptr), + m_viewAdapter(nullptr), m_actionCollection(this), - m_newMenu(0), - m_fileItemActions(0), + m_newMenu(nullptr), + m_fileItemActions(nullptr), m_usedByContainment(false), m_locked(true), m_sortMode(0), @@ -115,7 +115,7 @@ qmlRegisterType(); DirLister *dirLister = new DirLister(this); dirLister->setDelayedMimeTypes(true); - dirLister->setAutoErrorHandlingEnabled(false, 0); + dirLister->setAutoErrorHandlingEnabled(false, nullptr); connect(dirLister, &DirLister::error, this, &FolderModel::dirListFailed); connect(dirLister, &KCoreDirLister::itemsDeleted, this, &FolderModel::evictFromIsDirCache); @@ -210,6 +210,7 @@ if (m_dirWatch) { delete m_dirWatch; + m_dirWatch = nullptr; } if (resolvedUrl.isValid()) { @@ -235,7 +236,7 @@ { QUrl resolvedUrl; - if (url.startsWith('~')) { + if (url.startsWith(QLatin1Char('~'))) { resolvedUrl = QUrl::fromLocalFile(KShell::tildeExpand(url)); } else { resolvedUrl = QUrl::fromUserInput(url); @@ -482,7 +483,7 @@ m_filterPattern = pattern; m_filterPatternMatchAll = (pattern == QLatin1String("*")); - const QStringList patterns = pattern.split(' '); + const QStringList patterns = pattern.split(QLatin1Char(' ')); m_regExps.clear(); m_regExps.reserve(patterns.count()); @@ -569,7 +570,7 @@ url.setScheme(QStringLiteral("file")); } - KRun *run = new KRun(url, 0); + KRun *run = new KRun(url, nullptr); // On desktop:/ we want to be able to run .desktop files right away, // otherwise ask for security reasons. We also don't use the targetUrl() // from above since we don't want the resolved /home/foo/Desktop URL. @@ -1027,7 +1028,7 @@ QVector roles; roles.append(SelectedRole); - foreach(const QModelIndex index, indices) { + foreach(const QModelIndex &index, indices) { emit dataChanged(index, index, roles); } @@ -1355,7 +1356,7 @@ m_newMenu = new KNewFileMenu(&m_actionCollection, QStringLiteral("newMenu"), QApplication::desktop()); m_newMenu->setModal(false); - m_copyToMenu = new KFileCopyToMenu(Q_NULLPTR); + m_copyToMenu = new KFileCopyToMenu(nullptr); } QAction* FolderModel::action(const QString &name) const @@ -1538,7 +1539,7 @@ QAction *act = new QAction(menu); act->setText(i18n("&Properties")); QObject::connect(act, &QAction::triggered, [this, items]() { - KPropertiesDialog::showDialog(items, Q_NULLPTR, false /*non modal*/); + KPropertiesDialog::showDialog(items, nullptr, false /*non modal*/); }); menu->addAction(act); } @@ -1655,7 +1656,7 @@ const QList urls = selectedUrls(false); for (const QUrl &url : urls) { - (void) new KRun(url, Q_NULLPTR); + (void) new KRun(url, nullptr); } } diff --git a/containments/desktop/plugins/folder/labelgenerator.cpp b/containments/desktop/plugins/folder/labelgenerator.cpp --- a/containments/desktop/plugins/folder/labelgenerator.cpp +++ b/containments/desktop/plugins/folder/labelgenerator.cpp @@ -126,14 +126,14 @@ label = label.right(label.length() - root.length()); if (!label.isEmpty()) { - if (label.at(0) == '/') { + if (label.at(0) == QLatin1Char('/')) { label.remove(0, 1); } if (m_rtl) { - label.prepend(" < "); + label.prepend(QStringLiteral(" < ")); } else { - label.prepend(" > "); + label.prepend(QStringLiteral(" > ")); } } diff --git a/containments/desktop/plugins/folder/mimetypesmodel.h b/containments/desktop/plugins/folder/mimetypesmodel.h --- a/containments/desktop/plugins/folder/mimetypesmodel.h +++ b/containments/desktop/plugins/folder/mimetypesmodel.h @@ -36,12 +36,12 @@ ~MimeTypesModel(); QHash roleNames() const override; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; - bool setData(const QModelIndex &index, const QVariant &value, int role) Q_DECL_OVERRIDE; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; + bool setData(const QModelIndex &index, const QVariant &value, int role) override; Q_INVOKABLE void checkAll(); - int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE { Q_UNUSED(parent) return m_mimeTypesList.size(); } + int rowCount(const QModelIndex &parent = QModelIndex()) const override { Q_UNUSED(parent) return m_mimeTypesList.size(); } QStringList checkedTypes() const; void setCheckedTypes(const QStringList &list); diff --git a/containments/desktop/plugins/folder/placesmodel.h b/containments/desktop/plugins/folder/placesmodel.h --- a/containments/desktop/plugins/folder/placesmodel.h +++ b/containments/desktop/plugins/folder/placesmodel.h @@ -44,7 +44,7 @@ void placesChanged() const; protected: - bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const Q_DECL_OVERRIDE; + bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override; private: KFilePlacesModel *m_sourceModel; diff --git a/containments/desktop/plugins/folder/positioner.h b/containments/desktop/plugins/folder/positioner.h --- a/containments/desktop/plugins/folder/positioner.h +++ b/containments/desktop/plugins/folder/positioner.h @@ -49,7 +49,7 @@ void setPerStripe(int perStripe); QStringList positions() const; - void setPositions(QStringList positions); + void setPositions(const QStringList &positions); Q_INVOKABLE int map(int row) const; @@ -66,13 +66,13 @@ QHash roleNames() const Q_DECL_OVERRIDE; - QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; + QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override; QModelIndex parent(const QModelIndex &index) const Q_DECL_OVERRIDE; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; - int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; - int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; + int rowCount(const QModelIndex &parent = QModelIndex()) const override; + int columnCount(const QModelIndex &parent = QModelIndex()) const override; Q_SIGNALS: void enabledChanged() const; diff --git a/containments/desktop/plugins/folder/positioner.cpp b/containments/desktop/plugins/folder/positioner.cpp --- a/containments/desktop/plugins/folder/positioner.cpp +++ b/containments/desktop/plugins/folder/positioner.cpp @@ -121,7 +121,7 @@ return m_positions; } -void Positioner::setPositions(QStringList positions) +void Positioner::setPositions(const QStringList &positions) { if (m_positions != positions) { m_positions = positions; diff --git a/containments/desktop/plugins/folder/previewpluginsmodel.h b/containments/desktop/plugins/folder/previewpluginsmodel.h --- a/containments/desktop/plugins/folder/previewpluginsmodel.h +++ b/containments/desktop/plugins/folder/previewpluginsmodel.h @@ -37,10 +37,10 @@ ~PreviewPluginsModel(); QHash roleNames() const override; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; - bool setData(const QModelIndex &index, const QVariant &value, int role) Q_DECL_OVERRIDE; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; + bool setData(const QModelIndex &index, const QVariant &value, int role) override; - int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE { Q_UNUSED(parent) return m_plugins.size(); } + int rowCount(const QModelIndex &parent = QModelIndex()) const override { Q_UNUSED(parent) return m_plugins.size(); } QStringList checkedPlugins() const; void setCheckedPlugins(const QStringList &list); diff --git a/containments/desktop/plugins/folder/previewpluginsmodel.cpp b/containments/desktop/plugins/folder/previewpluginsmodel.cpp --- a/containments/desktop/plugins/folder/previewpluginsmodel.cpp +++ b/containments/desktop/plugins/folder/previewpluginsmodel.cpp @@ -109,7 +109,7 @@ QStringList PreviewPluginsModel::checkedPlugins() const { QStringList list; - for (int i =0; i < m_checkedRows.size(); ++i) { + for (int i = 0; i < m_checkedRows.size(); ++i) { if (m_checkedRows.at(i)) { list.append(m_plugins.at(i)->desktopEntryName()); } diff --git a/containments/desktop/plugins/folder/rubberband.h b/containments/desktop/plugins/folder/rubberband.h --- a/containments/desktop/plugins/folder/rubberband.h +++ b/containments/desktop/plugins/folder/rubberband.h @@ -30,12 +30,12 @@ explicit RubberBand(QQuickItem *parent = nullptr); ~RubberBand(); - void paint(QPainter* painter) Q_DECL_OVERRIDE; + void paint(QPainter* painter) override; Q_INVOKABLE bool intersects(const QRectF &rect); protected: - void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE; + void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override; private: QRectF m_geometry; diff --git a/containments/desktop/plugins/folder/shortcut.h b/containments/desktop/plugins/folder/shortcut.h --- a/containments/desktop/plugins/folder/shortcut.h +++ b/containments/desktop/plugins/folder/shortcut.h @@ -49,7 +49,7 @@ void moveToTrash(); protected: - bool eventFilter(QObject *obj, QEvent *e) Q_DECL_OVERRIDE; + bool eventFilter(QObject *obj, QEvent *e) override; }; #endif // SHORTCUT_H diff --git a/containments/desktop/plugins/folder/viewpropertiesmenu.h b/containments/desktop/plugins/folder/viewpropertiesmenu.h --- a/containments/desktop/plugins/folder/viewpropertiesmenu.h +++ b/containments/desktop/plugins/folder/viewpropertiesmenu.h @@ -30,7 +30,7 @@ { Q_OBJECT - Q_PROPERTY(QObject* menu READ menu CONSTANT); + Q_PROPERTY(QObject* menu READ menu CONSTANT) Q_PROPERTY(bool showLayoutActions READ showLayoutActions WRITE setShowLayoutActions NOTIFY showLayoutActionsChanged) Q_PROPERTY(bool showLockAction READ showLockAction WRITE setShowLockAction NOTIFY showLockActionChanged) @@ -45,7 +45,7 @@ Q_PROPERTY(int iconSize READ iconSize WRITE setIconSize NOTIFY iconSizeChanged) public: - ViewPropertiesMenu(QObject *parent = 0); + explicit ViewPropertiesMenu(QObject *parent = nullptr); ~ViewPropertiesMenu(); QObject* menu() const; diff --git a/containments/desktop/plugins/folder/viewpropertiesmenu.cpp b/containments/desktop/plugins/folder/viewpropertiesmenu.cpp --- a/containments/desktop/plugins/folder/viewpropertiesmenu.cpp +++ b/containments/desktop/plugins/folder/viewpropertiesmenu.cpp @@ -92,7 +92,7 @@ action->setCheckable(true); action->setData(i); m_iconSize->addAction(action); - }; + } m_locked = m_menu->addAction(i18n("Locked"), this, SIGNAL(lockedChanged())); m_locked->setCheckable(true);