1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
/**
* kcmhtmlsearch.cpp
*
* Copyright (c) 2000 Matthias Hölzer-Klüpfel <hoelzer@kde.org>
*
* This program 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 program 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 program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <qlayout.h>
#include <qwhatsthis.h>
#include <kdebug.h>
#include <kstandarddirs.h>
#include <klocale.h>
#include <kurllabel.h>
#include <kapplication.h>
#include <kfiledialog.h>
#include <kurlrequester.h>
#include <klineedit.h>
#include "htmlsearchconfig.h"
#include "htmlsearchconfig.moc"
namespace KHC {
HtmlSearchConfig::HtmlSearchConfig(QWidget *parent, const char *name)
: QWidget(parent, name)
{
QVBoxLayout *vbox = new QVBoxLayout(this, 5);
QGroupBox *gb = new QGroupBox(i18n("ht://dig"), this);
vbox->addWidget(gb);
QGridLayout *grid = new QGridLayout(gb, 3,2, 6,6);
grid->addRowSpacing(0, gb->fontMetrics().lineSpacing());
QLabel *l = new QLabel(i18n("The fulltext search feature makes use of the "
"ht://dig HTML search engine. "
"You can get ht://dig at the"), gb);
l->setAlignment(QLabel::WordBreak);
l->setMinimumSize(l->sizeHint());
grid->addMultiCellWidget(l, 1, 1, 0, 1);
QWhatsThis::add( gb, i18n( "Information about where to get the ht://dig package." ) );
KURLLabel *url = new KURLLabel(gb);
url->setURL("http://www.htdig.org");
url->setText(i18n("ht://dig home page"));
url->setAlignment(QLabel::AlignHCenter);
grid->addMultiCellWidget(url, 2,2, 0, 1);
connect(url, SIGNAL(leftClickedURL(const QString&)),
this, SLOT(urlClicked(const QString&)));
gb = new QGroupBox(i18n("Program Locations"), this);
vbox->addWidget(gb);
grid = new QGridLayout(gb, 4,2, 6,6);
grid->addRowSpacing(0, gb->fontMetrics().lineSpacing());
mHtsearchUrl = new KURLRequester(gb);
l = new QLabel(mHtsearchUrl, i18n("htsearch:"), gb);
l->setBuddy( mHtsearchUrl );
grid->addWidget(l, 1,0);
grid->addWidget(mHtsearchUrl, 1,1);
connect( mHtsearchUrl->lineEdit(), SIGNAL( textChanged( const QString & ) ),
SIGNAL( changed() ) );
QString wtstr = i18n( "Enter the URL of the htsearch CGI program." );
QWhatsThis::add( mHtsearchUrl, wtstr );
QWhatsThis::add( l, wtstr );
mIndexerBin = new KURLRequester(gb);
l = new QLabel(mIndexerBin, i18n("Indexer:"), gb);
l->setBuddy( mIndexerBin );
grid->addWidget(l, 2,0);
grid->addWidget(mIndexerBin, 2,1);
connect( mIndexerBin->lineEdit(), SIGNAL( textChanged( const QString & ) ),
SIGNAL( changed() ) );
wtstr = i18n( "Enter the path to your htdig indexer program here." );
QWhatsThis::add( mIndexerBin, wtstr );
QWhatsThis::add( l, wtstr );
mDbDir = new KURLRequester(gb);
mDbDir->setMode( KFile::Directory | KFile::LocalOnly );
l = new QLabel(mDbDir, i18n("htdig database:"), gb);
l->setBuddy( mDbDir );
grid->addWidget(l, 3,0);
grid->addWidget(mDbDir, 3,1);
connect( mDbDir->lineEdit(), SIGNAL( textChanged( const QString & ) ),
SIGNAL( changed() ) );
wtstr = i18n( "Enter the path to the htdig database folder." );
QWhatsThis::add( mDbDir, wtstr );
QWhatsThis::add( l, wtstr );
}
HtmlSearchConfig::~HtmlSearchConfig()
{
kdDebug() << "~HtmlSearchConfig()" << endl;
}
void HtmlSearchConfig::makeReadOnly()
{
mHtsearchUrl->setEnabled( false );
mIndexerBin->setEnabled( false );
mDbDir->setEnabled( false );
}
void HtmlSearchConfig::load( KConfig *config )
{
config->setGroup("htdig");
mHtsearchUrl->lineEdit()->setText(config->readPathEntry("htsearch", kapp->dirs()->findExe("htsearch")));
mIndexerBin->lineEdit()->setText(config->readPathEntry("indexer"));
mDbDir->lineEdit()->setText(config->readPathEntry("dbdir", "/opt/www/htdig/db/" ) );
}
void HtmlSearchConfig::save( KConfig *config )
{
config->setGroup("htdig");
config->writePathEntry("htsearch", mHtsearchUrl->lineEdit()->text());
config->writePathEntry("indexer", mIndexerBin->lineEdit()->text());
config->writePathEntry("dbdir", mDbDir->lineEdit()->text());
}
void HtmlSearchConfig::defaults()
{
mHtsearchUrl->lineEdit()->setText(kapp->dirs()->findExe("htsearch"));
mIndexerBin->lineEdit()->setText("");
mDbDir->lineEdit()->setText("/opt/www/htdig/db/" );
}
void HtmlSearchConfig::urlClicked(const QString &url)
{
kapp->invokeBrowser(url);
}
} // End namespace KHC
// vim:ts=2:sw=2:et
|