1 /***************************************************************************
2 * Copyright (C) 2006 by Peter Penz <peter.penz@gmx.at> *
3 * Copyright (C) 2006 by Gregor Kališnik <gregor@podnapisi.net> *
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. *
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. *
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 ***************************************************************************/
21 #include "dolphinview.h"
23 #include <QApplication>
26 #include <QItemSelection>
31 #include <kactioncollection.h>
32 #include <kcolorscheme.h>
33 #include <kdirlister.h>
34 #include <kfilepreviewgenerator.h>
35 #include <kiconeffect.h>
36 #include <kfileitem.h>
38 #include <kio/deletejob.h>
39 #include <kio/netaccess.h>
40 #include <kio/previewjob.h>
43 #include <kmessagebox.h>
44 #include <kmimetyperesolver.h>
45 #include <konq_fileitemcapabilities.h>
46 #include <konq_operations.h>
47 #include <konqmimedata.h>
48 #include <kstringhandler.h>
49 #include <ktoggleaction.h>
52 #include "dolphinmodel.h"
53 #include "dolphincolumnview.h"
54 #include "dolphincontroller.h"
55 #include "dolphindetailsview.h"
56 #include "dolphinfileitemdelegate.h"
57 #include "dolphinnewmenuobserver.h"
58 #include "dolphinsortfilterproxymodel.h"
59 #include "dolphin_detailsmodesettings.h"
60 #include "dolphiniconsview.h"
61 #include "dolphin_generalsettings.h"
62 #include "draganddrophelper.h"
63 #include "folderexpander.h"
64 #include "renamedialog.h"
65 #include "revisioncontrolobserver.h"
66 #include "tooltips/tooltipmanager.h"
67 #include "settings/dolphinsettings.h"
68 #include "viewproperties.h"
69 #include "zoomlevelinfo.h"
72 * Helper function for sorting items with qSort() in
73 * DolphinView::renameSelectedItems().
75 bool lessThan(const KFileItem
& item1
, const KFileItem
& item2
)
77 return KStringHandler::naturalCompare(item1
.name(), item2
.name()) < 0;
80 DolphinView::DolphinView(QWidget
* parent
,
82 KDirLister
* dirLister
,
83 DolphinModel
* dolphinModel
,
84 DolphinSortFilterProxyModel
* proxyModel
) :
88 m_loadingDirectory(false),
89 m_storedCategorizedSorting(false),
90 m_tabsForFiles(false),
91 m_isContextMenuOpen(false),
92 m_ignoreViewProperties(false),
93 m_assureVisibleCurrentIndex(false),
94 m_mode(DolphinView::IconsView
),
100 m_fileItemDelegate(0),
102 m_selectionChangedTimer(0),
103 m_dolphinModel(dolphinModel
),
104 m_dirLister(dirLister
),
105 m_proxyModel(proxyModel
),
106 m_previewGenerator(0),
108 m_revisionControlObserver(0),
114 m_expandedDragSource(0)
116 m_topLayout
= new QVBoxLayout(this);
117 m_topLayout
->setSpacing(0);
118 m_topLayout
->setMargin(0);
120 m_controller
= new DolphinController(this);
121 m_controller
->setUrl(url
);
123 connect(m_controller
, SIGNAL(urlChanged(const KUrl
&)),
124 this, SIGNAL(urlChanged(const KUrl
&)));
125 connect(m_controller
, SIGNAL(requestUrlChange(const KUrl
&)),
126 this, SLOT(slotRequestUrlChange(const KUrl
&)));
128 connect(m_controller
, SIGNAL(requestContextMenu(const QPoint
&, const QList
<QAction
*>&)),
129 this, SLOT(openContextMenu(const QPoint
&, const QList
<QAction
*>&)));
130 connect(m_controller
, SIGNAL(urlsDropped(const KFileItem
&, const KUrl
&, QDropEvent
*)),
131 this, SLOT(dropUrls(const KFileItem
&, const KUrl
&, QDropEvent
*)));
132 connect(m_controller
, SIGNAL(sortingChanged(DolphinView::Sorting
)),
133 this, SLOT(updateSorting(DolphinView::Sorting
)));
134 connect(m_controller
, SIGNAL(sortOrderChanged(Qt::SortOrder
)),
135 this, SLOT(updateSortOrder(Qt::SortOrder
)));
136 connect(m_controller
, SIGNAL(sortFoldersFirstChanged(bool)),
137 this, SLOT(updateSortFoldersFirst(bool)));
138 connect(m_controller
, SIGNAL(additionalInfoChanged(const KFileItemDelegate::InformationList
&)),
139 this, SLOT(updateAdditionalInfo(const KFileItemDelegate::InformationList
&)));
140 connect(m_controller
, SIGNAL(itemTriggered(const KFileItem
&)),
141 this, SLOT(triggerItem(const KFileItem
&)));
142 connect(m_controller
, SIGNAL(tabRequested(const KUrl
&)),
143 this, SIGNAL(tabRequested(const KUrl
&)));
144 connect(m_controller
, SIGNAL(activated()),
145 this, SLOT(activate()));
146 connect(m_controller
, SIGNAL(itemEntered(const KFileItem
&)),
147 this, SLOT(showHoverInformation(const KFileItem
&)));
148 connect(m_controller
, SIGNAL(viewportEntered()),
149 this, SLOT(clearHoverInformation()));
151 connect(m_dirLister
, SIGNAL(redirection(KUrl
, KUrl
)),
152 this, SIGNAL(redirection(KUrl
, KUrl
)));
153 connect(m_dirLister
, SIGNAL(completed()),
154 this, SLOT(slotDirListerCompleted()));
155 connect(m_dirLister
, SIGNAL(refreshItems(const QList
<QPair
<KFileItem
,KFileItem
>>&)),
156 this, SLOT(slotRefreshItems()));
158 // When a new item has been created by the "Create New..." menu, the item should
159 // get selected and it must be assured that the item will get visible. As the
160 // creation is done asynchronously, several signals must be checked:
161 connect(&DolphinNewMenuObserver::instance(), SIGNAL(itemCreated(const KUrl
&)),
162 this, SLOT(observeCreatedItem(const KUrl
&)));
164 applyViewProperties(url
);
165 m_topLayout
->addWidget(itemView());
168 DolphinView::~DolphinView()
170 delete m_expandedDragSource
;
171 m_expandedDragSource
= 0;
174 const KUrl
& DolphinView::url() const
176 return m_controller
->url();
179 KUrl
DolphinView::rootUrl() const
181 return isColumnViewActive() ? m_columnView
->rootUrl() : url();
184 void DolphinView::setActive(bool active
)
186 if (active
== m_active
) {
192 QColor color
= KColorScheme(QPalette::Active
, KColorScheme::View
).background().color();
194 emitSelectionChangedSignal();
199 QWidget
* viewport
= itemView()->viewport();
201 palette
.setColor(viewport
->backgroundRole(), color
);
202 viewport
->setPalette(palette
);
207 itemView()->setFocus();
211 m_controller
->indicateActivationChange(active
);
214 bool DolphinView::isActive() const
219 void DolphinView::setMode(Mode mode
)
221 if (mode
== m_mode
) {
222 return; // the wished mode is already set
225 const int oldZoomLevel
= m_controller
->zoomLevel();
230 const KUrl viewPropsUrl
= viewPropertiesUrl();
231 ViewProperties
props(viewPropsUrl
);
232 props
.setViewMode(m_mode
);
235 // the file item delegate has been recreated, apply the current
236 // additional information manually
237 const KFileItemDelegate::InformationList infoList
= props
.additionalInfo();
238 m_fileItemDelegate
->setShowInformation(infoList
);
239 emit
additionalInfoChanged();
241 // Not all view modes support categorized sorting. Adjust the sorting model
242 // if changing the view mode results in a change of the categorized sorting
244 m_storedCategorizedSorting
= props
.categorizedSorting();
245 const bool categorized
= m_storedCategorizedSorting
&& supportsCategorizedSorting();
246 if (categorized
!= m_proxyModel
->isCategorizedModel()) {
247 m_proxyModel
->setCategorizedModel(categorized
);
248 emit
categorizedSortingChanged();
253 updateZoomLevel(oldZoomLevel
);
255 loadDirectory(viewPropsUrl
);
259 DolphinView::Mode
DolphinView::mode() const
264 bool DolphinView::showPreview() const
266 return m_showPreview
;
269 bool DolphinView::showHiddenFiles() const
271 return m_dirLister
->showingDotFiles();
274 bool DolphinView::categorizedSorting() const
276 // If all view modes would support categorized sorting, returning
277 // m_proxyModel->isCategorizedModel() would be the way to go. As
278 // currently only the icons view supports caterized sorting, we remember
279 // the stored view properties state in m_storedCategorizedSorting and
280 // return this state. The application takes care to disable the corresponding
281 // checkbox by checking DolphinView::supportsCategorizedSorting() to indicate
282 // that this setting is not applied to the current view mode.
283 return m_storedCategorizedSorting
;
286 bool DolphinView::supportsCategorizedSorting() const
288 return m_iconsView
!= 0;
291 void DolphinView::selectAll()
293 QAbstractItemView
* view
= itemView();
294 // TODO: there seems to be a bug in QAbstractItemView::selectAll(); if
295 // the Ctrl-key is pressed (e. g. for Ctrl+A), selectAll() inverts the
296 // selection instead of selecting all items. This is bypassed for KDE 4.0
297 // by invoking clearSelection() first.
298 view
->clearSelection();
302 void DolphinView::invertSelection()
304 if (isColumnViewActive()) {
305 // QAbstractItemView does not offer a virtual method invertSelection()
306 // as counterpart to QAbstractItemView::selectAll(). This makes it
307 // necessary to delegate the inverting of the selection to the
308 // column view, as only the selection of the active column should
310 m_columnView
->invertSelection();
312 QItemSelectionModel
* selectionModel
= itemView()->selectionModel();
313 const QAbstractItemModel
* itemModel
= selectionModel
->model();
315 const QModelIndex topLeft
= itemModel
->index(0, 0);
316 const QModelIndex bottomRight
= itemModel
->index(itemModel
->rowCount() - 1,
317 itemModel
->columnCount() - 1);
319 const QItemSelection
selection(topLeft
, bottomRight
);
320 selectionModel
->select(selection
, QItemSelectionModel::Toggle
);
324 bool DolphinView::hasSelection() const
326 return itemView()->selectionModel()->hasSelection();
329 void DolphinView::clearSelection()
331 QItemSelectionModel
* selModel
= itemView()->selectionModel();
332 const QModelIndex currentIndex
= selModel
->currentIndex();
333 selModel
->setCurrentIndex(currentIndex
, QItemSelectionModel::Current
|
334 QItemSelectionModel::Clear
);
335 m_selectedItems
.clear();
338 KFileItemList
DolphinView::selectedItems() const
340 if (isColumnViewActive()) {
341 return m_columnView
->selectedItems();
344 const QAbstractItemView
* view
= itemView();
346 // Our view has a selection, we will map them back to the DolphinModel
347 // and then fill the KFileItemList.
348 Q_ASSERT((view
!= 0) && (view
->selectionModel() != 0));
350 const QItemSelection selection
= m_proxyModel
->mapSelectionToSource(view
->selectionModel()->selection());
351 KFileItemList itemList
;
353 const QModelIndexList indexList
= selection
.indexes();
354 foreach (const QModelIndex
&index
, indexList
) {
355 KFileItem item
= m_dolphinModel
->itemForIndex(index
);
356 if (!item
.isNull()) {
357 itemList
.append(item
);
364 KUrl::List
DolphinView::selectedUrls() const
367 const KFileItemList list
= selectedItems();
368 foreach (const KFileItem
&item
, list
) {
369 urls
.append(item
.url());
374 int DolphinView::selectedItemsCount() const
376 if (isColumnViewActive()) {
377 // TODO: get rid of this special case by adjusting the dir lister
378 // to the current column
379 return m_columnView
->selectedItems().count();
382 return itemView()->selectionModel()->selectedIndexes().count();
385 void DolphinView::setContentsPosition(int x
, int y
)
387 QAbstractItemView
* view
= itemView();
389 // the ColumnView takes care itself for the horizontal scrolling
390 if (!isColumnViewActive()) {
391 view
->horizontalScrollBar()->setValue(x
);
393 view
->verticalScrollBar()->setValue(y
);
395 m_loadingDirectory
= false;
398 QPoint
DolphinView::contentsPosition() const
400 const int x
= itemView()->horizontalScrollBar()->value();
401 const int y
= itemView()->verticalScrollBar()->value();
405 void DolphinView::setZoomLevel(int level
)
407 if (level
< ZoomLevelInfo::minimumLevel()) {
408 level
= ZoomLevelInfo::minimumLevel();
409 } else if (level
> ZoomLevelInfo::maximumLevel()) {
410 level
= ZoomLevelInfo::maximumLevel();
413 if (level
!= zoomLevel()) {
414 m_controller
->setZoomLevel(level
);
415 m_previewGenerator
->updateIcons();
416 emit
zoomLevelChanged(level
);
420 int DolphinView::zoomLevel() const
422 return m_controller
->zoomLevel();
425 void DolphinView::setSorting(Sorting sorting
)
427 if (sorting
!= this->sorting()) {
428 updateSorting(sorting
);
432 DolphinView::Sorting
DolphinView::sorting() const
434 return m_proxyModel
->sorting();
437 void DolphinView::setSortOrder(Qt::SortOrder order
)
439 if (sortOrder() != order
) {
440 updateSortOrder(order
);
444 Qt::SortOrder
DolphinView::sortOrder() const
446 return m_proxyModel
->sortOrder();
449 void DolphinView::setSortFoldersFirst(bool foldersFirst
)
451 if (sortFoldersFirst() != foldersFirst
) {
452 updateSortFoldersFirst(foldersFirst
);
456 bool DolphinView::sortFoldersFirst() const
458 return m_proxyModel
->sortFoldersFirst();
461 void DolphinView::setAdditionalInfo(KFileItemDelegate::InformationList info
)
463 const KUrl viewPropsUrl
= viewPropertiesUrl();
464 ViewProperties
props(viewPropsUrl
);
465 props
.setAdditionalInfo(info
);
466 m_fileItemDelegate
->setShowInformation(info
);
468 emit
additionalInfoChanged();
470 if (itemView() != m_detailsView
) {
471 // the details view requires no reloading of the directory, as it maps
472 // the file item delegate info to its columns internally
473 loadDirectory(viewPropsUrl
);
477 KFileItemDelegate::InformationList
DolphinView::additionalInfo() const
479 return m_fileItemDelegate
->showInformation();
482 void DolphinView::reload()
485 loadDirectory(url(), true);
488 void DolphinView::refresh()
490 m_ignoreViewProperties
= false;
492 const bool oldActivationState
= m_active
;
493 const int oldZoomLevel
= m_controller
->zoomLevel();
497 applyViewProperties(m_controller
->url());
500 setActive(oldActivationState
);
501 updateZoomLevel(oldZoomLevel
);
504 void DolphinView::updateView(const KUrl
& url
, const KUrl
& rootUrl
)
506 if (m_controller
->url() == url
) {
510 m_previewGenerator
->cancelPreviews();
511 m_controller
->setUrl(url
); // emits urlChanged, which we forward
513 if (!rootUrl
.isEmpty() && rootUrl
.isParentOf(url
)) {
514 applyViewProperties(rootUrl
);
515 loadDirectory(rootUrl
);
516 if (itemView() == m_columnView
) {
517 m_columnView
->setRootUrl(rootUrl
);
518 m_columnView
->showColumn(url
);
521 applyViewProperties(url
);
525 // When changing the URL there is no need to keep the revision
526 // data of the previous URL.
527 m_dolphinModel
->clearRevisionData();
529 emit
startedPathLoading(url
);
532 void DolphinView::setNameFilter(const QString
& nameFilter
)
534 m_proxyModel
->setFilterRegExp(nameFilter
);
536 if (isColumnViewActive()) {
537 // adjusting the directory lister is not enough in the case of the
538 // column view, as each column has its own directory lister internally...
539 m_columnView
->setNameFilter(nameFilter
);
543 void DolphinView::calculateItemCount(int& fileCount
,
545 KIO::filesize_t
& totalFileSize
) const
547 foreach (const KFileItem
& item
, m_dirLister
->items()) {
552 totalFileSize
+= item
.size();
557 QString
DolphinView::statusBarText() const
562 KIO::filesize_t totalFileSize
= 0;
564 if (hasSelection()) {
565 // give a summary of the status of the selected files
566 const KFileItemList list
= selectedItems();
567 if (list
.isEmpty()) {
568 // when an item is triggered, it is temporary selected but selectedItems()
569 // will return an empty list
573 KFileItemList::const_iterator it
= list
.begin();
574 const KFileItemList::const_iterator end
= list
.end();
576 const KFileItem
& item
= *it
;
581 totalFileSize
+= item
.size();
586 if (folderCount
+ fileCount
== 1) {
587 // if only one item is selected, show the filename
588 const QString name
= list
.first().name();
589 text
= (folderCount
== 1) ? i18nc("@info:status", "<filename>%1</filename> selected", name
) :
590 i18nc("@info:status", "<filename>%1</filename> selected (%2)",
591 name
, KIO::convertSize(totalFileSize
));
593 // at least 2 items are selected
594 const QString foldersText
= i18ncp("@info:status", "1 Folder selected", "%1 Folders selected", folderCount
);
595 const QString filesText
= i18ncp("@info:status", "1 File selected", "%1 Files selected", fileCount
);
596 if ((folderCount
> 0) && (fileCount
> 0)) {
597 text
= i18nc("@info:status folders, files (size)", "%1, %2 (%3)",
598 foldersText
, filesText
, KIO::convertSize(totalFileSize
));
599 } else if (fileCount
> 0) {
600 text
= i18nc("@info:status files (size)", "%1 (%2)", filesText
, KIO::convertSize(totalFileSize
));
602 Q_ASSERT(folderCount
> 0);
607 calculateItemCount(fileCount
, folderCount
, totalFileSize
);
608 text
= KIO::itemsSummaryString(fileCount
+ folderCount
,
609 fileCount
, folderCount
,
610 totalFileSize
, true);
616 QList
<QAction
*> DolphinView::revisionControlActions(const KFileItemList
& items
) const
618 return items
.isEmpty()
619 ? m_revisionControlObserver
->contextMenuActions(url().path(KUrl::AddTrailingSlash
))
620 : m_revisionControlObserver
->contextMenuActions(items
);
623 void DolphinView::setUrl(const KUrl
& url
)
625 m_newFileNames
.clear();
626 updateView(url
, KUrl());
629 void DolphinView::changeSelection(const KFileItemList
& selection
)
632 if (selection
.isEmpty()) {
635 const KUrl
& baseUrl
= url();
637 QItemSelection newSelection
;
638 foreach(const KFileItem
& item
, selection
) {
639 url
= item
.url().upUrl();
640 if (baseUrl
.equals(url
, KUrl::CompareWithoutTrailingSlash
)) {
641 QModelIndex index
= m_proxyModel
->mapFromSource(m_dolphinModel
->indexForItem(item
));
642 newSelection
.select(index
, index
);
645 itemView()->selectionModel()->select(newSelection
,
646 QItemSelectionModel::ClearAndSelect
647 | QItemSelectionModel::Current
);
650 void DolphinView::renameSelectedItems()
652 KFileItemList items
= selectedItems();
653 const int itemCount
= items
.count();
659 // More than one item has been selected for renaming. Open
660 // a rename dialog and rename all items afterwards.
661 QPointer
<RenameDialog
> dialog
= new RenameDialog(this, items
);
662 if (dialog
->exec() == QDialog::Rejected
) {
667 const QString newName
= dialog
->newName();
668 if (newName
.isEmpty()) {
669 emit
errorMessage(dialog
->errorString());
675 // the selection would be invalid after renaming the items, so just clear
679 // TODO: check how this can be integrated into KIO::FileUndoManager/KonqOperations
680 // as one operation instead of n rename operations like it is done now...
681 Q_ASSERT(newName
.contains('#'));
683 // currently the items are sorted by the selection order, resort
684 // them by the file name
685 qSort(items
.begin(), items
.end(), lessThan
);
687 // iterate through all selected items and rename them...
689 foreach (const KFileItem
& item
, items
) {
690 const KUrl
& oldUrl
= item
.url();
692 number
.setNum(index
++);
694 QString name
= newName
;
695 name
.replace('#', number
);
697 if (oldUrl
.fileName() != name
) {
698 KUrl newUrl
= oldUrl
;
699 newUrl
.setFileName(name
);
700 KonqOperations::rename(this, oldUrl
, newUrl
);
703 } else if (DolphinSettings::instance().generalSettings()->renameInline()) {
704 Q_ASSERT(itemCount
== 1);
706 if (isColumnViewActive()) {
707 m_columnView
->editItem(items
.first());
709 const QModelIndex dirIndex
= m_dolphinModel
->indexForItem(items
.first());
710 const QModelIndex proxyIndex
= m_proxyModel
->mapFromSource(dirIndex
);
711 itemView()->edit(proxyIndex
);
714 Q_ASSERT(itemCount
== 1);
716 QPointer
<RenameDialog
> dialog
= new RenameDialog(this, items
);
717 if (dialog
->exec() == QDialog::Rejected
) {
722 const QString newName
= dialog
->newName();
723 if (newName
.isEmpty()) {
724 emit
errorMessage(dialog
->errorString());
730 const KUrl
& oldUrl
= items
.first().url();
731 KUrl newUrl
= oldUrl
;
732 newUrl
.setFileName(newName
);
733 KonqOperations::rename(this, oldUrl
, newUrl
);
736 // assure that the current index remains visible when KDirLister
737 // will notify the view about changed items
738 m_assureVisibleCurrentIndex
= true;
741 void DolphinView::trashSelectedItems()
743 const KUrl::List list
= simplifiedSelectedUrls();
744 KonqOperations::del(this, KonqOperations::TRASH
, list
);
747 void DolphinView::deleteSelectedItems()
749 const KUrl::List list
= simplifiedSelectedUrls();
750 const bool del
= KonqOperations::askDeleteConfirmation(list
,
752 KonqOperations::DEFAULT_CONFIRMATION
,
756 KIO::Job
* job
= KIO::del(list
);
757 connect(job
, SIGNAL(result(KJob
*)),
758 this, SLOT(slotDeleteFileFinished(KJob
*)));
762 void DolphinView::cutSelectedItems()
764 QMimeData
* mimeData
= selectionMimeData();
765 KonqMimeData::addIsCutSelection(mimeData
, true);
766 QApplication::clipboard()->setMimeData(mimeData
);
769 void DolphinView::copySelectedItems()
771 QMimeData
* mimeData
= selectionMimeData();
772 QApplication::clipboard()->setMimeData(mimeData
);
775 void DolphinView::paste()
780 void DolphinView::pasteIntoFolder()
782 const KFileItemList items
= selectedItems();
783 if ((items
.count() == 1) && items
.first().isDir()) {
784 pasteToUrl(items
.first().url());
788 void DolphinView::setShowPreview(bool show
)
790 if (m_showPreview
== show
) {
794 const KUrl viewPropsUrl
= viewPropertiesUrl();
795 ViewProperties
props(viewPropsUrl
);
796 props
.setShowPreview(show
);
798 m_showPreview
= show
;
799 m_previewGenerator
->setPreviewShown(show
);
801 const int oldZoomLevel
= m_controller
->zoomLevel();
802 emit
showPreviewChanged();
804 // Enabling or disabling the preview might change the icon size of the view.
805 // As the view does not emit a signal when the icon size has been changed,
806 // the used zoom level of the controller must be adjusted manually:
807 updateZoomLevel(oldZoomLevel
);
809 loadDirectory(viewPropsUrl
);
812 void DolphinView::setShowHiddenFiles(bool show
)
814 if (m_dirLister
->showingDotFiles() == show
) {
818 const KUrl viewPropsUrl
= viewPropertiesUrl();
819 ViewProperties
props(viewPropsUrl
);
820 props
.setShowHiddenFiles(show
);
822 m_dirLister
->setShowingDotFiles(show
);
823 emit
showHiddenFilesChanged();
825 loadDirectory(viewPropsUrl
);
828 void DolphinView::setCategorizedSorting(bool categorized
)
830 if (categorized
== categorizedSorting()) {
834 // setCategorizedSorting(true) may only get invoked
835 // if the view supports categorized sorting
836 Q_ASSERT(!categorized
|| supportsCategorizedSorting());
838 ViewProperties
props(viewPropertiesUrl());
839 props
.setCategorizedSorting(categorized
);
842 m_storedCategorizedSorting
= categorized
;
843 m_proxyModel
->setCategorizedModel(categorized
);
845 emit
categorizedSortingChanged();
848 void DolphinView::toggleSortOrder()
850 const Qt::SortOrder order
= (sortOrder() == Qt::AscendingOrder
) ?
851 Qt::DescendingOrder
:
856 void DolphinView::toggleSortFoldersFirst()
858 setSortFoldersFirst(!sortFoldersFirst());
861 void DolphinView::toggleAdditionalInfo(QAction
* action
)
863 const KFileItemDelegate::Information info
=
864 static_cast<KFileItemDelegate::Information
>(action
->data().toInt());
866 KFileItemDelegate::InformationList list
= additionalInfo();
868 const bool show
= action
->isChecked();
870 const int index
= list
.indexOf(info
);
871 const bool containsInfo
= (index
>= 0);
872 if (show
&& !containsInfo
) {
874 setAdditionalInfo(list
);
875 } else if (!show
&& containsInfo
) {
876 list
.removeAt(index
);
877 setAdditionalInfo(list
);
878 Q_ASSERT(list
.indexOf(info
) < 0);
882 void DolphinView::mouseReleaseEvent(QMouseEvent
* event
)
884 QWidget::mouseReleaseEvent(event
);
888 void DolphinView::wheelEvent(QWheelEvent
* event
)
890 if (event
->modifiers() & Qt::ControlModifier
) {
891 const int delta
= event
->delta();
892 const int level
= zoomLevel();
894 setZoomLevel(level
+ 1);
895 } else if (delta
< 0) {
896 setZoomLevel(level
- 1);
902 bool DolphinView::eventFilter(QObject
* watched
, QEvent
* event
)
904 switch (event
->type()) {
905 case QEvent::FocusIn
:
906 if (watched
== itemView()) {
907 m_controller
->requestActivation();
911 case QEvent::MouseButtonPress
:
912 if ((watched
== itemView()->viewport()) && (m_expandedDragSource
!= 0)) {
913 // Listening to a mousebutton press event to delete expanded views is a
914 // workaround, as it seems impossible for the FolderExpander to know when
915 // a dragging outside a view has been finished. However it works quite well:
916 // A mousebutton press event indicates that a drag operation must be
918 m_expandedDragSource
->deleteLater();
919 m_expandedDragSource
= 0;
923 case QEvent::DragEnter
:
924 if (watched
== itemView()->viewport()) {
929 case QEvent::KeyPress
:
930 if (watched
== itemView()) {
931 if (m_toolTipManager
!= 0) {
932 m_toolTipManager
->hideTip();
935 // clear the selection when Escape has been pressed
936 QKeyEvent
* keyEvent
= static_cast<QKeyEvent
*>(event
);
937 if (keyEvent
->key() == Qt::Key_Escape
) {
947 return QWidget::eventFilter(watched
, event
);
950 void DolphinView::activate()
955 void DolphinView::triggerItem(const KFileItem
& item
)
957 const Qt::KeyboardModifiers modifier
= QApplication::keyboardModifiers();
958 if ((modifier
& Qt::ShiftModifier
) || (modifier
& Qt::ControlModifier
)) {
959 // items are selected by the user, hence don't trigger the
960 // item specified by 'index'
964 // TODO: the m_isContextMenuOpen check is a workaround for Qt-issue 207192
965 if (item
.isNull() || m_isContextMenuOpen
) {
969 if (m_toolTipManager
!= 0) {
970 m_toolTipManager
->hideTip();
972 emit
itemTriggered(item
); // caught by DolphinViewContainer or DolphinPart
975 void DolphinView::emitDelayedSelectionChangedSignal()
977 // Invoke emitSelectionChangedSignal() with a delay of 300 ms. This assures
978 // that fast selection changes don't result in expensive operations to
979 // collect all file items for the signal (see DolphinView::selectedItems()).
980 m_selectionChangedTimer
->start();
983 void DolphinView::emitSelectionChangedSignal()
985 emit
selectionChanged(DolphinView::selectedItems());
988 void DolphinView::openContextMenu(const QPoint
& pos
,
989 const QList
<QAction
*>& customActions
)
992 if (isColumnViewActive()) {
993 item
= m_columnView
->itemAt(pos
);
995 const QModelIndex index
= itemView()->indexAt(pos
);
996 if (index
.isValid() && (index
.column() == DolphinModel::Name
)) {
997 const QModelIndex dolphinModelIndex
= m_proxyModel
->mapToSource(index
);
998 item
= m_dolphinModel
->itemForIndex(dolphinModelIndex
);
1002 if (m_toolTipManager
!= 0) {
1003 m_toolTipManager
->hideTip();
1006 m_isContextMenuOpen
= true; // TODO: workaround for Qt-issue 207192
1007 emit
requestContextMenu(item
, url(), customActions
);
1008 m_isContextMenuOpen
= false;
1011 void DolphinView::dropUrls(const KFileItem
& destItem
,
1012 const KUrl
& destPath
,
1015 addNewFileNames(event
->mimeData());
1016 DragAndDropHelper::instance().dropUrls(destItem
, destPath
, event
, this);
1019 void DolphinView::updateSorting(DolphinView::Sorting sorting
)
1021 ViewProperties
props(viewPropertiesUrl());
1022 props
.setSorting(sorting
);
1024 m_proxyModel
->setSorting(sorting
);
1026 emit
sortingChanged(sorting
);
1029 void DolphinView::updateSortOrder(Qt::SortOrder order
)
1031 ViewProperties
props(viewPropertiesUrl());
1032 props
.setSortOrder(order
);
1034 m_proxyModel
->setSortOrder(order
);
1036 emit
sortOrderChanged(order
);
1039 void DolphinView::updateSortFoldersFirst(bool foldersFirst
)
1041 ViewProperties
props(viewPropertiesUrl());
1042 props
.setSortFoldersFirst(foldersFirst
);
1044 m_proxyModel
->setSortFoldersFirst(foldersFirst
);
1046 emit
sortFoldersFirstChanged(foldersFirst
);
1049 void DolphinView::updateAdditionalInfo(const KFileItemDelegate::InformationList
& info
)
1051 ViewProperties
props(viewPropertiesUrl());
1052 props
.setAdditionalInfo(info
);
1055 m_fileItemDelegate
->setShowInformation(info
);
1057 emit
additionalInfoChanged();
1060 void DolphinView::updateAdditionalInfoActions(KActionCollection
* collection
)
1062 const bool enable
= (m_mode
== DolphinView::DetailsView
) ||
1063 (m_mode
== DolphinView::IconsView
);
1065 QAction
* showSizeInfo
= collection
->action("show_size_info");
1066 QAction
* showDateInfo
= collection
->action("show_date_info");
1067 QAction
* showPermissionsInfo
= collection
->action("show_permissions_info");
1068 QAction
* showOwnerInfo
= collection
->action("show_owner_info");
1069 QAction
* showGroupInfo
= collection
->action("show_group_info");
1070 QAction
* showMimeInfo
= collection
->action("show_mime_info");
1072 showSizeInfo
->setChecked(false);
1073 showDateInfo
->setChecked(false);
1074 showPermissionsInfo
->setChecked(false);
1075 showOwnerInfo
->setChecked(false);
1076 showGroupInfo
->setChecked(false);
1077 showMimeInfo
->setChecked(false);
1079 showSizeInfo
->setEnabled(enable
);
1080 showDateInfo
->setEnabled(enable
);
1081 showPermissionsInfo
->setEnabled(enable
);
1082 showOwnerInfo
->setEnabled(enable
);
1083 showGroupInfo
->setEnabled(enable
);
1084 showMimeInfo
->setEnabled(enable
);
1086 foreach (KFileItemDelegate::Information info
, m_fileItemDelegate
->showInformation()) {
1088 case KFileItemDelegate::Size
:
1089 showSizeInfo
->setChecked(true);
1091 case KFileItemDelegate::ModificationTime
:
1092 showDateInfo
->setChecked(true);
1094 case KFileItemDelegate::Permissions
:
1095 showPermissionsInfo
->setChecked(true);
1097 case KFileItemDelegate::Owner
:
1098 showOwnerInfo
->setChecked(true);
1100 case KFileItemDelegate::OwnerAndGroup
:
1101 showGroupInfo
->setChecked(true);
1103 case KFileItemDelegate::FriendlyMimeType
:
1104 showMimeInfo
->setChecked(true);
1112 QPair
<bool, QString
> DolphinView::pasteInfo() const
1114 return KonqOperations::pasteInfo(url());
1117 void DolphinView::setTabsForFilesEnabled(bool tabsForFiles
)
1119 m_tabsForFiles
= tabsForFiles
;
1122 bool DolphinView::isTabsForFilesEnabled() const
1124 return m_tabsForFiles
;
1127 void DolphinView::activateItem(const KUrl
& url
)
1129 m_activeItemUrl
= url
;
1132 bool DolphinView::itemsExpandable() const
1134 return (m_detailsView
!= 0) && m_detailsView
->itemsExpandable();
1137 void DolphinView::deleteWhenNotDragSource(QAbstractItemView
*view
)
1142 if (DragAndDropHelper::instance().isDragSource(view
)) {
1143 // We must store for later deletion.
1144 if (m_expandedDragSource
!= 0) {
1145 // The old stored view is obviously not the drag source anymore.
1146 m_expandedDragSource
->deleteLater();
1147 m_expandedDragSource
= 0;
1150 m_expandedDragSource
= view
;
1153 view
->deleteLater();
1157 void DolphinView::observeCreatedItem(const KUrl
& url
)
1159 m_createdItemUrl
= url
;
1160 connect(m_dolphinModel
, SIGNAL(rowsInserted(const QModelIndex
&, int, int)),
1161 this, SLOT(selectAndScrollToCreatedItem()));
1164 void DolphinView::selectAndScrollToCreatedItem()
1166 const QModelIndex dirIndex
= m_dolphinModel
->indexForUrl(m_createdItemUrl
);
1167 if (dirIndex
.isValid()) {
1168 const QModelIndex proxyIndex
= m_proxyModel
->mapFromSource(dirIndex
);
1169 itemView()->setCurrentIndex(proxyIndex
);
1172 disconnect(m_dolphinModel
, SIGNAL(rowsInserted(const QModelIndex
&, int, int)),
1173 this, SLOT(selectAndScrollToCreatedItem()));
1174 m_createdItemUrl
= KUrl();
1177 void DolphinView::restoreSelection()
1179 disconnect(m_dirLister
, SIGNAL(completed()), this, SLOT(restoreSelection()));
1180 changeSelection(m_selectedItems
);
1183 void DolphinView::emitContentsMoved()
1185 // only emit the contents moved signal if:
1186 // - no directory loading is ongoing (this would reset the contents position
1187 // always to (0, 0))
1188 // - if the Column View is active: the column view does an automatic
1189 // positioning during the loading operation, which must be remembered
1190 if (!m_loadingDirectory
|| isColumnViewActive()) {
1191 const QPoint
pos(contentsPosition());
1192 emit
contentsMoved(pos
.x(), pos
.y());
1196 void DolphinView::showHoverInformation(const KFileItem
& item
)
1198 emit
requestItemInfo(item
);
1201 void DolphinView::clearHoverInformation()
1203 emit
requestItemInfo(KFileItem());
1206 void DolphinView::slotDeleteFileFinished(KJob
* job
)
1208 if (job
->error() == 0) {
1209 emit
operationCompletedMessage(i18nc("@info:status", "Delete operation completed."));
1210 } else if (job
->error() != KIO::ERR_USER_CANCELED
) {
1211 emit
errorMessage(job
->errorString());
1215 void DolphinView::slotRequestUrlChange(const KUrl
& url
)
1217 emit
requestUrlChange(url
);
1218 m_controller
->setUrl(url
);
1221 void DolphinView::slotDirListerCompleted()
1223 if (!m_activeItemUrl
.isEmpty()) {
1224 // assure that the current item remains visible
1225 const QModelIndex dirIndex
= m_dolphinModel
->indexForUrl(m_activeItemUrl
);
1226 if (dirIndex
.isValid()) {
1227 const QModelIndex proxyIndex
= m_proxyModel
->mapFromSource(dirIndex
);
1228 QAbstractItemView
* view
= itemView();
1229 const bool clearSelection
= !hasSelection();
1230 view
->setCurrentIndex(proxyIndex
);
1231 if (clearSelection
) {
1232 view
->clearSelection();
1234 m_activeItemUrl
.clear();
1238 if (!m_newFileNames
.isEmpty()) {
1239 // select all newly added items created by a paste operation or
1240 // a drag & drop operation
1241 const int rowCount
= m_proxyModel
->rowCount();
1242 QItemSelection selection
;
1243 for (int row
= 0; row
< rowCount
; ++row
) {
1244 const QModelIndex proxyIndex
= m_proxyModel
->index(row
, 0);
1245 const QModelIndex dirIndex
= m_proxyModel
->mapToSource(proxyIndex
);
1246 const KUrl url
= m_dolphinModel
->itemForIndex(dirIndex
).url();
1247 if (m_newFileNames
.contains(url
.fileName())) {
1248 selection
.merge(QItemSelection(proxyIndex
, proxyIndex
), QItemSelectionModel::Select
);
1251 itemView()->selectionModel()->select(selection
, QItemSelectionModel::Select
);
1253 m_newFileNames
.clear();
1257 void DolphinView::slotRefreshItems()
1259 if (m_assureVisibleCurrentIndex
) {
1260 m_assureVisibleCurrentIndex
= false;
1261 itemView()->scrollTo(itemView()->currentIndex());
1265 void DolphinView::loadDirectory(const KUrl
& url
, bool reload
)
1267 if (!url
.isValid()) {
1268 const QString
location(url
.pathOrUrl());
1269 if (location
.isEmpty()) {
1270 emit
errorMessage(i18nc("@info:status", "The location is empty."));
1272 emit
errorMessage(i18nc("@info:status", "The location '%1' is invalid.", location
));
1277 m_loadingDirectory
= true;
1280 m_selectedItems
= selectedItems();
1281 connect(m_dirLister
, SIGNAL(completed()), this, SLOT(restoreSelection()));
1284 m_dirLister
->stop();
1285 m_dirLister
->openUrl(url
, reload
? KDirLister::Reload
: KDirLister::NoFlags
);
1287 if (isColumnViewActive()) {
1288 // adjusting the directory lister is not enough in the case of the
1289 // column view, as each column has its own directory lister internally...
1291 m_columnView
->reload();
1293 m_columnView
->showColumn(url
);
1298 KUrl
DolphinView::viewPropertiesUrl() const
1300 if (isColumnViewActive()) {
1301 return m_columnView
->rootUrl();
1307 void DolphinView::applyViewProperties(const KUrl
& url
)
1309 if (m_ignoreViewProperties
) {
1313 if (isColumnViewActive() && rootUrl().isParentOf(url
)) {
1314 // The column view is active, hence don't apply the view properties
1315 // of sub directories (represented by columns) to the view. The
1316 // view always represents the properties of the first column.
1320 const ViewProperties
props(url
);
1322 const Mode mode
= props
.viewMode();
1323 if (m_mode
!= mode
) {
1324 const int oldZoomLevel
= m_controller
->zoomLevel();
1330 updateZoomLevel(oldZoomLevel
);
1332 if (itemView() == 0) {
1335 Q_ASSERT(itemView() != 0);
1336 Q_ASSERT(m_fileItemDelegate
!= 0);
1338 const bool showHiddenFiles
= props
.showHiddenFiles();
1339 if (showHiddenFiles
!= m_dirLister
->showingDotFiles()) {
1340 m_dirLister
->setShowingDotFiles(showHiddenFiles
);
1341 emit
showHiddenFilesChanged();
1344 m_storedCategorizedSorting
= props
.categorizedSorting();
1345 const bool categorized
= m_storedCategorizedSorting
&& supportsCategorizedSorting();
1346 if (categorized
!= m_proxyModel
->isCategorizedModel()) {
1347 m_proxyModel
->setCategorizedModel(categorized
);
1348 emit
categorizedSortingChanged();
1351 const DolphinView::Sorting sorting
= props
.sorting();
1352 if (sorting
!= m_proxyModel
->sorting()) {
1353 m_proxyModel
->setSorting(sorting
);
1354 emit
sortingChanged(sorting
);
1357 const Qt::SortOrder sortOrder
= props
.sortOrder();
1358 if (sortOrder
!= m_proxyModel
->sortOrder()) {
1359 m_proxyModel
->setSortOrder(sortOrder
);
1360 emit
sortOrderChanged(sortOrder
);
1363 const bool sortFoldersFirst
= props
.sortFoldersFirst();
1364 if (sortFoldersFirst
!= m_proxyModel
->sortFoldersFirst()) {
1365 m_proxyModel
->setSortFoldersFirst(sortFoldersFirst
);
1366 emit
sortFoldersFirstChanged(sortFoldersFirst
);
1369 KFileItemDelegate::InformationList info
= props
.additionalInfo();
1370 if (info
!= m_fileItemDelegate
->showInformation()) {
1371 m_fileItemDelegate
->setShowInformation(info
);
1372 emit
additionalInfoChanged();
1375 const bool showPreview
= props
.showPreview();
1376 if (showPreview
!= m_showPreview
) {
1377 m_showPreview
= showPreview
;
1378 m_previewGenerator
->setPreviewShown(showPreview
);
1380 const int oldZoomLevel
= m_controller
->zoomLevel();
1381 emit
showPreviewChanged();
1383 // Enabling or disabling the preview might change the icon size of the view.
1384 // As the view does not emit a signal when the icon size has been changed,
1385 // the used zoom level of the controller must be adjusted manually:
1386 updateZoomLevel(oldZoomLevel
);
1389 if (DolphinSettings::instance().generalSettings()->globalViewProps()) {
1390 // During the lifetime of a DolphinView instance the global view properties
1391 // should not be changed. This allows e. g. to split a view and use different
1392 // view properties for each view.
1393 m_ignoreViewProperties
= true;
1397 void DolphinView::createView()
1400 Q_ASSERT(m_iconsView
== 0);
1401 Q_ASSERT(m_detailsView
== 0);
1402 Q_ASSERT(m_columnView
== 0);
1404 QAbstractItemView
* view
= 0;
1407 m_iconsView
= new DolphinIconsView(this, m_controller
);
1413 m_detailsView
= new DolphinDetailsView(this, m_controller
);
1414 view
= m_detailsView
;
1418 m_columnView
= new DolphinColumnView(this, m_controller
);
1419 view
= m_columnView
;
1423 Q_ASSERT(view
!= 0);
1424 view
->installEventFilter(this);
1425 view
->viewport()->installEventFilter(this);
1426 setFocusProxy(view
);
1428 if (m_mode
!= ColumnView
) {
1429 // Give the view the ability to auto-expand its directories on hovering
1430 // (the column view takes care about this itself). If the details view
1431 // uses expandable folders, the auto-expanding should be used always.
1432 DolphinSettings
& settings
= DolphinSettings::instance();
1433 const bool enabled
= settings
.generalSettings()->autoExpandFolders() ||
1434 ((m_detailsView
!= 0) && settings
.detailsModeSettings()->expandableFolders());
1436 FolderExpander
* folderExpander
= new FolderExpander(view
, m_proxyModel
);
1437 folderExpander
->setEnabled(enabled
);
1438 connect(folderExpander
, SIGNAL(enterDir(const QModelIndex
&)),
1439 m_controller
, SLOT(triggerItem(const QModelIndex
&)));
1442 // Listen out for requests to delete the current column.
1443 connect(m_columnView
, SIGNAL(requestColumnDeletion(QAbstractItemView
*)),
1444 this, SLOT(deleteWhenNotDragSource(QAbstractItemView
*)));
1447 m_controller
->setItemView(view
);
1449 m_fileItemDelegate
= new DolphinFileItemDelegate(view
);
1450 m_fileItemDelegate
->setShowToolTipWhenElided(false);
1451 m_fileItemDelegate
->setMinimizedNameColumn(m_mode
== DetailsView
);
1452 view
->setItemDelegate(m_fileItemDelegate
);
1454 view
->setModel(m_proxyModel
);
1455 if (m_selectionModel
!= 0) {
1456 view
->setSelectionModel(m_selectionModel
);
1458 m_selectionModel
= view
->selectionModel();
1461 m_selectionChangedTimer
= new QTimer(this);
1462 m_selectionChangedTimer
->setSingleShot(true);
1463 m_selectionChangedTimer
->setInterval(300);
1464 connect(m_selectionChangedTimer
, SIGNAL(timeout()),
1465 this, SLOT(emitSelectionChangedSignal()));
1467 // reparent the selection model, as it should not be deleted
1468 // when deleting the model
1469 m_selectionModel
->setParent(this);
1471 view
->setSelectionMode(QAbstractItemView::ExtendedSelection
);
1473 m_previewGenerator
= new KFilePreviewGenerator(view
);
1474 m_previewGenerator
->setPreviewShown(m_showPreview
);
1476 m_revisionControlObserver
= new RevisionControlObserver(view
);
1477 connect(m_revisionControlObserver
, SIGNAL(infoMessage(const QString
&)),
1478 this, SIGNAL(infoMessage(const QString
&)));
1479 connect(m_revisionControlObserver
, SIGNAL(errorMessage(const QString
&)),
1480 this, SIGNAL(errorMessage(const QString
&)));
1481 connect(m_revisionControlObserver
, SIGNAL(operationCompletedMessage(const QString
&)),
1482 this, SIGNAL(operationCompletedMessage(const QString
&)));
1484 if (DolphinSettings::instance().generalSettings()->showToolTips()) {
1485 m_toolTipManager
= new ToolTipManager(view
, m_proxyModel
);
1486 connect(m_controller
, SIGNAL(hideToolTip()),
1487 m_toolTipManager
, SLOT(hideTip()));
1490 m_topLayout
->insertWidget(1, view
);
1492 connect(view
->selectionModel(), SIGNAL(selectionChanged(const QItemSelection
&, const QItemSelection
&)),
1493 this, SLOT(emitDelayedSelectionChangedSignal()));
1494 connect(view
->verticalScrollBar(), SIGNAL(valueChanged(int)),
1495 this, SLOT(emitContentsMoved()));
1496 connect(view
->horizontalScrollBar(), SIGNAL(valueChanged(int)),
1497 this, SLOT(emitContentsMoved()));
1500 void DolphinView::deleteView()
1502 QAbstractItemView
* view
= itemView();
1504 // It's important to set the keyboard focus to the parent
1505 // before deleting the view: Otherwise when having a split
1506 // view the other view will get the focus and will request
1507 // an activation (see DolphinView::eventFilter()).
1511 m_topLayout
->removeWidget(view
);
1514 // m_previewGenerator's parent is not always destroyed, and we
1515 // don't want two active at once - manually delete.
1516 delete m_previewGenerator
;
1517 m_previewGenerator
= 0;
1520 m_controller
->disconnect(view
);
1523 deleteWhenNotDragSource(view
);
1529 m_fileItemDelegate
= 0;
1530 m_toolTipManager
= 0;
1534 QAbstractItemView
* DolphinView::itemView() const
1536 if (m_detailsView
!= 0) {
1537 return m_detailsView
;
1538 } else if (m_columnView
!= 0) {
1539 return m_columnView
;
1545 void DolphinView::pasteToUrl(const KUrl
& url
)
1547 addNewFileNames(QApplication::clipboard()->mimeData());
1548 KonqOperations::doPaste(this, url
);
1551 void DolphinView::updateZoomLevel(int oldZoomLevel
)
1553 const int newZoomLevel
= ZoomLevelInfo::zoomLevelForIconSize(itemView()->iconSize());
1554 if (oldZoomLevel
!= newZoomLevel
) {
1555 m_controller
->setZoomLevel(newZoomLevel
);
1556 emit
zoomLevelChanged(newZoomLevel
);
1560 KUrl::List
DolphinView::simplifiedSelectedUrls() const
1562 KUrl::List list
= selectedUrls();
1563 if (itemsExpandable() ) {
1564 list
= KDirModel::simplifiedUrlList(list
);
1569 QMimeData
* DolphinView::selectionMimeData() const
1571 if (isColumnViewActive()) {
1572 return m_columnView
->selectionMimeData();
1575 const QAbstractItemView
* view
= itemView();
1576 Q_ASSERT((view
!= 0) && (view
->selectionModel() != 0));
1577 const QItemSelection selection
= m_proxyModel
->mapSelectionToSource(view
->selectionModel()->selection());
1578 return m_dolphinModel
->mimeData(selection
.indexes());
1581 void DolphinView::addNewFileNames(const QMimeData
* mimeData
)
1583 const KUrl::List urls
= KUrl::List::fromMimeData(mimeData
);
1584 foreach (const KUrl
& url
, urls
) {
1585 m_newFileNames
.insert(url
.fileName());
1589 #include "dolphinview.moc"