Make addItem() a slot to be able adding items using a signal.
[Rockbox.git] / rbutil / rbutilqt / browseof.cpp
blob28cde9c6fe9926f8a6a50ab65d526a77a102be6d
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
9 * Copyright (C) 2007 by Dominik Wenger
10 * $Id$
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
20 #include <QtGui>
22 #include "browseof.h"
23 #include "browsedirtree.h"
26 BrowseOF::BrowseOF(QWidget *parent) : QDialog(parent)
28 ui.setupUi(this);
29 this->setModal(true);
31 connect(ui.browseOFButton,SIGNAL(clicked()),this,SLOT(onBrowse()));
34 void BrowseOF::setFile(QString file)
36 ui.OFlineEdit->setText(file);
39 void BrowseOF::onBrowse()
41 BrowseDirtree browser(this);
42 browser.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
44 if(QFileInfo(ui.OFlineEdit->text()).exists())
46 browser.setDir(ui.OFlineEdit->text());
49 if(browser.exec() == QDialog::Accepted)
51 qDebug() << browser.getSelected();
52 setFile(browser.getSelected());
56 QString BrowseOF::getFile()
58 return ui.OFlineEdit->text();
61 void BrowseOF::accept()
63 this->close();
64 setResult(QDialog::Accepted);