From 96ed4a52d862828a7968d1e4c0eb6be72846419c Mon Sep 17 00:00:00 2001 From: drw Date: Mon, 16 Aug 2004 18:33:22 +0000 Subject: Use OFileDialog::getDirectory to select Sword path --- diff --git a/noncore/apps/dagger/configuredlg.cpp b/noncore/apps/dagger/configuredlg.cpp index 0a9317c..535659d 100644 --- a/noncore/apps/dagger/configuredlg.cpp +++ b/noncore/apps/dagger/configuredlg.cpp @@ -17,8 +17,13 @@ file; see the file COPYING. If not, write to the Free Software Foundation, Inc., #include "configuredlg.h" +#include + +#include + #include #include +#include #include #include @@ -45,7 +50,13 @@ ConfigureDlg::ConfigureDlg( QWidget *parent, const QString &swordPath, bool alwa grid->addMultiCellWidget( label, 0, 0, 0, 1 ); m_swordPath = new QLineEdit( swordPath, widget ); QWhatsThis::add( m_swordPath, tr( "Enter the path where the Sword texts (Bibles, commentaries, etc.) can be found. This path should contain either the 'mods.conf' file or 'mods.d' sub-directory." ) ); - grid->addMultiCellWidget( m_swordPath, 1, 1, 0, 1 ); + grid->addWidget( m_swordPath, 1, 0 ); + QPushButton *btn = new QPushButton( Resource::loadPixmap( "folder" ), QString::null, widget ); + btn->setMaximumWidth( btn->height() ); + QWhatsThis::add( btn, tr( "Tap here to select the path where the Sword texts (Bibles, commentaries, etc.) can be found. This path should contain either the 'mods.conf' file or 'mods.d' sub-directory." ) ); + connect( btn, SIGNAL(clicked()), this, SLOT(slotSelectSwordPath()) ); + grid->addWidget( btn, 1, 1 ); + label = new QLabel( tr( "(Note: Dagger must be restarted for this option to take affect.)" ), widget ); label->setAlignment( Qt::AlignHCenter | Qt::AlignTop | Qt::WordBreak ); QWhatsThis::add( label, tr( "Enter the path where the Sword modules (Bible texts, commentaries, etc.) can be found. This path should contain either the 'mods.conf' file or 'mods.d' sub-directory." ) ); @@ -148,3 +159,11 @@ void ConfigureDlg::slotCopyFormatSelected() else if ( option == m_copyKey && m_copyKey->isChecked() ) m_copyExample->setText( key ); } + +void ConfigureDlg::slotSelectSwordPath() +{ + QString path = Opie::Ui::OFileDialog::getDirectory( 0, m_swordPath->text() ); + if ( path.at( path.length() - 1 ) == '/' ) + path.truncate( path.length() - 1 ); + m_swordPath->setText( path ); +} diff --git a/noncore/apps/dagger/configuredlg.h b/noncore/apps/dagger/configuredlg.h index a91da12..56a4d94 100644 --- a/noncore/apps/dagger/configuredlg.h +++ b/noncore/apps/dagger/configuredlg.h @@ -70,6 +70,7 @@ private: private slots: void slotCopyFormatSelected(); + void slotSelectSwordPath(); }; #endif -- cgit v0.9.0.2