X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/f42d1d2c02eb7e608564f137ce97f9424d9c49f6..85bc196887fbed01187e3830cd28c2500cb01cb2:/src/dolphinview.h diff --git a/src/dolphinview.h b/src/dolphinview.h index 875b6b114..14c8372d3 100644 --- a/src/dolphinview.h +++ b/src/dolphinview.h @@ -24,6 +24,7 @@ #include #include +#include #include #include @@ -38,6 +39,7 @@ class DolphinController; class FilterBar; +class KFileItemDelegate; class KUrl; class KDirModel; class UrlNavigator; @@ -209,19 +211,11 @@ public: */ void setUrlEditable(bool editable); - /** - * Returns the complete URL history. The index 0 indicates the oldest - * history element. - * @param index Output parameter which indicates the current - * index of the location. - */ - const QLinkedList urlHistory(int& index) const; - - /** - * Returns true, if at least one item is selected. - */ + /** Returns true, if at least one item is selected. */ bool hasSelection() const; + void clearSelection(); + /** * Returns the selected items. The list is empty if no item has been * selected. @@ -248,7 +242,6 @@ public: */ void rename(const KUrl& source, const QString& newName); - /** Returns the status bar of the view. */ DolphinStatusBar* statusBar() const; /** @@ -301,6 +294,12 @@ public: /** Returns the current used sort order (Qt::Ascending or Qt::Descending). */ Qt::SortOrder sortOrder() const; + /** Sets the additional information which should be shown for the items. */ + void setAdditionalInfo(KFileItemDelegate::AdditionalInformation info); + + /** Returns the additional information which should be shown for the items. */ + KFileItemDelegate::AdditionalInformation additionalInfo() const; + /** Refreshs the view settings by reading out the stored settings. */ void refreshSettings(); @@ -327,11 +326,6 @@ public: /** Reloads the current directory. */ void reload(); - /** - * Declare this View as the activeview of the mainWindow() - */ - void declareViewActive(); - public slots: /** * Popups the filter bar above the status bar if \a show is true. @@ -351,6 +345,14 @@ public slots: */ void requestActivation(); + /** + * Request of a selection change. The view will do its best to accomodate + * the request, but it is not guaranteed that all items in \a selection + * will actually get selected. The view will e.g. not select items which + * are not in the currently displayed folder. + */ + void changeSelection(const KFileItemList& selection); + signals: /** Is emitted if URL of the view has been changed to \a url. */ void urlChanged(const KUrl& url); @@ -373,6 +375,9 @@ signals: /** Is emitted if the sort order (ascending or descending) has been changed. */ void sortOrderChanged(Qt::SortOrder order); + /** Is emitted if the addtional information for an item has been changed. */ + void additionalInfoChanged(KFileItemDelegate::AdditionalInformation info); + /** * Is emitted if information of an item is requested to be shown e. g. in the sidebar. * It the URL is empty, no item information request is pending. @@ -383,11 +388,9 @@ signals: void contentsMoved(int x, int y); /** - * Is emitted whenever the selection has been changed. The current selection can - * be retrieved by mainWindow()->activeView()->selectedItems() or by - * mainWindow()->activeView()->selectedUrls(). + * Is emitted whenever the selection has been changed. */ - void selectionChanged(); + void selectionChanged(const KFileItemList& selection); /** * Is emitted whenever the filter bar has been turned show or hidden. @@ -409,6 +412,19 @@ private slots: */ void updateItemCount(); + /** + * Generates a preview image for each file item in \a items. + * The current preview settings (maximum size, 'Show Preview' menu) + * are respected. + */ + void generatePreviews(const KFileItemList& items); + + /** + * Replaces the icon of the item \a item by the preview pixmap + * \a pixmap. + */ + void showPreview(const KFileItem* item, const QPixmap& pixmap); + /** * Restores the x- and y-position of the contents if the * current view is part of the history. @@ -430,8 +446,27 @@ private slots: */ void changeNameFilter(const QString& nameFilter); - void openContextMenu(const QPoint& pos, const QPoint& globalPos); + /** + * Opens the context menu on position \a pos. The position + * is used to check whether the context menu is related to an + * item or to the viewport. + */ + void openContextMenu(const QPoint& pos); + + /** + * Drops the URLs \a urls to the index \a index. \a source + * indicates the widget where the dragging has been started from. + */ + void dropUrls(const KUrl::List& urls, + const QModelIndex& index, + QWidget* source); + /** + * Drops the URLs \a urls at the + * destination \a destination. + */ + void dropUrls(const KUrl::List& urls, + const KUrl& destination); /** * Updates the view properties of the current URL to the * sorting given by \a sorting. @@ -444,6 +479,21 @@ private slots: */ void updateSortOrder(Qt::SortOrder order); + /** + * Emits the signal contentsMoved with the current coordinates + * of the viewport as parameters. + */ + void emitContentsMoved(); + + /** + * Updates the activation state of the view by checking whether + * the currently active view is this view. + */ + void updateActivationState(); + + /** Applies an item effect to all cut items of the clipboard. */ + void updateCutItems(); + private: void startDirLister(const KUrl& url, bool reload = false); @@ -460,16 +510,11 @@ private: QString selectionStatusBarText() const; /** - * Creates a new view representing the given view mode (DolphinView::viewMode()). + * Creates a new view representing the given view mode (DolphinView::mode()). * The current view will get deleted. */ void createView(); - /** - * Returns the column index used in the KDirModel depending on \a sorting. - */ - int columnIndex(Sorting sorting) const; - /** * Selects all items by using the selection flags \a flags. This is a helper * method for the slots DolphinView::selectAll() and DolphinView::invertSelection(). @@ -482,8 +527,33 @@ private: */ QAbstractItemView* itemView() const; + /** + * Returns true if the index is valid and represents + * the column KDirModel::Name. + */ + bool isValidNameIndex(const QModelIndex& index) const; + + /** + * Returns true, if the item \a item has been cut into + * the clipboard. + */ + bool isCutItem(const KFileItem& item) const; + + /** Applies an item effect to all cut items. */ + void applyCutItemEffect(); + private: + /** + * Remembers the original pixmap for an item before + * the cut effect is applied. + */ + struct CutItem { + KUrl url; + QPixmap pixmap; + }; + bool m_showProgress; + bool m_blockContentsMovedSignal; Mode m_mode; int m_iconSize; @@ -497,6 +567,7 @@ private: DolphinController* m_controller; DolphinIconsView* m_iconsView; DolphinDetailsView* m_detailsView; + KFileItemDelegate* m_fileItemDelegate; FilterBar* m_filterBar; DolphinStatusBar* m_statusBar; @@ -504,6 +575,8 @@ private: KDirModel* m_dirModel; DolphinDirLister* m_dirLister; DolphinSortFilterProxyModel* m_proxyModel; + + QList m_cutItemsCache; }; #endif // _DOLPHINVIEW_H_