]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinmainwindow.h
Use a stat job to determine the caption on non-file URLs. This way we get the fancy...
[dolphin.git] / src / dolphinmainwindow.h
index 687eecddfefdf9eccc1333eb5d6b88ec4c68b739..c1411319a196290b7df0a4d8d79a1094c226e4d9 100644 (file)
@@ -41,14 +41,15 @@ class KAction;
 class DolphinViewActionHandler;
 class DolphinApplication;
 class DolphinSearchBox;
+class DolphinSearchOptionsConfigurator;
 class DolphinSettingsDialog;
 class DolphinViewContainer;
 class DolphinRemoteEncoding;
 class KNewMenu;
 class KTabBar;
 class KUrl;
-class QDropEvent;
 class QSplitter;
+class KJob;
 
 /**
  * @short Main window for Dolphin.
@@ -73,6 +74,19 @@ public:
      */
     DolphinViewContainer* activeViewContainer() const;
 
+    /**
+     * Opens each directory \p in a separate tab. If the "split view"
+     * option is enabled, 2 directories are collected within one tab.
+     */
+    void openDirectories(const QList<KUrl>& dirs);
+
+    /**
+     * Opens the directory which contains the files \p files
+     * and selects all files (implements the --select option
+     * of Dolphin).
+     */
+    void openFiles(const QList<KUrl>& files);
+
     /**
      * Returns true, if the main window contains two instances
      * of a view container. The active view constainer can be
@@ -123,17 +137,12 @@ public slots:
     int getId() const;
 
     /**
+     * Implementation of the MainWindowAdaptor/QDBusAbstractAdaptor interface.
      * Inform all affected dolphin components (panels, views) of an URL
      * change.
      */
     void changeUrl(const KUrl& url);
 
-    /**
-     * Inform all affected dolphin components that a selection change is
-     * requested.
-     */
-    void changeSelection(const KFileItemList& selection);
-
     /** Stores all settings and quits Dolphin. */
     void quit();
 
@@ -157,6 +166,9 @@ signals:
     void requestItemInfo(const KFileItem& item);
 
 protected:
+    /** @see QWidget::showEvent() */
+    virtual void showEvent(QShowEvent* event);
+
     /** @see QMainWindow::closeEvent() */
     virtual void closeEvent(QCloseEvent* event);
 
@@ -194,7 +206,7 @@ private slots:
 
     /**
      * Copies all selected items to the clipboard and marks
-     * the items as cutted.
+     * the items as cut.
      */
     void cut();
 
@@ -259,6 +271,24 @@ private slots:
     /** Goes up one hierarchy of the current URL. */
     void goUp();
 
+    /**
+     * Open the previous URL in the URL history in a new tab
+     * if the middle mouse button is clicked.
+     */
+    void goBack(Qt::MouseButtons buttons);
+
+    /**
+     * Open the next URL in the URL history in a new tab
+     * if the middle mouse button is clicked.
+     */
+    void goForward(Qt::MouseButtons buttons);
+
+    /**
+     * Open the URL one hierarchy above the current URL in a new tab
+     * if the middle mouse button is clicked.
+     */
+    void goUp(Qt::MouseButtons buttons);
+
     /** Goes to the home URL. */
     void goHome();
 
@@ -370,10 +400,35 @@ private slots:
     void slotTestCanDecode(const QDragMoveEvent* event, bool& accept);
 
     /**
-     * Is connected with the Dolphin search box and searchs items that
-     * match to the text entered in the search bar.
+     * Is connected with the Dolphin search box and the search configurator
+     * and triggers a Nepomuk search.
+     */
+    void searchItems();
+
+    /**
+     * Is connected to the QTabBar signal tabMoved(int from, int to).
+     * Reorders the list of tabs after a tab was moved in the tab bar
+     * and sets m_tabIndex to the new index of the current tab.
+     */
+    void slotTabMoved(int from, int to);
+
+    /**
+     * Is connected to the searchbox signal 'requestSearchOptions' and
+     * takes care to show the search options.
+     */
+    void showSearchOptions();
+
+    /**
+     * If the URL can be listed open it in the current view, otherwise
+     * run it through KRun.
      */
-    void searchItems(const KUrl& url);
+    void handleUrl(const KUrl& url);
+
+    /**
+     * setUrlAsCaption will trigger a stat job which reports its result in
+     * this slot.
+     */
+    void slotCaptionStatFinished( KJob* job );
 
 private:
     DolphinMainWindow(int id);
@@ -428,6 +483,14 @@ private:
      */
     QString tabProperty(const QString& property, int tabIndex) const;
 
+    /**
+     * Sets the window caption to url.fileName() if this is non-empty,
+     * "/" if the URL is "file:///", and url.protocol() otherwise.
+     */
+    void setUrlAsCaption(const KUrl& url);
+
+    QString squeezedText(const QString& text) const;
+
 private:
     /**
      * Implements a custom error handling for the undo manager. This
@@ -449,6 +512,7 @@ private:
     DolphinViewContainer* m_activeViewContainer;
     QVBoxLayout* m_centralWidgetLayout;
     DolphinSearchBox* m_searchBox;
+    DolphinSearchOptionsConfigurator* m_searchOptionsConfigurator;
     int m_id;
 
     struct ViewTab
@@ -466,6 +530,8 @@ private:
     DolphinViewActionHandler* m_actionHandler;
     DolphinRemoteEncoding* m_remoteEncoding;
     QPointer<DolphinSettingsDialog> m_settingsDialog;
+
+    KJob* m_captionStatJob;
 };
 
 inline DolphinViewContainer* DolphinMainWindow::activeViewContainer() const