X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/93cc4808031cb45da9237dfc0c7759f668259331..d9dbd3398a258d04ec4517fd13e795b437c869d6:/src/dolphinviewcontainer.cpp diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index c8d495db1..1c15c88a9 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -49,6 +49,7 @@ #include "search/dolphinsearchbox.h" #include "statusbar/dolphinstatusbar.h" #include "views/dolphinplacesmodel.h" +#include "views/draganddrophelper.h" #include "views/viewmodecontroller.h" #include "views/viewproperties.h" @@ -101,7 +102,8 @@ DolphinViewContainer::DolphinViewContainer(const KUrl& url, QWidget* parent) : connect(m_view, SIGNAL(startedPathLoading(KUrl)), this, SLOT(slotStartedPathLoading())); connect(m_view, SIGNAL(finishedPathLoading(KUrl)), this, SLOT(slotFinishedPathLoading())); connect(m_view, SIGNAL(itemCountChanged()), this, SLOT(delayedStatusBarUpdate())); - connect(m_view, SIGNAL(pathLoadingProgress(int)), this, SLOT(updateProgress(int))); + connect(m_view, SIGNAL(pathLoadingProgress(int)), this, SLOT(updateLoadingProgress(int))); + connect(m_view, SIGNAL(sortProgress(int)), this, SLOT(updateSortProgress(int))); connect(m_view, SIGNAL(infoMessage(QString)), this, SLOT(showInfoMessage(QString))); connect(m_view, SIGNAL(errorMessage(QString)), this, SLOT(showErrorMessage(QString))); connect(m_view, SIGNAL(urlIsFileError(KUrl)), this, SLOT(openFile(KUrl))); @@ -210,7 +212,7 @@ DolphinSearchBox* DolphinViewContainer::searchBox() return m_searchBox; } -void DolphinViewContainer::refresh() +void DolphinViewContainer::readSettings() { if (GeneralSettings::modifiedStartupSettings()) { // The startup settings should only get applied if they have been @@ -218,11 +220,12 @@ void DolphinViewContainer::refresh() // settings of the URL navigator and the filterbar. m_urlNavigator->setUrlEditable(GeneralSettings::editableUrl()); m_urlNavigator->setShowFullPath(GeneralSettings::showFullPath()); + m_urlNavigator->setHomeUrl(KUrl(GeneralSettings::homeUrl())); setFilterBarVisible(GeneralSettings::filterBar()); } - m_view->refresh(); - m_statusBar->refresh(); + m_view->readSettings(); + m_statusBar->readSettings(); } bool DolphinViewContainer::isFilterBarVisible() const @@ -330,7 +333,7 @@ void DolphinViewContainer::updateStatusBar() } } -void DolphinViewContainer::updateProgress(int percent) +void DolphinViewContainer::updateLoadingProgress(int percent) { if (m_statusBar->progressText().isEmpty()) { m_statusBar->setProgressText(i18nc("@info:progress", "Loading folder...")); @@ -338,6 +341,14 @@ void DolphinViewContainer::updateProgress(int percent) m_statusBar->setProgress(percent); } +void DolphinViewContainer::updateSortProgress(int percent) +{ + if (m_statusBar->progressText().isEmpty()) { + m_statusBar->setProgressText(i18nc("@info:progress", "Sorting...")); + } + m_statusBar->setProgress(percent); +} + void DolphinViewContainer::slotStartedPathLoading() { if (isSearchUrl(url())) { @@ -350,7 +361,7 @@ void DolphinViewContainer::slotStartedPathLoading() // Trigger an undetermined progress indication. The progress // information in percent will be triggered by the percent() signal // of the directory lister later. - updateProgress(-1); + updateLoadingProgress(-1); } } @@ -372,6 +383,11 @@ void DolphinViewContainer::slotFinishedPathLoading() void DolphinViewContainer::slotItemActivated(const KFileItem& item) { + // It is possible to activate items on inactive views by + // drag & drop operations. Assure that activating an item always + // results in an active view. + m_view->setActive(true); + KUrl url = item.targetUrl(); if (item.isDir()) { @@ -423,12 +439,7 @@ void DolphinViewContainer::showItemInfo(const KFileItem& item) m_statusBar->clear(); } } else { - QString message; - if (item.isDir()) { - message = item.text(); - } else { - message = i18nc("@info:status filename (type)", "%1 (%2)", item.text(), item.mimeComment()); - } + const QString message = item.isDir() ? item.text() : item.getStatusBarInfo(); m_statusBar->setMessage(message, DolphinStatusBar::Default); } } @@ -532,9 +543,7 @@ void DolphinViewContainer::slotUrlNavigatorLocationChanged(const KUrl& url) void DolphinViewContainer::dropUrls(const KUrl& destination, QDropEvent* event) { - Q_UNUSED(destination); - Q_UNUSED(event); - //DragAndDropHelper::instance().dropUrls(KFileItem(), destination, event, this); + DragAndDropHelper::dropUrls(KFileItem(), destination, event); } void DolphinViewContainer::redirect(const KUrl& oldUrl, const KUrl& newUrl)