]> cloud.milkyroute.net Git - dolphin.git/blob - src/views/dolphinview.cpp
Activate the DolphinView if the KItemListContainer gets focus
[dolphin.git] / src / views / dolphinview.cpp
1 /***************************************************************************
2 * Copyright (C) 2006-2009 by Peter Penz <peter.penz19@gmail.com> *
3 * Copyright (C) 2006 by Gregor Kališnik <gregor@podnapisi.net> *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
19 ***************************************************************************/
20
21 #include "dolphinview.h"
22
23 #include <QAbstractItemView>
24 #include <QApplication>
25 #include <QBoxLayout>
26 #include <QClipboard>
27 #include <QDropEvent>
28 #include <QGraphicsSceneDragDropEvent>
29 #include <QKeyEvent>
30 #include <QItemSelection>
31 #include <QTimer>
32 #include <QScrollBar>
33
34 #include <KActionCollection>
35 #include <KColorScheme>
36 #include <KDirLister>
37 #include <KDirModel>
38 #include <KIconEffect>
39 #include <KFileItem>
40 #include <KFileItemListProperties>
41 #include <KLocale>
42 #include <kitemviews/kfileitemmodel.h>
43 #include <kitemviews/kfileitemlistview.h>
44 #include <kitemviews/kitemlistselectionmanager.h>
45 #include <kitemviews/kitemlistview.h>
46 #include <kitemviews/kitemlistcontroller.h>
47 #include <KIO/DeleteJob>
48 #include <KIO/NetAccess>
49 #include <KIO/PreviewJob>
50 #include <KJob>
51 #include <KMenu>
52 #include <KMessageBox>
53 #include <konq_fileitemcapabilities.h>
54 #include <konq_operations.h>
55 #include <konqmimedata.h>
56 #include <KToggleAction>
57 #include <KUrl>
58
59 #include "additionalinfoaccessor.h"
60 #include "dolphindirlister.h"
61 #include "dolphinnewfilemenuobserver.h"
62 #include "dolphin_detailsmodesettings.h"
63 #include "dolphin_generalsettings.h"
64 #include "dolphinitemlistcontainer.h"
65 #include "draganddrophelper.h"
66 #include "renamedialog.h"
67 #include "settings/dolphinsettings.h"
68 #include "versioncontrol/versioncontrolobserver.h"
69 #include "viewmodecontroller.h"
70 #include "viewproperties.h"
71 #include "views/tooltips/tooltipmanager.h"
72 #include "zoomlevelinfo.h"
73
74 namespace {
75 const int MaxModeEnum = DolphinView::CompactView;
76 const int MaxSortingEnum = DolphinView::SortByPath;
77 };
78
79 DolphinView::DolphinView(const KUrl& url, QWidget* parent) :
80 QWidget(parent),
81 m_active(true),
82 m_tabsForFiles(false),
83 m_assureVisibleCurrentIndex(false),
84 m_isFolderWritable(true),
85 m_url(url),
86 m_mode(DolphinView::IconsView),
87 m_additionalInfoList(),
88 m_topLayout(0),
89 m_dirLister(0),
90 m_container(0),
91 m_toolTipManager(0),
92 m_selectionChangedTimer(0),
93 m_currentItemUrl(),
94 m_restoredContentsPosition(),
95 m_createdItemUrl(),
96 m_selectedUrls(),
97 m_versionControlObserver(0)
98 {
99 m_topLayout = new QVBoxLayout(this);
100 m_topLayout->setSpacing(0);
101 m_topLayout->setMargin(0);
102
103 //m_dolphinViewController = new DolphinViewController(this);
104
105 //m_viewModeController = new ViewModeController(this);
106 //m_viewModeController->setUrl(url);
107
108 /*connect(m_viewModeController, SIGNAL(urlChanged(KUrl)),
109 this, SIGNAL(urlChanged(KUrl)));
110
111 connect(m_dolphinViewController, SIGNAL(requestContextMenu(QPoint,QList<QAction*>)),
112 this, SLOT(openContextMenu(QPoint,QList<QAction*>)));
113 connect(m_dolphinViewController, SIGNAL(urlsDropped(KFileItem,KUrl,QDropEvent*)),
114 this, SLOT(dropUrls(KFileItem,KUrl,QDropEvent*)));
115 connect(m_dolphinViewController, SIGNAL(sortingChanged(DolphinView::Sorting)),
116 this, SLOT(updateSorting(DolphinView::Sorting)));
117 connect(m_dolphinViewController, SIGNAL(sortOrderChanged(Qt::SortOrder)),
118 this, SLOT(updateSortOrder(Qt::SortOrder)));
119 connect(m_dolphinViewController, SIGNAL(sortFoldersFirstChanged(bool)),
120 this, SLOT(updateSortFoldersFirst(bool)));
121 connect(m_dolphinViewController, SIGNAL(additionalInfoChanged(QList<DolphinView::AdditionalInfo>)),
122 this, SLOT(updateAdditionalInfo(QList<DolphinView::AdditionalInfo>)));*/
123 //connect(m_dolphinViewController, SIGNAL(itemActivated(KFileItem)),
124 // this, SLOT(triggerItem(KFileItem)));
125 //connect(m_dolphinViewController, SIGNAL(tabRequested(KUrl)),
126 // this, SIGNAL(tabRequested(KUrl)));
127 /*connect(m_dolphinViewController, SIGNAL(activated()),
128 this, SLOT(activate()));
129 connect(m_dolphinViewController, SIGNAL(itemEntered(KFileItem)),
130 this, SLOT(showHoverInformation(KFileItem)));
131 connect(m_dolphinViewController, SIGNAL(viewportEntered()),
132 this, SLOT(clearHoverInformation()));
133 connect(m_dolphinViewController, SIGNAL(urlChangeRequested(KUrl)),
134 this, SLOT(slotUrlChangeRequested(KUrl)));*/
135
136 // When a new item has been created by the "Create New..." menu, the item should
137 // get selected and it must be assured that the item will get visible. As the
138 // creation is done asynchronously, several signals must be checked:
139 connect(&DolphinNewFileMenuObserver::instance(), SIGNAL(itemCreated(KUrl)),
140 this, SLOT(observeCreatedItem(KUrl)));
141
142 m_selectionChangedTimer = new QTimer(this);
143 m_selectionChangedTimer->setSingleShot(true);
144 m_selectionChangedTimer->setInterval(300);
145 connect(m_selectionChangedTimer, SIGNAL(timeout()),
146 this, SLOT(emitSelectionChangedSignal()));
147
148 m_dirLister = new DolphinDirLister(this);
149 m_dirLister->setAutoUpdate(true);
150 m_dirLister->setDelayedMimeTypes(true);
151
152 connect(m_dirLister, SIGNAL(redirection(KUrl,KUrl)), this, SLOT(slotRedirection(KUrl,KUrl)));
153 connect(m_dirLister, SIGNAL(started(KUrl)), this, SLOT(slotDirListerStarted(KUrl)));
154 connect(m_dirLister, SIGNAL(refreshItems(QList<QPair<KFileItem,KFileItem> >)),
155 this, SLOT(slotRefreshItems()));
156
157 connect(m_dirLister, SIGNAL(clear()), this, SIGNAL(itemCountChanged()));
158 connect(m_dirLister, SIGNAL(newItems(KFileItemList)), this, SIGNAL(itemCountChanged()));
159 connect(m_dirLister, SIGNAL(infoMessage(QString)), this, SIGNAL(infoMessage(QString)));
160 connect(m_dirLister, SIGNAL(errorMessage(QString)), this, SIGNAL(infoMessage(QString)));
161 connect(m_dirLister, SIGNAL(percent(int)), this, SIGNAL(pathLoadingProgress(int)));
162 connect(m_dirLister, SIGNAL(urlIsFileError(KUrl)), this, SIGNAL(urlIsFileError(KUrl)));
163 connect(m_dirLister, SIGNAL(itemsDeleted(KFileItemList)), this, SIGNAL(itemCountChanged()));
164
165 m_container = new DolphinItemListContainer(m_dirLister, this);
166 m_container->setVisibleRoles(QList<QByteArray>() << "name");
167 m_container->installEventFilter(this);
168
169 KItemListController* controller = m_container->controller();
170 controller->setSelectionBehavior(KItemListController::MultiSelection);
171 connect(controller, SIGNAL(itemActivated(int)),
172 this, SLOT(slotItemActivated(int)));
173 connect(controller, SIGNAL(itemMiddleClicked(int)), this, SLOT(slotItemMiddleClicked(int)));
174 connect(controller, SIGNAL(itemContextMenuRequested(int,QPointF)), this, SLOT(slotItemContextMenuRequested(int,QPointF)));
175 connect(controller, SIGNAL(viewContextMenuRequested(QPointF)), this, SLOT(slotViewContextMenuRequested(QPointF)));
176 connect(controller, SIGNAL(headerContextMenuRequested(QPointF)), this, SLOT(slotHeaderContextMenuRequested(QPointF)));
177 connect(controller, SIGNAL(itemExpansionToggleClicked(int)), this, SLOT(slotItemExpansionToggleClicked(int)));
178 connect(controller, SIGNAL(itemHovered(int)), this, SLOT(slotItemHovered(int)));
179 connect(controller, SIGNAL(itemUnhovered(int)), this, SLOT(slotItemUnhovered(int)));
180 connect(controller, SIGNAL(itemDropEvent(int,QGraphicsSceneDragDropEvent*)), this, SLOT(slotItemDropEvent(int,QGraphicsSceneDragDropEvent*)));
181 connect(controller, SIGNAL(modelChanged(KItemModelBase*,KItemModelBase*)), this, SLOT(slotModelChanged(KItemModelBase*,KItemModelBase*)));
182
183 KFileItemModel* model = fileItemModel();
184 if (model) {
185 connect(model, SIGNAL(loadingCompleted()), this, SLOT(slotLoadingCompleted()));
186 }
187
188 KItemListSelectionManager* selectionManager = controller->selectionManager();
189 connect(selectionManager, SIGNAL(selectionChanged(QSet<int>,QSet<int>)),
190 this, SLOT(slotSelectionChanged(QSet<int>,QSet<int>)));
191
192 m_toolTipManager = new ToolTipManager(this);
193
194 m_versionControlObserver = new VersionControlObserver(this);
195 m_versionControlObserver->setModel(model);
196 connect(m_versionControlObserver, SIGNAL(infoMessage(QString)), this, SIGNAL(infoMessage(QString)));
197 connect(m_versionControlObserver, SIGNAL(errorMessage(QString)), this, SIGNAL(errorMessage(QString)));
198 connect(m_versionControlObserver, SIGNAL(operationCompletedMessage(QString)), this, SIGNAL(operationCompletedMessage(QString)));
199
200 applyViewProperties();
201 m_topLayout->addWidget(m_container);
202
203 loadDirectory(url);
204 }
205
206 DolphinView::~DolphinView()
207 {
208 }
209
210 KUrl DolphinView::url() const
211 {
212 return m_url;
213 }
214
215 void DolphinView::setActive(bool active)
216 {
217 if (active == m_active) {
218 return;
219 }
220
221 m_active = active;
222
223 QColor color = KColorScheme(QPalette::Active, KColorScheme::View).background().color();
224 if (!active) {
225 color.setAlpha(150);
226 }
227
228 /*QAbstractItemView* view = m_viewAccessor.itemView();
229 QWidget* viewport = view ? view->viewport() : 0;
230 if (viewport) {
231 QPalette palette;
232 palette.setColor(viewport->backgroundRole(), color);
233 viewport->setPalette(palette);
234 }*/
235
236 update();
237
238 if (active) {
239 //if (view) {
240 // view->setFocus();
241 //}
242 emit activated();
243 emit writeStateChanged(m_isFolderWritable);
244 }
245
246 //m_viewModeController->indicateActivationChange(active);
247 }
248
249 bool DolphinView::isActive() const
250 {
251 return m_active;
252 }
253
254 void DolphinView::setMode(Mode mode)
255 {
256 if (mode != m_mode) {
257 ViewProperties props(url());
258 props.setViewMode(mode);
259 props.save();
260
261 applyViewProperties();
262 }
263 }
264
265 DolphinView::Mode DolphinView::mode() const
266 {
267 return m_mode;
268 }
269
270 bool DolphinView::previewsShown() const
271 {
272 return m_container->previewsShown();
273 }
274
275 bool DolphinView::hiddenFilesShown() const
276 {
277 return m_dirLister->showingDotFiles();
278 }
279
280 bool DolphinView::categorizedSorting() const
281 {
282 return false; //m_storedCategorizedSorting;
283 }
284
285 KFileItemList DolphinView::items() const
286 {
287 return m_dirLister->items();
288 }
289
290 KFileItemList DolphinView::selectedItems() const
291 {
292 const KFileItemModel* model = fileItemModel();
293 const KItemListSelectionManager* selectionManager = m_container->controller()->selectionManager();
294 const QSet<int> selectedIndexes = selectionManager->selectedItems();
295
296 KFileItemList selectedItems;
297 QSetIterator<int> it(selectedIndexes);
298 while (it.hasNext()) {
299 const int index = it.next();
300 selectedItems.append(model->fileItem(index));
301 }
302 return selectedItems;
303 }
304
305 int DolphinView::selectedItemsCount() const
306 {
307 const KItemListSelectionManager* selectionManager = m_container->controller()->selectionManager();
308 return selectionManager->selectedItems().count();
309 }
310
311 void DolphinView::markUrlsAsSelected(const QList<KUrl>& urls)
312 {
313 m_selectedUrls = urls;
314 }
315
316 void DolphinView::setItemSelectionEnabled(const QRegExp& pattern, bool enabled)
317 {
318 const KItemListSelectionManager::SelectionMode mode = enabled
319 ? KItemListSelectionManager::Select
320 : KItemListSelectionManager::Deselect;
321 const KFileItemModel* model = fileItemModel();
322 KItemListSelectionManager* selectionManager = m_container->controller()->selectionManager();
323
324 for (int index = 0; index < model->count(); index++) {
325 const KFileItem item = model->fileItem(index);
326 if (pattern.exactMatch(item.name())) {
327 // An alternative approach would be to store the matching items in a QSet<int> and
328 // select them in one go after the loop, but we'd need a new function
329 // KItemListSelectionManager::setSelected(QSet<int>, SelectionMode mode)
330 // for that.
331 selectionManager->setSelected(index, 1, mode);
332 }
333 }
334 }
335
336 void DolphinView::setZoomLevel(int level)
337 {
338 const int oldZoomLevel = zoomLevel();
339 m_container->setZoomLevel(level);
340 if (zoomLevel() != oldZoomLevel) {
341 emit zoomLevelChanged(zoomLevel(), oldZoomLevel);
342 }
343 }
344
345 int DolphinView::zoomLevel() const
346 {
347 return m_container->zoomLevel();
348 }
349
350 void DolphinView::setSorting(Sorting sorting)
351 {
352 if (sorting != this->sorting()) {
353 updateSorting(sorting);
354 }
355 }
356
357 DolphinView::Sorting DolphinView::sorting() const
358 {
359 KItemModelBase* model = m_container->controller()->model();
360 return sortingForSortRole(model->sortRole());
361 }
362
363 void DolphinView::setSortOrder(Qt::SortOrder order)
364 {
365 if (sortOrder() != order) {
366 updateSortOrder(order);
367 }
368 }
369
370 Qt::SortOrder DolphinView::sortOrder() const
371 {
372 KItemModelBase* model = fileItemModel();
373 return model->sortOrder();
374 }
375
376 void DolphinView::setSortFoldersFirst(bool foldersFirst)
377 {
378 if (sortFoldersFirst() != foldersFirst) {
379 updateSortFoldersFirst(foldersFirst);
380 }
381 }
382
383 bool DolphinView::sortFoldersFirst() const
384 {
385 KFileItemModel* model = fileItemModel();
386 return model->sortFoldersFirst();
387 }
388
389 void DolphinView::setAdditionalInfoList(const QList<AdditionalInfo>& info)
390 {
391 const QList<AdditionalInfo> previousList = info;
392
393 ViewProperties props(url());
394 props.setAdditionalInfoList(info);
395
396 m_additionalInfoList = info;
397 applyAdditionalInfoListToView();
398
399 emit additionalInfoListChanged(m_additionalInfoList, previousList);
400 }
401
402 QList<DolphinView::AdditionalInfo> DolphinView::additionalInfoList() const
403 {
404 return m_additionalInfoList;
405 }
406
407 void DolphinView::reload()
408 {
409 QByteArray viewState;
410 QDataStream saveStream(&viewState, QIODevice::WriteOnly);
411 saveState(saveStream);
412
413 const KFileItemList itemList = selectedItems();
414 m_selectedUrls.clear();
415 m_selectedUrls = itemList.urlList();
416
417 setUrl(url());
418 loadDirectory(url(), true);
419
420 QDataStream restoreStream(viewState);
421 restoreState(restoreStream);
422 }
423
424 void DolphinView::stopLoading()
425 {
426 m_dirLister->stop();
427 }
428
429 void DolphinView::refresh()
430 {
431 const bool oldActivationState = m_active;
432 const int oldZoomLevel = zoomLevel();
433 m_active = true;
434
435 applyViewProperties();
436 reload();
437
438 setActive(oldActivationState);
439 updateZoomLevel(oldZoomLevel);
440 }
441
442 void DolphinView::setNameFilter(const QString& nameFilter)
443 {
444 Q_UNUSED(nameFilter);
445 //m_viewModeController->setNameFilter(nameFilter);
446 }
447
448 QString DolphinView::nameFilter() const
449 {
450 return QString(); //m_viewModeController->nameFilter();
451 }
452
453 void DolphinView::calculateItemCount(int& fileCount,
454 int& folderCount,
455 KIO::filesize_t& totalFileSize) const
456 {
457 foreach (const KFileItem& item, m_dirLister->items()) {
458 if (item.isDir()) {
459 ++folderCount;
460 } else {
461 ++fileCount;
462 totalFileSize += item.size();
463 }
464 }
465 }
466
467 QString DolphinView::statusBarText() const
468 {
469 QString text;
470 int folderCount = 0;
471 int fileCount = 0;
472 KIO::filesize_t totalFileSize = 0;
473
474 if (hasSelection()) {
475 // give a summary of the status of the selected files
476 const KFileItemList list = selectedItems();
477 if (list.isEmpty()) {
478 // when an item is triggered, it is temporary selected but selectedItems()
479 // will return an empty list
480 return text;
481 }
482
483 KFileItemList::const_iterator it = list.begin();
484 const KFileItemList::const_iterator end = list.end();
485 while (it != end) {
486 const KFileItem& item = *it;
487 if (item.isDir()) {
488 ++folderCount;
489 } else {
490 ++fileCount;
491 totalFileSize += item.size();
492 }
493 ++it;
494 }
495
496 if (folderCount + fileCount == 1) {
497 // if only one item is selected, show the filename
498 const QString name = list.first().text();
499 text = (folderCount == 1) ? i18nc("@info:status", "<filename>%1</filename> selected", name) :
500 i18nc("@info:status", "<filename>%1</filename> selected (%2)",
501 name, KIO::convertSize(totalFileSize));
502 } else {
503 // at least 2 items are selected
504 const QString foldersText = i18ncp("@info:status", "1 Folder selected", "%1 Folders selected", folderCount);
505 const QString filesText = i18ncp("@info:status", "1 File selected", "%1 Files selected", fileCount);
506 if ((folderCount > 0) && (fileCount > 0)) {
507 text = i18nc("@info:status folders, files (size)", "%1, %2 (%3)",
508 foldersText, filesText, KIO::convertSize(totalFileSize));
509 } else if (fileCount > 0) {
510 text = i18nc("@info:status files (size)", "%1 (%2)", filesText, KIO::convertSize(totalFileSize));
511 } else {
512 Q_ASSERT(folderCount > 0);
513 text = foldersText;
514 }
515 }
516 } else {
517 calculateItemCount(fileCount, folderCount, totalFileSize);
518 text = KIO::itemsSummaryString(fileCount + folderCount,
519 fileCount, folderCount,
520 totalFileSize, true);
521 }
522
523 return text;
524 }
525
526 QList<QAction*> DolphinView::versionControlActions(const KFileItemList& items) const
527 {
528 QList<QAction*> actions;
529
530 if (items.isEmpty()) {
531 const KFileItem item = fileItemModel()->rootItem();
532 actions = m_versionControlObserver->actions(KFileItemList() << item);
533 } else {
534 actions = m_versionControlObserver->actions(items);
535 }
536
537 return actions;
538 }
539
540 void DolphinView::setUrl(const KUrl& url)
541 {
542 if (url == m_url) {
543 return;
544 }
545
546 emit urlAboutToBeChanged(url);
547 m_url = url;
548
549 if (GeneralSettings::showToolTips()) {
550 m_toolTipManager->hideToolTip();
551 }
552
553 // It is important to clear the items from the model before
554 // applying the view properties, otherwise expensive operations
555 // might be done on the existing items although they get cleared
556 // anyhow afterwards by loadDirectory().
557 fileItemModel()->clear();
558 applyViewProperties();
559 loadDirectory(url);
560
561 emit urlChanged(url);
562 }
563
564 void DolphinView::selectAll()
565 {
566 KItemListSelectionManager* selectionManager = m_container->controller()->selectionManager();
567 selectionManager->setSelected(0, fileItemModel()->count());
568 }
569
570 void DolphinView::invertSelection()
571 {
572 KItemListSelectionManager* selectionManager = m_container->controller()->selectionManager();
573 selectionManager->setSelected(0, fileItemModel()->count(), KItemListSelectionManager::Toggle);
574 }
575
576 void DolphinView::clearSelection()
577 {
578 m_container->controller()->selectionManager()->clearSelection();
579 }
580
581 void DolphinView::renameSelectedItems()
582 {
583 KFileItemList items = selectedItems();
584 const int itemCount = items.count();
585 if (itemCount < 1) {
586 return;
587 }
588
589 /*if ((itemCount == 1) && DolphinSettings::instance().generalSettings()->renameInline()) {
590 const QModelIndex dirIndex = m_viewAccessor.dirModel()->indexForItem(items.first());
591 const QModelIndex proxyIndex = m_viewAccessor.proxyModel()->mapFromSource(dirIndex);
592 m_viewAccessor.itemView()->edit(proxyIndex);
593 } else {*/
594 RenameDialog* dialog = new RenameDialog(this, items);
595 dialog->setAttribute(Qt::WA_DeleteOnClose);
596 dialog->show();
597 dialog->raise();
598 dialog->activateWindow();
599 //}
600
601 // assure that the current index remains visible when KDirLister
602 // will notify the view about changed items
603 m_assureVisibleCurrentIndex = true;
604 }
605
606 void DolphinView::trashSelectedItems()
607 {
608 const KUrl::List list = simplifiedSelectedUrls();
609 KonqOperations::del(this, KonqOperations::TRASH, list);
610 }
611
612 void DolphinView::deleteSelectedItems()
613 {
614 const KUrl::List list = simplifiedSelectedUrls();
615 const bool del = KonqOperations::askDeleteConfirmation(list,
616 KonqOperations::DEL,
617 KonqOperations::DEFAULT_CONFIRMATION,
618 this);
619
620 if (del) {
621 KIO::Job* job = KIO::del(list);
622 connect(job, SIGNAL(result(KJob*)),
623 this, SLOT(slotDeleteFileFinished(KJob*)));
624 }
625 }
626
627 void DolphinView::cutSelectedItems()
628 {
629 QMimeData* mimeData = selectionMimeData();
630 KonqMimeData::addIsCutSelection(mimeData, true);
631 QApplication::clipboard()->setMimeData(mimeData);
632 }
633
634 void DolphinView::copySelectedItems()
635 {
636 QMimeData* mimeData = selectionMimeData();
637 QApplication::clipboard()->setMimeData(mimeData);
638 }
639
640 void DolphinView::paste()
641 {
642 pasteToUrl(url());
643 }
644
645 void DolphinView::pasteIntoFolder()
646 {
647 const KFileItemList items = selectedItems();
648 if ((items.count() == 1) && items.first().isDir()) {
649 pasteToUrl(items.first().url());
650 }
651 }
652
653 void DolphinView::setPreviewsShown(bool show)
654 {
655 if (previewsShown() == show) {
656 return;
657 }
658
659 ViewProperties props(url());
660 props.setPreviewsShown(show);
661
662 m_container->setPreviewsShown(show);
663 emit previewsShownChanged(show);
664 }
665
666 void DolphinView::setHiddenFilesShown(bool show)
667 {
668 if (m_dirLister->showingDotFiles() == show) {
669 return;
670 }
671
672 const KFileItemList itemList = selectedItems();
673 m_selectedUrls.clear();
674 m_selectedUrls = itemList.urlList();
675
676 ViewProperties props(url());
677 props.setHiddenFilesShown(show);
678
679 m_dirLister->setShowingDotFiles(show);
680 m_dirLister->emitChanges();
681 emit hiddenFilesShownChanged(show);
682 }
683
684 void DolphinView::setCategorizedSorting(bool categorized)
685 {
686 if (categorized == categorizedSorting()) {
687 return;
688 }
689
690 ViewProperties props(url());
691 props.setCategorizedSorting(categorized);
692 props.save();
693
694 //m_viewAccessor.proxyModel()->setCategorizedModel(categorized);
695
696 emit categorizedSortingChanged(categorized);
697 }
698
699 bool DolphinView::eventFilter(QObject* watched, QEvent* event)
700 {
701 switch (event->type()) {
702 case QEvent::FocusIn:
703 if (watched == m_container) {
704 setActive(true);
705 }
706 break;
707
708 default:
709 break;
710 }
711
712 return QWidget::eventFilter(watched, event);
713 }
714
715 void DolphinView::activate()
716 {
717 setActive(true);
718 }
719
720 void DolphinView::slotItemActivated(int index)
721 {
722 Q_UNUSED(index);
723
724 const KFileItemList items = selectedItems();
725 if (items.isEmpty()) {
726 return;
727 }
728
729 if (items.count() == 1) {
730 emit itemActivated(items.at(0)); // caught by DolphinViewContainer or DolphinPart
731 } else {
732 foreach (const KFileItem& item, items) {
733 if (item.isDir()) {
734 emit tabRequested(item.url());
735 } else {
736 emit itemActivated(item);
737 }
738 }
739 }
740 }
741
742 void DolphinView::slotItemMiddleClicked(int index)
743 {
744 const KFileItem item = fileItemModel()->fileItem(index);
745 if (item.isDir() || isTabsForFilesEnabled()) {
746 emit tabRequested(item.url());
747 }
748 }
749
750 void DolphinView::slotItemContextMenuRequested(int index, const QPointF& pos)
751 {
752 if (GeneralSettings::showToolTips()) {
753 m_toolTipManager->hideToolTip();
754 }
755 const KFileItem item = fileItemModel()->fileItem(index);
756 emit requestContextMenu(pos.toPoint(), item, url(), QList<QAction*>());
757 }
758
759 void DolphinView::slotViewContextMenuRequested(const QPointF& pos)
760 {
761 if (GeneralSettings::showToolTips()) {
762 m_toolTipManager->hideToolTip();
763 }
764 emit requestContextMenu(pos.toPoint(), KFileItem(), url(), QList<QAction*>());
765 }
766
767 void DolphinView::slotHeaderContextMenuRequested(const QPointF& pos)
768 {
769 QWeakPointer<KMenu> menu = new KMenu(QApplication::activeWindow());
770
771 KItemListView* view = m_container->controller()->view();
772 const QSet<QByteArray> visibleRolesSet = view->visibleRoles().toSet();
773
774 // Add all roles to the menu that can be shown or hidden by the user
775 const AdditionalInfoAccessor& infoAccessor = AdditionalInfoAccessor::instance();
776 const QList<DolphinView::AdditionalInfo> keys = infoAccessor.keys();
777 foreach (const DolphinView::AdditionalInfo info, keys) {
778 const QByteArray& role = infoAccessor.role(info);
779 if (role != "name") {
780 const QString text = fileItemModel()->roleDescription(role);
781
782 QAction* action = menu.data()->addAction(text);
783 action->setCheckable(true);
784 action->setChecked(visibleRolesSet.contains(role));
785 action->setData(info);
786 }
787 }
788
789 QAction* action = menu.data()->exec(pos.toPoint());
790 if (action) {
791 // Show or hide the selected role
792 const DolphinView::AdditionalInfo info =
793 static_cast<DolphinView::AdditionalInfo>(action->data().toInt());
794
795 ViewProperties props(url());
796 QList<DolphinView::AdditionalInfo> infoList = props.additionalInfoList();
797
798 const QByteArray selectedRole = infoAccessor.role(info);
799 QList<QByteArray> visibleRoles = view->visibleRoles();
800
801 if (action->isChecked()) {
802 const int index = keys.indexOf(info) + 1;
803 visibleRoles.insert(index, selectedRole);
804 infoList.insert(index, info);
805 } else {
806 visibleRoles.removeOne(selectedRole);
807 infoList.removeOne(info);
808 }
809
810 view->setVisibleRoles(visibleRoles);
811 props.setAdditionalInfoList(infoList);
812 }
813
814 delete menu.data();
815 }
816
817 void DolphinView::slotItemExpansionToggleClicked(int index)
818 {
819 // TODO: When doing a model->setExpanded(false) it should
820 // be checked here whether the current index is part of the
821 // closed sub-tree. If this is the case, the current index
822 // should be adjusted to the parent index.
823 KFileItemModel* model = fileItemModel();
824 const bool expanded = model->isExpanded(index);
825 model->setExpanded(index, !expanded);
826 }
827
828 void DolphinView::slotItemHovered(int index)
829 {
830 const KFileItem item = fileItemModel()->fileItem(index);
831
832 if (GeneralSettings::showToolTips()) {
833 QRectF itemRect = m_container->controller()->view()->itemBoundingRect(index);
834 const QPoint pos = m_container->mapToGlobal(itemRect.topLeft().toPoint());
835 itemRect.moveTo(pos);
836
837 m_toolTipManager->showToolTip(item, itemRect);
838 }
839
840 emit requestItemInfo(item);
841 }
842
843 void DolphinView::slotItemUnhovered(int index)
844 {
845 Q_UNUSED(index);
846 if (GeneralSettings::showToolTips()) {
847 m_toolTipManager->hideToolTip();
848 }
849 emit requestItemInfo(KFileItem());
850 }
851
852 void DolphinView::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* event)
853 {
854 const KFileItem destItem = fileItemModel()->fileItem(index);
855
856 QDropEvent dropEvent(event->pos().toPoint(),
857 event->possibleActions(),
858 event->mimeData(),
859 event->buttons(),
860 event->modifiers());
861
862 DragAndDropHelper::dropUrls(destItem, url(), &dropEvent, this);
863 }
864
865 void DolphinView::slotModelChanged(KItemModelBase* current, KItemModelBase* previous)
866 {
867 if (previous != 0) {
868 disconnect(previous, SIGNAL(loadingCompleted()), this, SLOT(slotLoadingCompleted()));
869 }
870
871 Q_ASSERT(qobject_cast<KFileItemModel*>(current));
872 connect(current, SIGNAL(loadingCompleted()), this, SLOT(slotLoadingCompleted()));
873
874 KFileItemModel* fileItemModel = static_cast<KFileItemModel*>(current);
875 m_versionControlObserver->setModel(fileItemModel);
876 }
877
878 void DolphinView::slotSelectionChanged(const QSet<int>& current, const QSet<int>& previous)
879 {
880 const int currentCount = current.count();
881 const int previousCount = previous.count();
882 const bool selectionStateChanged = (currentCount == 0 && previousCount > 0) ||
883 (currentCount > 0 && previousCount == 0);
884
885 // If nothing has been selected before and something got selected (or if something
886 // was selected before and now nothing is selected) the selectionChangedSignal must
887 // be emitted asynchronously as fast as possible to update the edit-actions.
888 m_selectionChangedTimer->setInterval(selectionStateChanged ? 0 : 300);
889 m_selectionChangedTimer->start();
890 }
891
892 void DolphinView::emitSelectionChangedSignal()
893 {
894 m_selectionChangedTimer->stop();
895 emit selectionChanged(selectedItems());
896 }
897
898 void DolphinView::dropUrls(const KFileItem& destItem,
899 const KUrl& destPath,
900 QDropEvent* event)
901 {
902 Q_UNUSED(destItem);
903 Q_UNUSED(destPath);
904 markPastedUrlsAsSelected(event->mimeData());
905 //DragAndDropHelper::instance().dropUrls(destItem, destPath, event, this);
906 }
907
908 void DolphinView::updateSorting(DolphinView::Sorting sorting)
909 {
910 ViewProperties props(url());
911 props.setSorting(sorting);
912
913 KItemModelBase* model = m_container->controller()->model();
914 model->setSortRole(sortRoleForSorting(sorting));
915
916 emit sortingChanged(sorting);
917 }
918
919 void DolphinView::updateSortOrder(Qt::SortOrder order)
920 {
921 ViewProperties props(url());
922 props.setSortOrder(order);
923
924 KItemModelBase* model = fileItemModel();
925 model->setSortOrder(order);
926
927 emit sortOrderChanged(order);
928 }
929
930 void DolphinView::updateSortFoldersFirst(bool foldersFirst)
931 {
932 ViewProperties props(url());
933 props.setSortFoldersFirst(foldersFirst);
934
935 KFileItemModel* model = fileItemModel();
936 model->setSortFoldersFirst(foldersFirst);
937
938 emit sortFoldersFirstChanged(foldersFirst);
939 }
940
941 QPair<bool, QString> DolphinView::pasteInfo() const
942 {
943 return KonqOperations::pasteInfo(url());
944 }
945
946 void DolphinView::setTabsForFilesEnabled(bool tabsForFiles)
947 {
948 m_tabsForFiles = tabsForFiles;
949 }
950
951 bool DolphinView::isTabsForFilesEnabled() const
952 {
953 return m_tabsForFiles;
954 }
955
956 bool DolphinView::itemsExpandable() const
957 {
958 return m_mode == DetailsView;
959 }
960
961 void DolphinView::restoreState(QDataStream& stream)
962 {
963 // Restore the current item that had the keyboard focus
964 stream >> m_currentItemUrl;
965
966 // Restore the view position
967 stream >> m_restoredContentsPosition;
968
969 // Restore expanded folders (only relevant for the details view - will be ignored by the view in other view modes)
970 QSet<KUrl> urls;
971 stream >> urls;
972 fileItemModel()->restoreExpandedUrls(urls);
973 }
974
975 void DolphinView::saveState(QDataStream& stream)
976 {
977 // Save the current item that has the keyboard focus
978 const int currentIndex = m_container->controller()->selectionManager()->currentItem();
979 if (currentIndex != -1) {
980 KFileItem item = fileItemModel()->fileItem(currentIndex);
981 KUrl currentItemUrl = item.url();
982 stream << currentItemUrl;
983 } else {
984 stream << KUrl();
985 }
986
987 // Save view position
988 const qreal x = m_container->horizontalScrollBar()->value();
989 const qreal y = m_container->verticalScrollBar()->value();
990 stream << QPoint(x, y);
991
992 // Save expanded folders (only relevant for the details view - the set will be empty in other view modes)
993 stream << fileItemModel()->expandedUrls();
994 }
995
996 bool DolphinView::hasSelection() const
997 {
998 return m_container->controller()->selectionManager()->hasSelection();
999 }
1000
1001 KFileItem DolphinView::rootItem() const
1002 {
1003 return m_dirLister->rootItem();
1004 }
1005
1006 void DolphinView::observeCreatedItem(const KUrl& url)
1007 {
1008 m_createdItemUrl = url;
1009 //connect(m_dirModel, SIGNAL(rowsInserted(QModelIndex,int,int)),
1010 // this, SLOT(selectAndScrollToCreatedItem()));
1011 }
1012
1013 void DolphinView::selectAndScrollToCreatedItem()
1014 {
1015 /*const QModelIndex dirIndex = m_viewAccessor.dirModel()->indexForUrl(m_createdItemUrl);
1016 if (dirIndex.isValid()) {
1017 const QModelIndex proxyIndex = m_viewAccessor.proxyModel()->mapFromSource(dirIndex);
1018 QAbstractItemView* view = m_viewAccessor.itemView();
1019 if (view) {
1020 view->setCurrentIndex(proxyIndex);
1021 }
1022 }
1023
1024 disconnect(m_viewAccessor.dirModel(), SIGNAL(rowsInserted(QModelIndex,int,int)),
1025 this, SLOT(selectAndScrollToCreatedItem()));*/
1026 m_createdItemUrl = KUrl();
1027 }
1028
1029 void DolphinView::slotRedirection(const KUrl& oldUrl, const KUrl& newUrl)
1030 {
1031 if (oldUrl.equals(url(), KUrl::CompareWithoutTrailingSlash)) {
1032 emit redirection(oldUrl, newUrl);
1033 m_url = newUrl; // #186947
1034 }
1035 }
1036
1037 void DolphinView::updateViewState()
1038 {
1039 if (m_currentItemUrl != KUrl()) {
1040 KItemListSelectionManager* selectionManager = m_container->controller()->selectionManager();
1041 const int currentIndex = fileItemModel()->index(m_currentItemUrl);
1042 if (currentIndex != -1) {
1043 selectionManager->setCurrentItem(currentIndex);
1044 } else {
1045 selectionManager->setCurrentItem(0);
1046 }
1047 m_currentItemUrl = KUrl();
1048 }
1049
1050 if (!m_restoredContentsPosition.isNull()) {
1051 const int x = m_restoredContentsPosition.x();
1052 const int y = m_restoredContentsPosition.y();
1053 m_restoredContentsPosition = QPoint();
1054
1055 m_container->horizontalScrollBar()->setValue(x);
1056 m_container->verticalScrollBar()->setValue(y);
1057 }
1058
1059 if (!m_selectedUrls.isEmpty()) {
1060 KItemListSelectionManager* selectionManager = m_container->controller()->selectionManager();
1061 QSet<int> selectedItems = selectionManager->selectedItems();
1062 const KFileItemModel* model = fileItemModel();
1063
1064 foreach (const KUrl& url, m_selectedUrls) {
1065 const int index = model->index(url);
1066 if (index >= 0) {
1067 selectedItems.insert(index);
1068 }
1069 }
1070
1071 selectionManager->setSelectedItems(selectedItems);
1072 m_selectedUrls.clear();
1073 }
1074 }
1075
1076 void DolphinView::showHoverInformation(const KFileItem& item)
1077 {
1078 emit requestItemInfo(item);
1079 }
1080
1081 void DolphinView::clearHoverInformation()
1082 {
1083 emit requestItemInfo(KFileItem());
1084 }
1085
1086 void DolphinView::slotDeleteFileFinished(KJob* job)
1087 {
1088 if (job->error() == 0) {
1089 emit operationCompletedMessage(i18nc("@info:status", "Delete operation completed."));
1090 } else if (job->error() != KIO::ERR_USER_CANCELED) {
1091 emit errorMessage(job->errorString());
1092 }
1093 }
1094
1095 void DolphinView::slotDirListerStarted(const KUrl& url)
1096 {
1097 // Disable the writestate temporary until it can be determined in a fast way
1098 // in DolphinView::slotLoadingCompleted()
1099 if (m_isFolderWritable) {
1100 m_isFolderWritable = false;
1101 emit writeStateChanged(m_isFolderWritable);
1102 }
1103
1104 emit startedPathLoading(url);
1105 }
1106
1107 void DolphinView::slotLoadingCompleted()
1108 {
1109 // Update the view-state. This has to be done using a Qt::QueuedConnection
1110 // because the view might not be in its final state yet (the view also
1111 // listens to the completed()-signal from KDirLister and the order of
1112 // of slots is undefined).
1113 QTimer::singleShot(0, this, SLOT(updateViewState()));
1114
1115 emit finishedPathLoading(url());
1116
1117 updateWritableState();
1118 }
1119
1120 void DolphinView::slotRefreshItems()
1121 {
1122 if (m_assureVisibleCurrentIndex) {
1123 m_assureVisibleCurrentIndex = false;
1124 //QAbstractItemView* view = m_viewAccessor.itemView();
1125 //if (view) {
1126 // m_viewAccessor.itemView()->scrollTo(m_viewAccessor.itemView()->currentIndex());
1127 //}
1128 }
1129 }
1130
1131 KFileItemModel* DolphinView::fileItemModel() const
1132 {
1133 return static_cast<KFileItemModel*>(m_container->controller()->model());
1134 }
1135
1136 void DolphinView::loadDirectory(const KUrl& url, bool reload)
1137 {
1138 if (!url.isValid()) {
1139 const QString location(url.pathOrUrl());
1140 if (location.isEmpty()) {
1141 emit errorMessage(i18nc("@info:status", "The location is empty."));
1142 } else {
1143 emit errorMessage(i18nc("@info:status", "The location '%1' is invalid.", location));
1144 }
1145 return;
1146 }
1147
1148 m_dirLister->openUrl(url, reload ? KDirLister::Reload : KDirLister::NoFlags);
1149 }
1150
1151 void DolphinView::applyViewProperties()
1152 {
1153 m_container->beginTransaction();
1154
1155 const ViewProperties props(url());
1156
1157 const Mode mode = props.viewMode();
1158 if (m_mode != mode) {
1159 const Mode previousMode = m_mode;
1160 m_mode = mode;
1161
1162 // Changing the mode might result in changing
1163 // the zoom level. Remember the old zoom level so
1164 // that zoomLevelChanged() can get emitted.
1165 const int oldZoomLevel = m_container->zoomLevel();
1166
1167 switch (m_mode) {
1168 case IconsView: m_container->setItemLayout(KFileItemListView::IconsLayout); break;
1169 case CompactView: m_container->setItemLayout(KFileItemListView::CompactLayout); break;
1170 case DetailsView: m_container->setItemLayout(KFileItemListView::DetailsLayout); break;
1171 default: Q_ASSERT(false); break;
1172 }
1173
1174 emit modeChanged(m_mode, previousMode);
1175
1176 if (m_container->zoomLevel() != oldZoomLevel) {
1177 emit zoomLevelChanged(m_container->zoomLevel(), oldZoomLevel);
1178 }
1179 }
1180
1181 const bool hiddenFilesShown = props.hiddenFilesShown();
1182 if (hiddenFilesShown != m_dirLister->showingDotFiles()) {
1183 m_dirLister->setShowingDotFiles(hiddenFilesShown);
1184 m_dirLister->emitChanges();
1185 emit hiddenFilesShownChanged(hiddenFilesShown);
1186 }
1187
1188 /* m_storedCategorizedSorting = props.categorizedSorting();
1189 const bool categorized = m_storedCategorizedSorting && supportsCategorizedSorting();
1190 if (categorized != m_viewAccessor.proxyModel()->isCategorizedModel()) {
1191 m_viewAccessor.proxyModel()->setCategorizedModel(categorized);
1192 emit categorizedSortingChanged();
1193 }*/
1194
1195 const DolphinView::Sorting sorting = props.sorting();
1196 KFileItemModel* model = fileItemModel();
1197 const QByteArray newSortRole = sortRoleForSorting(sorting);
1198 if (newSortRole != model->sortRole()) {
1199 model->setSortRole(newSortRole);
1200 emit sortingChanged(sorting);
1201 }
1202
1203 const Qt::SortOrder sortOrder = props.sortOrder();
1204 if (sortOrder != model->sortOrder()) {
1205 model->setSortOrder(sortOrder);
1206 emit sortOrderChanged(sortOrder);
1207 }
1208
1209 const bool sortFoldersFirst = props.sortFoldersFirst();
1210 if (sortFoldersFirst != model->sortFoldersFirst()) {
1211 model->setSortFoldersFirst(sortFoldersFirst);
1212 emit sortFoldersFirstChanged(sortFoldersFirst);
1213 }
1214
1215 const QList<DolphinView::AdditionalInfo> infoList = props.additionalInfoList();
1216 if (infoList != m_additionalInfoList) {
1217 const QList<DolphinView::AdditionalInfo> previousList = m_additionalInfoList;
1218 m_additionalInfoList = infoList;
1219 applyAdditionalInfoListToView();
1220 emit additionalInfoListChanged(m_additionalInfoList, previousList);
1221 }
1222
1223 const bool previewsShown = props.previewsShown();
1224 if (previewsShown != m_container->previewsShown()) {
1225 const int oldZoomLevel = zoomLevel();
1226
1227 m_container->setPreviewsShown(previewsShown);
1228 emit previewsShownChanged(previewsShown);
1229
1230 // Changing the preview-state might result in a changed zoom-level
1231 if (oldZoomLevel != zoomLevel()) {
1232 emit zoomLevelChanged(zoomLevel(), oldZoomLevel);
1233 }
1234 }
1235
1236 m_container->endTransaction();
1237 }
1238
1239 void DolphinView::applyAdditionalInfoListToView()
1240 {
1241 const AdditionalInfoAccessor& infoAccessor = AdditionalInfoAccessor::instance();
1242
1243 QList<QByteArray> visibleRoles;
1244 visibleRoles.reserve(m_additionalInfoList.count() + 1);
1245 visibleRoles.append("name");
1246
1247 foreach (AdditionalInfo info, m_additionalInfoList) {
1248 visibleRoles.append(infoAccessor.role(info));
1249 }
1250
1251 m_container->setVisibleRoles(visibleRoles);
1252 }
1253
1254 void DolphinView::pasteToUrl(const KUrl& url)
1255 {
1256 markPastedUrlsAsSelected(QApplication::clipboard()->mimeData());
1257 KonqOperations::doPaste(this, url);
1258 }
1259
1260 void DolphinView::updateZoomLevel(int oldZoomLevel)
1261 {
1262 Q_UNUSED(oldZoomLevel);
1263 /* const int newZoomLevel = ZoomLevelInfo::zoomLevelForIconSize(m_viewAccessor.itemView()->iconSize());
1264 if (oldZoomLevel != newZoomLevel) {
1265 m_viewModeController->setZoomLevel(newZoomLevel);
1266 emit zoomLevelChanged(newZoomLevel);
1267 }*/
1268 }
1269
1270 KUrl::List DolphinView::simplifiedSelectedUrls() const
1271 {
1272 KUrl::List urls;
1273
1274 const KFileItemList items = selectedItems();
1275 foreach (const KFileItem &item, items) {
1276 urls.append(item.url());
1277 }
1278
1279 if (itemsExpandable()) {
1280 // TODO: Check if we still need KDirModel for this in KDE 5.0
1281 urls = KDirModel::simplifiedUrlList(urls);
1282 }
1283
1284 return urls;
1285 }
1286
1287 QMimeData* DolphinView::selectionMimeData() const
1288 {
1289 const KFileItemModel* model = fileItemModel();
1290 const KItemListSelectionManager* selectionManager = m_container->controller()->selectionManager();
1291 const QSet<int> selectedIndexes = selectionManager->selectedItems();
1292
1293 return model->createMimeData(selectedIndexes);
1294 }
1295
1296 void DolphinView::markPastedUrlsAsSelected(const QMimeData* mimeData)
1297 {
1298 const KUrl::List urls = KUrl::List::fromMimeData(mimeData);
1299 markUrlsAsSelected(urls);
1300 }
1301
1302 void DolphinView::updateWritableState()
1303 {
1304 const bool wasFolderWritable = m_isFolderWritable;
1305 m_isFolderWritable = true;
1306
1307 const KFileItem item = m_dirLister->rootItem();
1308 if (!item.isNull()) {
1309 KFileItemListProperties capabilities(KFileItemList() << item);
1310 m_isFolderWritable = capabilities.supportsWriting();
1311 }
1312 if (m_isFolderWritable != wasFolderWritable) {
1313 emit writeStateChanged(m_isFolderWritable);
1314 }
1315 }
1316
1317 QByteArray DolphinView::sortRoleForSorting(Sorting sorting) const
1318 {
1319 switch (sorting) {
1320 case SortByName: return "name";
1321 case SortBySize: return "size";
1322 case SortByDate: return "date";
1323 case SortByPermissions: return "permissions";
1324 case SortByOwner: return "owner";
1325 case SortByGroup: return "group";
1326 case SortByType: return "type";
1327 case SortByDestination: return "destination";
1328 case SortByPath: return "path";
1329 default: break;
1330 }
1331
1332 return QByteArray();
1333 }
1334
1335 DolphinView::Sorting DolphinView::sortingForSortRole(const QByteArray& sortRole) const
1336 {
1337 static QHash<QByteArray, DolphinView::Sorting> sortHash;
1338 if (sortHash.isEmpty()) {
1339 sortHash.insert("name", SortByName);
1340 sortHash.insert("size", SortBySize);
1341 sortHash.insert("date", SortByDate);
1342 sortHash.insert("permissions", SortByPermissions);
1343 sortHash.insert("owner", SortByOwner);
1344 sortHash.insert("group", SortByGroup);
1345 sortHash.insert("type", SortByType);
1346 sortHash.insert("destination", SortByDestination);
1347 sortHash.insert("path", SortByPath);
1348 }
1349 return sortHash.value(sortRole);
1350 }
1351
1352 void DolphinView::markUrlAsCurrent(const KUrl& url)
1353 {
1354 m_currentItemUrl = url;
1355 }
1356
1357 #include "dolphinview.moc"