author | drw <drw> | 2004-08-16 18:33:22 (UTC) |
---|---|---|
committer | drw <drw> | 2004-08-16 18:33:22 (UTC) |
commit | 96ed4a52d862828a7968d1e4c0eb6be72846419c (patch) (side-by-side diff) | |
tree | fa804a2890112a006f79b00c889315a58cfe58f8 | |
parent | cbb2e3969b0a6bb36aca6bc608a77dcaeb5bbac2 (diff) | |
download | opie-96ed4a52d862828a7968d1e4c0eb6be72846419c.zip opie-96ed4a52d862828a7968d1e4c0eb6be72846419c.tar.gz opie-96ed4a52d862828a7968d1e4c0eb6be72846419c.tar.bz2 |
Use OFileDialog::getDirectory to select Sword path
-rw-r--r-- | noncore/apps/dagger/configuredlg.cpp | 21 | ||||
-rw-r--r-- | noncore/apps/dagger/configuredlg.h | 1 |
2 files changed, 21 insertions, 1 deletions
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 @@ -14,14 +14,19 @@ You should have received a copy of the GNU General Public License along with thi file; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "configuredlg.h" +#include <opie2/ofiledialog.h> + +#include <qpe/resource.h> + #include <qlabel.h> #include <qlayout.h> +#include <qpushbutton.h> #include <qvbuttongroup.h> #include <qwhatsthis.h> ConfigureDlg::ConfigureDlg( QWidget *parent, const QString &swordPath, bool alwaysOpenNew, int numVerses, bool disableBlanking, int copyFormat, const QFont *font ) : QDialog( parent, QString::null, true, WStyle_ContextHelp ) @@ -42,13 +47,19 @@ ConfigureDlg::ConfigureDlg( QWidget *parent, const QString &swordPath, bool alwa QLabel *label = new QLabel( tr( "Path where Sword texts are located:" ), widget ); label->setAlignment( Qt::AlignLeft | 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." ) ); 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." ) ); grid->addMultiCellWidget( label, 2, 2, 0, 1 ); grid->addRowSpacing( 3, 15 ); @@ -145,6 +156,14 @@ void ConfigureDlg::slotCopyFormatSelected() m_copyExample->setText( QString( "%1 (%2)" ).arg( verse ).arg( key ) ); else if ( option == m_copyVerse && m_copyVerse->isChecked() ) m_copyExample->setText( verse ); 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 @@ -67,9 +67,10 @@ private: QRadioButton *m_copyVerse; // Verse QRadioButton *m_copyKey; // Book cc:vv QLabel *m_copyExample; // Text of copy format example private slots: void slotCopyFormatSelected(); + void slotSelectSwordPath(); }; #endif |