]>
cloud.milkyroute.net Git - dolphin.git/blob - src/dolphintabpage.h
2 * SPDX-FileCopyrightText: 2014 Emmanuel Pescosta <emmanuelpescosta099@gmail.com>
4 * SPDX-License-Identifier: GPL-2.0-or-later
7 #ifndef DOLPHIN_TAB_PAGE_H
8 #define DOLPHIN_TAB_PAGE_H
15 class DolphinViewContainer
;
18 class DolphinTabPage
: public QWidget
23 explicit DolphinTabPage(const QUrl
& primaryUrl
, const QUrl
& secondaryUrl
= QUrl(), QWidget
* parent
= nullptr);
26 * @return True if primary view is the active view in this tab.
28 bool primaryViewActive() const;
31 * @return True if split view is enabled.
33 bool splitViewEnabled() const;
36 * Enables or disables the split view mode.
38 * If \a enabled is true, it creates a secondary view with the url of the primary view.
40 void setSplitViewEnabled(bool enabled
, const QUrl
&secondaryUrl
= QUrl());
43 * @return The primary view container.
45 DolphinViewContainer
* primaryViewContainer() const;
48 * @return The secondary view container, can be 0 if split view is disabled.
50 DolphinViewContainer
* secondaryViewContainer() const;
53 * @return DolphinViewContainer of the active view
55 DolphinViewContainer
* activeViewContainer() const;
58 * Returns the selected items. The list is empty if no item has been
61 KFileItemList
selectedItems() const;
64 * Returns the number of selected items (this is faster than
65 * invoking selectedItems().count()).
67 int selectedItemsCount() const;
70 * Marks the items indicated by \p urls to get selected after the
71 * directory DolphinView::url() has been loaded. Note that nothing
72 * gets selected if no loading of a directory has been triggered
73 * by DolphinView::setUrl() or DolphinView::reload().
75 void markUrlsAsSelected(const QList
<QUrl
> &urls
);
78 * Marks the item indicated by \p url to be scrolled to and as the
79 * current item after directory DolphinView::url() has been loaded.
81 void markUrlAsCurrent(const QUrl
& url
);
84 * Sets the places selector visible, if \a visible is true.
85 * The places selector allows to select the places provided
86 * by the places model passed in the constructor. Per default
87 * the places selector is visible.
89 void setPlacesSelectorVisible(bool visible
);
92 * Refreshes the views of the main window by recreating them according to
93 * the given Dolphin settings.
98 * Saves all tab related properties (urls, splitter layout, ...).
100 * @return A byte-array which contains all properties.
102 QByteArray
saveState() const;
105 * Restores all tab related properties (urls, splitter layout, ...) from
106 * the given \a state.
108 void restoreState(const QByteArray
& state
);
111 * Restores all tab related properties (urls, splitter layout, ...) from
112 * the given \a state.
114 * @deprecated The first tab state version has no version number, we keep
115 * this method to restore old states (<= Dolphin 4.14.x).
117 Q_DECL_DEPRECATED
void restoreStateV1(const QByteArray
& state
);
120 * Set whether the tab page is active
123 void setActive(bool active
);
126 void activeViewChanged(DolphinViewContainer
* viewContainer
);
127 void activeViewUrlChanged(const QUrl
& url
);
131 * Handles the view activated event.
133 * It sets the previous active view to inactive, updates the current
134 * active view type and triggers the activeViewChanged event.
136 void slotViewActivated();
139 * Handles the view url redirection event.
141 * It emits the activeViewUrlChanged signal with the url \a newUrl.
143 void slotViewUrlRedirection(const QUrl
& oldUrl
, const QUrl
& newUrl
);
145 void switchActiveView();
149 * Creates a new view container and does the default initialization.
151 DolphinViewContainer
* createViewContainer(const QUrl
& url
) const;
154 QSplitter
* m_splitter
;
156 QPointer
<DolphinViewContainer
> m_primaryViewContainer
;
157 QPointer
<DolphinViewContainer
> m_secondaryViewContainer
;
159 bool m_primaryViewActive
;
160 bool m_splitViewEnabled
;
164 #endif // DOLPHIN_TAB_PAGE_H