Konqueror and empty window title...

David Faure faure at kde.org
Wed Aug 19 15:57:08 BST 2009


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 ) );


-- 
David Faure, faure at kde.org, sponsored by Qt Software @ Nokia to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).




More information about the kde-core-devel mailing list