X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/b0fb590ebdad6f90f204c1482806a9da38b08598..0a6257bce3de877e4ae869f974df645c428d32c9:/src/dolphinmainwindow.h diff --git a/src/dolphinmainwindow.h b/src/dolphinmainwindow.h index 7c3bff47f..0505037ce 100644 --- a/src/dolphinmainwindow.h +++ b/src/dolphinmainwindow.h @@ -24,11 +24,11 @@ #include -#include #include #include #include -#include +#include +#include #include #include @@ -40,17 +40,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 +145,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 +253,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,24 +327,21 @@ 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 tab in the background showing the URL \a primaryUrl and the - * optional URL \a secondaryUrl. + * Opens a new view with the current URL that is part of a tab and + * activates it. */ - void openNewTab(const KUrl& primaryUrl, const KUrl& secondaryUrl = KUrl()); + void openNewActivatedTab(); /** - * Opens a new tab showing the URL \a primaryUrl and the optional URL - * \a secondaryUrl and activates the tab. + * Opens a new tab in the background showing the URL \a url. */ - void openNewActivatedTab(const KUrl& primaryUrl, const KUrl& secondaryUrl = KUrl()); + void openNewTab(const KUrl& url); - void activateNextTab(); - - void activatePrevTab(); + /** + * Opens a new tab showing the URL \a url and activates the tab. + */ + void openNewActivatedTab(const KUrl& url); /** * Opens the selected folder in a new tab. @@ -378,39 +359,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 +371,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 +408,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(); @@ -491,7 +447,7 @@ private: * case if it has not added already to the toolbar. * @return True if the action has been added to the menu. */ - bool addActionToMenu(QAction* action, KMenu* menu); + bool addActionToMenu(QAction* action, QMenu* menu); /** * Connects the signals from the created DolphinView with @@ -509,27 +465,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 +493,10 @@ private: }; KNewFileMenu* m_newFileMenu; - KTabBar* m_tabBar; + DolphinTabWidget* m_tabWidget; DolphinViewContainer* m_activeViewContainer; - QVBoxLayout* m_centralWidgetLayout; int m_id; - int m_tabIndex; - QList m_viewTab; - DolphinViewActionHandler* m_actionHandler; DolphinRemoteEncoding* m_remoteEncoding; QWeakPointer m_settingsDialog;