Konqueror and empty window title...

Dawit A. adawit at kde.org
Wed Aug 19 22:29:38 BST 2009


On Wednesday 19 August 2009 10:57:08 David Faure wrote:
> On Wednesday 19 August 2009, Dawit A. wrote:
> > Is there any good reason why empty titles are not allowed in Konqueror's
> > title bar ? Both of the setCaption member functions in KonqMainWindow.cpp
> > (@ 4351) and KonqView.cpp (@ 700) reject an empty caption.
> >
> > I am in the process of fixing the history navigation issues when using
> > the webkitpart and I have ironed out all the issues except when no title
> > is present in the document being displayed. In other words a missing
> > <TITLE> tag in the document which is affected by the issue above.
> >
> > What happens in webkitpart is that whenever QtWebKit emits the
> > titleChanged signal the parts setWindowCaption signal is invoked.
> > However, QtWebkit always first clears the title everytime the url changes
> > by emitting titleChanged with an empty/null strings and sets is to the
> > current title after it parses the <TITLE> tag in the new document.
> > However, because of the restrictions imposed by Konqueror in the above
> > two functions, the title from the previous document remains displayed if
> > the current document does not provide a title. This is always the case if
> > the user clicks on a link to a text document in webkitpart for example.
> > The result is the entries in the history navigation buttons
> > (forward/backward) will contain show the wrong text (previous title).
>
> An empty title looks very bad; what if you had 5 such konqueror windows,
> how would you differenciate between them? I recommend that kdewebkit part
> does like khtml: if no title, then emit the URL as caption.
>
> (from DocumentImpl::setTitle in khtml/xml/dom_docimpl.cpp)
>
>          if (titleStr.isEmpty()) {
>              // empty title... set window caption as the URL
>              KUrl url = m_url;
>              url.setRef(QString());
>              url.setQuery(QString());
>              titleStr = url.prettyUrl();
>          }
>
>         emit view()->part()->setWindowCaption( KStringHandler::csqueeze(
> titleStr, 128 ) );

Hmm... It is a little more complicated in the webkitpart as simply doing that 
will cause way to many updates to the title bar two or more per every single 
request, but I will try to find a better solution. Anyhow, the only time this 
is an issue is when the link is redirected to another location...




More information about the kde-core-devel mailing list