Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Konqueror Konqueror
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 2
    • Issues 2
    • List
    • Boards
    • Service Desk
    • Milestones
  • Bugzilla
    • Bugzilla
  • Merge requests 6
    • Merge requests 6
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Network
  • KonquerorKonqueror
  • Merge requests
  • !106

Merged
Created Jan 08, 2022 by Stefano Crocco@stefanocroccoDeveloper

Remove KonqRun

  • Overview 29
  • Commits 27
  • Pipelines 24
  • Changes 22

KonqRun is replaced with UrlLoader class which has the task to decide how an URL should be opened. How it does this depends on whether the mimetype of the URL is known, on whether the URL corresponds to a local file and whether its scheme is http(s) or not.

If the mimetype isn't known:

  • if the URL is local, the mimetype is immediately determined using QMimeDatabase::mimeTypeForFile. KProtocolManager::protocolForArchiveMimetype and KDesktopFile::hasLinkType are also used to manage archive files and link-type .desktop files. This code has been taken from KonqMainWindow::openUrl and moved here
  • if the URL has http(s) scheme, it's treated as if its mimetype were text/html, so that it'll be opened in WebEnginePart
  • in all other cases, KIO::OpenUrlJob is used to determine the mimetype.

Once the mimetype has been determined, KonqFMSettings::shouldEmbed is used together with the arguments passed to the constructor, to determine if the URL should be embedded or not. In both cases, the user is asked whether to open/embed or save, except for html and xhtml files (currently, these mimetypes are hardcoded: a better way to handle this case should be found). In case the URL should be opened, KIO::ApplicationLauncerJob is used to do so. If the URL should be executed, this is done using KIO::OpenUrlJob. If the URL should be embedded, KMainWindow::openView is used. When everything is done, the finished signal is emitted.

Unlike KonqRun, UrlLoader does nothing on creation. It needs to be started using UrlLoader::start. This determines the mimetype and whether to embed, open or save the URL but only if it can do it without using KIO::OpenUrlJob. At this point, if the mimetype is known, it's able to tell KonqMainWindow whether the file should be embedded in the current view, in another tab or in the view given as argument. This allows KonqMainWindow to create a new tab, if needed, and to pass UrlLoader the correct view to use. If the mimetype is still unknown, a new tab is used. At this point, KonqMainWindow calls UrlLoader::goOn which executes the job to determine the mimetype, if needed, and embeds, opens or saves the URL.

Another change has been made in WebEnginePage::acceptNavigationRequest. When asked to load a local URL, it'll check, using UrlLoader which part is supposed to handle that mimetype: if it's another part, it won't load it and ask Konqueror to do so. This removes the need to use a special property to tell WebEnginePart whether acceptNavigationRequest had been called in response to the application asking to open the URL or by itself because the user clicked on a link. This is needed, for example, to avoid that the Home link in the introduction page is opened in WebEnginePart while permitting to use it to open local html files.

All of this needs a lot of polishing (there are some qDebug which should be removed, some class and function names could be improved, ...) but before doing so, I'd like an opinion about it. One thing in particular I'd like to know is whether it's possible to create a KService from a KPluginMetaData. In UrlLoader, I tried using KParts::PartLoader::partsForMimeType instead of KMimeTypeTrader::preferredService, as advised in the documentation. However, I couldn't find out how to create a KService from the returned KPluginMetaData. I thought that using KService::byStorageId passing KPluginMetaData::pluginId was the correct way, but it only worked with some parts (WebEngine and Dolphin) but not other (Ark and Okular).

Edited Mar 06, 2022 by Stefano Crocco
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: remove-konqrun