+}
+
+QPair<bool, QString> DolphinView::pasteInfo() const
+{
+ QPair<bool, QString> ret;
+ QClipboard* clipboard = QApplication::clipboard();
+ const QMimeData* mimeData = clipboard->mimeData();
+
+ KUrl::List urls = KUrl::List::fromMimeData(mimeData);
+ if (!urls.isEmpty()) {
+ // disable the paste action if no writing is supported
+ KFileItem item(KFileItem::Unknown, KFileItem::Unknown, url());
+ ret.first = KonqFileItemCapabilities(KFileItemList() << item).supportsWriting();
+
+ if (urls.count() == 1) {
+ const KFileItem item(KFileItem::Unknown, KFileItem::Unknown, urls.first(), true);
+ ret.second = item.isDir() ? i18nc("@action:inmenu", "Paste One Folder") :
+ i18nc("@action:inmenu", "Paste One File");
+
+ } else {
+ ret.second = i18ncp("@action:inmenu", "Paste One Item", "Paste %1 Items", urls.count());
+ }
+ } else {
+ ret.first = false;
+ ret.second = i18nc("@action:inmenu", "Paste");
+ }
+
+ return ret;
+}
+
+void DolphinView::setTabsForFilesEnabled(bool tabsForFiles)
+{
+ m_tabsForFiles = tabsForFiles;
+}
+
+bool DolphinView::isTabsForFilesEnabled() const
+{
+ return m_tabsForFiles;
+}
+
+bool DolphinView::itemsExpandable() const
+{
+ return (m_detailsView != 0) && m_detailsView->itemsExpandable();
+}
+
+void DolphinView::deleteWhenNotDragSource(QAbstractItemView *view)
+{
+ if (view == 0)
+ return;
+
+ if (DragAndDropHelper::instance().isDragSource(view)) {
+ kDebug() << "Is current drag source";
+ // We must store for later deletion.
+ if (m_expandedDragSource != 0) {
+ // The old stored view is obviously not the drag source anymore.
+ kDebug() << "Deleted old view " << m_expandedDragSource;
+ m_expandedDragSource->deleteLater();
+ m_expandedDragSource = 0;
+ }
+ view->hide();
+ m_expandedDragSource = view;
+ }
+ else {
+ kDebug() << "Deleted new view " << view;
+ view->deleteLater();
+ }
+}
+
+void DolphinView::emitContentsMoved()
+{
+ // only emit the contents moved signal if:
+ // - no directory loading is ongoing (this would reset the contents position
+ // always to (0, 0))
+ // - if the Column View is active: the column view does an automatic
+ // positioning during the loading operation, which must be remembered
+ if (!m_loadingDirectory || isColumnViewActive()) {
+ const QPoint pos(contentsPosition());
+ emit contentsMoved(pos.x(), pos.y());
+ }
+}
+
+void DolphinView::showHoverInformation(const KFileItem& item)
+{
+ emit requestItemInfo(item);
+}
+
+void DolphinView::clearHoverInformation()
+{
+ emit requestItemInfo(KFileItem());
+}
+
+void DolphinView::slotDeleteFileFinished(KJob* job)
+{
+ if (job->error() == 0) {
+ emit operationCompletedMessage(i18nc("@info:status", "Delete operation completed."));
+ } else if (job->error() != KIO::ERR_USER_CANCELED) {
+ emit errorMessage(job->errorString());
+ }
+}
+
+void DolphinView::slotRequestUrlChange(const KUrl& url)
+{
+ emit requestUrlChange(url);
+ m_controller->setUrl(url);
+}
+
+void DolphinView::restoreCurrentItem()
+{
+ const QModelIndex dirIndex = m_dolphinModel->indexForUrl(m_currentItemUrl);
+ if (dirIndex.isValid()) {
+ const QModelIndex proxyIndex = m_proxyModel->mapFromSource(dirIndex);
+ QAbstractItemView* view = itemView();
+ const bool clearSelection = !hasSelection();
+ view->setCurrentIndex(proxyIndex);
+ if (clearSelection) {
+ view->clearSelection();
+ }
+ }
+}
+
+void DolphinView::loadDirectory(const KUrl& url, bool reload)
+{
+ if (!url.isValid()) {
+ const QString location(url.pathOrUrl());
+ if (location.isEmpty()) {
+ emit errorMessage(i18nc("@info:status", "The location is empty."));
+ } else {
+ emit errorMessage(i18nc("@info:status", "The location '%1' is invalid.", location));
+ }
+ return;
+ }
+
+ m_loadingDirectory = true;
+
+ m_dirLister->stop();
+ m_dirLister->openUrl(url, reload ? KDirLister::Reload : KDirLister::NoFlags);
+
+ if (isColumnViewActive()) {
+ // adjusting the directory lister is not enough in the case of the
+ // column view, as each column has its own directory lister internally...
+ if (reload) {
+ m_columnView->reload();
+ } else {
+ m_columnView->showColumn(url);
+ }
+ }
+}
+
+KUrl DolphinView::viewPropertiesUrl() const
+{
+ if (isColumnViewActive()) {
+ return m_columnView->rootUrl();
+ }
+
+ return url();
+}
+
+void DolphinView::applyViewProperties(const KUrl& url)
+{
+ if (m_ignoreViewProperties) {
+ return;
+ }
+
+ if (isColumnViewActive() && rootUrl().isParentOf(url)) {
+ // The column view is active, hence don't apply the view properties
+ // of sub directories (represented by columns) to the view. The
+ // view always represents the properties of the first column.
+ return;
+ }
+
+ const ViewProperties props(url);
+
+ const Mode mode = props.viewMode();
+ if (m_mode != mode) {
+ const int oldZoomLevel = m_controller->zoomLevel();
+
+ m_mode = mode;
+ createView();
+ emit modeChanged();
+
+ updateZoomLevel(oldZoomLevel);
+ }
+ if (itemView() == 0) {
+ createView();
+ }
+ Q_ASSERT(itemView() != 0);
+ Q_ASSERT(m_fileItemDelegate != 0);