]>
cloud.milkyroute.net Git - dolphin.git/blob - src/dolphintabpage.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_PAGE_H
21 #define DOLPHIN_TAB_PAGE_H
28 class DolphinViewContainer
;
31 class DolphinTabPage
: public QWidget
36 explicit DolphinTabPage(const QUrl
& primaryUrl
, const QUrl
& secondaryUrl
= QUrl(), QWidget
* parent
= 0);
39 * @return True if primary view is the active view in this tab.
41 bool primaryViewActive() const;
44 * @return True if split view is enabled.
46 bool splitViewEnabled() const;
49 * Enables or disables the split view mode.
51 * If \a enabled is true, it creates a secondary view with the url of the primary view.
53 void setSplitViewEnabled(bool enabled
);
56 * @return The primary view containter.
58 DolphinViewContainer
* primaryViewContainer() const;
61 * @return The secondary view containter, can be 0 if split view is disabled.
63 DolphinViewContainer
* secondaryViewContainer() const;
66 * @return DolphinViewContainer of the active view
68 DolphinViewContainer
* activeViewContainer() const;
71 * Returns the selected items. The list is empty if no item has been
74 KFileItemList
selectedItems() const;
77 * Returns the number of selected items (this is faster than
78 * invoking selectedItems().count()).
80 int selectedItemsCount() const;
83 * Marks the items indicated by \p urls to get selected after the
84 * directory DolphinView::url() has been loaded. Note that nothing
85 * gets selected if no loading of a directory has been triggered
86 * by DolphinView::setUrl() or DolphinView::reload().
88 void markUrlsAsSelected(const QList
<QUrl
> &urls
);
91 * Marks the item indicated by \p url to be scrolled to and as the
92 * current item after directory DolphinView::url() has been loaded.
94 void markUrlAsCurrent(const QUrl
& url
);
97 * Sets the places selector visible, if \a visible is true.
98 * The places selector allows to select the places provided
99 * by the places model passed in the constructor. Per default
100 * the places selector is visible.
102 void setPlacesSelectorVisible(bool visible
);
105 * Refreshes the views of the main window by recreating them according to
106 * the given Dolphin settings.
111 * Saves all tab related properties (urls, splitter layout, ...).
113 * @return A byte-array which contains all properties.
115 QByteArray
saveState() const;
118 * Restores all tab related properties (urls, splitter layout, ...) from
119 * the given \a state.
121 void restoreState(const QByteArray
& state
);
124 * Restores all tab related properties (urls, splitter layout, ...) from
125 * the given \a state.
127 * @deprecated The first tab state version has no version number, we keep
128 * this method to restore old states (<= Dolphin 4.14.x).
130 void restoreStateV1(const QByteArray
& state
);
133 void activeViewChanged(DolphinViewContainer
* viewContainer
);
134 void activeViewUrlChanged(const QUrl
& url
);
138 * Handles the view activated event.
140 * It sets the previous active view to inactive, updates the current
141 * active view type and triggers the activeViewChanged event.
143 void slotViewActivated();
146 * Handles the view url redirection event.
148 * It emits the activeViewUrlChanged signal with the url \a newUrl.
150 void slotViewUrlRedirection(const QUrl
& oldUrl
, const QUrl
& newUrl
);
152 void switchActiveView();
156 * Creates a new view container and does the default initialization.
158 DolphinViewContainer
* createViewContainer(const QUrl
& url
) const;
161 QSplitter
* m_splitter
;
163 QPointer
<DolphinViewContainer
> m_primaryViewContainer
;
164 QPointer
<DolphinViewContainer
> m_secondaryViewContainer
;
166 bool m_primaryViewActive
;
167 bool m_splitViewEnabled
;
170 #endif // DOLPHIN_TAB_PAGE_H