1 /***************************************************************************
2 * Copyright (C) 2007 by Peter Penz <peter.penz19@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 #include "dolphinviewcontainer.h"
22 #include "dolphin_generalsettings.h"
23 #include "dolphinplacesmodelsingleton.h"
24 #include "dolphindebug.h"
25 #include "filterbar/filterbar.h"
27 #include "search/dolphinsearchbox.h"
28 #include "statusbar/dolphinstatusbar.h"
29 #include "trash/dolphintrash.h"
30 #include "views/viewmodecontroller.h"
31 #include "views/viewproperties.h"
33 #include <KFileItemActions>
34 #include <KIO/PreviewJob>
35 #include <KLocalizedString>
36 #include <KMessageWidget>
37 #include <KProtocolManager>
40 #include <KUrlComboBox>
41 #include <KUrlNavigator>
42 #include <kio_version.h>
45 #include <QLoggingCategory>
49 #include <QVBoxLayout>
51 DolphinViewContainer::DolphinViewContainer(const QUrl
& url
, QWidget
* parent
) :
54 m_navigatorWidget(nullptr),
55 m_urlNavigator(nullptr),
56 m_emptyTrashButton(nullptr),
58 m_messageWidget(nullptr),
62 m_statusBarTimer(nullptr),
63 m_statusBarTimestamp(),
65 #ifdef KActivities_FOUND
66 , m_activityResourceInstance(0)
71 m_topLayout
= new QVBoxLayout(this);
72 m_topLayout
->setSpacing(0);
73 m_topLayout
->setMargin(0);
75 m_navigatorWidget
= new QWidget(this);
76 QHBoxLayout
* navigatorLayout
= new QHBoxLayout(m_navigatorWidget
);
77 navigatorLayout
->setSpacing(0);
78 navigatorLayout
->setMargin(0);
80 m_urlNavigator
= new KUrlNavigator(DolphinPlacesModelSingleton::instance().placesModel(), url
, this);
81 connect(m_urlNavigator
, &KUrlNavigator::activated
,
82 this, &DolphinViewContainer::activate
);
83 connect(m_urlNavigator
->editor(), &KUrlComboBox::completionModeChanged
,
84 this, &DolphinViewContainer::saveUrlCompletionMode
);
86 const GeneralSettings
* settings
= GeneralSettings::self();
87 m_urlNavigator
->setUrlEditable(settings
->editableUrl());
88 m_urlNavigator
->setShowFullPath(settings
->showFullPath());
89 m_urlNavigator
->setHomeUrl(Dolphin::homeUrl());
90 KUrlComboBox
* editor
= m_urlNavigator
->editor();
91 editor
->setCompletionMode(KCompletion::CompletionMode(settings
->urlCompletionMode()));
93 m_emptyTrashButton
= new QPushButton(QIcon::fromTheme(QStringLiteral("user-trash")), i18nc("@action:button", "Empty Trash"), this);
94 m_emptyTrashButton
->setFlat(true);
95 connect(m_emptyTrashButton
, &QPushButton::clicked
, this, [this]() { Trash::empty(this); });
96 connect(&Trash::instance(), &Trash::emptinessChanged
, m_emptyTrashButton
, &QPushButton::setDisabled
);
97 m_emptyTrashButton
->setDisabled(Trash::isEmpty());
98 m_emptyTrashButton
->hide();
100 m_searchBox
= new DolphinSearchBox(this);
102 connect(m_searchBox
, &DolphinSearchBox::activated
, this, &DolphinViewContainer::activate
);
103 connect(m_searchBox
, &DolphinSearchBox::closeRequest
, this, &DolphinViewContainer::closeSearchBox
);
104 connect(m_searchBox
, &DolphinSearchBox::searchRequest
, this, &DolphinViewContainer::startSearching
);
105 connect(m_searchBox
, &DolphinSearchBox::returnPressed
, this, &DolphinViewContainer::requestFocus
);
107 m_messageWidget
= new KMessageWidget(this);
108 m_messageWidget
->setCloseButtonVisible(true);
109 m_messageWidget
->hide();
114 // We must be logged in as the root user; show a big scary warning
115 showMessage(i18n("Running Dolphin as root can be dangerous. Please be careful."), Warning
);
119 m_view
= new DolphinView(url
, this);
120 connect(m_view
, &DolphinView::urlChanged
,
121 m_urlNavigator
, &KUrlNavigator::setLocationUrl
);
122 connect(m_view
, &DolphinView::urlChanged
,
123 m_messageWidget
, &KMessageWidget::hide
);
124 connect(m_view
, &DolphinView::writeStateChanged
,
125 this, &DolphinViewContainer::writeStateChanged
);
126 connect(m_view
, &DolphinView::requestItemInfo
,
127 this, &DolphinViewContainer::showItemInfo
);
128 connect(m_view
, &DolphinView::itemActivated
,
129 this, &DolphinViewContainer::slotItemActivated
);
130 connect(m_view
, &DolphinView::itemsActivated
,
131 this, &DolphinViewContainer::slotItemsActivated
);
132 connect(m_view
, &DolphinView::redirection
,
133 this, &DolphinViewContainer::redirect
);
134 connect(m_view
, &DolphinView::directoryLoadingStarted
,
135 this, &DolphinViewContainer::slotDirectoryLoadingStarted
);
136 connect(m_view
, &DolphinView::directoryLoadingCompleted
,
137 this, &DolphinViewContainer::slotDirectoryLoadingCompleted
);
138 connect(m_view
, &DolphinView::directoryLoadingCanceled
,
139 this, &DolphinViewContainer::slotDirectoryLoadingCanceled
);
140 connect(m_view
, &DolphinView::itemCountChanged
,
141 this, &DolphinViewContainer::delayedStatusBarUpdate
);
142 connect(m_view
, &DolphinView::directoryLoadingProgress
,
143 this, &DolphinViewContainer::updateDirectoryLoadingProgress
);
144 connect(m_view
, &DolphinView::directorySortingProgress
,
145 this, &DolphinViewContainer::updateDirectorySortingProgress
);
146 connect(m_view
, &DolphinView::selectionChanged
,
147 this, &DolphinViewContainer::delayedStatusBarUpdate
);
148 connect(m_view
, &DolphinView::errorMessage
,
149 this, &DolphinViewContainer::showErrorMessage
);
150 connect(m_view
, &DolphinView::urlIsFileError
,
151 this, &DolphinViewContainer::slotUrlIsFileError
);
152 connect(m_view
, &DolphinView::activated
,
153 this, &DolphinViewContainer::activate
);
155 connect(m_urlNavigator
, &KUrlNavigator::urlAboutToBeChanged
,
156 this, &DolphinViewContainer::slotUrlNavigatorLocationAboutToBeChanged
);
157 connect(m_urlNavigator
, &KUrlNavigator::urlChanged
,
158 this, &DolphinViewContainer::slotUrlNavigatorLocationChanged
);
159 connect(m_urlNavigator
, &KUrlNavigator::urlSelectionRequested
,
160 this, &DolphinViewContainer::slotUrlSelectionRequested
);
161 connect(m_urlNavigator
, &KUrlNavigator::returnPressed
,
162 this, &DolphinViewContainer::slotReturnPressed
);
163 connect(m_urlNavigator
, &KUrlNavigator::urlsDropped
, this, [=](const QUrl
&destination
, QDropEvent
*event
) {
164 #if KIO_VERSION >= QT_VERSION_CHECK(5, 37, 0)
165 m_view
->dropUrls(destination
, event
, m_urlNavigator
->dropWidget());
167 // TODO: remove as soon as we can hard-depend of KF5 >= 5.37
168 m_view
->dropUrls(destination
, event
, m_view
);
172 connect(m_view
, &DolphinView::directoryLoadingCompleted
, this, [this]() {
173 m_emptyTrashButton
->setVisible(m_view
->url().scheme() == QLatin1String("trash"));
176 // Initialize status bar
177 m_statusBar
= new DolphinStatusBar(this);
178 m_statusBar
->setUrl(m_view
->url());
179 m_statusBar
->setZoomLevel(m_view
->zoomLevel());
180 connect(m_view
, &DolphinView::urlChanged
,
181 m_statusBar
, &DolphinStatusBar::setUrl
);
182 connect(m_view
, &DolphinView::zoomLevelChanged
,
183 m_statusBar
, &DolphinStatusBar::setZoomLevel
);
184 connect(m_view
, &DolphinView::infoMessage
,
185 m_statusBar
, &DolphinStatusBar::setText
);
186 connect(m_view
, &DolphinView::operationCompletedMessage
,
187 m_statusBar
, &DolphinStatusBar::setText
);
188 connect(m_statusBar
, &DolphinStatusBar::stopPressed
,
189 this, &DolphinViewContainer::stopDirectoryLoading
);
190 connect(m_statusBar
, &DolphinStatusBar::zoomLevelChanged
,
191 this, &DolphinViewContainer::slotStatusBarZoomLevelChanged
);
193 m_statusBarTimer
= new QTimer(this);
194 m_statusBarTimer
->setSingleShot(true);
195 m_statusBarTimer
->setInterval(300);
196 connect(m_statusBarTimer
, &QTimer::timeout
, this, &DolphinViewContainer::updateStatusBar
);
198 KIO::FileUndoManager
* undoManager
= KIO::FileUndoManager::self();
199 connect(undoManager
, &KIO::FileUndoManager::jobRecordingFinished
,
200 this, &DolphinViewContainer::delayedStatusBarUpdate
);
202 // Initialize filter bar
203 m_filterBar
= new FilterBar(this);
204 m_filterBar
->setVisible(settings
->filterBar());
205 connect(m_filterBar
, &FilterBar::filterChanged
,
206 this, &DolphinViewContainer::setNameFilter
);
207 connect(m_filterBar
, &FilterBar::closeRequest
,
208 this, &DolphinViewContainer::closeFilterBar
);
209 connect(m_filterBar
, &FilterBar::focusViewRequest
,
210 this, &DolphinViewContainer::requestFocus
);
211 connect(m_view
, &DolphinView::urlChanged
,
212 m_filterBar
, &FilterBar::slotUrlChanged
);
214 navigatorLayout
->addWidget(m_urlNavigator
);
215 navigatorLayout
->addWidget(m_emptyTrashButton
);
217 m_topLayout
->addWidget(m_navigatorWidget
);
218 m_topLayout
->addWidget(m_searchBox
);
219 m_topLayout
->addWidget(m_messageWidget
);
220 m_topLayout
->addWidget(m_view
);
221 m_topLayout
->addWidget(m_filterBar
);
222 m_topLayout
->addWidget(m_statusBar
);
224 setSearchModeEnabled(isSearchUrl(url
));
226 // Initialize kactivities resource instance
228 #ifdef KActivities_FOUND
229 m_activityResourceInstance
= new KActivities::ResourceInstance(
230 window()->winId(), url
);
231 m_activityResourceInstance
->setParent(this);
235 DolphinViewContainer::~DolphinViewContainer()
239 QUrl
DolphinViewContainer::url() const
241 return m_view
->url();
244 void DolphinViewContainer::setActive(bool active
)
246 m_searchBox
->setActive(active
);
247 m_urlNavigator
->setActive(active
);
248 m_view
->setActive(active
);
250 #ifdef KActivities_FOUND
252 m_activityResourceInstance
->notifyFocusedIn();
254 m_activityResourceInstance
->notifyFocusedOut();
259 bool DolphinViewContainer::isActive() const
261 Q_ASSERT(m_view
->isActive() == m_urlNavigator
->isActive());
262 return m_view
->isActive();
265 void DolphinViewContainer::setAutoGrabFocus(bool grab
)
267 m_autoGrabFocus
= grab
;
270 bool DolphinViewContainer::autoGrabFocus() const
272 return m_autoGrabFocus
;
275 QString
DolphinViewContainer::currentSearchText() const
277 return m_searchBox
->text();
280 const DolphinStatusBar
* DolphinViewContainer::statusBar() const
285 DolphinStatusBar
* DolphinViewContainer::statusBar()
290 const KUrlNavigator
* DolphinViewContainer::urlNavigator() const
292 return m_urlNavigator
;
295 KUrlNavigator
* DolphinViewContainer::urlNavigator()
297 return m_urlNavigator
;
300 const DolphinView
* DolphinViewContainer::view() const
305 DolphinView
* DolphinViewContainer::view()
310 void DolphinViewContainer::showMessage(const QString
& msg
, MessageType type
)
316 m_messageWidget
->setText(msg
);
319 case Information
: m_messageWidget
->setMessageType(KMessageWidget::Information
); break;
320 case Warning
: m_messageWidget
->setMessageType(KMessageWidget::Warning
); break;
321 case Error
: m_messageWidget
->setMessageType(KMessageWidget::Error
); break;
327 m_messageWidget
->setWordWrap(false);
328 const int unwrappedWidth
= m_messageWidget
->sizeHint().width();
329 m_messageWidget
->setWordWrap(unwrappedWidth
> size().width());
331 if (m_messageWidget
->isVisible()) {
332 m_messageWidget
->hide();
334 m_messageWidget
->animatedShow();
337 void DolphinViewContainer::readSettings()
339 if (GeneralSettings::modifiedStartupSettings()) {
340 // The startup settings should only get applied if they have been
341 // modified by the user. Otherwise keep the (possibly) different current
342 // settings of the URL navigator and the filterbar.
343 m_urlNavigator
->setUrlEditable(GeneralSettings::editableUrl());
344 m_urlNavigator
->setShowFullPath(GeneralSettings::showFullPath());
345 m_urlNavigator
->setHomeUrl(Dolphin::homeUrl());
346 setFilterBarVisible(GeneralSettings::filterBar());
349 m_view
->readSettings();
350 m_statusBar
->readSettings();
353 bool DolphinViewContainer::isFilterBarVisible() const
355 return m_filterBar
->isVisible();
358 void DolphinViewContainer::setSearchModeEnabled(bool enabled
)
360 if (enabled
== isSearchModeEnabled()) {
361 if (enabled
&& !m_searchBox
->hasFocus()) {
362 m_searchBox
->setFocus();
363 m_searchBox
->selectAll();
368 m_searchBox
->setVisible(enabled
);
369 m_navigatorWidget
->setVisible(!enabled
);
372 const QUrl
& locationUrl
= m_urlNavigator
->locationUrl();
373 m_searchBox
->fromSearchUrl(locationUrl
);
375 m_view
->setViewPropertiesContext(QString());
377 // Restore the URL for the URL navigator. If Dolphin has been
378 // started with a search-URL, the home URL is used as fallback.
379 QUrl url
= m_searchBox
->searchPath();
380 if (url
.isEmpty() || !url
.isValid() || isSearchUrl(url
)) {
381 url
= Dolphin::homeUrl();
383 m_urlNavigator
->setLocationUrl(url
);
387 bool DolphinViewContainer::isSearchModeEnabled() const
389 return m_searchBox
->isVisible();
392 QString
DolphinViewContainer::placesText() const
396 if (isSearchModeEnabled()) {
397 text
= i18n("Search for %1 in %2", m_searchBox
->text(), m_searchBox
->searchPath().fileName());
399 text
= url().fileName();
400 if (text
.isEmpty()) {
403 if (text
.isEmpty()) {
404 text
= url().scheme();
411 void DolphinViewContainer::reload()
414 m_messageWidget
->hide();
417 void DolphinViewContainer::setUrl(const QUrl
& newUrl
)
419 if (newUrl
!= m_urlNavigator
->locationUrl()) {
420 m_urlNavigator
->setLocationUrl(newUrl
);
423 #ifdef KActivities_FOUND
424 m_activityResourceInstance
->setUri(newUrl
);
428 void DolphinViewContainer::setFilterBarVisible(bool visible
)
430 Q_ASSERT(m_filterBar
);
433 m_filterBar
->setFocus();
434 m_filterBar
->selectAll();
440 void DolphinViewContainer::delayedStatusBarUpdate()
442 if (m_statusBarTimer
->isActive() && (m_statusBarTimestamp
.elapsed() > 2000)) {
443 // No update of the statusbar has been done during the last 2 seconds,
444 // although an update has been requested. Trigger an immediate update.
445 m_statusBarTimer
->stop();
448 // Invoke updateStatusBar() with a small delay. This assures that
449 // when a lot of delayedStatusBarUpdates() are done in a short time,
450 // no bottleneck is given.
451 m_statusBarTimer
->start();
455 void DolphinViewContainer::updateStatusBar()
457 m_statusBarTimestamp
.start();
459 const QString text
= m_view
->statusBarText();
460 m_statusBar
->setDefaultText(text
);
461 m_statusBar
->resetToDefaultText();
464 void DolphinViewContainer::updateDirectoryLoadingProgress(int percent
)
466 if (m_statusBar
->progressText().isEmpty()) {
467 m_statusBar
->setProgressText(i18nc("@info:progress", "Loading folder..."));
469 m_statusBar
->setProgress(percent
);
472 void DolphinViewContainer::updateDirectorySortingProgress(int percent
)
474 if (m_statusBar
->progressText().isEmpty()) {
475 m_statusBar
->setProgressText(i18nc("@info:progress", "Sorting..."));
477 m_statusBar
->setProgress(percent
);
480 void DolphinViewContainer::slotDirectoryLoadingStarted()
482 if (isSearchUrl(url())) {
483 // Search KIO-slaves usually don't provide any progress information. Give
484 // a hint to the user that a searching is done:
486 m_statusBar
->setProgressText(i18nc("@info", "Searching..."));
487 m_statusBar
->setProgress(-1);
489 // Trigger an undetermined progress indication. The progress
490 // information in percent will be triggered by the percent() signal
491 // of the directory lister later.
492 updateDirectoryLoadingProgress(-1);
496 void DolphinViewContainer::slotDirectoryLoadingCompleted()
498 if (!m_statusBar
->progressText().isEmpty()) {
499 m_statusBar
->setProgressText(QString());
500 m_statusBar
->setProgress(100);
503 if (isSearchUrl(url()) && m_view
->itemsCount() == 0) {
504 // The dir lister has been completed on a Baloo-URI and no items have been found. Instead
505 // of showing the default status bar information ("0 items") a more helpful information is given:
506 m_statusBar
->setText(i18nc("@info:status", "No items found."));
512 void DolphinViewContainer::slotDirectoryLoadingCanceled()
514 if (!m_statusBar
->progressText().isEmpty()) {
515 m_statusBar
->setProgressText(QString());
516 m_statusBar
->setProgress(100);
519 m_statusBar
->setText(QString());
522 void DolphinViewContainer::slotUrlIsFileError(const QUrl
& url
)
524 const KFileItem
item(url
);
526 // Find out if the file can be opened in the view (for example, this is the
527 // case if the file is an archive). The mime type must be known for that.
528 item
.determineMimeType();
529 const QUrl
& folderUrl
= DolphinView::openItemAsFolderUrl(item
, true);
530 if (!folderUrl
.isEmpty()) {
533 slotItemActivated(item
);
537 void DolphinViewContainer::slotItemActivated(const KFileItem
& item
)
539 // It is possible to activate items on inactive views by
540 // drag & drop operations. Assure that activating an item always
541 // results in an active view.
542 m_view
->setActive(true);
544 const QUrl
& url
= DolphinView::openItemAsFolderUrl(item
, GeneralSettings::browseThroughArchives());
545 if (!url
.isEmpty()) {
550 KRun
*run
= new KRun(item
.targetUrl(), this);
551 run
->setShowScriptExecutionPrompt(true);
554 void DolphinViewContainer::slotItemsActivated(const KFileItemList
& items
)
556 Q_ASSERT(items
.count() >= 2);
558 KFileItemActions
fileItemActions(this);
559 fileItemActions
.runPreferredApplications(items
, QString());
562 void DolphinViewContainer::showItemInfo(const KFileItem
& item
)
565 m_statusBar
->resetToDefaultText();
567 m_statusBar
->setText(item
.getStatusBarInfo());
571 void DolphinViewContainer::closeFilterBar()
573 m_filterBar
->closeFilterBar();
575 emit
showFilterBarChanged(false);
578 void DolphinViewContainer::setNameFilter(const QString
& nameFilter
)
580 m_view
->setNameFilter(nameFilter
);
581 delayedStatusBarUpdate();
584 void DolphinViewContainer::activate()
589 void DolphinViewContainer::slotUrlNavigatorLocationAboutToBeChanged(const QUrl
&)
594 void DolphinViewContainer::slotUrlNavigatorLocationChanged(const QUrl
& url
)
598 if (KProtocolManager::supportsListing(url
)) {
599 setSearchModeEnabled(isSearchUrl(url
));
601 tryRestoreViewState();
603 if (m_autoGrabFocus
&& isActive() && !isSearchUrl(url
)) {
604 // When an URL has been entered, the view should get the focus.
605 // The focus must be requested asynchronously, as changing the URL might create
606 // a new view widget.
607 QTimer::singleShot(0, this, &DolphinViewContainer::requestFocus
);
609 } else if (KProtocolManager::isSourceProtocol(url
)) {
610 QString app
= QStringLiteral("konqueror");
611 if (url
.scheme().startsWith(QLatin1String("http"))) {
612 showMessage(i18nc("@info:status", // krazy:exclude=qmethods
613 "Dolphin does not support web pages, the web browser has been launched"),
616 const KConfigGroup
config(KSharedConfig::openConfig(QStringLiteral("kdeglobals")), "General");
617 const QString browser
= config
.readEntry("BrowserApplication");
618 if (!browser
.isEmpty()) {
620 if (app
.startsWith('!')) {
621 // a literal command has been configured, remove the '!' prefix
626 showMessage(i18nc("@info:status",
627 "Protocol not supported by Dolphin, Konqueror has been launched"),
631 const QString secureUrl
= KShell::quoteArg(url
.toDisplayString(QUrl::PreferLocalFile
));
632 const QString command
= app
+ ' ' + secureUrl
;
633 KRun::runCommand(command
, app
, app
, this);
635 showMessage(i18nc("@info:status", "Invalid protocol"), Error
);
639 void DolphinViewContainer::slotUrlSelectionRequested(const QUrl
& url
)
641 qCDebug(DolphinDebug
) << "slotUrlSelectionRequested: " << url
;
642 m_view
->markUrlsAsSelected({url
});
643 m_view
->markUrlAsCurrent(url
); // makes the item scroll into view
646 void DolphinViewContainer::redirect(const QUrl
& oldUrl
, const QUrl
& newUrl
)
649 const bool block
= m_urlNavigator
->signalsBlocked();
650 m_urlNavigator
->blockSignals(true);
652 // Assure that the location state is reset for redirection URLs. This
653 // allows to skip redirection URLs when going back or forward in the
655 m_urlNavigator
->saveLocationState(QByteArray());
656 m_urlNavigator
->setLocationUrl(newUrl
);
657 setSearchModeEnabled(isSearchUrl(newUrl
));
659 m_urlNavigator
->blockSignals(block
);
662 void DolphinViewContainer::requestFocus()
667 void DolphinViewContainer::saveUrlCompletionMode(KCompletion::CompletionMode completion
)
669 GeneralSettings::setUrlCompletionMode(completion
);
672 void DolphinViewContainer::slotReturnPressed()
674 if (!GeneralSettings::editableUrl()) {
675 m_urlNavigator
->setUrlEditable(false);
679 void DolphinViewContainer::startSearching()
681 const QUrl url
= m_searchBox
->urlForSearching();
682 if (url
.isValid() && !url
.isEmpty()) {
683 m_view
->setViewPropertiesContext(QStringLiteral("search"));
684 m_urlNavigator
->setLocationUrl(url
);
688 void DolphinViewContainer::closeSearchBox()
690 setSearchModeEnabled(false);
693 void DolphinViewContainer::stopDirectoryLoading()
695 m_view
->stopLoading();
696 m_statusBar
->setProgress(100);
699 void DolphinViewContainer::slotStatusBarZoomLevelChanged(int zoomLevel
)
701 m_view
->setZoomLevel(zoomLevel
);
704 void DolphinViewContainer::showErrorMessage(const QString
& msg
)
706 showMessage(msg
, Error
);
709 bool DolphinViewContainer::isSearchUrl(const QUrl
& url
) const
711 return url
.scheme().contains(QStringLiteral("search"));
714 void DolphinViewContainer::saveViewState()
716 QByteArray locationState
;
717 QDataStream
stream(&locationState
, QIODevice::WriteOnly
);
718 m_view
->saveState(stream
);
719 m_urlNavigator
->saveLocationState(locationState
);
722 void DolphinViewContainer::tryRestoreViewState()
724 QByteArray locationState
= m_urlNavigator
->locationState();
725 if (!locationState
.isEmpty()) {
726 QDataStream
stream(&locationState
, QIODevice::ReadOnly
);
727 m_view
->restoreState(stream
);