author | drw <drw> | 2004-08-16 18:33:22 (UTC) |
---|---|---|
committer | drw <drw> | 2004-08-16 18:33:22 (UTC) |
commit | 96ed4a52d862828a7968d1e4c0eb6be72846419c (patch) (unidiff) | |
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 | |||
@@ -16,10 +16,15 @@ file; see the file COPYING. If not, write to the Free Software Foundation, Inc., | |||
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include "configuredlg.h" | 18 | #include "configuredlg.h" |
19 | 19 | ||
20 | #include <opie2/ofiledialog.h> | ||
21 | |||
22 | #include <qpe/resource.h> | ||
23 | |||
20 | #include <qlabel.h> | 24 | #include <qlabel.h> |
21 | #include <qlayout.h> | 25 | #include <qlayout.h> |
26 | #include <qpushbutton.h> | ||
22 | #include <qvbuttongroup.h> | 27 | #include <qvbuttongroup.h> |
23 | #include <qwhatsthis.h> | 28 | #include <qwhatsthis.h> |
24 | 29 | ||
25 | ConfigureDlg::ConfigureDlg( QWidget *parent, const QString &swordPath, bool alwaysOpenNew, int numVerses, | 30 | ConfigureDlg::ConfigureDlg( QWidget *parent, const QString &swordPath, bool alwaysOpenNew, int numVerses, |
@@ -44,9 +49,15 @@ ConfigureDlg::ConfigureDlg( QWidget *parent, const QString &swordPath, bool alwa | |||
44 | 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." ) ); | 49 | 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." ) ); |
45 | grid->addMultiCellWidget( label, 0, 0, 0, 1 ); | 50 | grid->addMultiCellWidget( label, 0, 0, 0, 1 ); |
46 | m_swordPath = new QLineEdit( swordPath, widget ); | 51 | m_swordPath = new QLineEdit( swordPath, widget ); |
47 | 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." ) ); | 52 | 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." ) ); |
48 | grid->addMultiCellWidget( m_swordPath, 1, 1, 0, 1 ); | 53 | grid->addWidget( m_swordPath, 1, 0 ); |
54 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "folder" ), QString::null, widget ); | ||
55 | btn->setMaximumWidth( btn->height() ); | ||
56 | 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." ) ); | ||
57 | connect( btn, SIGNAL(clicked()), this, SLOT(slotSelectSwordPath()) ); | ||
58 | grid->addWidget( btn, 1, 1 ); | ||
59 | |||
49 | label = new QLabel( tr( "(Note: Dagger must be restarted for this option to take affect.)" ), widget ); | 60 | label = new QLabel( tr( "(Note: Dagger must be restarted for this option to take affect.)" ), widget ); |
50 | label->setAlignment( Qt::AlignHCenter | Qt::AlignTop | Qt::WordBreak ); | 61 | label->setAlignment( Qt::AlignHCenter | Qt::AlignTop | Qt::WordBreak ); |
51 | 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." ) ); | 62 | 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." ) ); |
52 | grid->addMultiCellWidget( label, 2, 2, 0, 1 ); | 63 | grid->addMultiCellWidget( label, 2, 2, 0, 1 ); |
@@ -147,4 +158,12 @@ void ConfigureDlg::slotCopyFormatSelected() | |||
147 | m_copyExample->setText( verse ); | 158 | m_copyExample->setText( verse ); |
148 | else if ( option == m_copyKey && m_copyKey->isChecked() ) | 159 | else if ( option == m_copyKey && m_copyKey->isChecked() ) |
149 | m_copyExample->setText( key ); | 160 | m_copyExample->setText( key ); |
150 | } | 161 | } |
162 | |||
163 | void ConfigureDlg::slotSelectSwordPath() | ||
164 | { | ||
165 | QString path = Opie::Ui::OFileDialog::getDirectory( 0, m_swordPath->text() ); | ||
166 | if ( path.at( path.length() - 1 ) == '/' ) | ||
167 | path.truncate( path.length() - 1 ); | ||
168 | m_swordPath->setText( path ); | ||
169 | } | ||
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 | |||
@@ -69,7 +69,8 @@ private: | |||
69 | QLabel *m_copyExample; // Text of copy format example | 69 | QLabel *m_copyExample; // Text of copy format example |
70 | 70 | ||
71 | private slots: | 71 | private slots: |
72 | void slotCopyFormatSelected(); | 72 | void slotCopyFormatSelected(); |
73 | void slotSelectSwordPath(); | ||
73 | }; | 74 | }; |
74 | 75 | ||
75 | #endif | 76 | #endif |