diff options
Diffstat (limited to 'src/views')
| -rw-r--r-- | src/views/dolphinfileitemlistwidget.cpp | 2 | ||||
| -rw-r--r-- | src/views/dolphinview.cpp | 60 | ||||
| -rw-r--r-- | src/views/dolphinview.h | 24 | ||||
| -rw-r--r-- | src/views/draganddrophelper.cpp | 11 |
4 files changed, 61 insertions, 36 deletions
diff --git a/src/views/dolphinfileitemlistwidget.cpp b/src/views/dolphinfileitemlistwidget.cpp index 43030c634..33ee6a277 100644 --- a/src/views/dolphinfileitemlistwidget.cpp +++ b/src/views/dolphinfileitemlistwidget.cpp @@ -115,6 +115,8 @@ QPixmap DolphinFileItemListWidget::overlayForState(KVersionControlPlugin2::ItemV iconName = "vcs-conflicting"; break; case KVersionControlPlugin::UnversionedVersion: + case KVersionControlPlugin2::IgnoredVersion: + case KVersionControlPlugin2::MissingVersion: break; default: Q_ASSERT(false); diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index 233c7007a..05849729f 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -98,8 +98,8 @@ DolphinView::DolphinView(const KUrl& url, QWidget* parent) : m_toolTipManager(0), m_selectionChangedTimer(0), m_currentItemUrl(), + m_scrollToCurrentItem(false), m_restoredContentsPosition(), - m_createdItemUrl(), m_selectedUrls(), m_versionControlObserver(0) { @@ -363,6 +363,7 @@ void DolphinView::markUrlsAsSelected(const QList<KUrl>& urls) void DolphinView::markUrlAsCurrent(const KUrl& url) { m_currentItemUrl = url; + m_scrollToCurrentItem = true; } void DolphinView::selectItems(const QRegExp& pattern, bool enabled) @@ -509,6 +510,16 @@ QString DolphinView::nameFilter() const return m_model->nameFilter(); } +void DolphinView::setMimeTypeFilters(const QStringList& filters) +{ + return m_model->setMimeTypeFilters(filters); +} + +QStringList DolphinView::mimeTypeFilters() const +{ + return m_model->mimeTypeFilters(); +} + QString DolphinView::statusBarText() const { QString summary; @@ -624,7 +635,7 @@ void DolphinView::renameSelectedItems() return; } - if (items.count() == 1) { + if (items.count() == 1 && GeneralSettings::renameInline()) { const int index = m_model->index(items.first()); m_view->editRole(index, "text"); } else { @@ -742,6 +753,20 @@ void DolphinView::hideEvent(QHideEvent* event) QWidget::hideEvent(event); } +bool DolphinView::event(QEvent* event) +{ + /* See Bug 297355 + * Dolphin leaves file preview tooltips open even when is not visible. + * + * Hide tool-tip when Dolphin loses focus. + */ + if (event->type() == QEvent::WindowDeactivate) { + hideToolTip(); + } + + return QWidget::event(event); +} + void DolphinView::activate() { setActive(true); @@ -1150,25 +1175,8 @@ QString DolphinView::viewPropertiesContext() const void DolphinView::observeCreatedItem(const KUrl& url) { - m_createdItemUrl = url; - connect(m_model, SIGNAL(directoryLoadingCompleted()), - this, SLOT(selectAndScrollToCreatedItem())); -} - -void DolphinView::selectAndScrollToCreatedItem() -{ - KItemListSelectionManager* selectionManager = m_container->controller()->selectionManager(); - const int index = m_model->index(m_createdItemUrl); - if (index != -1) { - selectionManager->setCurrentItem(index); - selectionManager->clearSelection(); - selectionManager->setSelected(index); - m_view->scrollToItem(index); - } - - disconnect(m_model, SIGNAL(directoryLoadingCompleted()), - this, SLOT(selectAndScrollToCreatedItem())); - m_createdItemUrl = KUrl(); + markUrlAsCurrent(url); + markUrlsAsSelected(QList<KUrl>() << url); } void DolphinView::slotDirectoryRedirection(const KUrl& oldUrl, const KUrl& newUrl) @@ -1186,6 +1194,12 @@ void DolphinView::updateViewState() const int currentIndex = m_model->index(m_currentItemUrl); if (currentIndex != -1) { selectionManager->setCurrentItem(currentIndex); + + // scroll to current item and reset the state + if (m_scrollToCurrentItem) { + m_view->scrollToItem(currentIndex); + m_scrollToCurrentItem = false; + } } else { selectionManager->setCurrentItem(0); } @@ -1329,6 +1343,10 @@ void DolphinView::slotVisibleRolesChangedByHeader(const QList<QByteArray>& curre void DolphinView::slotRoleEditingFinished(int index, const QByteArray& role, const QVariant& value) { + if (index < 0 || index >= m_model->count()) { + return; + } + if (role == "text") { const KFileItem oldItem = m_model->fileItem(index); const QString newName = value.toString(); diff --git a/src/views/dolphinview.h b/src/views/dolphinview.h index 1ad4d6c82..7d8e8b76a 100644 --- a/src/views/dolphinview.h +++ b/src/views/dolphinview.h @@ -181,8 +181,8 @@ public: void markUrlsAsSelected(const QList<KUrl>& urls); /** - * Marks the item indicated by \p url as the current item after the - * directory DolphinView::url() has been loaded. + * Marks the item indicated by \p url to be scrolled to and as the + * current item after directory DolphinView::url() has been loaded. */ void markUrlAsCurrent(const KUrl& url); @@ -238,6 +238,14 @@ public: QString nameFilter() const; /** + * Filters the currently shown items by \a filters. All items + * whose content-type matches those given by the list of filters + * will be shown. + */ + void setMimeTypeFilters(const QStringList& filters); + QStringList mimeTypeFilters() const; + + /** * Returns a textual representation of the state of the current * folder or selected items, suitable for use in the status bar. */ @@ -524,6 +532,7 @@ protected: /** @reimp */ virtual void hideEvent(QHideEvent* event); + virtual bool event(QEvent* event); private slots: /** @@ -640,18 +649,10 @@ private slots: * Observes the item with the URL \a url. As soon as the directory * model indicates that the item is available, the item will * get selected and it is assured that the item stays visible. - * - * @see selectAndScrollToCreatedItem() */ void observeCreatedItem(const KUrl& url); /** - * Selects and scrolls to the item that got observed - * by observeCreatedItem(). - */ - void selectAndScrollToCreatedItem(); - - /** * Called when a redirection happens. * Testcase: fish://localhost */ @@ -754,8 +755,8 @@ private: QTimer* m_selectionChangedTimer; KUrl m_currentItemUrl; // Used for making the view to remember the current URL after F5 + bool m_scrollToCurrentItem; // Used for marking we need to scroll to current item or not QPoint m_restoredContentsPosition; - KUrl m_createdItemUrl; // URL for a new item that got created by the "Create New..." menu QList<KUrl> m_selectedUrls; // Used for making the view to remember selections after F5 @@ -764,6 +765,7 @@ private: // For unit tests friend class TestBase; friend class DolphinDetailsViewTest; + friend class DolphinPart; // Accesses m_model }; /// Allow using DolphinView::Mode in QVariant diff --git a/src/views/draganddrophelper.cpp b/src/views/draganddrophelper.cpp index 45e5076f6..f81d4d0bf 100644 --- a/src/views/draganddrophelper.cpp +++ b/src/views/draganddrophelper.cpp @@ -35,10 +35,13 @@ QString DragAndDropHelper::dropUrls(const KFileItem& destItem, const KUrl& destU } const QMimeData* mimeData = event->mimeData(); - if (mimeData->hasFormat("application/x-kde-dndextract")) { - const QString remoteDBusClient = mimeData->data("application/x-kde-dndextract"); - QDBusMessage message = QDBusMessage::createMethodCall(remoteDBusClient, "/DndExtract", - "org.kde.DndExtract", "extractSelectedFilesTo"); + if (mimeData->hasFormat("application/x-kde-ark-dndextract-service") && + mimeData->hasFormat("application/x-kde-ark-dndextract-path")) { + const QString remoteDBusClient = mimeData->data("application/x-kde-ark-dndextract-service"); + const QString remoteDBusPath = mimeData->data("application/x-kde-ark-dndextract-path"); + + QDBusMessage message = QDBusMessage::createMethodCall(remoteDBusClient, remoteDBusPath, + "org.kde.ark.DndExtract", "extractSelectedFilesTo"); message.setArguments(QVariantList() << destUrl.pathOrUrl()); QDBusConnection::sessionBus().call(message); } else if (!destItem.isNull() && (destItem.isDir() || destItem.isDesktopFile())) { |
