]> cloud.milkyroute.net Git - dolphin.git/blob - src/dolphinviewcontainer.cpp
Corrected the compile fix commit, rev 965fc6b3.
[dolphin.git] / src / dolphinviewcontainer.cpp
1 /***************************************************************************
2 * Copyright (C) 2007 by Peter Penz <peter.penz19@gmail.com> *
3 * *
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. *
8 * *
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. *
13 * *
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 ***************************************************************************/
19
20 #include "dolphinviewcontainer.h"
21 #include <KProtocolManager>
22
23 #include <QApplication>
24 #include <QKeyEvent>
25 #include <QItemSelection>
26 #include <QBoxLayout>
27 #include <QTimer>
28 #include <QScrollBar>
29
30 #include <KDesktopFile>
31 #include <KFileItemDelegate>
32 #include <KFilePlacesModel>
33 #include <KLocale>
34 #include <KIconEffect>
35 #include <KIO/NetAccess>
36 #include <KIO/PreviewJob>
37 #include <KMessageWidget>
38 #include <KNewFileMenu>
39 #include <konqmimedata.h>
40 #include <konq_operations.h>
41 #include <KShell>
42 #include <KUrl>
43 #include <KUrlComboBox>
44 #include <KUrlNavigator>
45 #include <KRun>
46
47 #include "dolphin_generalsettings.h"
48 #include "filterbar/filterbar.h"
49 #include "search/dolphinsearchbox.h"
50 #include "statusbar/dolphinstatusbar.h"
51 #include "views/draganddrophelper.h"
52 #include "views/viewmodecontroller.h"
53 #include "views/viewproperties.h"
54
55 DolphinViewContainer::DolphinViewContainer(const KUrl& url, QWidget* parent) :
56 QWidget(parent),
57 m_topLayout(0),
58 m_urlNavigator(0),
59 m_searchBox(0),
60 m_messageWidget(0),
61 m_view(0),
62 m_filterBar(0),
63 m_statusBar(0),
64 m_statusBarTimer(0),
65 m_statusBarTimestamp(),
66 m_autoGrabFocus(true)
67 {
68 hide();
69
70 m_topLayout = new QVBoxLayout(this);
71 m_topLayout->setSpacing(0);
72 m_topLayout->setMargin(0);
73
74 m_urlNavigator = new KUrlNavigator(new KFilePlacesModel(this), url, this);
75 connect(m_urlNavigator, SIGNAL(urlsDropped(KUrl,QDropEvent*)),
76 this, SLOT(dropUrls(KUrl,QDropEvent*)));
77 connect(m_urlNavigator, SIGNAL(activated()),
78 this, SLOT(activate()));
79 connect(m_urlNavigator->editor(), SIGNAL(completionModeChanged(KGlobalSettings::Completion)),
80 this, SLOT(saveUrlCompletionMode(KGlobalSettings::Completion)));
81
82 const GeneralSettings* settings = GeneralSettings::self();
83 m_urlNavigator->setUrlEditable(settings->editableUrl());
84 m_urlNavigator->setShowFullPath(settings->showFullPath());
85 m_urlNavigator->setHomeUrl(KUrl(settings->homeUrl()));
86 KUrlComboBox* editor = m_urlNavigator->editor();
87 editor->setCompletionMode(KGlobalSettings::Completion(settings->urlCompletionMode()));
88
89 m_searchBox = new DolphinSearchBox(this);
90 m_searchBox->hide();
91 connect(m_searchBox, SIGNAL(closeRequest()), this, SLOT(closeSearchBox()));
92 connect(m_searchBox, SIGNAL(searchRequest()), this, SLOT(startSearching()));
93 connect(m_searchBox, SIGNAL(returnPressed(QString)), this, SLOT(requestFocus()));
94
95 m_messageWidget = new KMessageWidget(this);
96 m_messageWidget->setCloseButtonVisible(true);
97 m_messageWidget->hide();
98
99 m_view = new DolphinView(url, this);
100 connect(m_view, SIGNAL(urlChanged(KUrl)), m_urlNavigator, SLOT(setUrl(KUrl)));
101 connect(m_view, SIGNAL(writeStateChanged(bool)), this, SIGNAL(writeStateChanged(bool)));
102 connect(m_view, SIGNAL(requestItemInfo(KFileItem)), this, SLOT(showItemInfo(KFileItem)));
103 connect(m_view, SIGNAL(itemActivated(KFileItem)), this, SLOT(slotItemActivated(KFileItem)));
104 connect(m_view, SIGNAL(redirection(KUrl,KUrl)), this, SLOT(redirect(KUrl,KUrl)));
105 connect(m_view, SIGNAL(directoryLoadingStarted()), this, SLOT(slotDirectoryLoadingStarted()));
106 connect(m_view, SIGNAL(directoryLoadingCompleted()), this, SLOT(slotDirectoryLoadingCompleted()));
107 connect(m_view, SIGNAL(itemCountChanged()), this, SLOT(delayedStatusBarUpdate()));
108 connect(m_view, SIGNAL(directoryLoadingProgress(int)), this, SLOT(updateDirectoryLoadingProgress(int)));
109 connect(m_view, SIGNAL(directorySortingProgress(int)), this, SLOT(updateDirectorySortingProgress(int)));
110 connect(m_view, SIGNAL(selectionChanged(KFileItemList)), this, SLOT(delayedStatusBarUpdate()));
111 connect(m_view, SIGNAL(urlAboutToBeChanged(KUrl)), this, SLOT(slotViewUrlAboutToBeChanged(KUrl)));
112 connect(m_view, SIGNAL(errorMessage(QString)), this, SLOT(showErrorMessage(QString)));
113 connect(m_view, SIGNAL(urlIsFileError(KUrl)), this, SLOT(slotUrlIsFileError(KUrl)));
114
115 connect(m_urlNavigator, SIGNAL(urlAboutToBeChanged(KUrl)),
116 this, SLOT(slotUrlNavigatorLocationAboutToBeChanged(KUrl)));
117 connect(m_urlNavigator, SIGNAL(urlChanged(KUrl)),
118 this, SLOT(slotUrlNavigatorLocationChanged(KUrl)));
119 connect(m_urlNavigator, SIGNAL(historyChanged()),
120 this, SLOT(slotHistoryChanged()));
121
122 // Initialize status bar
123 m_statusBar = new DolphinStatusBar(this);
124 m_statusBar->setUrl(m_view->url());
125 m_statusBar->setZoomLevel(m_view->zoomLevel());
126 connect(m_view, SIGNAL(urlChanged(KUrl)), m_statusBar, SLOT(setUrl(KUrl)));
127 connect(m_view, SIGNAL(zoomLevelChanged(int,int)), m_statusBar, SLOT(setZoomLevel(int)));
128 connect(m_view, SIGNAL(infoMessage(QString)), m_statusBar, SLOT(setText(QString)));
129 connect(m_view, SIGNAL(operationCompletedMessage(QString)), m_statusBar, SLOT(setText(QString)));
130 connect(m_statusBar, SIGNAL(stopPressed()), this, SLOT(stopDirectoryLoading()));
131 connect(m_statusBar, SIGNAL(zoomLevelChanged(int)), this, SLOT(slotStatusBarZoomLevelChanged(int)));
132
133 m_statusBarTimer = new QTimer(this);
134 m_statusBarTimer->setSingleShot(true);
135 m_statusBarTimer->setInterval(300);
136 connect(m_statusBarTimer, SIGNAL(timeout()), this, SLOT(updateStatusBar()));
137
138 KIO::FileUndoManager* undoManager = KIO::FileUndoManager::self();
139 connect(undoManager, SIGNAL(jobRecordingFinished(CommandType)),
140 this, SLOT(delayedStatusBarUpdate()));
141
142 // Initialize filter bar
143 m_filterBar = new FilterBar(this);
144 m_filterBar->setVisible(settings->filterBar());
145 connect(m_filterBar, SIGNAL(filterChanged(QString)),
146 this, SLOT(setNameFilter(QString)));
147 connect(m_filterBar, SIGNAL(closeRequest()),
148 this, SLOT(closeFilterBar()));
149 connect(m_view, SIGNAL(urlChanged(KUrl)),
150 m_filterBar, SLOT(clear()));
151
152 m_topLayout->addWidget(m_urlNavigator);
153 m_topLayout->addWidget(m_searchBox);
154 m_topLayout->addWidget(m_messageWidget);
155 m_topLayout->addWidget(m_view);
156 m_topLayout->addWidget(m_filterBar);
157 m_topLayout->addWidget(m_statusBar);
158
159 setSearchModeEnabled(isSearchUrl(url));
160 }
161
162 DolphinViewContainer::~DolphinViewContainer()
163 {
164 }
165
166 KUrl DolphinViewContainer::url() const
167 {
168 return m_view->url();
169 }
170
171 void DolphinViewContainer::setActive(bool active)
172 {
173 m_urlNavigator->setActive(active);
174 m_view->setActive(active);
175 }
176
177 bool DolphinViewContainer::isActive() const
178 {
179 Q_ASSERT(m_view->isActive() == m_urlNavigator->isActive());
180 return m_view->isActive();
181 }
182
183 void DolphinViewContainer::setAutoGrabFocus(bool grab)
184 {
185 m_autoGrabFocus = grab;
186 }
187
188 bool DolphinViewContainer::autoGrabFocus() const
189 {
190 return m_autoGrabFocus;
191 }
192
193 const DolphinStatusBar* DolphinViewContainer::statusBar() const
194 {
195 return m_statusBar;
196 }
197
198 DolphinStatusBar* DolphinViewContainer::statusBar()
199 {
200 return m_statusBar;
201 }
202
203 const KUrlNavigator* DolphinViewContainer::urlNavigator() const
204 {
205 return m_urlNavigator;
206 }
207
208 KUrlNavigator* DolphinViewContainer::urlNavigator()
209 {
210 return m_urlNavigator;
211 }
212
213 const DolphinView* DolphinViewContainer::view() const
214 {
215 return m_view;
216 }
217
218 DolphinView* DolphinViewContainer::view()
219 {
220 return m_view;
221 }
222
223 void DolphinViewContainer::showMessage(const QString& msg, MessageType type)
224 {
225 if (msg.isEmpty()) {
226 return;
227 }
228
229 m_messageWidget->setText(msg);
230
231 switch (type) {
232 case Information: m_messageWidget->setMessageType(KMessageWidget::Information); break;
233 case Warning: m_messageWidget->setMessageType(KMessageWidget::Warning); break;
234 case Error: m_messageWidget->setMessageType(KMessageWidget::Error); break;
235 default:
236 Q_ASSERT(false);
237 break;
238 }
239
240 m_messageWidget->setWordWrap(false);
241 const int unwrappedWidth = m_messageWidget->sizeHint().width();
242 m_messageWidget->setWordWrap(unwrappedWidth > size().width());
243
244 m_messageWidget->animatedShow();
245 }
246
247 void DolphinViewContainer::readSettings()
248 {
249 if (GeneralSettings::modifiedStartupSettings()) {
250 // The startup settings should only get applied if they have been
251 // modified by the user. Otherwise keep the (possibly) different current
252 // settings of the URL navigator and the filterbar.
253 m_urlNavigator->setUrlEditable(GeneralSettings::editableUrl());
254 m_urlNavigator->setShowFullPath(GeneralSettings::showFullPath());
255 m_urlNavigator->setHomeUrl(KUrl(GeneralSettings::homeUrl()));
256 setFilterBarVisible(GeneralSettings::filterBar());
257 }
258
259 m_view->readSettings();
260 m_statusBar->readSettings();
261 }
262
263 bool DolphinViewContainer::isFilterBarVisible() const
264 {
265 return m_filterBar->isVisible();
266 }
267
268 void DolphinViewContainer::setSearchModeEnabled(bool enabled)
269 {
270 if (enabled == isSearchModeEnabled()) {
271 if (enabled && !m_searchBox->hasFocus()) {
272 m_searchBox->setFocus();
273 m_searchBox->selectAll();
274 }
275 return;
276 }
277
278 m_searchBox->setVisible(enabled);
279 m_urlNavigator->setVisible(!enabled);
280
281 if (enabled) {
282 KUrl url = m_urlNavigator->locationUrl();
283 m_searchBox->setText(QString());
284 m_searchBox->setReadOnly(isSearchUrl(url), url);
285
286 // Remember the most recent non-search URL as search path
287 // of the search-box, so that it can be restored
288 // when switching back to the URL navigator.
289 int index = m_urlNavigator->historyIndex();
290 const int historySize = m_urlNavigator->historySize();
291 while (isSearchUrl(url) && (index < historySize)) {
292 ++index;
293 url = m_urlNavigator->locationUrl(index);
294 }
295
296 if (!isSearchUrl(url)) {
297 m_searchBox->setSearchPath(url);
298 }
299 } else {
300 m_view->setViewPropertiesContext(QString());
301
302 // Restore the URL for the URL navigator. If Dolphin has been
303 // started with a search-URL, the home URL is used as fallback.
304 const KUrl url = m_searchBox->searchPath();
305 if (url.isValid() && !url.isEmpty()) {
306 if (isSearchUrl(url)) {
307 m_urlNavigator->goHome();
308 } else {
309 m_urlNavigator->setLocationUrl(url);
310 }
311 }
312 }
313 }
314
315 bool DolphinViewContainer::isSearchModeEnabled() const
316 {
317 return m_searchBox->isVisible();
318 }
319
320 QString DolphinViewContainer::placesText() const
321 {
322 QString text;
323
324 if (isSearchModeEnabled()) {
325 text = m_searchBox->searchPath().fileName() + QLatin1String(": ") + m_searchBox->text();
326 } else {
327 text = url().fileName();
328 if (text.isEmpty()) {
329 text = url().host();
330 }
331 }
332
333 return text;
334 }
335
336 void DolphinViewContainer::setUrl(const KUrl& newUrl)
337 {
338 if (newUrl != m_urlNavigator->locationUrl()) {
339 m_urlNavigator->setLocationUrl(newUrl);
340 }
341 }
342
343 void DolphinViewContainer::setFilterBarVisible(bool visible)
344 {
345 Q_ASSERT(m_filterBar);
346 if (visible) {
347 m_filterBar->show();
348 m_filterBar->setFocus();
349 m_filterBar->selectAll();
350 } else {
351 closeFilterBar();
352 }
353 }
354
355 void DolphinViewContainer::delayedStatusBarUpdate()
356 {
357 if (m_statusBarTimer->isActive() && (m_statusBarTimestamp.elapsed() > 2000)) {
358 // No update of the statusbar has been done during the last 2 seconds,
359 // although an update has been requested. Trigger an immediate update.
360 m_statusBarTimer->stop();
361 updateStatusBar();
362 } else {
363 // Invoke updateStatusBar() with a small delay. This assures that
364 // when a lot of delayedStatusBarUpdates() are done in a short time,
365 // no bottleneck is given.
366 m_statusBarTimer->start();
367 }
368 }
369
370 void DolphinViewContainer::updateStatusBar()
371 {
372 m_statusBarTimestamp.start();
373
374 const QString text = m_view->statusBarText();
375 m_statusBar->setDefaultText(text);
376 m_statusBar->resetToDefaultText();
377 }
378
379 void DolphinViewContainer::updateDirectoryLoadingProgress(int percent)
380 {
381 if (m_statusBar->progressText().isEmpty()) {
382 m_statusBar->setProgressText(i18nc("@info:progress", "Loading folder..."));
383 }
384 m_statusBar->setProgress(percent);
385 }
386
387 void DolphinViewContainer::updateDirectorySortingProgress(int percent)
388 {
389 if (m_statusBar->progressText().isEmpty()) {
390 m_statusBar->setProgressText(i18nc("@info:progress", "Sorting..."));
391 }
392 m_statusBar->setProgress(percent);
393 }
394
395 void DolphinViewContainer::slotDirectoryLoadingStarted()
396 {
397 if (isSearchUrl(url())) {
398 // Search KIO-slaves usually don't provide any progress information. Give
399 // a hint to the user that a searching is done:
400 updateStatusBar();
401 m_statusBar->setProgressText(i18nc("@info", "Searching..."));
402 m_statusBar->setProgress(-1);
403 } else {
404 // Trigger an undetermined progress indication. The progress
405 // information in percent will be triggered by the percent() signal
406 // of the directory lister later.
407 updateDirectoryLoadingProgress(-1);
408 }
409 }
410
411 void DolphinViewContainer::slotDirectoryLoadingCompleted()
412 {
413 if (!m_statusBar->progressText().isEmpty()) {
414 m_statusBar->setProgressText(QString());
415 m_statusBar->setProgress(100);
416 }
417
418 if (isSearchUrl(url()) && m_view->itemsCount() == 0) {
419 // The dir lister has been completed on a Nepomuk-URI and no items have been found. Instead
420 // of showing the default status bar information ("0 items") a more helpful information is given:
421 m_statusBar->setText(i18nc("@info:status", "No items found."));
422 } else {
423 updateStatusBar();
424 }
425 }
426
427 void DolphinViewContainer::slotUrlIsFileError(const KUrl& url)
428 {
429 const KFileItem item(KFileItem::Unknown, KFileItem::Unknown, url);
430 slotItemActivated(item);
431 }
432
433 void DolphinViewContainer::slotItemActivated(const KFileItem& item)
434 {
435 // It is possible to activate items on inactive views by
436 // drag & drop operations. Assure that activating an item always
437 // results in an active view.
438 m_view->setActive(true);
439
440 KUrl url = item.targetUrl();
441
442 if (item.isDir()) {
443 m_view->setUrl(url);
444 return;
445 }
446
447 if (GeneralSettings::browseThroughArchives() && item.isFile() && url.isLocalFile()) {
448 // Generic mechanism for redirecting to tar:/<path>/ when clicking on a tar file,
449 // zip:/<path>/ when clicking on a zip file, etc.
450 // The .protocol file specifies the mimetype that the kioslave handles.
451 // Note that we don't use mimetype inheritance since we don't want to
452 // open OpenDocument files as zip folders...
453 const QString protocol = KProtocolManager::protocolForArchiveMimetype(item.mimetype());
454 if (!protocol.isEmpty()) {
455 url.setProtocol(protocol);
456 m_view->setUrl(url);
457 return;
458 }
459 }
460
461 if (item.mimetype() == QLatin1String("application/x-desktop")) {
462 // Redirect to the URL in Type=Link desktop files
463 KDesktopFile desktopFile(url.toLocalFile());
464 if (desktopFile.hasLinkType()) {
465 url = desktopFile.readUrl();
466 m_view->setUrl(url);
467 return;
468 }
469 }
470
471 item.run();
472 }
473
474 void DolphinViewContainer::showItemInfo(const KFileItem& item)
475 {
476 if (item.isNull()) {
477 m_statusBar->resetToDefaultText();
478 } else {
479 const QString text = item.isDir() ? item.text() : item.getStatusBarInfo();
480 m_statusBar->setText(text);
481 }
482 }
483
484 void DolphinViewContainer::closeFilterBar()
485 {
486 m_filterBar->hide();
487 m_filterBar->clear();
488 m_view->setFocus();
489 emit showFilterBarChanged(false);
490 }
491
492 void DolphinViewContainer::setNameFilter(const QString& nameFilter)
493 {
494 m_view->setNameFilter(nameFilter);
495 delayedStatusBarUpdate();
496 }
497
498 void DolphinViewContainer::activate()
499 {
500 setActive(true);
501 }
502
503 void DolphinViewContainer::slotViewUrlAboutToBeChanged(const KUrl& url)
504 {
505 // URL changes of the view can happen in two ways:
506 // 1. The URL navigator gets changed and will trigger the view to update its URL
507 // 2. The URL of the view gets changed and will trigger the URL navigator to update
508 // its URL (e.g. by clicking on an item)
509 // In this scope the view-state may only get saved in case 2:
510 if (url != m_urlNavigator->locationUrl()) {
511 saveViewState();
512 }
513 }
514
515 void DolphinViewContainer::slotUrlNavigatorLocationAboutToBeChanged(const KUrl& url)
516 {
517 // URL changes of the view can happen in two ways:
518 // 1. The URL navigator gets changed and will trigger the view to update its URL
519 // 2. The URL of the view gets changed and will trigger the URL navigator to update
520 // its URL (e.g. by clicking on an item)
521 // In this scope the view-state may only get saved in case 1:
522 if (url != m_view->url()) {
523 saveViewState();
524 }
525 }
526
527 void DolphinViewContainer::slotUrlNavigatorLocationChanged(const KUrl& url)
528 {
529 if (KProtocolManager::supportsListing(url)) {
530 setSearchModeEnabled(isSearchUrl(url));
531 m_view->setUrl(url);
532
533 if (m_autoGrabFocus && isActive() && !isSearchUrl(url)) {
534 // When an URL has been entered, the view should get the focus.
535 // The focus must be requested asynchronously, as changing the URL might create
536 // a new view widget.
537 QTimer::singleShot(0, this, SLOT(requestFocus()));
538 }
539 } else if (KProtocolManager::isSourceProtocol(url)) {
540 QString app = "konqueror";
541 if (url.protocol().startsWith(QLatin1String("http"))) {
542 showMessage(i18nc("@info:status", // krazy:exclude=qmethods
543 "Dolphin does not support web pages, the web browser has been launched"),
544 Information);
545
546 const KConfigGroup config(KSharedConfig::openConfig("kdeglobals"), "General");
547 const QString browser = config.readEntry("BrowserApplication");
548 if (!browser.isEmpty()) {
549 app = browser;
550 if (app.startsWith('!')) {
551 // a literal command has been configured, remove the '!' prefix
552 app = app.mid(1);
553 }
554 }
555 } else {
556 showMessage(i18nc("@info:status",
557 "Protocol not supported by Dolphin, Konqueror has been launched"),
558 Information);
559 }
560
561 const QString secureUrl = KShell::quoteArg(url.pathOrUrl());
562 const QString command = app + ' ' + secureUrl;
563 KRun::runCommand(command, app, app, this);
564 } else {
565 showMessage(i18nc("@info:status", "Invalid protocol"), Error);
566 }
567 }
568
569 void DolphinViewContainer::dropUrls(const KUrl& destination, QDropEvent* event)
570 {
571 const QString error = DragAndDropHelper::dropUrls(KFileItem(), destination, event);
572 if (!error.isEmpty()) {
573 showMessage(error, Error);
574 }
575 }
576
577 void DolphinViewContainer::redirect(const KUrl& oldUrl, const KUrl& newUrl)
578 {
579 Q_UNUSED(oldUrl);
580 const bool block = m_urlNavigator->signalsBlocked();
581 m_urlNavigator->blockSignals(true);
582
583 // Assure that the location state is reset for redirection URLs. This
584 // allows to skip redirection URLs when going back or forward in the
585 // URL history.
586 m_urlNavigator->saveLocationState(QByteArray());
587 m_urlNavigator->setLocationUrl(newUrl);
588 setSearchModeEnabled(isSearchUrl(newUrl));
589
590 m_urlNavigator->blockSignals(block);
591 }
592
593 void DolphinViewContainer::requestFocus()
594 {
595 m_view->setFocus();
596 }
597
598 void DolphinViewContainer::saveUrlCompletionMode(KGlobalSettings::Completion completion)
599 {
600 GeneralSettings::setUrlCompletionMode(completion);
601 }
602
603 void DolphinViewContainer::slotHistoryChanged()
604 {
605 QByteArray locationState = m_urlNavigator->locationState();
606 if (!locationState.isEmpty()) {
607 QDataStream stream(&locationState, QIODevice::ReadOnly);
608 m_view->restoreState(stream);
609 }
610 }
611
612 void DolphinViewContainer::startSearching()
613 {
614 const KUrl url = m_searchBox->urlForSearching();
615 if (url.isValid() && !url.isEmpty()) {
616 m_view->setViewPropertiesContext("search");
617 m_urlNavigator->setLocationUrl(url);
618 }
619 }
620
621 void DolphinViewContainer::closeSearchBox()
622 {
623 setSearchModeEnabled(false);
624 }
625
626 void DolphinViewContainer::stopDirectoryLoading()
627 {
628 m_view->stopLoading();
629 m_statusBar->setProgress(100);
630 }
631
632 void DolphinViewContainer::slotStatusBarZoomLevelChanged(int zoomLevel)
633 {
634 m_view->setZoomLevel(zoomLevel);
635 }
636
637 void DolphinViewContainer::showErrorMessage(const QString& msg)
638 {
639 showMessage(msg, Error);
640 }
641
642 bool DolphinViewContainer::isSearchUrl(const KUrl& url) const
643 {
644 const QString protocol = url.protocol();
645 return protocol.contains("search") || (protocol == QLatin1String("nepomuk"));
646 }
647
648 void DolphinViewContainer::saveViewState()
649 {
650 QByteArray locationState;
651 QDataStream stream(&locationState, QIODevice::WriteOnly);
652 m_view->saveState(stream);
653 m_urlNavigator->saveLocationState(locationState);
654 }
655
656 #include "dolphinviewcontainer.moc"