diff options
Diffstat (limited to 'src/views')
24 files changed, 160 insertions, 181 deletions
diff --git a/src/views/dolphinfileitemlistwidget.h b/src/views/dolphinfileitemlistwidget.h index af73ac937..a04bc6828 100644 --- a/src/views/dolphinfileitemlistwidget.h +++ b/src/views/dolphinfileitemlistwidget.h @@ -37,10 +37,10 @@ class DOLPHIN_EXPORT DolphinFileItemListWidget : public KFileItemListWidget public: DolphinFileItemListWidget(KItemListWidgetInformant* informant, QGraphicsItem* parent); - virtual ~DolphinFileItemListWidget(); + ~DolphinFileItemListWidget() override; protected: - virtual void refreshCache() Q_DECL_OVERRIDE; + void refreshCache() override; private: static QPixmap overlayForState(KVersionControlPlugin::ItemVersion version, int size); diff --git a/src/views/dolphinitemlistview.cpp b/src/views/dolphinitemlistview.cpp index a3740cb26..a1472c661 100644 --- a/src/views/dolphinitemlistview.cpp +++ b/src/views/dolphinitemlistview.cpp @@ -30,6 +30,7 @@ #include <kitemviews/kitemlistcontroller.h> #include <kitemviews/kitemliststyleoption.h> +#include <KIO/PreviewJob> #include <views/viewmodecontroller.h> @@ -94,11 +95,7 @@ void DolphinItemListView::readSettings() updateGridSize(); const KConfigGroup globalConfig(KSharedConfig::openConfig(), "PreviewSettings"); - const QStringList plugins = globalConfig.readEntry("Plugins", QStringList() - << QStringLiteral("directorythumbnail") - << QStringLiteral("imagethumbnail") - << QStringLiteral("jpegthumbnail")); - setEnabledPlugins(plugins); + setEnabledPlugins(globalConfig.readEntry("Plugins", KIO::PreviewJob::defaultPlugins())); endTransaction(); } diff --git a/src/views/dolphinitemlistview.h b/src/views/dolphinitemlistview.h index 7eec6f17a..ff14fbe7c 100644 --- a/src/views/dolphinitemlistview.h +++ b/src/views/dolphinitemlistview.h @@ -39,8 +39,8 @@ class DOLPHIN_EXPORT DolphinItemListView : public KFileItemListView Q_OBJECT public: - explicit DolphinItemListView(QGraphicsWidget* parent = 0); - virtual ~DolphinItemListView(); + explicit DolphinItemListView(QGraphicsWidget* parent = nullptr); + ~DolphinItemListView() override; void setZoomLevel(int level); int zoomLevel() const; @@ -49,14 +49,14 @@ public: void writeSettings(); protected: - virtual KItemListWidgetCreatorBase* defaultWidgetCreator() const Q_DECL_OVERRIDE; - virtual bool itemLayoutSupportsItemExpanding(ItemLayout layout) const Q_DECL_OVERRIDE; - virtual void onItemLayoutChanged(ItemLayout current, ItemLayout previous) Q_DECL_OVERRIDE; - virtual void onPreviewsShownChanged(bool shown) Q_DECL_OVERRIDE; - virtual void onVisibleRolesChanged(const QList<QByteArray>& current, - const QList<QByteArray>& previous) Q_DECL_OVERRIDE; + KItemListWidgetCreatorBase* defaultWidgetCreator() const override; + bool itemLayoutSupportsItemExpanding(ItemLayout layout) const override; + void onItemLayoutChanged(ItemLayout current, ItemLayout previous) override; + void onPreviewsShownChanged(bool shown) override; + void onVisibleRolesChanged(const QList<QByteArray>& current, + const QList<QByteArray>& previous) override; - virtual void updateFont() Q_DECL_OVERRIDE; + void updateFont() override; private: void updateGridSize(); diff --git a/src/views/dolphinnewfilemenuobserver.cpp b/src/views/dolphinnewfilemenuobserver.cpp index 275e1c4fb..6379adb31 100644 --- a/src/views/dolphinnewfilemenuobserver.cpp +++ b/src/views/dolphinnewfilemenuobserver.cpp @@ -54,7 +54,7 @@ void DolphinNewFileMenuObserver::detach(const DolphinNewFileMenu* menu) } DolphinNewFileMenuObserver::DolphinNewFileMenuObserver() : - QObject(0) + QObject(nullptr) { } diff --git a/src/views/dolphinnewfilemenuobserver.h b/src/views/dolphinnewfilemenuobserver.h index df4621f17..2386bce1e 100644 --- a/src/views/dolphinnewfilemenuobserver.h +++ b/src/views/dolphinnewfilemenuobserver.h @@ -48,7 +48,7 @@ signals: private: DolphinNewFileMenuObserver(); - virtual ~DolphinNewFileMenuObserver(); + ~DolphinNewFileMenuObserver() override; friend class DolphinNewFileMenuObserverSingleton; }; diff --git a/src/views/dolphinremoteencoding.h b/src/views/dolphinremoteencoding.h index 28ff52cb3..ca1cea2c7 100644 --- a/src/views/dolphinremoteencoding.h +++ b/src/views/dolphinremoteencoding.h @@ -40,7 +40,7 @@ class DOLPHIN_EXPORT DolphinRemoteEncoding: public QObject Q_OBJECT public: DolphinRemoteEncoding(QObject* parent, DolphinViewActionHandler* actionHandler); - ~DolphinRemoteEncoding(); + ~DolphinRemoteEncoding() override; public Q_SLOTS: void slotAboutToOpenUrl(); diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index cd802eec1..e40e49d6e 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -87,19 +87,19 @@ DolphinView::DolphinView(const QUrl& url, QWidget* parent) : m_viewPropertiesContext(), m_mode(DolphinView::IconsView), m_visibleRoles(), - m_topLayout(0), - m_model(0), - m_view(0), - m_container(0), - m_toolTipManager(0), - m_selectionChangedTimer(0), + m_topLayout(nullptr), + m_model(nullptr), + m_view(nullptr), + m_container(nullptr), + m_toolTipManager(nullptr), + m_selectionChangedTimer(nullptr), m_currentItemUrl(), m_scrollToCurrentItem(false), m_restoredContentsPosition(), m_selectedUrls(), m_clearSelectionBeforeSelectingNewItems(false), m_markFirstNewlySelectedItemAsCurrent(false), - m_versionControlObserver(0), + m_versionControlObserver(nullptr), m_twoClicksRenamingTimer(nullptr) { m_topLayout = new QVBoxLayout(this); @@ -912,7 +912,7 @@ void DolphinView::slotHeaderContextMenuRequested(const QPointF& pos) #endif QString groupName; - QMenu* groupMenu = 0; + QMenu* groupMenu = nullptr; // Add all roles to the menu that can be shown or hidden by the user const QList<KFileItemModel::RoleInfo> rolesInfo = KFileItemModel::rolesInformation(); @@ -923,7 +923,7 @@ void DolphinView::slotHeaderContextMenuRequested(const QPointF& pos) } const QString text = m_model->roleDescription(info.role); - QAction* action = 0; + QAction* action = nullptr; if (info.group.isEmpty()) { action = menu->addAction(text); } else { @@ -1094,11 +1094,11 @@ void DolphinView::dropUrls(const QUrl &destUrl, QDropEvent *dropEvent, QWidget * void DolphinView::slotModelChanged(KItemModelBase* current, KItemModelBase* previous) { - if (previous != 0) { + if (previous != nullptr) { Q_ASSERT(qobject_cast<KFileItemModel*>(previous)); KFileItemModel* fileItemModel = static_cast<KFileItemModel*>(previous); disconnect(fileItemModel, &KFileItemModel::directoryLoadingCompleted, this, &DolphinView::slotDirectoryLoadingCompleted); - m_versionControlObserver->setModel(0); + m_versionControlObserver->setModel(nullptr); } if (current) { @@ -1356,17 +1356,21 @@ void DolphinView::updateViewState() { if (m_currentItemUrl != QUrl()) { KItemListSelectionManager* selectionManager = m_container->controller()->selectionManager(); - const int currentIndex = m_model->index(m_currentItemUrl); - if (currentIndex != -1) { - selectionManager->setCurrentItem(currentIndex); - // scroll to current item and reset the state - if (m_scrollToCurrentItem) { - m_view->scrollToItem(currentIndex); - m_scrollToCurrentItem = false; + // if there is a selection already, leave it that way + if (!selectionManager->hasSelection()) { + const int currentIndex = m_model->index(m_currentItemUrl); + if (currentIndex != -1) { + selectionManager->setCurrentItem(currentIndex); + + // scroll to current item and reset the state + if (m_scrollToCurrentItem) { + m_view->scrollToItem(currentIndex); + m_scrollToCurrentItem = false; + } + } else { + selectionManager->setCurrentItem(0); } - } else { - selectionManager->setCurrentItem(0); } m_currentItemUrl = QUrl(); @@ -1384,26 +1388,29 @@ void DolphinView::updateViewState() if (!m_selectedUrls.isEmpty()) { KItemListSelectionManager* selectionManager = m_container->controller()->selectionManager(); - if (m_clearSelectionBeforeSelectingNewItems) { - selectionManager->clearSelection(); - m_clearSelectionBeforeSelectingNewItems = false; - } + // if there is a selection already, leave it that way + if (!selectionManager->hasSelection()) { + if (m_clearSelectionBeforeSelectingNewItems) { + selectionManager->clearSelection(); + m_clearSelectionBeforeSelectingNewItems = false; + } - KItemSet selectedItems = selectionManager->selectedItems(); + KItemSet selectedItems = selectionManager->selectedItems(); - QList<QUrl>::iterator it = m_selectedUrls.begin(); - while (it != m_selectedUrls.end()) { - const int index = m_model->index(*it); - if (index >= 0) { - selectedItems.insert(index); - it = m_selectedUrls.erase(it); - } else { - ++it; + QList<QUrl>::iterator it = m_selectedUrls.begin(); + while (it != m_selectedUrls.end()) { + const int index = m_model->index(*it); + if (index >= 0) { + selectedItems.insert(index); + it = m_selectedUrls.erase(it); + } else { + ++it; + } } - } - selectionManager->beginAnchoredSelection(selectionManager->currentItem()); - selectionManager->setSelectedItems(selectedItems); + selectionManager->beginAnchoredSelection(selectionManager->currentItem()); + selectionManager->setSelectedItems(selectedItems); + } } } diff --git a/src/views/dolphinview.h b/src/views/dolphinview.h index 2df1cf9e4..61f6af1e2 100644 --- a/src/views/dolphinview.h +++ b/src/views/dolphinview.h @@ -93,7 +93,7 @@ public: */ DolphinView(const QUrl& url, QWidget* parent); - virtual ~DolphinView(); + ~DolphinView() override; /** * Returns the current active URL, where all actions are applied. @@ -370,7 +370,7 @@ public slots: void stopLoading(); /** Activates the view if the item list container gets focus. */ - virtual bool eventFilter(QObject* watched, QEvent* event) Q_DECL_OVERRIDE; + bool eventFilter(QObject* watched, QEvent* event) override; signals: /** @@ -552,10 +552,10 @@ signals: protected: /** Changes the zoom level if Control is pressed during a wheel event. */ - virtual void wheelEvent(QWheelEvent* event) Q_DECL_OVERRIDE; + void wheelEvent(QWheelEvent* event) override; - virtual void hideEvent(QHideEvent* event) Q_DECL_OVERRIDE; - virtual bool event(QEvent* event) Q_DECL_OVERRIDE; + void hideEvent(QHideEvent* event) override; + bool event(QEvent* event) override; private slots: /** diff --git a/src/views/dolphinviewactionhandler.cpp b/src/views/dolphinviewactionhandler.cpp index 10aae11ce..9debd5173 100644 --- a/src/views/dolphinviewactionhandler.cpp +++ b/src/views/dolphinviewactionhandler.cpp @@ -49,7 +49,7 @@ DolphinViewActionHandler::DolphinViewActionHandler(KActionCollection* collection, QObject* parent) : QObject(parent), m_actionCollection(collection), - m_currentView(0), + m_currentView(nullptr), m_sortByActions(), m_visibleRoles() { @@ -62,7 +62,7 @@ void DolphinViewActionHandler::setCurrentView(DolphinView* view) Q_ASSERT(view); if (m_currentView) { - disconnect(m_currentView, 0, this, 0); + disconnect(m_currentView, nullptr, this, nullptr); } m_currentView = view; @@ -233,8 +233,8 @@ QActionGroup* DolphinViewActionHandler::createFileItemRolesActionGroup(const QSt } QString groupName; - KActionMenu* groupMenu = 0; - QActionGroup* groupMenuGroup = 0; + KActionMenu* groupMenu = nullptr; + QActionGroup* groupMenuGroup = nullptr; bool indexingEnabled = false; #ifdef HAVE_BALOO @@ -249,7 +249,7 @@ QActionGroup* DolphinViewActionHandler::createFileItemRolesActionGroup(const QSt continue; } - KToggleAction* action = 0; + KToggleAction* action = nullptr; const QString name = groupPrefix + info.role; if (info.group.isEmpty()) { action = m_actionCollection->add<KToggleAction>(name); @@ -590,7 +590,7 @@ void DolphinViewActionHandler::slotAdjustViewProperties() void DolphinViewActionHandler::slotProperties() { - KPropertiesDialog* dialog = 0; + KPropertiesDialog* dialog = nullptr; const KFileItemList list = m_currentView->selectedItems(); if (list.isEmpty()) { const QUrl url = m_currentView->url(); diff --git a/src/views/draganddrophelper.cpp b/src/views/draganddrophelper.cpp index 831a9d43e..4d76992ca 100644 --- a/src/views/draganddrophelper.cpp +++ b/src/views/draganddrophelper.cpp @@ -29,12 +29,21 @@ #include <KIO/DropJob> #include <KJobWidgets> +QHash<QUrl, bool> DragAndDropHelper::m_urlListMatchesUrlCache; bool DragAndDropHelper::urlListMatchesUrl(const QList<QUrl>& urls, const QUrl& destUrl) { - return std::find_if(urls.constBegin(), urls.constEnd(), [destUrl](const QUrl& url) { - return url.matches(destUrl, QUrl::StripTrailingSlash); - }) != urls.constEnd(); + auto iteratorResult = m_urlListMatchesUrlCache.constFind(destUrl); + if (iteratorResult != m_urlListMatchesUrlCache.constEnd()) { + return *iteratorResult; + } + + const bool destUrlMatches = + std::find_if(urls.constBegin(), urls.constEnd(), [destUrl](const QUrl& url) { + return url.matches(destUrl, QUrl::StripTrailingSlash); + }) != urls.constEnd(); + + return *m_urlListMatchesUrlCache.insert(destUrl, destUrlMatches); } KIO::DropJob* DragAndDropHelper::dropUrls(const QUrl& destUrl, QDropEvent* event, QWidget* window) @@ -60,6 +69,11 @@ KIO::DropJob* DragAndDropHelper::dropUrls(const QUrl& destUrl, QDropEvent* event return job; } - return 0; + return nullptr; +} + +void DragAndDropHelper::clearUrlListMatchesUrlCache() +{ + DragAndDropHelper::m_urlListMatchesUrlCache.clear(); } diff --git a/src/views/draganddrophelper.h b/src/views/draganddrophelper.h index e47f83ca8..0c7eadc6c 100644 --- a/src/views/draganddrophelper.h +++ b/src/views/draganddrophelper.h @@ -54,6 +54,16 @@ public: * @return True if destUrl is contained in the urls parameter. */ static bool urlListMatchesUrl(const QList<QUrl>& urls, const QUrl& destUrl); + + /** + * clear the internal cache. + */ + static void clearUrlListMatchesUrlCache(); +private: + /** + * Stores the results of the expensive checks made in urlListMatchesUrl. + */ + static QHash<QUrl, bool> m_urlListMatchesUrlCache; }; #endif diff --git a/src/views/renamedialog.cpp b/src/views/renamedialog.cpp index 6309bfbdf..2e1fa8634 100644 --- a/src/views/renamedialog.cpp +++ b/src/views/renamedialog.cpp @@ -24,6 +24,7 @@ #include <KIO/CopyJob> #include <KIO/FileUndoManager> #include <KJobUiDelegate> +#include <KIO/BatchRenameJob> #include <QHBoxLayout> #include <QLabel> @@ -39,10 +40,10 @@ RenameDialog::RenameDialog(QWidget *parent, const KFileItemList& items) : QDialog(parent), m_renameOneItem(false), m_newName(), - m_lineEdit(0), + m_lineEdit(nullptr), m_items(items), m_allExtensionsDifferent(true), - m_spinBox(0) + m_spinBox(nullptr) { const QSize minSize = minimumSize(); setMinimumSize(QSize(320, minSize.height())); @@ -72,7 +73,7 @@ RenameDialog::RenameDialog(QWidget *parent, const KFileItemList& items) : QVBoxLayout* topLayout = new QVBoxLayout(page); - QLabel* editLabel = 0; + QLabel* editLabel = nullptr; if (m_renameOneItem) { m_newName = items.first().name(); editLabel = new QLabel(xi18nc("@label:textbox", "Rename the item <filename>%1</filename> to:", m_newName), @@ -148,38 +149,32 @@ RenameDialog::~RenameDialog() { } -void RenameDialog::renameItem(const KFileItem &item, const QString& newName) +void RenameDialog::slotAccepted() { - const QUrl oldUrl = item.url(); - QUrl newUrl = oldUrl.adjusted(QUrl::RemoveFilename); - newUrl.setPath(newUrl.path() + KIO::encodeFileName(newName)); - QWidget* widget = parentWidget(); if (!widget) { widget = this; } - KIO::Job * job = KIO::moveAs(oldUrl, newUrl, KIO::HideProgressInfo); + KIO::FileUndoManager::CommandType cmdType; + if (m_renameOneItem) { + Q_ASSERT(m_items.count() == 1); + cmdType = KIO::FileUndoManager::Rename; + } else { + cmdType = KIO::FileUndoManager::BatchRename; + } + + const QList<QUrl> srcList = m_items.urlList(); + KIO::BatchRenameJob* job = KIO::batchRename(srcList, m_lineEdit->text(), m_spinBox->value(), QLatin1Char('#')); KJobWidgets::setWindow(job, widget); - KIO::FileUndoManager::self()->recordJob(KIO::FileUndoManager::Rename, {oldUrl}, newUrl, job); + const QUrl parentUrl = srcList.first().adjusted(QUrl::RemoveFilename | QUrl::StripTrailingSlash); + KIO::FileUndoManager::self()->recordJob(cmdType, srcList, parentUrl, job); - if (!job->error()) { - m_renamedItems << newUrl; - } + connect(job, &KIO::BatchRenameJob::fileRenamed, this, &RenameDialog::slotFileRenamed); + connect(job, &KIO::BatchRenameJob::result, this, &RenameDialog::slotResult); job->uiDelegate()->setAutoErrorHandlingEnabled(true); -} -void RenameDialog::slotAccepted() -{ - m_newName = m_lineEdit->text(); - - if (m_renameOneItem) { - Q_ASSERT(m_items.count() == 1); - renameItem(m_items.first(), m_newName); - } else { - renameItems(); - } accept(); } @@ -201,55 +196,22 @@ void RenameDialog::slotTextChanged(const QString& newName) m_okButton->setEnabled(enable); } -void RenameDialog::showEvent(QShowEvent* event) +void RenameDialog::slotFileRenamed(const QUrl &oldUrl, const QUrl &newUrl) { - m_lineEdit->setFocus(); - - QDialog::showEvent(event); + Q_UNUSED(oldUrl) + m_renamedItems << newUrl; } -void RenameDialog::renameItems() +void RenameDialog::slotResult(KJob *job) { - // Iterate through all items and rename them... - int index = m_spinBox->value(); - foreach (const KFileItem& item, m_items) { - QString newName = indexedName(m_newName, index, QLatin1Char('#')); - ++index; - - const QUrl oldUrl = item.url(); - QMimeDatabase db; - const QString extension = db.suffixForFileName(oldUrl.path().toLower()); - if (!extension.isEmpty()) { - newName.append(QLatin1Char('.')); - newName.append(extension); - } - - if (oldUrl.fileName() != newName) { - renameItem(item, newName); - } - } - - if (!m_items.empty()) { + if (!job->error()) { emit renamingFinished(m_renamedItems); } } -QString RenameDialog::indexedName(const QString& name, int index, const QChar& indexPlaceHolder) +void RenameDialog::showEvent(QShowEvent* event) { - QString newName = name; - - QString indexString = QString::number(index); - - // Insert leading zeros if necessary - const int minIndexLength = name.count(indexPlaceHolder); - while (indexString.length() < minIndexLength) { - indexString.prepend(QLatin1Char('0')); - } - - // Replace the index placeholders by the indexString - const int placeHolderStart = newName.indexOf(indexPlaceHolder); - newName.replace(placeHolderStart, minIndexLength, indexString); + m_lineEdit->setFocus(); - return newName; + QDialog::showEvent(event); } - diff --git a/src/views/renamedialog.h b/src/views/renamedialog.h index 7ead0ca9f..8da770895 100644 --- a/src/views/renamedialog.h +++ b/src/views/renamedialog.h @@ -29,7 +29,7 @@ class QLineEdit; class QSpinBox; class QPushButton; - +class KJob; /** * @brief Dialog for renaming a variable number of files. */ @@ -39,7 +39,7 @@ class DOLPHIN_EXPORT RenameDialog : public QDialog public: explicit RenameDialog(QWidget* parent, const KFileItemList& items); - virtual ~RenameDialog(); + ~RenameDialog() override; signals: void renamingFinished(const QList<QUrl>& urls); @@ -47,24 +47,13 @@ signals: private slots: void slotAccepted(); void slotTextChanged(const QString& newName); + void slotFileRenamed(const QUrl& oldUrl, const QUrl& newUrl); + void slotResult(KJob* job); protected: void showEvent(QShowEvent* event) override; private: - void renameItems(); - void renameItem(const KFileItem &item, const QString& newName); - - /** - * @return Returns the string \p name, where the characters represented by - * \p indexPlaceHolder get replaced by the index \p index. - * E. g. Calling indexedName("Test #.jpg", 12, '#') returns "Test 12.jpg". - * A connected sequence of placeholders results in leading zeros: - * indexedName("Test ####.jpg", 12, '#') returns "Test 0012.jpg". - */ - static QString indexedName(const QString& name, int index, const QChar& indexPlaceHolder); - -private: bool m_renameOneItem; QList<QUrl> m_renamedItems; QString m_newName; diff --git a/src/views/tooltips/dolphinfilemetadatawidget.cpp b/src/views/tooltips/dolphinfilemetadatawidget.cpp index 52eeb3b71..cabfc0617 100644 --- a/src/views/tooltips/dolphinfilemetadatawidget.cpp +++ b/src/views/tooltips/dolphinfilemetadatawidget.cpp @@ -41,9 +41,9 @@ DolphinFileMetaDataWidget::DolphinFileMetaDataWidget(QWidget* parent) : QWidget(parent), - m_preview(0), - m_name(0), - m_fileMetaDataWidget(0) + m_preview(nullptr), + m_name(nullptr), + m_fileMetaDataWidget(nullptr) { // Create widget for file preview m_preview = new QLabel(this); diff --git a/src/views/tooltips/dolphinfilemetadatawidget.h b/src/views/tooltips/dolphinfilemetadatawidget.h index c5c228766..e7459b197 100644 --- a/src/views/tooltips/dolphinfilemetadatawidget.h +++ b/src/views/tooltips/dolphinfilemetadatawidget.h @@ -23,7 +23,7 @@ #define DOLPHINFILEMETADATAWIDGET_H #include <QWidget> -#include "config-baloo.h" +#include <config-baloo.h> class KFileItemList; class QLabel; @@ -45,8 +45,8 @@ class DolphinFileMetaDataWidget : public QWidget Q_OBJECT public: - DolphinFileMetaDataWidget(QWidget* parent = 0); - virtual ~DolphinFileMetaDataWidget(); + explicit DolphinFileMetaDataWidget(QWidget* parent = nullptr); + ~DolphinFileMetaDataWidget() override; void setPreview(const QPixmap& pixmap); QPixmap preview() const; diff --git a/src/views/tooltips/tooltipmanager.cpp b/src/views/tooltips/tooltipmanager.cpp index 9375172eb..3d3598ff5 100644 --- a/src/views/tooltips/tooltipmanager.cpp +++ b/src/views/tooltips/tooltipmanager.cpp @@ -35,10 +35,10 @@ ToolTipManager::ToolTipManager(QWidget* parent) : QObject(parent), - m_showToolTipTimer(0), - m_contentRetrievalTimer(0), - m_transientParent(0), - m_fileMetaDataWidget(0), + m_showToolTipTimer(nullptr), + m_contentRetrievalTimer(nullptr), + m_transientParent(nullptr), + m_fileMetaDataWidget(nullptr), m_toolTipRequested(false), m_metaDataRequested(false), m_appliedWaitCursor(false), diff --git a/src/views/tooltips/tooltipmanager.h b/src/views/tooltips/tooltipmanager.h index 9f1f104f1..746d6cb67 100644 --- a/src/views/tooltips/tooltipmanager.h +++ b/src/views/tooltips/tooltipmanager.h @@ -43,7 +43,7 @@ class ToolTipManager : public QObject public: explicit ToolTipManager(QWidget* parent); - virtual ~ToolTipManager(); + ~ToolTipManager() override; /** * Triggers the showing of the tooltip for the item \p item diff --git a/src/views/versioncontrol/kversioncontrolplugin.h b/src/views/versioncontrol/kversioncontrolplugin.h index 1696f975c..a3be381f3 100644 --- a/src/views/versioncontrol/kversioncontrolplugin.h +++ b/src/views/versioncontrol/kversioncontrolplugin.h @@ -144,8 +144,8 @@ public: MissingVersion }; - KVersionControlPlugin(QObject* parent = 0); - virtual ~KVersionControlPlugin(); + KVersionControlPlugin(QObject* parent = nullptr); + ~KVersionControlPlugin() override; /** * Returns the name of the file which stores diff --git a/src/views/versioncontrol/updateitemstatesthread.cpp b/src/views/versioncontrol/updateitemstatesthread.cpp index e4413fabf..574402dcd 100644 --- a/src/views/versioncontrol/updateitemstatesthread.cpp +++ b/src/views/versioncontrol/updateitemstatesthread.cpp @@ -25,7 +25,7 @@ UpdateItemStatesThread::UpdateItemStatesThread(KVersionControlPlugin* plugin, const QMap<QString, QVector<VersionControlObserver::ItemState> >& itemStates) : QThread(), - m_globalPluginMutex(0), + m_globalPluginMutex(nullptr), m_plugin(plugin), m_itemStates(itemStates) { diff --git a/src/views/versioncontrol/updateitemstatesthread.h b/src/views/versioncontrol/updateitemstatesthread.h index 3dc03fc75..d33a64cc7 100644 --- a/src/views/versioncontrol/updateitemstatesthread.h +++ b/src/views/versioncontrol/updateitemstatesthread.h @@ -46,12 +46,12 @@ public: */ UpdateItemStatesThread(KVersionControlPlugin* plugin, const QMap<QString, QVector<VersionControlObserver::ItemState> >& itemStates); - virtual ~UpdateItemStatesThread(); + ~UpdateItemStatesThread() override; QMap<QString, QVector<VersionControlObserver::ItemState> > itemStates() const; protected: - virtual void run() Q_DECL_OVERRIDE; + void run() override; private: QMutex* m_globalPluginMutex; // Protects the m_plugin globally diff --git a/src/views/versioncontrol/versioncontrolobserver.cpp b/src/views/versioncontrol/versioncontrolobserver.cpp index c79440882..44dffac45 100644 --- a/src/views/versioncontrol/versioncontrolobserver.cpp +++ b/src/views/versioncontrol/versioncontrolobserver.cpp @@ -37,10 +37,10 @@ VersionControlObserver::VersionControlObserver(QObject* parent) : m_pendingItemStatesUpdate(false), m_versionedDirectory(false), m_silentUpdate(false), - m_model(0), - m_dirVerificationTimer(0), - m_plugin(0), - m_updateItemStatesThread(0) + m_model(nullptr), + m_dirVerificationTimer(nullptr), + m_plugin(nullptr), + m_updateItemStatesThread(nullptr) { // The verification timer specifies the timeout until the shown directory // is checked whether it is versioned. Per default it is assumed that users @@ -58,7 +58,7 @@ VersionControlObserver::~VersionControlObserver() { if (m_plugin) { m_plugin->disconnect(this); - m_plugin = 0; + m_plugin = nullptr; } } @@ -163,7 +163,7 @@ void VersionControlObserver::verifyDirectory() void VersionControlObserver::slotThreadFinished() { UpdateItemStatesThread* thread = m_updateItemStatesThread; - m_updateItemStatesThread = 0; // The thread deletes itself automatically (see updateItemStates()) + m_updateItemStatesThread = nullptr; // The thread deletes itself automatically (see updateItemStates()) if (!m_plugin || !thread) { return; @@ -266,7 +266,7 @@ KVersionControlPlugin* VersionControlObserver::searchPlugin(const QUrl& director if (!pluginsAvailable) { // A searching for plugins has already been done, but no // plugins are installed - return 0; + return nullptr; } if (plugins.isEmpty()) { @@ -285,13 +285,13 @@ KVersionControlPlugin* VersionControlObserver::searchPlugin(const QUrl& director } if (plugins.isEmpty()) { pluginsAvailable = false; - return 0; + return nullptr; } } // We use the number of upUrl() calls to find the best matching plugin // for the given directory. The smaller value, the better it is (0 is best). - KVersionControlPlugin* bestPlugin = 0; + KVersionControlPlugin* bestPlugin = nullptr; int bestScore = INT_MAX; // Verify whether the current directory contains revision information diff --git a/src/views/versioncontrol/versioncontrolobserver.h b/src/views/versioncontrol/versioncontrolobserver.h index c817c2187..2c2fe2940 100644 --- a/src/views/versioncontrol/versioncontrolobserver.h +++ b/src/views/versioncontrol/versioncontrolobserver.h @@ -50,8 +50,8 @@ class DOLPHIN_EXPORT VersionControlObserver : public QObject Q_OBJECT public: - explicit VersionControlObserver(QObject* parent = 0); - virtual ~VersionControlObserver(); + explicit VersionControlObserver(QObject* parent = nullptr); + ~VersionControlObserver() override; void setModel(KFileItemModel* model); KFileItemModel* model() const; diff --git a/src/views/viewmodecontroller.h b/src/views/viewmodecontroller.h index 4b1ff2083..6fa43c38b 100644 --- a/src/views/viewmodecontroller.h +++ b/src/views/viewmodecontroller.h @@ -38,8 +38,8 @@ class DOLPHIN_EXPORT ViewModeController : public QObject Q_OBJECT public: - explicit ViewModeController(QObject* parent = 0); - virtual ~ViewModeController(); + explicit ViewModeController(QObject* parent = nullptr); + ~ViewModeController() override; /** * @return URL that is shown by the view mode implementation. diff --git a/src/views/viewproperties.cpp b/src/views/viewproperties.cpp index ca52be890..e2be18819 100644 --- a/src/views/viewproperties.cpp +++ b/src/views/viewproperties.cpp @@ -50,7 +50,7 @@ namespace { ViewProperties::ViewProperties(const QUrl& url) : m_changedProps(false), m_autoSave(true), - m_node(0) + m_node(nullptr) { GeneralSettings* settings = GeneralSettings::self(); const bool useGlobalViewProps = settings->globalViewProps() || url.isEmpty(); @@ -140,7 +140,7 @@ ViewProperties::~ViewProperties() } delete m_node; - m_node = 0; + m_node = nullptr; } void ViewProperties::setViewMode(DolphinView::Mode mode) |
