From 2ba5c2cfc2cea534cccd860f94a7198530b83594 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Sun, 11 Mar 2012 19:02:45 +0100 Subject: First step to introduce dynamic roles Currently Dolphin is only capable of showing a fixed number of roles (e.g. name, size, date, owner, ...). Dolphin 2.1 should support also other roles like rating, tags, comments or other meta-information of images or audio-files. To support this the sorting-type and additional-type from DolphinView has been replaced by a role-type represented as QByteArray. --- src/views/dolphinview.h | 66 +++++++++++-------------------------------------- 1 file changed, 14 insertions(+), 52 deletions(-) (limited to 'src/views/dolphinview.h') diff --git a/src/views/dolphinview.h b/src/views/dolphinview.h index f2f15c592..628ab2dc5 100644 --- a/src/views/dolphinview.h +++ b/src/views/dolphinview.h @@ -93,34 +93,6 @@ public: CompactView }; - /** Defines the sort order for the items of a directory. */ - enum Sorting - { - SortByName = 0, - SortBySize, - SortByDate, - SortByPermissions, - SortByOwner, - SortByGroup, - SortByType, - SortByDestination, - SortByPath - }; - - /** Defines the additional information shown for the items of a directory. */ - enum AdditionalInfo - { - NoInfo = 0, - SizeInfo, - DateInfo, - PermissionsInfo, - OwnerInfo, - GroupInfo, - TypeInfo, - DestinationInfo, - PathInfo - }; - /** * @param url Specifies the content which should be shown. * @param parent Parent widget of the view. @@ -234,29 +206,21 @@ public: */ bool isZoomOutPossible() const; - /** Sets the sorting criterion (e.g., SortByName, SortBySize,...) of the items inside a directory (see DolphinView::Sorting). */ - void setSorting(Sorting sorting); - - /** Returns the sorting criterion (e.g., SortByName, SortBySize,...) of the items inside a directory (see DolphinView::Sorting). */ - Sorting sorting() const; + void setSortRole(const QByteArray& role); + QByteArray sortRole() const; - /** Sets the sort order (Qt::Ascending or Qt::Descending) for the items. */ void setSortOrder(Qt::SortOrder order); - - /** Returns the currently used sort order (Qt::Ascending or Qt::Descending). */ Qt::SortOrder sortOrder() const; /** Sets a separate sorting with folders first (true) or a mixed sorting of files and folders (false). */ void setSortFoldersFirst(bool foldersFirst); - - /** Returns if files and folders are sorted separately or not. */ bool sortFoldersFirst() const; /** Sets the additional information which should be shown for the items. */ - void setAdditionalInfoList(const QList& info); + void setVisibleRoles(const QList& roles); /** Returns the additional information which should be shown for the items. */ - QList additionalInfoList() const; + QList visibleRoles() const; /** Reloads the current directory. */ void reload(); @@ -450,17 +414,20 @@ signals: void groupedSortingChanged(bool groupedSorting); /** Is emitted if the sorting by name, size or date has been changed. */ - void sortingChanged(DolphinView::Sorting sorting); + void sortRoleChanged(const QByteArray& role); /** Is emitted if the sort order (ascending or descending) has been changed. */ void sortOrderChanged(Qt::SortOrder order); - /** Is emitted if the sorting of files and folders (separate with folders first or mixed) has been changed. */ + /** + * Is emitted if the sorting of files and folders (separate with folders + * first or mixed) has been changed. + */ void sortFoldersFirstChanged(bool foldersFirst); /** Is emitted if the additional information shown for this view has been changed. */ - void additionalInfoListChanged(const QList& current, - const QList& previous); + void visibleRolesChanged(const QList& current, + const QList& previous); /** Is emitted if the zoom level has been changed by zooming in or out. */ void zoomLevelChanged(int current, int previous); @@ -586,9 +553,9 @@ private slots: /** * Updates the view properties of the current URL to the - * sorting given by \a sorting. + * sorting given by \a role. */ - void updateSorting(DolphinView::Sorting sorting); + void updateSortRole(const QByteArray& role); /** * Updates the view properties of the current URL to the @@ -702,8 +669,6 @@ private: */ void applyViewProperties(); - void applyAdditionalInfoListToView(); - /** * Helper method for DolphinView::paste() and DolphinView::pasteIntoFolder(). * Pastes the clipboard data into the URL \a url. @@ -737,9 +702,6 @@ private: */ void updateWritableState(); - QByteArray sortRoleForSorting(Sorting sorting) const; - Sorting sortingForSortRole(const QByteArray& sortRole) const; - /** * Returns the text for the filesize by converting it to the best fitting * unit. @@ -756,7 +718,7 @@ private: KUrl m_url; Mode m_mode; - QList m_additionalInfoList; + QList m_visibleRoles; QVBoxLayout* m_topLayout; -- cgit v1.3