D6856: Reset url in closeUrl()

David Faure noreply at phabricator.kde.org
Mon Jul 24 22:48:50 UTC 2017


dfaure requested changes to this revision.
dfaure added a comment.
This revision now requires changes to proceed.


  The URL changes twice because you make it change twice ;)
  
  But that can lead to the application updating stuff twice, which doesn't seem very optimal. (actions getting disabled and then re-enabled, title bar flickering, stuff like that).
  
  Ideally it should change only once, either from oldURL to newURL, or from oldURL to QUrl() if loading failed.
  
  This might require a special bool checked by closeUrl(), since we can't just split closeUrl (because it's public *and* virtual - bad design practice - I was young).
  
  (if it wasn't virtual, then moving the code into a closeUrlImpl and having the public closeUrl() do closeUrlImpl()+setUrl(QUrl()) would be the best solution, but we can't do that since openUrl has to call the virtual closeUrl, not just closeUrlImpl. So I can't think of another solution than a bool member set by openUrl and checked by closeUrl to skip the setUrl(QUrl()) until after we try to open the new URL).

REVISION DETAIL
  https://phabricator.kde.org/D6856

To: elvisangelaccio, dfaure, #ktexteditor, #kate, #kdevelop
Cc: cullmann, #frameworks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20170724/dcfa581d/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list