diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2007-08-07 16:48:45 +0000 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2007-08-07 16:48:45 +0000 |
commit | 3a4e540c3db4309990965455b0686230345be002 (patch) | |
tree | 76dcb5cff51e91065cc0fba97b61a30db4e29da9 /rbutil/rbutilqt/browsedirtree.cpp | |
parent | 611c699fd7c2c65d3d7f0d1a1d007cf2cdc42e05 (diff) | |
download | rockbox-3a4e540c3db4309990965455b0686230345be002.tar.gz rockbox-3a4e540c3db4309990965455b0686230345be002.zip |
Replace the file selection dialog for the mountpoint with a pure folder tree view. This fixes an issue with the selection dialog which could try opening a nonexisting folder. Only allow to select drive letters on windows. Additionally, remove an old file I forgot earlier.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14233 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/rbutilqt/browsedirtree.cpp')
-rw-r--r-- | rbutil/rbutilqt/browsedirtree.cpp | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/rbutil/rbutilqt/browsedirtree.cpp b/rbutil/rbutilqt/browsedirtree.cpp new file mode 100644 index 0000000000..0899ab103f --- /dev/null +++ b/rbutil/rbutilqt/browsedirtree.cpp @@ -0,0 +1,70 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2007 by Dominik Riebeling + * $Id: installrb.cpp 13990 2007-07-25 22:26:10Z Dominik Wenger $ + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include <QtGui> + +#include "browsedirtree.h" +#include "ui_browsedirtreefrm.h" + + +BrowseDirtree::BrowseDirtree(QWidget *parent) : QDialog(parent) +{ + ui.setupUi(this); + this->setModal(true); + ui.tree->setModel(&model); + model.setReadOnly(true); + // disable size / date / type columns + ui.tree->setColumnHidden(1, true); + ui.tree->setColumnHidden(2, true); + ui.tree->setColumnHidden(3, true); +} + + +void BrowseDirtree::setDir(QDir &dir) +{ + qDebug() << "BrowseDirtree::setDir()" << model.index(dir.absolutePath()); + + // hilight the set directory if it's valid + if(model.index(dir.absolutePath()).isValid()) { + model.index(dir.absolutePath()).parent(); + + QModelIndex p = model.index(dir.absolutePath()); + ui.tree->setCurrentIndex(p); + ui.tree->scrollTo(p); + ui.tree->resizeColumnToContents(0); + } +} + + +void BrowseDirtree::setFilter(QDir::Filters filters) +{ + model.setFilter(filters); +} + + +void BrowseDirtree::accept() +{ + QString path; + path = model.filePath(ui.tree->currentIndex()); + + this->close(); + emit itemChanged(path); +} + + |