diff --git a/containments/desktop/plugins/folder/foldermodel.h b/containments/desktop/plugins/folder/foldermodel.h index f29faf70f..86b776b9e 100644 --- a/containments/desktop/plugins/folder/foldermodel.h +++ b/containments/desktop/plugins/folder/foldermodel.h @@ -1,326 +1,326 @@ /*************************************************************************** * Copyright (C) 2008 Fredrik Höglund * * Copyright (C) 2011 Marco Martin * * Copyright (C) 2014 by Eike Hein * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program 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 General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * ***************************************************************************/ #ifndef FOLDERMODEL_H #define FOLDERMODEL_H #include #include #include #include #include #include #include #include #include #include #include #include #include "folderplugin_private_export.h" class QDrag; class QItemSelectionModel; class QQuickItem; class KFileCopyToMenu; class KActionCollection; class KDirModel; class KDirWatch; class KFileItem; class KFileItemActions; class KJob; class KNewFileMenu; namespace KIO { class DropJob; } class DirLister : public KDirLister { Q_OBJECT public: explicit DirLister(QObject *parent = nullptr); ~DirLister(); Q_SIGNALS: void error(const QString &string); protected: - void handleError(KIO::Job *job) Q_DECL_OVERRIDE; + void handleError(KIO::Job *job) override; }; class FOLDERPLUGIN_TESTS_EXPORT FolderModel : public QSortFilterProxyModel { Q_OBJECT Q_PROPERTY(QString url READ url WRITE setUrl NOTIFY urlChanged) Q_PROPERTY(QString iconName READ iconName NOTIFY iconNameChanged) Q_PROPERTY(QUrl resolvedUrl READ resolvedUrl NOTIFY resolvedUrlChanged) Q_PROPERTY(Status status READ status NOTIFY statusChanged) Q_PROPERTY(QString errorString READ errorString NOTIFY errorStringChanged) Q_PROPERTY(bool dragging READ dragging NOTIFY draggingChanged) Q_PROPERTY(bool usedByContainment READ usedByContainment WRITE setUsedByContainment NOTIFY usedByContainmentChanged) Q_PROPERTY(bool locked READ locked WRITE setLocked NOTIFY lockedChanged) Q_PROPERTY(int sortMode READ sortMode WRITE setSortMode NOTIFY sortModeChanged) Q_PROPERTY(bool sortDesc READ sortDesc WRITE setSortDesc NOTIFY sortDescChanged) Q_PROPERTY(bool sortDirsFirst READ sortDirsFirst WRITE setSortDirsFirst NOTIFY sortDirsFirstChanged) Q_PROPERTY(bool parseDesktopFiles READ parseDesktopFiles WRITE setParseDesktopFiles NOTIFY parseDesktopFilesChanged) Q_PROPERTY(QObject* viewAdapter READ viewAdapter WRITE setViewAdapter NOTIFY viewAdapterChanged) Q_PROPERTY(bool previews READ previews WRITE setPreviews NOTIFY previewsChanged) Q_PROPERTY(QStringList previewPlugins READ previewPlugins WRITE setPreviewPlugins NOTIFY previewPluginsChanged) Q_PROPERTY(int filterMode READ filterMode WRITE setFilterMode NOTIFY filterModeChanged) Q_PROPERTY(QString filterPattern READ filterPattern WRITE setFilterPattern NOTIFY filterPatternChanged) Q_PROPERTY(QStringList filterMimeTypes READ filterMimeTypes WRITE setFilterMimeTypes NOTIFY filterMimeTypesChanged) Q_PROPERTY(QObject* newMenu READ newMenu CONSTANT) public: enum DataRole { BlankRole = Qt::UserRole + 1, OverlaysRole, SelectedRole, IsDirRole, IsLinkRole, IsHiddenRole, UrlRole, LinkDestinationUrl, SizeRole, TypeRole, FileNameRole }; enum FilterMode { NoFilter = 0, FilterShowMatches, FilterHideMatches }; enum Status { None, Ready, Listing, Canceled }; Q_ENUM(Status) explicit FolderModel(QObject *parent = nullptr); ~FolderModel(); QHash roleNames() const override; static QHash staticRoleNames(); QString url() const; void setUrl(const QString &url); QString iconName() const; QUrl resolvedUrl() const; Q_INVOKABLE QUrl resolve(const QString& url); Status status() const; QString errorString() const; bool dragging() const; bool usedByContainment() const; void setUsedByContainment(bool used); bool locked() const; void setLocked(bool locked); int sortMode() const; void setSortMode(int mode); bool sortDesc() const; void setSortDesc(bool desc); bool sortDirsFirst() const; void setSortDirsFirst(bool enable); bool parseDesktopFiles() const; void setParseDesktopFiles(bool enable); QObject* viewAdapter() const; void setViewAdapter(QObject *adapter); bool previews() const; void setPreviews(bool previews); QStringList previewPlugins() const; void setPreviewPlugins(const QStringList &previewPlugins); int filterMode() const; void setFilterMode(int filterMode); QString filterPattern() const; void setFilterPattern(const QString &pattern); QStringList filterMimeTypes() const; void setFilterMimeTypes(const QStringList &mimeList); KFileItem rootItem() const; Q_INVOKABLE void up(); Q_INVOKABLE void cd(int row); Q_INVOKABLE void run(int row); Q_INVOKABLE void runSelected(); Q_INVOKABLE void rename(int row, const QString &name); Q_INVOKABLE int fileExtensionBoundary(int row); Q_INVOKABLE bool hasSelection() const; Q_INVOKABLE bool isSelected(int row); Q_INVOKABLE void setSelected(int row); Q_INVOKABLE void toggleSelected(int row); Q_INVOKABLE void setRangeSelected(int anchor, int to); Q_INVOKABLE void updateSelection(const QVariantList &rows, bool toggle); Q_INVOKABLE void clearSelection(); Q_INVOKABLE void pinSelection(); Q_INVOKABLE void unpinSelection(); Q_INVOKABLE void addItemDragImage(int row, int x, int y, int width, int height, const QVariant &image); Q_INVOKABLE void clearDragImages(); Q_INVOKABLE void setDragHotSpotScrollOffset(int x, int y); // FIXME TODO: Propify. Q_INVOKABLE QPoint dragCursorOffset(int row); Q_INVOKABLE void dragSelected(int x, int y); Q_INVOKABLE void drop(QQuickItem *target, QObject *dropEvent, int row); Q_INVOKABLE void dropCwd(QObject *dropEvent); Q_INVOKABLE bool isBlank(int row) const; Q_INVOKABLE QAction* action(const QString& name) const; QObject* newMenu() const; Q_INVOKABLE void updateActions(); Q_INVOKABLE void openContextMenu(QQuickItem *visualParent = nullptr); Q_INVOKABLE void linkHere(const QUrl &sourceUrl); 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 override; Qt::DropActions supportedDragActions() const override; Q_INVOKABLE void paste(); Q_INVOKABLE void copy(); Q_INVOKABLE void cut(); Q_INVOKABLE void deleteSelected(); Q_INVOKABLE void openSelected(); Q_INVOKABLE void undo(); Q_INVOKABLE void refresh(); Q_SIGNALS: void urlChanged() const; void listingCompleted() const; void listingCanceled() const; void iconNameChanged() const; void resolvedUrlChanged() const; void statusChanged() const; void errorStringChanged() const; void draggingChanged() const; void usedByContainmentChanged() const; void lockedChanged() const; void sortModeChanged() const; void sortDescChanged() const; void sortDirsFirstChanged() const; void parseDesktopFilesChanged() const; void viewAdapterChanged(); void previewsChanged() const; void previewPluginsChanged() const; void filterModeChanged() const; void filterPatternChanged() const; void filterMimeTypesChanged() const; void requestRename() const; void move(int x, int y, QList urls); void popupMenuAboutToShow(KIO::DropJob *dropJob, QMimeData *mimeData, int x, int y); protected: bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override; bool matchMimeType(const KFileItem &item) const; bool matchPattern(const KFileItem &item) const; private Q_SLOTS: void dragSelectedInternal(int x, int y); void dirListFailed(const QString &error); void statResult(KJob *job); void evictFromIsDirCache(const KFileItemList &items); void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected); void pasteTo(); void moveSelectedToTrash(); void emptyTrashBin(); void restoreSelectedFromTrash(); void undoTextChanged(const QString &text); private: struct DragImage { int row; QRect rect; QPoint cursorOffset; QImage image; bool blank; }; void createActions(); void updatePasteAction(); void addDragImage(QDrag *drag, int x, int y); void setStatus(Status status); QList selectedUrls(bool forTrash) const; KDirModel *m_dirModel; KDirWatch *m_dirWatch; QString m_url; QHash m_isDirCache; QItemSelectionModel *m_selectionModel; QItemSelection m_pinnedSelection; QModelIndexList m_dragIndexes; QHash m_dragImages; QPoint m_dragHotSpotScrollOffset; bool m_dragInProgress; bool m_urlChangedWhileDragging; QPointer m_previewGenerator; QPointer m_viewAdapter; KActionCollection m_actionCollection; KNewFileMenu *m_newMenu; KFileItemActions *m_fileItemActions; KFileCopyToMenu *m_copyToMenu; Status m_status = Status::None; QString m_errorString; bool m_usedByContainment; bool m_locked; int m_sortMode; // FIXME TODO: Enumify. bool m_sortDesc; bool m_sortDirsFirst; bool m_parseDesktopFiles; bool m_previews; QStringList m_previewPlugins; FilterMode m_filterMode; QString m_filterPattern; bool m_filterPatternMatchAll; QSet m_mimeSet; QList m_regExps; }; #endif diff --git a/containments/desktop/plugins/folder/folderplugin.h b/containments/desktop/plugins/folder/folderplugin.h index 4173d3286..283faf83c 100644 --- a/containments/desktop/plugins/folder/folderplugin.h +++ b/containments/desktop/plugins/folder/folderplugin.h @@ -1,34 +1,34 @@ /*************************************************************************** * Copyright (C) 2014 by Eike Hein * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program 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 General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * ***************************************************************************/ #ifndef FOLDERPLUGIN_H #define FOLDERPLUGIN_H #include class FolderPlugin : public QQmlExtensionPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") public: - void registerTypes(const char *uri) Q_DECL_OVERRIDE; + void registerTypes(const char *uri) override; }; #endif // FOLDERPLUGIN_H diff --git a/containments/desktop/plugins/folder/itemviewadapter.h b/containments/desktop/plugins/folder/itemviewadapter.h index 342f831c5..f7e127101 100644 --- a/containments/desktop/plugins/folder/itemviewadapter.h +++ b/containments/desktop/plugins/folder/itemviewadapter.h @@ -1,73 +1,73 @@ /*************************************************************************** * Copyright (C) 2014 by Eike Hein * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program 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 General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * ***************************************************************************/ #ifndef ITEMVIEWADAPTER_H #define ITEMVIEWADAPTER_H #include #include class ItemViewAdapter : public KAbstractViewAdapter { Q_OBJECT Q_PROPERTY(QObject* adapterView READ adapterView WRITE setAdapterView NOTIFY adapterViewChanged) Q_PROPERTY(QAbstractItemModel* adapterModel READ adapterModel WRITE setAdapterModel NOTIFY adapterModelChanged) Q_PROPERTY(int adapterIconSize READ adapterIconSize WRITE setAdapterIconSize NOTIFY adapterIconSizeChanged) Q_PROPERTY(QRect adapterVisibleArea READ adapterVisibleArea WRITE setAdapterVisibleArea NOTIFY adapterVisibleAreaChanged) public: explicit ItemViewAdapter(QObject* parent = nullptr); - QAbstractItemModel *model() const Q_DECL_OVERRIDE; - QSize iconSize() const Q_DECL_OVERRIDE; - QPalette palette() const Q_DECL_OVERRIDE; - QRect visibleArea() const Q_DECL_OVERRIDE; - QRect visualRect(const QModelIndex &index) const Q_DECL_OVERRIDE; - void connect(Signal signal, QObject *receiver, const char *slot) Q_DECL_OVERRIDE; + QAbstractItemModel *model() const override; + QSize iconSize() const override; + QPalette palette() const override; + QRect visibleArea() const override; + QRect visualRect(const QModelIndex &index) const override; + void connect(Signal signal, QObject *receiver, const char *slot) override; QObject *adapterView() const; void setAdapterView(QObject *view); QAbstractItemModel *adapterModel() const; void setAdapterModel(QAbstractItemModel *model); int adapterIconSize() const; void setAdapterIconSize(int size); QRect adapterVisibleArea() const; void setAdapterVisibleArea(QRect rect); Q_SIGNALS: void viewScrolled() const; void adapterViewChanged() const; void adapterModelChanged() const; void adapterIconSizeChanged() const; void adapterVisibleAreaChanged() const; private: QObject *m_adapterView; QAbstractItemModel *m_adapterModel; int m_adapterIconSize; QRect m_adapterVisibleArea; }; #endif diff --git a/containments/desktop/plugins/folder/positioner.h b/containments/desktop/plugins/folder/positioner.h index 15b20a67e..e9c0ae051 100644 --- a/containments/desktop/plugins/folder/positioner.h +++ b/containments/desktop/plugins/folder/positioner.h @@ -1,133 +1,133 @@ /*************************************************************************** * Copyright (C) 2014 by Eike Hein * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program 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 General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * ***************************************************************************/ #ifndef POSITIONER_H #define POSITIONER_H #include #include "folderplugin_private_export.h" class FolderModel; class QTimer; class FOLDERPLUGIN_TESTS_EXPORT Positioner : public QAbstractItemModel { Q_OBJECT Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged) Q_PROPERTY(FolderModel* folderModel READ folderModel WRITE setFolderModel NOTIFY folderModelChanged) Q_PROPERTY(int perStripe READ perStripe WRITE setPerStripe NOTIFY perStripeChanged) Q_PROPERTY(QStringList positions READ positions WRITE setPositions NOTIFY positionsChanged) public: explicit Positioner(QObject *parent = nullptr); ~Positioner(); bool enabled() const; void setEnabled(bool enabled); FolderModel *folderModel() const; void setFolderModel(QObject *folderModel); int perStripe() const; void setPerStripe(int perStripe); QStringList positions() const; void setPositions(const QStringList &positions); Q_INVOKABLE int map(int row) const; Q_INVOKABLE int nearestItem(int currentIndex, Qt::ArrowType direction); Q_INVOKABLE bool isBlank(int row) const; Q_INVOKABLE int indexForUrl(const QUrl &url) const; Q_INVOKABLE void setRangeSelected(int anchor, int to); Q_INVOKABLE void reset(); Q_INVOKABLE void move(const QVariantList &moves); - QHash roleNames() const Q_DECL_OVERRIDE; + QHash roleNames() const override; QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override; - QModelIndex parent(const QModelIndex &index) const Q_DECL_OVERRIDE; + QModelIndex parent(const QModelIndex &index) const override; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; int rowCount(const QModelIndex &parent = QModelIndex()) const override; int columnCount(const QModelIndex &parent = QModelIndex()) const override; Q_SIGNALS: void enabledChanged() const; void folderModelChanged() const; void perStripeChanged() const; void positionsChanged() const; private Q_SLOTS: void updatePositions(); void sourceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector &roles); void sourceModelAboutToBeReset(); void sourceModelReset(); void sourceRowsAboutToBeInserted(const QModelIndex &parent, int start, int end); void sourceRowsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow); void sourceRowsAboutToBeRemoved(const QModelIndex &parent, int first, int last); void sourceLayoutAboutToBeChanged(const QList &parents, QAbstractItemModel::LayoutChangeHint hint); void sourceRowsInserted(const QModelIndex &parent, int first, int last); void sourceRowsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow); void sourceRowsRemoved(const QModelIndex &parent, int first, int last); void sourceLayoutChanged(const QList &parents, QAbstractItemModel::LayoutChangeHint hint); private: void initMaps(int size = -1); void updateMaps(int proxyIndex, int sourceIndex); int firstRow() const; int lastRow() const; int firstFreeRow() const; void applyPositions(); void flushPendingChanges(); void connectSignals(FolderModel *model); void disconnectSignals(FolderModel *model); bool m_enabled; FolderModel *m_folderModel; int m_perStripe; int m_lastRow; QModelIndexList m_pendingChanges; bool m_ignoreNextTransaction; QStringList m_positions; bool m_pendingPositions; QTimer *m_updatePositionsTimer; QHash m_proxyToSource; QHash m_sourceToProxy; }; #endif diff --git a/containments/desktop/plugins/folder/wheelinterceptor.h b/containments/desktop/plugins/folder/wheelinterceptor.h index 9a20875a6..7b02a0f91 100644 --- a/containments/desktop/plugins/folder/wheelinterceptor.h +++ b/containments/desktop/plugins/folder/wheelinterceptor.h @@ -1,49 +1,49 @@ /************************************************************************** * Copyright (C) 2014 by Eike Hein * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program 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 General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * ***************************************************************************/ #ifndef WHEELINTERCEPTOR_H #define WHEELINTERCEPTOR_H #include #include class WheelInterceptor : public QQuickItem { Q_OBJECT Q_PROPERTY(QObject* destination READ destination WRITE setDestination NOTIFY destinationChanged) public: explicit WheelInterceptor(QQuickItem *parent = nullptr); ~WheelInterceptor(); QObject *destination() const; void setDestination(QObject *destination); Q_SIGNALS: void destinationChanged() const; protected: - void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE; + void wheelEvent(QWheelEvent *event) override; private: QPointer m_destination; }; #endif