Fixed code for searching for help handbooks. This resolves bug 1839.

pull/16/head
Michele Calgaro 10 years ago
parent 3ddabae8fd
commit 37906b5b72

@ -37,7 +37,7 @@
using namespace TDEIO; using namespace TDEIO;
TQString HelpProtocol::langLookup(const TQString& fname) TQString HelpProtocol::langLookup(const TQString &fname)
{ {
TQStringList search; TQStringList search;
@ -88,23 +88,17 @@ TQString HelpProtocol::langLookup(const TQString& fname)
} }
TQString HelpProtocol::lookupFile(const TQString &fname, TQString HelpProtocol::lookupFile(const TQString &fname, const TQString &query, bool &redirect)
const TQString &query, bool &redirect)
{ {
redirect = false; redirect = false;
TQString result = langLookup(fname);
TQString path, result;
path = fname;
result = langLookup(path);
if (result.isEmpty()) if (result.isEmpty())
{ {
result = langLookup(path+"/index.html"); result = langLookup(fname+"/index.html");
if (!result.isEmpty()) if (!result.isEmpty())
{ {
KURL red( "help:/" ); KURL red("help:/");
red.setPath( path + "/index.html" ); red.setPath( fname+"/index.html" );
red.setQuery( query ); red.setQuery( query );
redirection(red); redirection(red);
kdDebug( 7119 ) << "redirect to " << red.url() << endl; kdDebug( 7119 ) << "redirect to " << red.url() << endl;
@ -112,11 +106,11 @@ TQString HelpProtocol::lookupFile(const TQString &fname,
} }
else else
{ {
const TQString helpNotFound = "khelpcenter/helpnotfound/index.html"; const TQString helpNotFound("khelpcenter/helpnotfound/index.html");
if (!langLookup(helpNotFound).isEmpty()) result = langLookup(helpNotFound);
if (!result.isEmpty())
{ {
KURL red; KURL red("help:/");
red.setProtocol("help");
red.setPath(helpNotFound); red.setPath(helpNotFound);
red.setQuery(query); red.setQuery(query);
redirection(red); redirection(red);
@ -125,7 +119,7 @@ TQString HelpProtocol::lookupFile(const TQString &fname,
} }
else else
{ {
unicodeError( i18n("There is no documentation available for %1." ).arg(path) ); unicodeError(i18n("Sorry, there is no documentation available at all for %1." ).arg(fname));
finished(); finished();
return TQString::null; return TQString::null;
} }

Loading…
Cancel
Save