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 @@ -4,61 +4,72 @@ Copyright (c) 2004 Dan Williams <drw@handhelds.org> This file is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this 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 ) , m_tabs( this ) { setCaption( tr( "Configure Dagger" ) ); QVBoxLayout *layout = new QVBoxLayout( this ); layout->setMargin( 4 ); layout->addWidget( &m_tabs ); // General tab QWidget *widget = new QWidget( this ); QGridLayout *grid = new QGridLayout( widget, 1, 2, 4, 2 ); grid->setRowStretch( 9, 5 ); grid->setColStretch( 0, 2 ); 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 ); m_alwaysOpenNew = new QCheckBox( tr( "Always open texts in new window?" ), widget ); m_alwaysOpenNew->setChecked( alwaysOpenNew ); QWhatsThis::add( m_alwaysOpenNew, tr( "Tap here to always open texts in a new window. If this option is not selected, only one copy of a Sword text will be opened." ) ); grid->addMultiCellWidget( m_alwaysOpenNew, 4, 4, 0, 1 ); grid->addRowSpacing( 5, 15 ); label = new QLabel( tr( "Number of verses to display at a time:" ), widget ); label->setAlignment( Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak ); @@ -135,16 +146,24 @@ void ConfigureDlg::slotCopyFormatSelected() { const QObject *option = sender(); QString text = tr( "KJV" ); QString verse = tr( "In the beginning God created the heaven and the earth." ); QString key = tr( "Gen 1:1" ); if ( option == m_copyTextFull && m_copyTextFull->isChecked() ) m_copyExample->setText( QString( "%1 (%2, %3)" ).arg( verse ).arg( key ).arg( text ) ); else if ( option == m_copyFull && m_copyFull->isChecked() ) 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 @@ -57,19 +57,20 @@ private: // General tab's UI controls QLineEdit *m_swordPath; // Contains path to Sword modules QCheckBox *m_alwaysOpenNew; // Indicates whether to always open modules in a new tab QSpinBox *m_numVerses; // Contains number of verses to display for Bible modules QCheckBox *m_disableScreenBlank; // Indicates whether to disable automatic screen blanking // Copy tab's UI controls QRadioButton *m_copyTextFull; // Verse (Text, Book cc:vv) QRadioButton *m_copyFull; // Verse (Book cc:vv) 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 |