2006-11-21 06:02:05 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* Copyright (C) 2006 by Peter Penz <peter.penz@gmx.at> *
|
|
|
|
* Copyright (C) 2006 by Gregor Kališnik <gregor@podnapisi.net> *
|
|
|
|
* *
|
|
|
|
* 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., *
|
2006-12-08 21:24:08 +00:00
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
2006-11-21 06:02:05 +00:00
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _DOLPHINVIEW_H_
|
|
|
|
#define _DOLPHINVIEW_H_
|
|
|
|
|
|
|
|
#include <kparts/part.h>
|
|
|
|
#include <kfileitem.h>
|
2007-03-11 16:47:12 +00:00
|
|
|
#include <kfileitemdelegate.h>
|
2006-11-21 06:02:05 +00:00
|
|
|
#include <kfileiconview.h>
|
|
|
|
#include <kio/job.h>
|
2007-01-23 21:44:52 +00:00
|
|
|
|
2006-11-21 06:02:05 +00:00
|
|
|
#include <urlnavigator.h>
|
|
|
|
|
2007-01-23 21:44:52 +00:00
|
|
|
#include <QDropEvent>
|
|
|
|
#include <QLinkedList>
|
2006-11-24 22:10:33 +00:00
|
|
|
#include <QListView>
|
2007-01-23 21:44:52 +00:00
|
|
|
#include <QMouseEvent>
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
#include <QWidget>
|
2006-11-24 22:10:33 +00:00
|
|
|
|
2007-02-14 21:54:24 +00:00
|
|
|
class DolphinController;
|
2007-01-23 21:44:52 +00:00
|
|
|
class FilterBar;
|
2007-03-11 16:47:12 +00:00
|
|
|
class KFileItemDelegate;
|
2006-11-21 06:02:05 +00:00
|
|
|
class KUrl;
|
2006-11-24 22:10:33 +00:00
|
|
|
class KDirModel;
|
2006-11-22 17:13:11 +00:00
|
|
|
class UrlNavigator;
|
2007-01-15 06:43:17 +00:00
|
|
|
class DolphinDetailsView;
|
2006-11-21 06:02:05 +00:00
|
|
|
class DolphinDirLister;
|
|
|
|
class DolphinIconsView;
|
2007-01-23 21:44:52 +00:00
|
|
|
class DolphinMainWindow;
|
2006-12-14 23:49:30 +00:00
|
|
|
class DolphinSortFilterProxyModel;
|
2007-01-23 21:44:52 +00:00
|
|
|
class DolphinStatusBar;
|
2006-11-24 22:10:33 +00:00
|
|
|
class QModelIndex;
|
2007-01-23 21:44:52 +00:00
|
|
|
class QPainter;
|
|
|
|
class QTimer;
|
|
|
|
class ViewProperties;
|
2006-11-24 22:10:33 +00:00
|
|
|
|
2006-11-21 06:02:05 +00:00
|
|
|
/**
|
|
|
|
* @short Represents a view for the directory content
|
2007-02-14 22:27:47 +00:00
|
|
|
* including the navigation bar, filter bar and status bar.
|
2006-11-21 06:02:05 +00:00
|
|
|
*
|
2007-01-23 21:44:52 +00:00
|
|
|
* View modes for icons and details are supported. Currently
|
2006-11-21 06:02:05 +00:00
|
|
|
* Dolphin allows to have up to two views inside the main window.
|
|
|
|
*
|
|
|
|
* @see DolphinIconsView
|
|
|
|
* @see DolphinDetailsView
|
2006-11-22 17:13:11 +00:00
|
|
|
* @see UrlNavigator
|
2006-11-21 06:02:05 +00:00
|
|
|
* @see DolphinStatusBar
|
|
|
|
*/
|
|
|
|
class DolphinView : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Defines the view mode for a directory. The view mode
|
|
|
|
* can be defined when constructing a DolphinView. The
|
|
|
|
* view mode is automatically updated if the directory itself
|
|
|
|
* defines a view mode (see class ViewProperties for details).
|
|
|
|
*/
|
|
|
|
enum Mode
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The directory items are shown as icons including an
|
|
|
|
* icon name. */
|
|
|
|
IconsView = 0,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The icon, the name and at least the size of the directory
|
|
|
|
* items are shown in a table. It is possible to add columns
|
|
|
|
* for date, group and permissions.
|
|
|
|
*/
|
|
|
|
DetailsView = 1,
|
2006-12-13 07:41:11 +00:00
|
|
|
MaxModeEnum = DetailsView
|
2006-11-21 06:02:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/** Defines the sort order for the items of a directory. */
|
|
|
|
enum Sorting
|
|
|
|
{
|
|
|
|
SortByName = 0,
|
2007-02-07 06:19:06 +00:00
|
|
|
SortBySize,
|
|
|
|
SortByDate,
|
|
|
|
SortByPermissions,
|
|
|
|
SortByOwner,
|
|
|
|
SortByGroup,
|
|
|
|
MaxSortEnum = SortByGroup
|
2006-11-21 06:02:05 +00:00
|
|
|
};
|
|
|
|
|
2006-11-29 00:02:19 +00:00
|
|
|
DolphinView(DolphinMainWindow* mainwindow,
|
|
|
|
QWidget *parent,
|
2006-11-21 06:02:05 +00:00
|
|
|
const KUrl& url,
|
|
|
|
Mode mode = IconsView,
|
|
|
|
bool showHiddenFiles = false);
|
|
|
|
|
|
|
|
virtual ~DolphinView();
|
|
|
|
|
|
|
|
/**
|
2007-01-23 21:44:52 +00:00
|
|
|
* Sets the current active URL.
|
|
|
|
* The signals UrlNavigator::urlChanged() and UrlNavigator::historyChanged()
|
2007-02-14 22:27:47 +00:00
|
|
|
* are emitted.
|
2006-11-21 06:02:05 +00:00
|
|
|
*/
|
2006-11-22 17:13:11 +00:00
|
|
|
void setUrl(const KUrl& url);
|
2006-11-21 06:02:05 +00:00
|
|
|
|
2007-01-23 21:44:52 +00:00
|
|
|
/** Returns the current active URL. */
|
2006-11-21 06:02:05 +00:00
|
|
|
const KUrl& url() const;
|
|
|
|
|
2007-02-14 21:54:24 +00:00
|
|
|
/**
|
|
|
|
* Returns true if the view is active and hence all actions are
|
|
|
|
* applied to this view.
|
|
|
|
*/
|
2006-11-21 06:02:05 +00:00
|
|
|
bool isActive() const;
|
|
|
|
|
2006-12-20 20:50:32 +00:00
|
|
|
/**
|
|
|
|
* Changes the view mode for the current directory to \a mode.
|
|
|
|
* If the view properties should be remembered for each directory
|
|
|
|
* (GeneralSettings::globalViewProps() returns false), then the
|
|
|
|
* changed view mode will be be stored automatically.
|
|
|
|
*/
|
2006-11-21 06:02:05 +00:00
|
|
|
void setMode(Mode mode);
|
|
|
|
Mode mode() const;
|
2006-12-20 20:50:32 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Turns on the file preview for the all files of the current directory,
|
|
|
|
* if \a show is true.
|
|
|
|
* If the view properties should be remembered for each directory
|
|
|
|
* (GeneralSettings::globalViewProps() returns false), then the
|
|
|
|
* preview setting will be be stored automatically.
|
|
|
|
*/
|
|
|
|
void setShowPreview(bool show);
|
|
|
|
bool showPreview() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Shows all hidden files of the current directory,
|
|
|
|
* if \a show is true.
|
|
|
|
* If the view properties should be remembered for each directory
|
|
|
|
* (GeneralSettings::globalViewProps() returns false), then the
|
|
|
|
* show hidden file setting will be be stored automatically.
|
|
|
|
*/
|
2006-12-13 07:41:11 +00:00
|
|
|
void setShowHiddenFiles(bool show);
|
|
|
|
bool showHiddenFiles() const;
|
2006-11-21 06:02:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Triggers the renaming of the currently selected items, where
|
|
|
|
* the user must input a new name for the items.
|
|
|
|
*/
|
|
|
|
void renameSelectedItems();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Selects all items.
|
|
|
|
* @see DolphinView::selectedItems()
|
|
|
|
*/
|
|
|
|
void selectAll();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Inverts the current selection: selected items get unselected,
|
|
|
|
* unselected items get selected.
|
|
|
|
* @see DolphinView::selectedItems()
|
|
|
|
*/
|
|
|
|
void invertSelection();
|
|
|
|
|
|
|
|
/**
|
2007-01-23 21:44:52 +00:00
|
|
|
* Goes back one step in the URL history. The signals
|
|
|
|
* UrlNavigator::urlChanged() and UrlNavigator::historyChanged()
|
2006-11-21 06:02:05 +00:00
|
|
|
* are submitted.
|
|
|
|
*/
|
|
|
|
void goBack();
|
|
|
|
|
|
|
|
/**
|
2006-11-22 17:13:11 +00:00
|
|
|
* Goes forward one step in the Url history. The signals
|
2007-01-23 21:44:52 +00:00
|
|
|
* UrlNavigator::urlChanged() and UrlNavigator::historyChanged()
|
2006-11-21 06:02:05 +00:00
|
|
|
* are submitted.
|
|
|
|
*/
|
|
|
|
void goForward();
|
|
|
|
|
|
|
|
/**
|
2006-11-22 17:13:11 +00:00
|
|
|
* Goes up one step of the Url path. The signals
|
2007-01-23 21:44:52 +00:00
|
|
|
* UrlNavigator::urlChanged() and UrlNavigator::historyChanged()
|
2006-11-21 06:02:05 +00:00
|
|
|
* are submitted.
|
|
|
|
*/
|
|
|
|
void goUp();
|
|
|
|
|
|
|
|
/**
|
2007-01-23 21:44:52 +00:00
|
|
|
* Goes to the home URL. The signals UrlNavigator::urlChanged()
|
|
|
|
* and UrlNavigator::historyChanged() are submitted.
|
2006-11-21 06:02:05 +00:00
|
|
|
*/
|
|
|
|
void goHome();
|
|
|
|
|
|
|
|
/**
|
2007-01-23 21:44:52 +00:00
|
|
|
* Sets the URL of the navigation bar to an editable state
|
2006-11-21 06:02:05 +00:00
|
|
|
* if \a editable is true. If \a editable is false, each part of
|
|
|
|
* the location is presented by a button for a fast navigation.
|
|
|
|
*/
|
2006-11-22 17:13:11 +00:00
|
|
|
void setUrlEditable(bool editable);
|
2006-11-21 06:02:05 +00:00
|
|
|
|
|
|
|
/**
|
2007-01-23 21:44:52 +00:00
|
|
|
* Returns the complete URL history. The index 0 indicates the oldest
|
2006-11-21 06:02:05 +00:00
|
|
|
* history element.
|
|
|
|
* @param index Output parameter which indicates the current
|
|
|
|
* index of the location.
|
|
|
|
*/
|
2007-01-23 21:44:52 +00:00
|
|
|
const QLinkedList<UrlNavigator::HistoryElem> urlHistory(int& index) const;
|
2006-11-21 06:02:05 +00:00
|
|
|
|
2007-03-17 20:42:26 +00:00
|
|
|
/** Returns true, if at least one item is selected. */
|
2006-11-21 06:02:05 +00:00
|
|
|
bool hasSelection() const;
|
|
|
|
|
2007-03-17 20:42:26 +00:00
|
|
|
void clearSelection();
|
|
|
|
|
2006-11-21 06:02:05 +00:00
|
|
|
/**
|
2006-12-02 21:51:36 +00:00
|
|
|
* Returns the selected items. The list is empty if no item has been
|
|
|
|
* selected.
|
2006-11-22 17:13:11 +00:00
|
|
|
* @see DolphinView::selectedUrls()
|
2006-11-21 06:02:05 +00:00
|
|
|
*/
|
2006-12-02 21:51:36 +00:00
|
|
|
KFileItemList selectedItems() const;
|
2006-11-21 06:02:05 +00:00
|
|
|
|
|
|
|
/**
|
2007-01-23 21:44:52 +00:00
|
|
|
* Returns a list of URLs for all selected items. An empty list
|
2006-11-21 06:02:05 +00:00
|
|
|
* is returned, if no item is selected.
|
|
|
|
* @see DolphinView::selectedItems()
|
|
|
|
*/
|
2006-11-22 17:13:11 +00:00
|
|
|
KUrl::List selectedUrls() const;
|
2006-11-21 06:02:05 +00:00
|
|
|
|
|
|
|
/**
|
2007-01-21 21:20:37 +00:00
|
|
|
* Returns the file item for the given model index \a index.
|
2006-11-21 06:02:05 +00:00
|
|
|
*/
|
2007-01-21 21:20:37 +00:00
|
|
|
KFileItem* fileItem(const QModelIndex index) const;
|
2006-11-21 06:02:05 +00:00
|
|
|
|
|
|
|
/**
|
2007-01-23 21:44:52 +00:00
|
|
|
* Renames the filename of the source URL by the new file name.
|
2006-11-21 06:02:05 +00:00
|
|
|
* If the new file name already exists, a dialog is opened which
|
|
|
|
* asks the user to enter a new name.
|
|
|
|
*/
|
|
|
|
void rename(const KUrl& source, const QString& newName);
|
|
|
|
|
|
|
|
DolphinStatusBar* statusBar() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the x-position of the view content.
|
|
|
|
* The content of the view might be larger than the visible area
|
|
|
|
* and hence a scrolling must be done.
|
|
|
|
*/
|
|
|
|
int contentsX() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the y-position of the view content.
|
|
|
|
* The content of the view might be larger than the visible area
|
|
|
|
* and hence a scrolling must be done.
|
|
|
|
*/
|
|
|
|
int contentsY() const;
|
|
|
|
|
|
|
|
/**
|
2007-01-23 21:44:52 +00:00
|
|
|
* Returns true, if the URL shown by the navigation bar is editable.
|
2006-11-22 17:13:11 +00:00
|
|
|
* @see UrlNavigator
|
2006-11-21 06:02:05 +00:00
|
|
|
*/
|
2006-11-22 17:13:11 +00:00
|
|
|
bool isUrlEditable() const;
|
2006-11-21 06:02:05 +00:00
|
|
|
|
|
|
|
/** Increases the size of the current set view mode. */
|
|
|
|
void zoomIn();
|
|
|
|
|
|
|
|
/** Decreases the size of the current set view mode. */
|
|
|
|
void zoomOut();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true, if zooming in is possible. If false is returned,
|
|
|
|
* the minimal zoom size is possible.
|
|
|
|
*/
|
|
|
|
bool isZoomInPossible() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true, if zooming out is possible. If false is returned,
|
|
|
|
* the maximum zoom size is possible.
|
|
|
|
*/
|
|
|
|
bool isZoomOutPossible() const;
|
|
|
|
|
|
|
|
/** Sets the sort order of the items inside a directory (see DolphinView::Sorting). */
|
|
|
|
void setSorting(Sorting sorting);
|
|
|
|
|
|
|
|
/** Returns the sort order of the items inside a directory (see DolphinView::Sorting). */
|
|
|
|
Sorting sorting() const;
|
|
|
|
|
|
|
|
/** Sets the sort order (Qt::Ascending or Qt::Descending) for the items. */
|
|
|
|
void setSortOrder(Qt::SortOrder order);
|
|
|
|
|
|
|
|
/** Returns the current used sort order (Qt::Ascending or Qt::Descending). */
|
|
|
|
Qt::SortOrder sortOrder() const;
|
|
|
|
|
2007-03-11 16:47:12 +00:00
|
|
|
/** 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;
|
|
|
|
|
2006-11-21 06:02:05 +00:00
|
|
|
/** Refreshs the view settings by reading out the stored settings. */
|
|
|
|
void refreshSettings();
|
|
|
|
|
2006-11-22 17:13:11 +00:00
|
|
|
/** Returns the UrlNavigator of the view for read access. */
|
|
|
|
const UrlNavigator* urlNavigator() const { return m_urlNavigator; }
|
2006-11-21 06:02:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Triggers to request user information for the item given
|
2007-01-23 21:44:52 +00:00
|
|
|
* by the URL \a url. The signal requestItemInfo is emitted,
|
2006-11-21 06:02:05 +00:00
|
|
|
* which provides a way for widgets to get an indication to update
|
|
|
|
* the item information.
|
|
|
|
*/
|
2006-12-08 23:41:08 +00:00
|
|
|
void emitRequestItemInfo(const KUrl& url);
|
2006-11-21 06:02:05 +00:00
|
|
|
|
2006-12-08 23:41:08 +00:00
|
|
|
/** Returns true, if the filter bar is visible. */
|
|
|
|
bool isFilterBarVisible() const;
|
2006-11-21 06:02:05 +00:00
|
|
|
|
2006-11-29 00:02:19 +00:00
|
|
|
/**
|
|
|
|
* Return the DolphinMainWindow this View belongs to. It is guranteed
|
|
|
|
* that we have one.
|
|
|
|
*/
|
|
|
|
DolphinMainWindow* mainWindow() const ;
|
|
|
|
|
2007-01-25 16:56:52 +00:00
|
|
|
/** Reloads the current directory. */
|
2006-11-21 06:02:05 +00:00
|
|
|
void reload();
|
|
|
|
|
2007-01-25 16:56:52 +00:00
|
|
|
public slots:
|
2006-11-29 00:02:19 +00:00
|
|
|
/**
|
2007-01-25 16:56:52 +00:00
|
|
|
* Popups the filter bar above the status bar if \a show is true.
|
2006-11-29 00:02:19 +00:00
|
|
|
*/
|
2007-01-25 16:56:52 +00:00
|
|
|
void showFilterBar(bool show);
|
2006-11-29 00:02:19 +00:00
|
|
|
|
2007-01-23 21:44:52 +00:00
|
|
|
/**
|
|
|
|
* Updates the number of items (= number of files + number of
|
|
|
|
* directories) in the statusbar. If files are selected, the number
|
|
|
|
* of selected files and the sum of the filesize is shown.
|
|
|
|
*/
|
|
|
|
void updateStatusBar();
|
|
|
|
|
2007-02-14 21:54:24 +00:00
|
|
|
/**
|
|
|
|
* Requests the main window to set this view as active view, which
|
|
|
|
* means that all actions are applied to this view.
|
|
|
|
*/
|
|
|
|
void requestActivation();
|
|
|
|
|
2006-11-21 06:02:05 +00:00
|
|
|
signals:
|
2007-01-23 21:44:52 +00:00
|
|
|
/** Is emitted if URL of the view has been changed to \a url. */
|
2006-12-08 23:41:08 +00:00
|
|
|
void urlChanged(const KUrl& url);
|
2006-11-21 06:02:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Is emitted if the view mode (IconsView, DetailsView,
|
|
|
|
* PreviewsView) has been changed.
|
|
|
|
*/
|
2006-12-08 23:41:08 +00:00
|
|
|
void modeChanged();
|
2006-11-21 06:02:05 +00:00
|
|
|
|
2006-12-20 20:50:32 +00:00
|
|
|
/** Is emitted if the 'show preview' property has been changed. */
|
|
|
|
void showPreviewChanged();
|
|
|
|
|
2006-11-21 06:02:05 +00:00
|
|
|
/** Is emitted if the 'show hidden files' property has been changed. */
|
2006-12-08 23:41:08 +00:00
|
|
|
void showHiddenFilesChanged();
|
2006-11-21 06:02:05 +00:00
|
|
|
|
|
|
|
/** Is emitted if the sorting by name, size or date has been changed. */
|
2006-12-08 23:41:08 +00:00
|
|
|
void sortingChanged(DolphinView::Sorting sorting);
|
2006-11-21 06:02:05 +00:00
|
|
|
|
|
|
|
/** Is emitted if the sort order (ascending or descending) has been changed. */
|
2006-12-08 23:41:08 +00:00
|
|
|
void sortOrderChanged(Qt::SortOrder order);
|
2006-11-21 06:02:05 +00:00
|
|
|
|
2007-03-11 16:47:12 +00:00
|
|
|
/** Is emitted if the addtional information for an item has been changed. */
|
|
|
|
void additionalInfoChanged(KFileItemDelegate::AdditionalInformation info);
|
|
|
|
|
2006-11-21 06:02:05 +00:00
|
|
|
/**
|
|
|
|
* Is emitted if information of an item is requested to be shown e. g. in the sidebar.
|
2007-02-14 22:27:47 +00:00
|
|
|
* It the URL is empty, no item information request is pending.
|
2006-11-21 06:02:05 +00:00
|
|
|
*/
|
2006-12-08 23:41:08 +00:00
|
|
|
void requestItemInfo(const KUrl& url);
|
2006-11-21 06:02:05 +00:00
|
|
|
|
|
|
|
/** Is emitted if the contents has been moved to \a x, \a y. */
|
|
|
|
void contentsMoved(int x, int y);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Is emitted whenever the selection has been changed. The current selection can
|
2006-11-29 00:02:19 +00:00
|
|
|
* be retrieved by mainWindow()->activeView()->selectedItems() or by
|
|
|
|
* mainWindow()->activeView()->selectedUrls().
|
2006-11-21 06:02:05 +00:00
|
|
|
*/
|
2006-12-08 23:41:08 +00:00
|
|
|
void selectionChanged();
|
2006-11-21 06:02:05 +00:00
|
|
|
|
|
|
|
/**
|
2006-12-08 23:41:08 +00:00
|
|
|
* Is emitted whenever the filter bar has been turned show or hidden.
|
2006-11-21 06:02:05 +00:00
|
|
|
*/
|
2006-12-08 23:41:08 +00:00
|
|
|
void showFilterBarChanged(bool shown);
|
2006-11-21 06:02:05 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
/** @see QWidget::mouseReleaseEvent */
|
|
|
|
virtual void mouseReleaseEvent(QMouseEvent* event);
|
|
|
|
|
|
|
|
private slots:
|
2006-12-08 23:41:08 +00:00
|
|
|
void loadDirectory(const KUrl& kurl);
|
2006-11-24 22:10:33 +00:00
|
|
|
void triggerItem(const QModelIndex& index);
|
2007-01-23 21:44:52 +00:00
|
|
|
void updateProgress(int percent);
|
2006-11-21 06:02:05 +00:00
|
|
|
|
|
|
|
/**
|
2007-01-23 21:44:52 +00:00
|
|
|
* Updates the number of items (= number of directories + number of files)
|
|
|
|
* and shows this information in the statusbar.
|
2006-11-21 06:02:05 +00:00
|
|
|
*/
|
2007-01-23 21:44:52 +00:00
|
|
|
void updateItemCount();
|
|
|
|
|
2007-02-28 19:17:26 +00:00
|
|
|
/**
|
|
|
|
* 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);
|
|
|
|
|
2007-02-10 21:29:29 +00:00
|
|
|
/**
|
|
|
|
* Restores the x- and y-position of the contents if the
|
|
|
|
* current view is part of the history.
|
|
|
|
*/
|
|
|
|
void restoreContentsPos();
|
|
|
|
|
2007-01-23 21:44:52 +00:00
|
|
|
/** Shows the information \a msg inside the statusbar. */
|
|
|
|
void showInfoMessage(const QString& msg);
|
|
|
|
|
|
|
|
/** Shows the error message \a msg inside the statusbar. */
|
|
|
|
void showErrorMessage(const QString& msg);
|
|
|
|
|
|
|
|
void emitSelectionChangedSignal();
|
|
|
|
void closeFilterBar();
|
2006-11-21 06:02:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Filters the currently shown items by \a nameFilter. All items
|
|
|
|
* which contain the given filter string will be shown.
|
|
|
|
*/
|
2007-01-23 21:44:52 +00:00
|
|
|
void changeNameFilter(const QString& nameFilter);
|
2006-11-21 06:02:05 +00:00
|
|
|
|
2007-02-16 17:03:02 +00:00
|
|
|
/**
|
|
|
|
* 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);
|
|
|
|
|
|
|
|
/**
|
2007-03-11 11:13:07 +00:00
|
|
|
* Drops the URLs \a urls to the index \a index. \a source
|
|
|
|
* indicates the widget where the dragging has been started from.
|
2007-02-16 17:03:02 +00:00
|
|
|
*/
|
|
|
|
void dropUrls(const KUrl::List& urls,
|
2007-03-11 11:13:07 +00:00
|
|
|
const QModelIndex& index,
|
|
|
|
QWidget* source);
|
2007-02-14 21:54:24 +00:00
|
|
|
|
2007-02-17 10:31:52 +00:00
|
|
|
/**
|
|
|
|
* Drops the URLs \a urls at the
|
|
|
|
* destination \a destination.
|
|
|
|
*/
|
|
|
|
void dropUrls(const KUrl::List& urls,
|
|
|
|
const KUrl& destination);
|
2007-02-14 21:54:24 +00:00
|
|
|
/**
|
|
|
|
* Updates the view properties of the current URL to the
|
|
|
|
* sorting given by \a sorting.
|
|
|
|
*/
|
|
|
|
void updateSorting(DolphinView::Sorting sorting);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Updates the view properties of the current URL to the
|
|
|
|
* sort order given by \a order.
|
|
|
|
*/
|
|
|
|
void updateSortOrder(Qt::SortOrder order);
|
|
|
|
|
2007-02-17 07:16:59 +00:00
|
|
|
/**
|
|
|
|
* Emits the signal contentsMoved with the current coordinates
|
|
|
|
* of the viewport as parameters.
|
|
|
|
*/
|
|
|
|
void emitContentsMoved();
|
|
|
|
|
2007-02-17 10:31:52 +00:00
|
|
|
/**
|
|
|
|
* Updates the activation state of the view by checking whether
|
|
|
|
* the currently active view is this view.
|
|
|
|
*/
|
|
|
|
void updateActivationState();
|
|
|
|
|
2007-03-22 19:25:44 +00:00
|
|
|
/** Applies an item effect to all cut items of the clipboard. */
|
|
|
|
void updateCutItems();
|
|
|
|
|
2006-11-21 06:02:05 +00:00
|
|
|
private:
|
|
|
|
void startDirLister(const KUrl& url, bool reload = false);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the default text of the status bar, if no item is
|
|
|
|
* selected.
|
|
|
|
*/
|
|
|
|
QString defaultStatusBarText() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the text for the status bar, if at least one item
|
|
|
|
* is selected.
|
|
|
|
*/
|
|
|
|
QString selectionStatusBarText() const;
|
|
|
|
|
2006-11-24 22:28:49 +00:00
|
|
|
/**
|
2007-03-11 17:51:37 +00:00
|
|
|
* Creates a new view representing the given view mode (DolphinView::mode()).
|
2007-01-15 06:43:17 +00:00
|
|
|
* The current view will get deleted.
|
2006-11-24 22:28:49 +00:00
|
|
|
*/
|
2007-01-15 06:43:17 +00:00
|
|
|
void createView();
|
2006-11-24 22:28:49 +00:00
|
|
|
|
2006-12-14 19:54:59 +00:00
|
|
|
/**
|
|
|
|
* Selects all items by using the selection flags \a flags. This is a helper
|
|
|
|
* method for the slots DolphinView::selectAll() and DolphinView::invertSelection().
|
|
|
|
*/
|
|
|
|
void selectAll(QItemSelectionModel::SelectionFlags flags);
|
|
|
|
|
2007-01-15 06:43:17 +00:00
|
|
|
/**
|
|
|
|
* Returns a pointer to the currently used item view, which is either
|
|
|
|
* a ListView or a TreeView.
|
|
|
|
*/
|
|
|
|
QAbstractItemView* itemView() const;
|
|
|
|
|
2007-03-08 05:43:33 +00:00
|
|
|
/**
|
|
|
|
* Returns true if the index is valid and represents
|
|
|
|
* the column KDirModel::Name.
|
|
|
|
*/
|
|
|
|
bool isValidNameIndex(const QModelIndex& index) const;
|
|
|
|
|
2007-03-10 21:58:55 +00:00
|
|
|
/**
|
|
|
|
* Returns true, if the item \a item has been cut into
|
|
|
|
* the clipboard.
|
|
|
|
*/
|
|
|
|
bool isCutItem(const KFileItem& item) const;
|
|
|
|
|
2007-03-22 19:25:44 +00:00
|
|
|
/** Applies an item effect to all cut items. */
|
|
|
|
void applyCutItemEffect();
|
|
|
|
|
2006-12-14 19:12:05 +00:00
|
|
|
private:
|
2007-03-22 19:25:44 +00:00
|
|
|
/**
|
|
|
|
* Remembers the original pixmap for an item before
|
|
|
|
* the cut effect is applied.
|
|
|
|
*/
|
|
|
|
struct CutItem {
|
|
|
|
KUrl url;
|
|
|
|
QPixmap pixmap;
|
|
|
|
};
|
|
|
|
|
2006-11-21 06:02:05 +00:00
|
|
|
bool m_showProgress;
|
2007-03-19 15:59:23 +00:00
|
|
|
bool m_blockContentsMovedSignal;
|
2006-11-21 06:02:05 +00:00
|
|
|
Mode m_mode;
|
|
|
|
|
2006-12-14 23:49:30 +00:00
|
|
|
int m_iconSize;
|
|
|
|
int m_folderCount;
|
|
|
|
int m_fileCount;
|
|
|
|
|
2006-12-08 23:41:08 +00:00
|
|
|
DolphinMainWindow* m_mainWindow;
|
2006-12-04 05:46:34 +00:00
|
|
|
QVBoxLayout* m_topLayout;
|
2006-11-22 17:13:11 +00:00
|
|
|
UrlNavigator* m_urlNavigator;
|
2007-01-15 06:43:17 +00:00
|
|
|
|
2007-02-14 21:54:24 +00:00
|
|
|
DolphinController* m_controller;
|
2006-11-21 06:02:05 +00:00
|
|
|
DolphinIconsView* m_iconsView;
|
2007-01-15 06:43:17 +00:00
|
|
|
DolphinDetailsView* m_detailsView;
|
2007-03-11 16:47:12 +00:00
|
|
|
KFileItemDelegate* m_fileItemDelegate;
|
2007-01-15 06:43:17 +00:00
|
|
|
|
2007-01-25 16:56:52 +00:00
|
|
|
FilterBar* m_filterBar;
|
2006-11-21 06:02:05 +00:00
|
|
|
DolphinStatusBar* m_statusBar;
|
|
|
|
|
2006-12-15 01:56:57 +00:00
|
|
|
KDirModel* m_dirModel;
|
2006-11-21 06:02:05 +00:00
|
|
|
DolphinDirLister* m_dirLister;
|
2006-12-14 23:49:30 +00:00
|
|
|
DolphinSortFilterProxyModel* m_proxyModel;
|
2007-03-22 19:25:44 +00:00
|
|
|
|
|
|
|
QList<CutItem> m_cutItemsCache;
|
2006-11-21 06:02:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _DOLPHINVIEW_H_
|