X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/652d08c9242ed51d86dba3b2afda9d3b2e9a9cd7..fd74aa8e2057158d2eadb835eb61564854c81020:/src/views/dolphinviewcontroller.cpp diff --git a/src/views/dolphinviewcontroller.cpp b/src/views/dolphinviewcontroller.cpp index 6ef32f07f..f8f27ea38 100644 --- a/src/views/dolphinviewcontroller.cpp +++ b/src/views/dolphinviewcontroller.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2010 by Peter Penz * + * Copyright (C) 2010 by Peter Penz * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -20,8 +20,8 @@ #include "dolphinviewcontroller.h" #include "zoomlevelinfo.h" -#include -#include +#include +#include #include #include #include @@ -84,11 +84,9 @@ void DolphinViewController::requestActivation() emit activated(); } -void DolphinViewController::indicateDroppedUrls(const KFileItem& destItem, - const KUrl& destPath, - QDropEvent* event) +void DolphinViewController::indicateDroppedUrls(const KFileItem& destItem, QDropEvent* event) { - emit urlsDropped(destItem, destPath, event); + emit urlsDropped(destItem, m_dolphinView->url(), event); } @@ -128,7 +126,9 @@ QList DolphinViewController::versionControlActions(const KFileItemList void DolphinViewController::handleKeyPressEvent(QKeyEvent* event) { - Q_ASSERT(m_itemView != 0); + if (m_itemView == 0) { + return; + } const QItemSelectionModel* selModel = m_itemView->selectionModel(); const QModelIndex currentIndex = selModel->currentIndex(); @@ -194,12 +194,16 @@ void DolphinViewController::emitItemTriggered(const KFileItem& item) KFileItem DolphinViewController::itemForIndex(const QModelIndex& index) const { - Q_ASSERT(m_itemView != 0); + if (m_itemView != 0) { + QAbstractProxyModel* proxyModel = static_cast(m_itemView->model()); + if (proxyModel != 0) { + KDirModel* dirModel = static_cast(proxyModel->sourceModel()); + const QModelIndex dirIndex = proxyModel->mapToSource(index); + return dirModel->itemForIndex(dirIndex); + } + } - QAbstractProxyModel* proxyModel = static_cast(m_itemView->model()); - KDirModel* dirModel = static_cast(proxyModel->sourceModel()); - const QModelIndex dirIndex = proxyModel->mapToSource(index); - return dirModel->itemForIndex(dirIndex); + return KFileItem(); } void DolphinViewController::triggerItem(const QModelIndex& index) @@ -208,7 +212,7 @@ void DolphinViewController::triggerItem(const QModelIndex& index) const KFileItem item = itemForIndex(index); if (index.isValid() && (index.column() == KDirModel::Name)) { emit itemTriggered(item); - } else { + } else if (m_itemView != 0) { m_itemView->clearSelection(); emit itemEntered(KFileItem()); }