]> cloud.milkyroute.net Git - dolphin.git/commitdiff
respect the show hidden files settingin the url nav bar
authorAaron J. Seigo <aseigo@kde.org>
Sat, 3 Mar 2007 03:07:04 +0000 (03:07 +0000)
committerAaron J. Seigo <aseigo@kde.org>
Sat, 3 Mar 2007 03:07:04 +0000 (03:07 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=638732

src/dolphinview.cpp
src/urlnavigator.cpp
src/urlnavigator.h
src/urlnavigatorbutton.cpp

index fd6b1409e7d6f5450cc3e2dc41a6390be1d74c5e..2956cf6bea3e1d81b65c4a01f9a46df746c02fc5 100644 (file)
@@ -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();
 
index 1ac92474ea6046343448f5caeea581dc31db7883..e273e76cbbbf9c770f11e23f16d5d26245d7ced6 100644 (file)
@@ -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)
 {
index 9482619d62a91fcbc83d007ddd58198681e5762b..e3e22632c0b59cd827eaa3cc9d82342f84001ecc 100644 (file)
@@ -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;
index 3be037ced8d6b5d876e75aa78803e47f6e32bad4..c97a560ba6447e43d681ac61c1b7c12d565e5ac6 100644 (file)
@@ -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;