]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinmainwindow.h
allow to enable the categorization feature for sorting
[dolphin.git] / src / dolphinmainwindow.h
index 7a71b685c2905801308b1d10ab0fea543be405f6..bdb7ec59aeb6827a08386cda03ffae158bf90560 100644 (file)
  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
  ***************************************************************************/
 
-#ifndef _DOLPHIN_MAINWINDOW_H_
-#define _DOLPHIN_MAINWINDOW_H_
+#ifndef DOLPHIN_MAINWINDOW_H
+#define DOLPHIN_MAINWINDOW_H
 
 #include "dolphinview.h"
+#include "sidebarpage.h"
 
 #include <kmainwindow.h>
 #include <ksortablelist.h>
-#include <konq_operations.h>
 #include <konq_undo.h>
 
 #include <QList>
 
+class DolphinApplication;
 class KNewMenu;
-class KPrinter;
 class KUrl;
-class QLineEdit;
-class KFileIconView;
-class KHBox;
-class Q3IconViewItem;
 class QSplitter;
-class KAction;
-class UrlNavigator;
-class DolphinApplication;
 
 /**
  * @short Main window for Dolphin.
@@ -58,33 +51,25 @@ class DolphinMainWindow: public KMainWindow
 public:
     virtual ~DolphinMainWindow();
 
-       /**
-     * Activates the given view, which means that
-     * all menu actions are applied to this view. When
-     * having a split view setup the nonactive view
-     * is usually shown in darker colors.
-     */
+    /**
+        * Activates the given view, which means that
+        * all menu actions are applied to this view. When
+        * having a split view setup the nonactive view
+        * is usually shown in darker colors.
+        */
     void setActiveView(DolphinView* view);
 
     /**
      * Returns the currently active view. See
      * DolphinMainWindow::setActiveView() for more details.
      */
-    DolphinView* activeView() const { return m_activeView; }
+    DolphinView* activeView() const
+    {
+        return m_activeView;
+    }
 
-    /**
-     * Handles the dropping of Urls to the given
-     * destination. A context menu with the options
-     * 'Move Here', 'Copy Here', 'Link Here' and
-     * 'Cancel' is offered to the user.
-     * @param urls        List of Urls which have been
-     *                    dropped.
-     * @param destination Destination Url, where the
-     *                    list or Urls should be moved,
-     *                    copied or linked to.
-     */
-    void dropUrls(const KUrl::List& urls,
-                  const KUrl& destination);
+    /** Renames the item represented by \a oldUrl to \a newUrl. */
+    void rename(const KUrl& oldUrl, const KUrl& newUrl);
 
     /**
      * Refreshs the views of the main window by recreating them dependent from
@@ -96,18 +81,45 @@ public:
      * Returns the 'Create New...' sub menu which also can be shared
      * with other menus (e. g. a context menu).
      */
-    KNewMenu* newMenu() const { return m_newMenu; }
+    KNewMenu* newMenu() const
+    {
+        return m_newMenu;
+    }
 
 public slots:
     /**
-     * Returns the main windows ID, mainly used throught DBus.
+     * Handles the dropping of URLs to the given
+     * destination. A context menu with the options
+     * 'Move Here', 'Copy Here', 'Link Here' and
+     * 'Cancel' is offered to the user.
+     * @param urls        List of URLs which have been
+     *                    dropped.
+     * @param destination Destination URL, where the
+     *                    list or URLs should be moved,
+     *                    copied or linked to.
+     */
+    void dropUrls(const KUrl::List& urls,
+                  const KUrl& destination);
+
+    /**
+     * Returns the main window ID used through DBus.
+     */
+    int getId() const
+    {
+        return m_id;
+    }
+
+    /**
+     * Inform all affected dolphin components (sidebars, views) of an URL
+     * change.
      */
-    int getId() const { return m_id; }
+    void changeUrl(const KUrl& url);
 
     /**
-     * Changes the URL of the current active DolphinView to \a url.
+     * Inform all affected dolphin components that a selection change is
+     * requested.
      */
-    void changeUrl(const QString& url);
+    void changeSelection(const KFileItemList& selection);
 
     /** Stores all settings and quits Dolphin. */
     void quit();
@@ -120,10 +132,16 @@ signals:
     void activeViewChanged();
 
     /**
-     * Is send if the selection of the currently active view has
+     * Is sent if the selection of the currently active view has
+     * been changed.
+     */
+    void selectionChanged(const KFileItemList& selection);
+
+    /**
+     * Is sent if the url of the currently active view has
      * been changed.
      */
-    void selectionChanged();
+    void urlChanged(const KUrl& url);
 
 protected:
     /** @see QMainWindow::closeEvent */
@@ -146,7 +164,10 @@ private slots:
     /** Updates the 'Create New...' sub menu. */
     void updateNewMenu();
 
-    /** Renames the selected item of the active view. */
+    /**
+     * Let the user input a name for the selected item(s) and trigger
+     * a renaming afterwards.
+     */
     void rename();
 
     /** Moves the selected items of the active view to the trash. */
@@ -220,6 +241,9 @@ private slots:
     /** The current active view is switched to the details mode. */
     void setDetailsView();
 
+    /** The current active view is switched to the column mode. */
+    void setColumnView();
+
     /** The sorting of the current view should be done by the name. */
     void sortByName();
 
@@ -241,6 +265,24 @@ private slots:
     /** Switches between an ascending and descending sorting order. */
     void toggleSortOrder();
 
+    /** Switches between sorting by categories or not. */
+    void toggleSortCategorization();
+
+    /**
+     * Clears any additional information for an item except for the
+     * name and the icon.
+     */
+    void clearInfo();
+
+    /** Shows the MIME type as additional information for the item. */
+    void showMimeInfo();
+
+    /** Shows the size as additional information for the item. */
+    void showSizeInfo();
+
+    /** Shows the date as additional information for the item. */
+    void showDateInfo();
+
     /**
      * Switches between one and two views:
      * If one view is visible, it will get split into two views.
@@ -292,16 +334,16 @@ private slots:
      */
     void adjustViewProperties();
 
-    /** Goes back on step of the Url history. */
+    /** Goes back on step of the URL history. */
     void goBack();
 
-    /** Goes forward one step of the Url history. */
+    /** Goes forward one step of the URL history. */
     void goForward();
 
-    /** Goes up one hierarchy of the current Url. */
+    /** Goes up one hierarchy of the current URL. */
     void goUp();
 
-    /** Goes to the home Url. */
+    /** Goes to the home URL. */
     void goHome();
 
     /** Opens a terminal for the current shown directory. */
@@ -319,17 +361,26 @@ private slots:
     /** Updates the state of all 'View' menu actions. */
     void slotViewModeChanged();
 
+    /** Updates the state of the 'Show preview' menu action. */
+    void slotShowPreviewChanged();
+
     /** Updates the state of the 'Show hidden files' menu action. */
     void slotShowHiddenFilesChanged();
 
+    /** Updates the state of the 'Categorized sorting' menu action. */
+    void slotCategorizedSortingChanged();
+
     /** Updates the state of the 'Sort by' actions. */
     void slotSortingChanged(DolphinView::Sorting sorting);
 
     /** Updates the state of the 'Sort Ascending/Descending' action. */
     void slotSortOrderChanged(Qt::SortOrder order);
 
+    /** Updates the state of the 'Additional Information' actions. */
+    void slotAdditionalInfoChanged(KFileItemDelegate::AdditionalInformation info);
+
     /** Updates the state of the 'Edit' menu actions. */
-    void slotSelectionChanged();
+    void slotSelectionChanged(const KFileItemList& selection);
 
     /**
      * Updates the state of the 'Back' and 'Forward' menu
@@ -337,12 +388,6 @@ private slots:
      */
     void slotHistoryChanged();
 
-    /**
-     * Updates the caption of the main window and the state
-     * of all menu actions which depend from a changed Url.
-     */
-    void slotUrlChanged(const KUrl& url);
-
     /** Updates the state of the 'Show filter bar' menu action. */
     void updateFilterBarAction(bool show);
 
@@ -374,6 +419,11 @@ private:
      */
     void connectViewSignals(int viewIndex);
 
+    /**
+     * Helper function to connect all signal/slots of the given \sidebar.
+     */
+    void connectSidebarPage(SidebarPage* sidebar);
+
 private:
     /**
      * DolphinMainWindowsupports only one or two views, which
@@ -390,7 +440,7 @@ private:
      * assures that all errors are shown in the status bar of Dolphin
      * instead as modal error dialog with an OK button.
      */
-    class UndoUiInterface : public KonqUndoManager::UiInterface
+class UndoUiInterface : public KonqUndoManager::UiInterface
     {
     public:
         UndoUiInterface(DolphinMainWindow* mainWin);
@@ -409,8 +459,8 @@ private:
     DolphinView* m_view[SecondaryIdx + 1];
 
     /// remember pending undo operations until they are finished
-    QList<KonqOperations::Operation> m_undoOperations;
+    QList<KonqUndoManager::CommandType> m_undoCommandTypes;
 };
 
-#endif // _DOLPHIN_H_
+#endif // DOLPHIN_MAINWINDOW_H