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 m_view
->dropUrls(destination
, event
, m_urlNavigator
->dropWidget());
167 connect(m_view
, &DolphinView::directoryLoadingCompleted
, this, [this]() {
168 m_emptyTrashButton
->setVisible(m_view
->url().scheme() == QLatin1String("trash"));
171 // Initialize status bar
172 m_statusBar
= new DolphinStatusBar(this);
173 m_statusBar
->setUrl(m_view
->url());
174 m_statusBar
->setZoomLevel(m_view
->zoomLevel());
175 connect(m_view
, &DolphinView::urlChanged
,
176 m_statusBar
, &DolphinStatusBar::setUrl
);
177 connect(m_view
, &DolphinView::zoomLevelChanged
,
178 m_statusBar
, &DolphinStatusBar::setZoomLevel
);
179 connect(m_view
, &DolphinView::infoMessage
,
180 m_statusBar
, &DolphinStatusBar::setText
);
181 connect(m_view
, &DolphinView::operationCompletedMessage
,
182 m_statusBar
, &DolphinStatusBar::setText
);
183 connect(m_statusBar
, &DolphinStatusBar::stopPressed
,
184 this, &DolphinViewContainer::stopDirectoryLoading
);
185 connect(m_statusBar
, &DolphinStatusBar::zoomLevelChanged
,
186 this, &DolphinViewContainer::slotStatusBarZoomLevelChanged
);
188 m_statusBarTimer
= new QTimer(this);
189 m_statusBarTimer
->setSingleShot(true);
190 m_statusBarTimer
->setInterval(300);
191 connect(m_statusBarTimer
, &QTimer::timeout
, this, &DolphinViewContainer::updateStatusBar
);
193 KIO::FileUndoManager
* undoManager
= KIO::FileUndoManager::self();
194 connect(undoManager
, &KIO::FileUndoManager::jobRecordingFinished
,
195 this, &DolphinViewContainer::delayedStatusBarUpdate
);
197 // Initialize filter bar
198 m_filterBar
= new FilterBar(this);
199 m_filterBar
->setVisible(settings
->filterBar());
200 connect(m_filterBar
, &FilterBar::filterChanged
,
201 this, &DolphinViewContainer::setNameFilter
);
202 connect(m_filterBar
, &FilterBar::closeRequest
,
203 this, &DolphinViewContainer::closeFilterBar
);
204 connect(m_filterBar
, &FilterBar::focusViewRequest
,
205 this, &DolphinViewContainer::requestFocus
);
206 connect(m_view
, &DolphinView::urlChanged
,
207 m_filterBar
, &FilterBar::slotUrlChanged
);
209 navigatorLayout
->addWidget(m_urlNavigator
);
210 navigatorLayout
->addWidget(m_emptyTrashButton
);
212 m_topLayout
->addWidget(m_navigatorWidget
);
213 m_topLayout
->addWidget(m_searchBox
);
214 m_topLayout
->addWidget(m_messageWidget
);
215 m_topLayout
->addWidget(m_view
);
216 m_topLayout
->addWidget(m_filterBar
);
217 m_topLayout
->addWidget(m_statusBar
);
219 setSearchModeEnabled(isSearchUrl(url
));
221 // Initialize kactivities resource instance
223 #ifdef KActivities_FOUND
224 m_activityResourceInstance
= new KActivities::ResourceInstance(
225 window()->winId(), url
);
226 m_activityResourceInstance
->setParent(this);
230 DolphinViewContainer::~DolphinViewContainer()
234 QUrl
DolphinViewContainer::url() const
236 return m_view
->url();
239 void DolphinViewContainer::setActive(bool active
)
241 m_searchBox
->setActive(active
);
242 m_urlNavigator
->setActive(active
);
243 m_view
->setActive(active
);
245 #ifdef KActivities_FOUND
247 m_activityResourceInstance
->notifyFocusedIn();
249 m_activityResourceInstance
->notifyFocusedOut();
254 bool DolphinViewContainer::isActive() const
256 Q_ASSERT(m_view
->isActive() == m_urlNavigator
->isActive());
257 return m_view
->isActive();
260 void DolphinViewContainer::setAutoGrabFocus(bool grab
)
262 m_autoGrabFocus
= grab
;
265 bool DolphinViewContainer::autoGrabFocus() const
267 return m_autoGrabFocus
;
270 QString
DolphinViewContainer::currentSearchText() const
272 return m_searchBox
->text();
275 const DolphinStatusBar
* DolphinViewContainer::statusBar() const
280 DolphinStatusBar
* DolphinViewContainer::statusBar()
285 const KUrlNavigator
* DolphinViewContainer::urlNavigator() const
287 return m_urlNavigator
;
290 KUrlNavigator
* DolphinViewContainer::urlNavigator()
292 return m_urlNavigator
;
295 const DolphinView
* DolphinViewContainer::view() const
300 DolphinView
* DolphinViewContainer::view()
305 void DolphinViewContainer::showMessage(const QString
& msg
, MessageType type
)
311 m_messageWidget
->setText(msg
);
314 case Information
: m_messageWidget
->setMessageType(KMessageWidget::Information
); break;
315 case Warning
: m_messageWidget
->setMessageType(KMessageWidget::Warning
); break;
316 case Error
: m_messageWidget
->setMessageType(KMessageWidget::Error
); break;
322 m_messageWidget
->setWordWrap(false);
323 const int unwrappedWidth
= m_messageWidget
->sizeHint().width();
324 m_messageWidget
->setWordWrap(unwrappedWidth
> size().width());
326 if (m_messageWidget
->isVisible()) {
327 m_messageWidget
->hide();
329 m_messageWidget
->animatedShow();
332 void DolphinViewContainer::readSettings()
334 if (GeneralSettings::modifiedStartupSettings()) {
335 // The startup settings should only get applied if they have been
336 // modified by the user. Otherwise keep the (possibly) different current
337 // settings of the URL navigator and the filterbar.
338 m_urlNavigator
->setUrlEditable(GeneralSettings::editableUrl());
339 m_urlNavigator
->setShowFullPath(GeneralSettings::showFullPath());
340 m_urlNavigator
->setHomeUrl(Dolphin::homeUrl());
341 setFilterBarVisible(GeneralSettings::filterBar());
344 m_view
->readSettings();
345 m_statusBar
->readSettings();
348 bool DolphinViewContainer::isFilterBarVisible() const
350 return m_filterBar
->isVisible();
353 void DolphinViewContainer::setSearchModeEnabled(bool enabled
)
355 if (enabled
== isSearchModeEnabled()) {
356 if (enabled
&& !m_searchBox
->hasFocus()) {
357 m_searchBox
->setFocus();
358 m_searchBox
->selectAll();
363 m_searchBox
->setVisible(enabled
);
364 m_navigatorWidget
->setVisible(!enabled
);
367 const QUrl
& locationUrl
= m_urlNavigator
->locationUrl();
368 m_searchBox
->fromSearchUrl(locationUrl
);
370 m_view
->setViewPropertiesContext(QString());
372 // Restore the URL for the URL navigator. If Dolphin has been
373 // started with a search-URL, the home URL is used as fallback.
374 QUrl url
= m_searchBox
->searchPath();
375 if (url
.isEmpty() || !url
.isValid() || isSearchUrl(url
)) {
376 url
= Dolphin::homeUrl();
378 m_urlNavigator
->setLocationUrl(url
);
382 bool DolphinViewContainer::isSearchModeEnabled() const
384 return m_searchBox
->isVisible();
387 QString
DolphinViewContainer::placesText() const
391 if (isSearchModeEnabled()) {
392 text
= i18n("Search for %1 in %2", m_searchBox
->text(), m_searchBox
->searchPath().fileName());
394 text
= url().fileName();
395 if (text
.isEmpty()) {
398 if (text
.isEmpty()) {
399 text
= url().scheme();
406 void DolphinViewContainer::reload()
409 m_messageWidget
->hide();
412 void DolphinViewContainer::setUrl(const QUrl
& newUrl
)
414 if (newUrl
!= m_urlNavigator
->locationUrl()) {
415 m_urlNavigator
->setLocationUrl(newUrl
);
418 #ifdef KActivities_FOUND
419 m_activityResourceInstance
->setUri(newUrl
);
423 void DolphinViewContainer::setFilterBarVisible(bool visible
)
425 Q_ASSERT(m_filterBar
);
428 m_filterBar
->setFocus();
429 m_filterBar
->selectAll();
435 void DolphinViewContainer::delayedStatusBarUpdate()
437 if (m_statusBarTimer
->isActive() && (m_statusBarTimestamp
.elapsed() > 2000)) {
438 // No update of the statusbar has been done during the last 2 seconds,
439 // although an update has been requested. Trigger an immediate update.
440 m_statusBarTimer
->stop();
443 // Invoke updateStatusBar() with a small delay. This assures that
444 // when a lot of delayedStatusBarUpdates() are done in a short time,
445 // no bottleneck is given.
446 m_statusBarTimer
->start();
450 void DolphinViewContainer::updateStatusBar()
452 m_statusBarTimestamp
.start();
454 const QString text
= m_view
->statusBarText();
455 m_statusBar
->setDefaultText(text
);
456 m_statusBar
->resetToDefaultText();
459 void DolphinViewContainer::updateDirectoryLoadingProgress(int percent
)
461 if (m_statusBar
->progressText().isEmpty()) {
462 m_statusBar
->setProgressText(i18nc("@info:progress", "Loading folder..."));
464 m_statusBar
->setProgress(percent
);
467 void DolphinViewContainer::updateDirectorySortingProgress(int percent
)
469 if (m_statusBar
->progressText().isEmpty()) {
470 m_statusBar
->setProgressText(i18nc("@info:progress", "Sorting..."));
472 m_statusBar
->setProgress(percent
);
475 void DolphinViewContainer::slotDirectoryLoadingStarted()
477 if (isSearchUrl(url())) {
478 // Search KIO-slaves usually don't provide any progress information. Give
479 // a hint to the user that a searching is done:
481 m_statusBar
->setProgressText(i18nc("@info", "Searching..."));
482 m_statusBar
->setProgress(-1);
484 // Trigger an undetermined progress indication. The progress
485 // information in percent will be triggered by the percent() signal
486 // of the directory lister later.
487 updateDirectoryLoadingProgress(-1);
491 void DolphinViewContainer::slotDirectoryLoadingCompleted()
493 if (!m_statusBar
->progressText().isEmpty()) {
494 m_statusBar
->setProgressText(QString());
495 m_statusBar
->setProgress(100);
498 if (isSearchUrl(url()) && m_view
->itemsCount() == 0) {
499 // The dir lister has been completed on a Baloo-URI and no items have been found. Instead
500 // of showing the default status bar information ("0 items") a more helpful information is given:
501 m_statusBar
->setText(i18nc("@info:status", "No items found."));
507 void DolphinViewContainer::slotDirectoryLoadingCanceled()
509 if (!m_statusBar
->progressText().isEmpty()) {
510 m_statusBar
->setProgressText(QString());
511 m_statusBar
->setProgress(100);
514 m_statusBar
->setText(QString());
517 void DolphinViewContainer::slotUrlIsFileError(const QUrl
& url
)
519 const KFileItem
item(url
);
521 // Find out if the file can be opened in the view (for example, this is the
522 // case if the file is an archive). The mime type must be known for that.
523 item
.determineMimeType();
524 const QUrl
& folderUrl
= DolphinView::openItemAsFolderUrl(item
, true);
525 if (!folderUrl
.isEmpty()) {
528 slotItemActivated(item
);
532 void DolphinViewContainer::slotItemActivated(const KFileItem
& item
)
534 // It is possible to activate items on inactive views by
535 // drag & drop operations. Assure that activating an item always
536 // results in an active view.
537 m_view
->setActive(true);
539 const QUrl
& url
= DolphinView::openItemAsFolderUrl(item
, GeneralSettings::browseThroughArchives());
540 if (!url
.isEmpty()) {
545 KRun
*run
= new KRun(item
.targetUrl(), this);
546 run
->setShowScriptExecutionPrompt(true);
549 void DolphinViewContainer::slotItemsActivated(const KFileItemList
& items
)
551 Q_ASSERT(items
.count() >= 2);
553 KFileItemActions
fileItemActions(this);
554 fileItemActions
.runPreferredApplications(items
, QString());
557 void DolphinViewContainer::showItemInfo(const KFileItem
& item
)
560 m_statusBar
->resetToDefaultText();
562 m_statusBar
->setText(item
.getStatusBarInfo());
566 void DolphinViewContainer::closeFilterBar()
568 m_filterBar
->closeFilterBar();
570 emit
showFilterBarChanged(false);
573 void DolphinViewContainer::setNameFilter(const QString
& nameFilter
)
575 m_view
->setNameFilter(nameFilter
);
576 delayedStatusBarUpdate();
579 void DolphinViewContainer::activate()
584 void DolphinViewContainer::slotUrlNavigatorLocationAboutToBeChanged(const QUrl
&)
589 void DolphinViewContainer::slotUrlNavigatorLocationChanged(const QUrl
& url
)
593 if (KProtocolManager::supportsListing(url
)) {
594 setSearchModeEnabled(isSearchUrl(url
));
596 tryRestoreViewState();
598 if (m_autoGrabFocus
&& isActive() && !isSearchUrl(url
)) {
599 // When an URL has been entered, the view should get the focus.
600 // The focus must be requested asynchronously, as changing the URL might create
601 // a new view widget.
602 QTimer::singleShot(0, this, &DolphinViewContainer::requestFocus
);
604 } else if (KProtocolManager::isSourceProtocol(url
)) {
605 QString app
= QStringLiteral("konqueror");
606 if (url
.scheme().startsWith(QLatin1String("http"))) {
607 showMessage(i18nc("@info:status", // krazy:exclude=qmethods
608 "Dolphin does not support web pages, the web browser has been launched"),
611 const KConfigGroup
config(KSharedConfig::openConfig(QStringLiteral("kdeglobals")), "General");
612 const QString browser
= config
.readEntry("BrowserApplication");
613 if (!browser
.isEmpty()) {
615 if (app
.startsWith('!')) {
616 // a literal command has been configured, remove the '!' prefix
621 showMessage(i18nc("@info:status",
622 "Protocol not supported by Dolphin, Konqueror has been launched"),
626 const QString secureUrl
= KShell::quoteArg(url
.toDisplayString(QUrl::PreferLocalFile
));
627 const QString command
= app
+ ' ' + secureUrl
;
628 KRun::runCommand(command
, app
, app
, this);
630 showMessage(i18nc("@info:status", "Invalid protocol"), Error
);
634 void DolphinViewContainer::slotUrlSelectionRequested(const QUrl
& url
)
636 qCDebug(DolphinDebug
) << "slotUrlSelectionRequested: " << url
;
637 m_view
->markUrlsAsSelected({url
});
638 m_view
->markUrlAsCurrent(url
); // makes the item scroll into view
641 void DolphinViewContainer::redirect(const QUrl
& oldUrl
, const QUrl
& newUrl
)
644 const bool block
= m_urlNavigator
->signalsBlocked();
645 m_urlNavigator
->blockSignals(true);
647 // Assure that the location state is reset for redirection URLs. This
648 // allows to skip redirection URLs when going back or forward in the
650 m_urlNavigator
->saveLocationState(QByteArray());
651 m_urlNavigator
->setLocationUrl(newUrl
);
652 setSearchModeEnabled(isSearchUrl(newUrl
));
654 m_urlNavigator
->blockSignals(block
);
657 void DolphinViewContainer::requestFocus()
662 void DolphinViewContainer::saveUrlCompletionMode(KCompletion::CompletionMode completion
)
664 GeneralSettings::setUrlCompletionMode(completion
);
667 void DolphinViewContainer::slotReturnPressed()
669 if (!GeneralSettings::editableUrl()) {
670 m_urlNavigator
->setUrlEditable(false);
674 void DolphinViewContainer::startSearching()
676 const QUrl url
= m_searchBox
->urlForSearching();
677 if (url
.isValid() && !url
.isEmpty()) {
678 m_view
->setViewPropertiesContext(QStringLiteral("search"));
679 m_urlNavigator
->setLocationUrl(url
);
683 void DolphinViewContainer::closeSearchBox()
685 setSearchModeEnabled(false);
688 void DolphinViewContainer::stopDirectoryLoading()
690 m_view
->stopLoading();
691 m_statusBar
->setProgress(100);
694 void DolphinViewContainer::slotStatusBarZoomLevelChanged(int zoomLevel
)
696 m_view
->setZoomLevel(zoomLevel
);
699 void DolphinViewContainer::showErrorMessage(const QString
& msg
)
701 showMessage(msg
, Error
);
704 bool DolphinViewContainer::isSearchUrl(const QUrl
& url
) const
706 return url
.scheme().contains(QStringLiteral("search"));
709 void DolphinViewContainer::saveViewState()
711 QByteArray locationState
;
712 QDataStream
stream(&locationState
, QIODevice::WriteOnly
);
713 m_view
->saveState(stream
);
714 m_urlNavigator
->saveLocationState(locationState
);
717 void DolphinViewContainer::tryRestoreViewState()
719 QByteArray locationState
= m_urlNavigator
->locationState();
720 if (!locationState
.isEmpty()) {
721 QDataStream
stream(&locationState
, QIODevice::ReadOnly
);
722 m_view
->restoreState(stream
);