X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/eadbf920b5dffdf2d1548240c25ec2eaf835aad5..0222d552811efb7049de2d024247b0b8eaeffe2b:/src/dolphinviewcontainer.cpp diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index 47195bbca..9809fbaf5 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include @@ -48,8 +47,9 @@ #include "dolphinmainwindow.h" #include "filterbar/filterbar.h" #include "search/dolphinsearchbox.h" -#include "settings/dolphinsettings.h" #include "statusbar/dolphinstatusbar.h" +#include "views/dolphinplacesmodel.h" +#include "views/draganddrophelper.h" #include "views/viewmodecontroller.h" #include "views/viewproperties.h" @@ -70,7 +70,7 @@ DolphinViewContainer::DolphinViewContainer(const KUrl& url, QWidget* parent) : m_topLayout->setSpacing(0); m_topLayout->setMargin(0); - m_urlNavigator = new KUrlNavigator(DolphinSettings::instance().placesModel(), url, this); + m_urlNavigator = new KUrlNavigator(DolphinPlacesModel::instance(), url, this); connect(m_urlNavigator, SIGNAL(urlsDropped(KUrl,QDropEvent*)), this, SLOT(dropUrls(KUrl,QDropEvent*))); connect(m_urlNavigator, SIGNAL(activated()), @@ -78,7 +78,7 @@ DolphinViewContainer::DolphinViewContainer(const KUrl& url, QWidget* parent) : connect(m_urlNavigator->editor(), SIGNAL(completionModeChanged(KGlobalSettings::Completion)), this, SLOT(saveUrlCompletionMode(KGlobalSettings::Completion))); - const GeneralSettings* settings = DolphinSettings::instance().generalSettings(); + const GeneralSettings* settings = GeneralSettings::self(); m_urlNavigator->setUrlEditable(settings->editableUrl()); m_urlNavigator->setShowFullPath(settings->showFullPath()); m_urlNavigator->setHomeUrl(KUrl(settings->homeUrl())); @@ -211,20 +211,20 @@ DolphinSearchBox* DolphinViewContainer::searchBox() return m_searchBox; } -void DolphinViewContainer::refresh() +void DolphinViewContainer::readSettings() { - GeneralSettings* settings = DolphinSettings::instance().generalSettings(); - if (settings->modifiedStartupSettings()) { + if (GeneralSettings::modifiedStartupSettings()) { // The startup settings should only get applied if they have been // modified by the user. Otherwise keep the (possibly) different current // settings of the URL navigator and the filterbar. - m_urlNavigator->setUrlEditable(settings->editableUrl()); - m_urlNavigator->setShowFullPath(settings->showFullPath()); - setFilterBarVisible(settings->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 @@ -374,6 +374,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()) { @@ -381,9 +386,7 @@ void DolphinViewContainer::slotItemActivated(const KFileItem& item) return; } - const GeneralSettings* settings = DolphinSettings::instance().generalSettings(); - const bool browseThroughArchives = settings->browseThroughArchives(); - if (browseThroughArchives && item.isFile() && url.isLocalFile()) { + if (GeneralSettings::browseThroughArchives() && item.isFile() && url.isLocalFile()) { // Generic mechanism for redirecting to tar:// when clicking on a tar file, // zip:// when clicking on a zip file, etc. // The .protocol file specifies the mimetype that the kioslave handles. @@ -429,9 +432,9 @@ void DolphinViewContainer::showItemInfo(const KFileItem& item) } else { QString message; if (item.isDir()) { - message = item.name(); + message = item.text(); } else { - message = i18nc("@info:status filename (type)", "%1 (%2)", item.name(), item.mimeComment()); + message = i18nc("@info:status filename (type)", "%1 (%2)", item.text(), item.mimeComment()); } m_statusBar->setMessage(message, DolphinStatusBar::Default); } @@ -536,9 +539,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) @@ -564,9 +565,7 @@ void DolphinViewContainer::requestFocus() void DolphinViewContainer::saveUrlCompletionMode(KGlobalSettings::Completion completion) { - DolphinSettings& settings = DolphinSettings::instance(); - settings.generalSettings()->setUrlCompletionMode(completion); - settings.save(); + GeneralSettings::setUrlCompletionMode(completion); } void DolphinViewContainer::slotHistoryChanged()