]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinmainwindow.h
Merge branch 'master' into frameworks
[dolphin.git] / src / dolphinmainwindow.h
index 7c3bff47fdd288c9e56f9e58461385659fdc80fd..fd231cf0b7f3005c5119bcffe4952301e59c9f30 100644 (file)
@@ -29,6 +29,7 @@
 #include <ksortablelist.h>
 #include <kxmlguiwindow.h>
 #include <KIcon>
+#include <KUrl>
 
 #include <QList>
 #include <QWeakPointer>
@@ -40,17 +41,13 @@ class DolphinApplication;
 class DolphinSettingsDialog;
 class DolphinViewContainer;
 class DolphinRemoteEncoding;
-class DolphinTabPage;
-class KAction;
+class DolphinTabWidget;
 class KFileItem;
 class KFileItemList;
 class KJob;
 class KNewFileMenu;
-class KTabBar;
-class KUrl;
-class QSplitter;
 class QToolButton;
-class QVBoxLayout;
+class QIcon;
 
 /**
  * @short Main window for Dolphin.
@@ -149,11 +146,6 @@ signals:
      */
     void settingsChanged();
 
-    /**
-     * Is emitted when a tab has been closed.
-     */
-    void rememberClosedTab(const KUrl& primaryUrl, const KUrl& secondaryUrl);
-
 protected:
     /** @see QWidget::showEvent() */
     virtual void showEvent(QShowEvent* event);
@@ -262,13 +254,6 @@ private slots:
      */
     void togglePanelLockState();
 
-    /**
-     * Is invoked if the Places panel got visible/invisible and takes care
-     * that the places-selector of all views is only shown if the Places panel
-     * is invisible.
-     */
-    void slotPlacesPanelVisibilityChanged(bool visible);
-
     /** Goes back one step of the URL history. */
     void goBack();
 
@@ -343,8 +328,11 @@ private slots:
     /** Open a new main window. */
     void openNewMainWindow();
 
-    /** Opens a new view with the current URL that is part of a tab. */
-    void openNewTab();
+    /**
+     * Opens a new view with the current URL that is part of a tab and
+     * activates it.
+     */
+    void openNewActivatedTab();
 
     /**
      * Opens a new tab in the background showing the URL \a primaryUrl and the
@@ -358,10 +346,6 @@ private slots:
      */
     void openNewActivatedTab(const KUrl& primaryUrl, const KUrl& secondaryUrl = KUrl());
 
-    void activateNextTab();
-
-    void activatePrevTab();
-
     /**
      * Opens the selected folder in a new tab.
      */
@@ -378,39 +362,6 @@ private slots:
      */
     void showCommand(CommandType command);
 
-    /**
-     * Activates the tab with the index \a index, which means that the current view
-     * is replaced by the view of the given tab.
-     */
-    void setActiveTab(int index);
-
-    /** Closes the currently active tab. */
-    void closeTab();
-
-    /**
-     * Closes the tab with the index \a index and activates the tab with index - 1.
-     */
-    void closeTab(int index);
-
-    /**
-     * Opens a context menu for the tab with the index \a index
-     * on the position \a pos.
-     */
-    void openTabContextMenu(int index, const QPoint& pos);
-
-    /**
-     * 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 KTabBar signal testCanDecode() and adjusts
-     * the output parameter \a accept.
-     */
-    void slotTestCanDecode(const QDragMoveEvent* event, bool& accept);
-
     /**
      * If the URL can be listed, open it in the current view, otherwise
      * run it through KRun.
@@ -423,12 +374,6 @@ private slots:
      */
     void slotHandleUrlStatFinished(KJob* job);
 
-    /**
-     * Is connected to the KTabBar signal receivedDropEvent.
-     * Allows dragging and dropping files onto tabs.
-     */
-    void tabDropEvent(int tab, QDropEvent* event);
-
     /**
      * Is invoked when the write state of a folder has been changed and
      * enables/disables the "Create New..." menu entry.
@@ -466,17 +411,31 @@ private slots:
      */
     void slotPlaceActivated(const KUrl& url);
 
-    void activeViewChanged();
+    /**
+     * Is called if the another view has been activated by changing the current
+     * tab or activating another view in split-view mode.
+     *
+     * 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 activeViewChanged(DolphinViewContainer* viewContainer);
+
+    void closedTabsCountChanged(unsigned int count);
 
-private:
     /**
-     * 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.
+     * Is called if a new tab has been opened or a tab has been closed to
+     * enable/disable the tab actions.
+     */
+    void tabCountChanged(int count);
+
+    /**
+     * Sets the window caption to url.fileName() if this is non-empty,
+     * "/" if the URL is "file:///", and url.protocol() otherwise.
      */
-    void setActiveViewContainer(DolphinViewContainer* view);
+    void setUrlAsCaption(const KUrl& url);
 
+private:
     void setupActions();
     void setupDockWidgets();
     void updateEditActions();
@@ -509,27 +468,15 @@ private:
      */
     void updateSplitAction();
 
-    /** Returns the name of the tab for the URL \a url. */
-    QString tabName(const KUrl& url) const;
-
-
     bool isKompareInstalled() 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;
-
     /**
      * Creates an action for showing/hiding a panel, that is accessible
      * in "Configure toolbars..." and "Configure shortcuts...". This is necessary
      * as the action for toggling the dock visibility is done by Qt which
      * is no KAction instance.
      */
-    void createPanelAction(const KIcon& icon,
+    void createPanelAction(const QIcon &icon,
                            const QKeySequence& shortcut,
                            QAction* dockAction,
                            const QString& actionName);
@@ -549,14 +496,10 @@ private:
     };
 
     KNewFileMenu* m_newFileMenu;
-    KTabBar* m_tabBar;
+    DolphinTabWidget* m_tabWidget;
     DolphinViewContainer* m_activeViewContainer;
-    QVBoxLayout* m_centralWidgetLayout;
     int m_id;
 
-    int m_tabIndex;
-    QList<DolphinTabPage*> m_viewTab;
-
     DolphinViewActionHandler* m_actionHandler;
     DolphinRemoteEncoding* m_remoteEncoding;
     QWeakPointer<DolphinSettingsDialog> m_settingsDialog;