[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-look
Subject:    feedback in search centre.
From:       Thomas Zander <zander () xs4all ! nl>
Date:       2000-04-16 12:45:22
[Download RAW message or body]

--
I crossposted this because of the fix, I am not a member of kde-devel so 
please consider that when replying.
--

In the help centre is a great Search option. This has the following problems.
- Feedback
  I receive no feedback if nothing is found.
  I receive no feedback after I click search, I would like to see the results 
window cleaned, and a waiting cursor appear.

results.
  If the html document contains an empty title tag the </title> tag is missed. (only 
if no space is used between title tags.
This is a bug in the documentation as well, it should be titled.

The last issue seems easy to fix, here is the new function: (ps how do I make a 
diff file)

kdebase/khelpcenter/khc_htmlsearch.cc:
QString HTMLSearch::readTitle(const char *filename)
// Fixed: removed \n, gave feedback if title was empty, better detection on 
// end of title tag (if pos>0 changed to if pos>=0)
{
    QString title;
    QFile file(filename);
  
    if (file.open(IO_ReadOnly))
    {
        QTextStream stream(&file);
        QString buffer;
        int pos;
          
        do
        {
            buffer = stream.readLine();
            if (stream.eof())
            return filename;
        }
        while ((pos = buffer.find("<TITLE>", 0, FALSE)) < 0);

        if(pos>=0) {
            title = buffer.right(buffer.length() - pos - 7);
            if ((pos = title.find("</TITLE>", 0, FALSE )) >= 0)
                title.truncate(pos);
            else  {
                if(pos!=0) {
                    do {
                        buffer = stream.readLine();
                        title += buffer;
                        if (stream.eof())
                            return title;
                    }
                    while ((pos = buffer.find("</TITLE>", 0, FALSE)) < 0);
                      
                    if ((pos = title.find("</TITLE>", 0, FALSE)) >= 0)
                    title.truncate(pos);
                } 
            }
        }
    }
    title.replace(QRegExp("^[ \n\r]"),"");
    if(title.length()<=0)
        return "Unnamed";
    return title;
}
--
Thomas Zander                                                zander@microweb.nl
History repeats itself, it has to, nobody ever listens      OpenPGP key: 0588D5 

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic