]>
cloud.milkyroute.net Git - dolphin.git/blob - src/dolphintabwidget.h
1 /***************************************************************************
2 * Copyright (C) 2014 by Emmanuel Pescosta <emmanuelpescosta099@gmail.com> *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
20 #ifndef DOLPHIN_TAB_WIDGET_H
21 #define DOLPHIN_TAB_WIDGET_H
26 class DolphinViewContainer
;
30 class DolphinTabWidget
: public QTabWidget
35 explicit DolphinTabWidget(QWidget
* parent
);
38 * @return Tab page at the current index (can be 0 if tabs count is smaller than 1)
40 DolphinTabPage
* currentTabPage() const;
43 * @return Tab page at the given \a index (can be 0 if the index is out-of-range)
45 DolphinTabPage
* tabPageAt(const int index
) const;
47 void saveProperties(KConfigGroup
& group
) const;
48 void readProperties(const KConfigGroup
& group
);
51 * Refreshes the views of the main window by recreating them according to
52 * the given Dolphin settings.
58 * Is emitted when the active view has been changed, by changing the current
59 * tab or by activating another view when split view is enabled in the current
62 void activeViewChanged(DolphinViewContainer
* viewContainer
);
65 * Is emitted when the number of open tabs has changed (e.g. by opening or
68 void tabCountChanged(int count
);
71 * Is emitted when a tab has been closed.
73 void rememberClosedTab(const QUrl
& url
, const QByteArray
& state
);
76 * Is emitted when the url of the current tab has been changed. This signal
77 * is also emitted when the active view has been changed.
79 void currentUrlChanged(const QUrl
& url
);
83 * Opens a new view with the current URL that is part of a tab and activates
86 void openNewActivatedTab();
89 * Opens a new tab showing the URL \a primaryUrl and the optional URL
90 * \a secondaryUrl and activates the tab.
92 void openNewActivatedTab(const QUrl
& primaryUrl
, const QUrl
& secondaryUrl
= QUrl());
95 * Opens a new tab in the background showing the URL \a primaryUrl and the
96 * optional URL \a secondaryUrl.
98 void openNewTab(const QUrl
&primaryUrl
, const QUrl
&secondaryUrl
= QUrl());
101 * Opens each directory in \p dirs in a separate tab. If \a splitView is set,
102 * 2 directories are collected within one tab.
103 * \pre \a dirs must contain at least one url.
105 void openDirectories(const QList
<QUrl
>& dirs
, bool splitView
);
108 * Opens the directories which contain the files \p files and selects all files.
109 * If \a splitView is set, 2 directories are collected within one tab.
110 * \pre \a files must contain at least one url.
112 void openFiles(const QList
<QUrl
> &files
, bool splitView
);
115 * Closes the currently active tab.
120 * Closes the tab with the index \a index and activates the tab with index - 1.
122 void closeTab(const int index
);
125 * Activates the next tab in the tab bar.
126 * If the current active tab is the last tab, it activates the first tab.
128 void activateNextTab();
131 * Activates the previous tab in the tab bar.
132 * If the current active tab is the first tab, it activates the last tab.
134 void activatePrevTab();
137 * Is invoked if the Places panel got visible/invisible and takes care
138 * that the places-selector of all views is only shown if the Places panel
141 void slotPlacesPanelVisibilityChanged(bool visible
);
144 * Is called when the user wants to reopen a previously closed tab from
145 * the recent tabs menu.
147 void restoreClosedTab(const QByteArray
& state
);
151 * Opens the tab with the index \a index in a new Dolphin instance and closes
154 void detachTab(int index
);
157 * Opens a new tab showing the url from tab at the given \a index and
160 void openNewActivatedTab(int index
);
163 * Is connected to the KTabBar signal receivedDropEvent.
164 * Allows dragging and dropping files onto tabs.
166 void tabDropEvent(int tab
, QDropEvent
* event
);
169 * The active view url of a tab has been changed so update the text and the
170 * icon of the corresponding tab.
172 void tabUrlChanged(const QUrl
& url
);
174 void currentTabChanged(int index
);
177 virtual void tabInserted(int index
) Q_DECL_OVERRIDE
;
178 virtual void tabRemoved(int index
) Q_DECL_OVERRIDE
;
182 * Returns the name of the tab for the URL \a url.
184 QString
tabName(const QUrl
& url
) const;
187 /** Caches the (negated) places panel visibility */
188 bool m_placesSelectorVisible
;