2 Copyright (c) 2000 Matthias Elter <elter@kde.org>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License along
15 with this program; if not, write to the Free Software Foundation, Inc.,
16 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #include "helpwidget.h"
21 #include "quickhelp.h"
26 #include <kapplication.h>
28 #include <ktoolinvocation.h>
30 #include <QVBoxLayout>
32 #include "helpwidget.moc"
34 HelpWidget::HelpWidget(QWidget
*parent
)
37 QVBoxLayout
*l
= new QVBoxLayout(this);
39 _browser
= new QuickHelp(this);
40 connect(_browser
, SIGNAL(urlClick(const QString
&)),
41 SLOT(urlClicked(const QString
&)));
42 connect(_browser
, SIGNAL(mailClick(const QString
&,const QString
&)),
43 SLOT(mailClicked(const QString
&,const QString
&)));
45 l
->addWidget(_browser
);
50 void HelpWidget::setText( const QString
& docPath
, const QString
& text
)
53 if (text
.isEmpty() && docPath
.isEmpty())
55 else if (docPath
.isEmpty())
56 _browser
->setText(text
);
59 QByteArray a
= docPath
.toLocal8Bit();
60 QString path
= QString::fromLocal8Bit (a
.data(), a
.size());
62 _browser
->setText(text
+ i18n("<p>Use the \"Whats This\" (Shift+F1) to get help on specific options.</p><p>To read the full manual click <a href=\"%1\">here</a>.</p>",
67 void HelpWidget::setBaseText()
69 _browser
->setText(i18n("<h1>KDE Info Center</h1>"
70 "There is no quick help available for the active info module."
72 "Click <a href = \"kinfocenter/index.html\">here</a> to read the general Info Center manual.") );
75 void HelpWidget::urlClicked(const QString
& _url
)
77 KUrl
url(KUrl("help:/"), _url
);
79 if (url
.protocol() == "help" || url
.protocol() == "man" || url
.protocol() == "info") {
80 KProcess::startDetached("khelpcenter", QStringList() << url
.url());
86 void HelpWidget::mailClicked(const QString
&,const QString
& addr
)
88 KToolInvocation::invokeMailer(addr
, QString());