From: Aaron J. Seigo Date: Sat, 3 Mar 2007 03:07:04 +0000 (+0000) Subject: respect the show hidden files settingin the url nav bar X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/9d24c28b4ba3ac62b698a53925f9747850959d63 respect the show hidden files settingin the url nav bar svn path=/trunk/KDE/kdebase/apps/; revision=638732 --- diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp index fd6b1409e..2956cf6be 100644 --- a/src/dolphinview.cpp +++ b/src/dolphinview.cpp @@ -84,6 +84,7 @@ DolphinView::DolphinView(DolphinMainWindow* mainWindow, this, SLOT(updateActivationState())); m_urlNavigator = new UrlNavigator(url, this); + m_urlNavigator->setShowHiddenFiles(showHiddenFiles); connect(m_urlNavigator, SIGNAL(urlChanged(const KUrl&)), this, SLOT(loadDirectory(const KUrl&))); connect(m_urlNavigator, SIGNAL(urlsDropped(const KUrl::List&, const KUrl&)), @@ -229,6 +230,7 @@ void DolphinView::setShowHiddenFiles(bool show) props.save(); m_dirLister->setShowingDotFiles(show); + m_urlNavigator->setShowHiddenFiles(show); emit showHiddenFilesChanged(); diff --git a/src/urlnavigator.cpp b/src/urlnavigator.cpp index 1ac92474e..e273e76cb 100644 --- a/src/urlnavigator.cpp +++ b/src/urlnavigator.cpp @@ -69,6 +69,7 @@ UrlNavigator::UrlNavigator(const KUrl& url, QWidget* parent) : QWidget(parent), m_active(true), + m_showHiddenFiles(false), m_historyIndex(0), m_layout(0), m_protocols(0), @@ -231,6 +232,11 @@ void UrlNavigator::setActive(bool active) } } +void UrlNavigator::setShowHiddenFiles( bool show ) +{ + m_showHiddenFiles = show; +} + void UrlNavigator::dropUrls(const KUrl::List& urls, const KUrl& destination) { diff --git a/src/urlnavigator.h b/src/urlnavigator.h index 9482619d6..e3e22632c 100644 --- a/src/urlnavigator.h +++ b/src/urlnavigator.h @@ -168,6 +168,16 @@ public: */ bool isActive() const { return m_active; } + /** + * Sets whether or not to show hidden files in lists + */ + void setShowHiddenFiles( bool show ); + + /** + * Returns true if the URL navigator is set to show hidden files + */ + bool showHiddenFiles() { return m_showHiddenFiles; } + /** * Handles the dropping of the URLs \a urls to the given * destination \a destination and emits the signal urlsDropped. @@ -289,6 +299,7 @@ private: private: bool m_active; + bool m_showHiddenFiles; int m_historyIndex; QHBoxLayout* m_layout; diff --git a/src/urlnavigatorbutton.cpp b/src/urlnavigatorbutton.cpp index 3be037ced..c97a560ba 100644 --- a/src/urlnavigatorbutton.cpp +++ b/src/urlnavigatorbutton.cpp @@ -270,7 +270,7 @@ void UrlNavigatorButton::startListJob() } const KUrl& url = urlNavigator()->url(m_index); - m_listJob = KIO::listDir(url, false, false); + m_listJob = KIO::listDir(url, false, urlNavigator()->showHiddenFiles()); m_subdirs.clear(); // just to be ++safe connect(m_listJob, SIGNAL(entries(KIO::Job*, const KIO::UDSEntryList &)), @@ -286,6 +286,8 @@ void UrlNavigatorButton::entriesList(KIO::Job* job, const KIO::UDSEntryList& ent KIO::UDSEntryList::const_iterator it = entries.constBegin(); KIO::UDSEntryList::const_iterator itEnd = entries.constEnd(); + + bool showHidden = urlNavigator()->showHiddenFiles(); while (it != itEnd) { QString name; //bool isDir = false; @@ -314,7 +316,11 @@ void UrlNavigatorButton::entriesList(KIO::Job* job, const KIO::UDSEntryList& ent */ if (entry.isDir()) { - m_subdirs.append(entry.stringValue(KIO::UDS_NAME)); + QString dir = entry.stringValue(KIO::UDS_NAME); + + if (!showHidden || (dir != "." && dir != "..")) { + m_subdirs.append(entry.stringValue(KIO::UDS_NAME)); + } } ++it;