+# Copyright 2023 Soren Stoutner <soren@stoutner.com>.
+#
+# This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
+#
+# Privacy Browser PC is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Privacy Browser PC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Privacy Browser PC. If not, see <http://www.gnu.org/licenses/>.
+
+# Create the documentation.
kdoctools_create_handbook(index.docbook INSTALL_DESTINATION ${KDE_INSTALL_DOCBUNDLEDIR}/en SUBDIR privacybrowser)
<?xml version="1.0" ?>
-<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.5-Based Variant V1.1//EN" "dtd/kdedbx45.dtd" [
- <!-- Define an entity for your application if it is not part of KDE
- Git -->
- <!ENTITY kmyapplication "<application>privacybrowserpc</application>">
- <!ENTITY i18n-translatable-entity "<application>Translatable Entity</application>">
- <!ENTITY % addindex "IGNORE">
- <!ENTITY % English "INCLUDE">
-
- <!-- Do not define any other entities; instead, use the entities
- from entities/general.entities and en/user.entities. -->
-]>
<!--
-Use this template for application docbooks
-For kioslave, systemsettings (kcontrol) modules and simple/short application docbooks use article-template.docbook
-Rename this template to index.docbook and place into the directory doc/ or doc/appname if you have several applications in one doc directory
--->
-
-<!-- kdoctemplate v0.13.0 2017-07-31 ltoscano
- add CC BY-SA 4.0 International and set as default
-
- kdoctemplate v0.12.0 2016-04-23 lueck
- add translatable entities
- remove help.menu.documentation entity
- and add some examples how to use the common menus Settings and Help
-
- kdoctemplate v0.11.0 2015-04-03 lueck
- updated instructions for date + releaseinfo
- remove ENTITY package - not used anymore
- add info about KDE Games special chapters
- Appendix Installation is now optional
-
- kdoctemplate v0.10.0 2014-04-02 ltoscano
- updated to KF5/kdoctools
- references to KDE reworded
-
- kdoctemplate v0.9.2 2012-10-15 pino
- update versions to 4.9
- update years to 2012
- switch from CVS to Git
- add id attribute to <book>
-
- kdoctemplate v0.9.1 2010-10-27 lueck
- changed releaseinfo format
- removed screenshot format="EPS
- added comment when to write a command reference
- added tip using id's in varlistentries
- removed refentry stuff
-
- kdoctemplate v0.9 January 10 2003
- Changes to comments to clarify entity usage January 10 2003
- Minor update to "Credits and Licenses" section on August 24, 2000
- Removed "Revision history" section on 22 January 2001
- Changed to Installation/Help menu entities 18 October 2001
- Other minor cleanup and changes 18 October 2001
- FPI change and minor changes November 2002 -->
-
-<!--
-This template was designed by: David Rugge davidrugge@mindspring.com
-with lots of help from: Eric Bischoff ebisch@cybercable.tm.fr
-and Frederik Fouvry fouvry@sfs.nphil.uni-tuebingen.de
-of the KDE DocBook team.
-
-You may freely use this template for writing any sort of KDE documentation.
-If you have any changes or improvements, please let us know.
-
-Remember:
-- in XML, the case of the <tags> and attributes is relevant ;
-- also, quote all attributes.
-
-Please don't forget to remove all these comments in your final documentation,
-thanks ;-).
--->
-
-<!-- ................................................................ -->
-
-<!-- The language must NOT be changed here. -->
-<!-- If you are writing original documentation in a language other -->
-<!-- than English, change the language above ONLY, not here -->
-<!-- Change the value of id to the name of your application -->
-<book id="kmyapplication" lang="&language;">
-
-<!-- This header contains all of the meta-information for the document such
-as Authors, publish date, the abstract, and Keywords -->
-
-<bookinfo>
-<title>The &kmyapplication; Handbook</title>
-
-<authorgroup>
-<author>
-<!-- This is just put in as an example. For real documentation, please
- define a general entity in entities/contributor.entities, e.g.
-<!ENTITY George.N.Ugnacious "<personname><firstname>George</firstname><othername>N.</othername><surname>Ugnacious</surname></personname>">
-<!ENTITY George.N.Ugnacious.mail "<email>gnu@kde.org</email>">
-and use `&George.N.Ugnacious; &George.N.Ugnacious.mail;' in the author element.
- -->
-<personname>
-<firstname>George</firstname>
-<othername>N.</othername>
-<surname>Ugnacious</surname>
-</personname>
-<email>gnu@kde.org</email>
-</author>
-<!-- TRANS:ROLES_OF_TRANSLATORS -->
-</authorgroup>
-
-<copyright>
-<year>2015</year>
-<holder>George N. Ugnacious</holder>
-</copyright>
-<legalnotice>&CCBYSA4Notice;</legalnotice>
-
-<!-- Date of the documentation
-Change date/releaseinfo only if
- docbook is updated and verified to be valid for the current app version
- or
- docbook is proofread and verified to be valid for the current app version
-Don't forget to include this last date.
-Please respect the format of the date (YYYY-MM-DD),it is used by scripts.
--->
-<date>2016-04-23</date>
-
-<!--version information of Frameworks/Plasma/Applications this documentation is valid for.
-Example:
-Frameworks xx.yy for docbooks in frameworks
-Plasma xx.yy for docbooks in plasma workspace
-Applications xx.yy for docbooks released as Applications
-xx.yy (Applications xx.yy) for docbooks with own version released as Applications
-$applicationname xx.yy for applications with independent release schedule (extragear/playground)
--->
-<releaseinfo>Frameworks xx.yy or Plasma xx.yy or Applications xx.yy or xx.yy (Applications xx.yy) or $applicationname xx.yy</releaseinfo>
-
-<!-- Abstract about this handbook -->
-
-<abstract>
-<para>
-&kmyapplication; is an application specially designed to do nothing you would
-ever want.
-</para>
-</abstract>
-
-<!-- This is a set of Keywords for indexing by search engines.
-Please at least include KDE, the KDE section it is in, the name
- of your application, and a few relevant keywords. -->
-
-<keywordset>
-<keyword>KDE</keyword>
-<keyword>kdeutils</keyword>
-<keyword>Kapp</keyword>
-<keyword>nothing</keyword>
-<keyword>nothing else</keyword>
-</keywordset>
-
-</bookinfo>
-
-<!-- The contents of the documentation begin here. Label
-each chapter so with the id attribute. This is necessary for two reasons: it
-allows you to easily reference the chapter from other chapters of your
-document, and if there is no ID, the name of the generated HTML files will vary
-from time to time making it hard to manage for maintainers and for the CVS
-system. Any chapter labelled (OPTIONAL) may be left out at the author's
-discretion. Other chapters should not be left out in order to maintain a
-consistent documentation style across all KDE apps. -->
-
-
-<!-- KDE Games have special chapters
-
-Introduction
-
-How to play
-
-Game Rules, Strategies and Tips
-
-Interface Overview
-
-Frequently asked questions
-
-Credits and License
-
-Please use one of index.docbook files from kdegames
-
--->
-<chapter id="introduction">
-<title>Introduction</title>
-
-<!-- The introduction chapter contains a brief introduction for the
-application that explains what it does and where to report
-problems. Basically a long version of the abstract. Don't include a
-revision history. (see installation appendix comment) -->
-
-<para>
-&kmyapplication; is a program that lets you do absolutely nothing. Please report
-any problems or feature requests to the &kde; mailing lists.
-</para>
-</chapter>
-
-<chapter id="using-kapp">
-<title>Using &kmyapplication;</title>
-
-<!-- This chapter should tell the user how to use your app. You should use as
-many sections (Chapter, Sect1, Sect3, etc...) as is necessary to fully document
-your application. -->
-
-<para>
-
-<!-- Note that all graphics should be in .png format. Use no gifs because of
-patent issues. -->
-
-<screenshot>
-<screeninfo>Here's a screenshot of &kmyapplication;</screeninfo>
- <mediaobject>
- <imageobject>
- <imagedata fileref="screenshot.png" format="PNG"/>
- </imageobject>
- <textobject>
- <phrase>Screenshot</phrase>
- </textobject>
- </mediaobject>
-</screenshot>
-</para>
-
-
-<sect1 id="kapp-features">
-<title>More &kmyapplication; features</title>
-
-<para>It slices! It dices! and it comes with a free toaster!</para>
-<para>
-The Squiggle Tool <guiicon><inlinemediaobject>
- <imageobject>
- <imagedata fileref="squiggle.png" format="PNG"/>
- </imageobject>
- <textobject>
- <phrase>Squiggle</phrase>
- </textobject>
-</inlinemediaobject></guiicon> is used to draw squiggly lines all over
-the &kmyapplication; main window. It's not a bug, it's a feature!
-</para>
-
-</sect1>
-</chapter>
-
-<chapter id="commands">
-<title>Command Reference</title>
-
-<!-- (OPTIONAL, BUT RECOMMENDED) This chapter should list all of the
-application windows and their menubar and toolbar commands for easy reference.
-Also include any keys that have a special function but have no equivalent in the
-menus or toolbars.
-This may not be necessary for small apps or apps with no tool or menu bars.
-
-Don't bother users with well known kde menu items like Settings->Shortcuts etc.
-
-Use cases for a command reference:
-
-Applications with many menu items (Kate/Konqueror)
-Applications with different modes and menus (KWrite/Konqueror)
--> Enables search for menu items
-
-For Applications with default menu items and some special items where user
-needs additional information use something like:
-"Apart from the common KDE menu items you find these action in the menu:
-
-File -> Special Action: Explanation of special action
-
-Tools -> Special Tool: Explanation of special tool
-
-Use variablelist markup for this
--->
-
-<sect1 id="kapp-mainwindow">
-<title>The main &kmyapplication; window</title>
-
-<sect2>
-<title>The File Menu</title>
-<para>
-<variablelist>
-<varlistentry id="file-new">
-<!-- Tip: With id's here, then you can use them like
-"select <xref linkend="file-new"/> to open the file dialog"
-which will be expanded to:
-"select File->New (Ctrl+N) to open the file dialog"
--->
-<term><menuchoice>
-<shortcut>
-<keycombo action="simul">&Ctrl;<keycap>N</keycap></keycombo>
-</shortcut>
-<guimenu>File</guimenu>
-<guimenuitem>New</guimenuitem>
-</menuchoice></term>
-<listitem><para><action>Creates a new document</action></para></listitem>
-</varlistentry>
-
-<varlistentry id="file-save">
-<term><menuchoice>
-<shortcut>
-<keycombo action="simul">&Ctrl;<keycap>S</keycap></keycombo>
-</shortcut>
-<guimenu>File</guimenu>
-<guimenuitem>Save</guimenuitem>
-</menuchoice></term>
-<listitem><para><action>Saves the document</action></para></listitem>
-</varlistentry>
-
-<varlistentry id="file-quit">
-<term><menuchoice>
-<shortcut>
-<keycombo action="simul">&Ctrl;<keycap>Q</keycap></keycombo>
-</shortcut>
-<guimenu>File</guimenu>
-<guimenuitem>Quit</guimenuitem>
-</menuchoice></term>
-<listitem><para><action>Quits</action> &kmyapplication;</para></listitem>
-</varlistentry>
-</variablelist>
-</para>
-
-</sect2>
-
-<!-- Examples how to use the common menus Settings and Help -->
-
-<sect2 id="settings-help-menu">
-<title>The Settings and Help Menu</title>
-<para>
-&kmyapplication; has the common &kde; <guimenu>Settings</guimenu> and <guimenu>Help</guimenu>
-menu items, for more information read the sections about the <ulink url="help:/fundamentals/ui.html#menus-settings"
->Settings Menu</ulink> and <ulink url="help:/fundamentals/ui.html#menus-help">Help Menu</ulink>
-of the &kde; Fundamentals.
-</para>
-</sect2>
-
-<sect2 id="help-menu1">
-<title>The Help Menu</title>
-<para>
-&kmyapplication; has the common &kde; <guimenu>Help</guimenu> menu item, for more information read the section
-about the <ulink url="help:/fundamentals/ui.html#menus-help">Help Menu</ulink> of the &kde; Fundamentals.
-</para>
-</sect2>
-
-<sect2 id="menu-commands">
-<title>Menu Items</title>
-<para>Apart from the common &kde; menus described in the <ulink url="help:/fundamentals/ui.html#menus">Menu</ulink>
-chapter of the &kde; Fundamentals documentation &kmyapplication; has these application specific menu entries:
-</para>
-<!-- variablelist -->
-</sect2>
-
-<sect2 id="help-menu2">
-<title>The Help Menu</title>
-<para>&kmyapplication; has a default &kde; <guimenu>Help</guimenu> menu as described in the
-<ulink url="help:/fundamentals/ui.html#menus-help">&kde; Fundamentals</ulink>
-with two additional entries:</para>
-<!-- variablelist -->
-</sect2>
-
-</sect1>
-</chapter>
-
-<chapter id="developers">
-<title>Developer's Guide to &kmyapplication;</title>
-
-<!-- (OPTIONAL) A Programming/Scripting reference chapter should be
-used for apps that use plugins or that provide their own scripting hooks
-and/or development libraries. -->
-
-<para>
-Programming &kmyapplication; plugins is a joy to behold.
-</para>
-
-
-</chapter>
-
-<chapter id="faq">
-<title>Questions and Answers</title>
-
-<!-- (OPTIONAL but recommended) This chapter should include all of the silly
-(and not-so-silly) newbie questions that fill up your mailbox. This chapter
-should be reserved for BRIEF questions and answers! If one question uses more
-than a page or so then it should probably be part of the
-"Using this Application" chapter instead. You should use links to
-cross-reference questions to the parts of your documentation that answer them.
-This is also a great place to provide pointers to other FAQ's if your users
-must do some complicated configuration on other programs in order for your
-application work. -->
-
-<qandaset id="faqlist">
-<qandaentry>
-<question>
-<para>My Mouse doesn't work. How do I quit &kmyapplication;?</para>
-</question>
-<answer>
-<para>You silly goose! Check out the <link linkend="commands">Commands
-Section</link> for the answer.</para>
-</answer>
-</qandaentry>
-<qandaentry>
-<question>
-<para>Why can I not twiddle my documents?</para>
-</question>
-<answer>
-<para>You can only twiddle your documents if you have the foobar.lib
-installed.</para>
-</answer>
-</qandaentry>
-</qandaset>
-</chapter>
-
-<chapter id="credits">
-
-<!-- Include credits for the programmers, documentation writers, and
-contributors here. The license for your software should then be included below
-the credits with a reference to the appropriate license file included in the KDE
-distribution. -->
-
-<title>Credits and License</title>
-
-<para>
-&kmyapplication;
-</para>
-<para>
-Program copyright 2010-2014 John Q. Hacker <email>jqh@kde.org</email>
-</para>
-<para>
-Contributors:
-<itemizedlist>
-<listitem><para>Konqui the &kde; Dragon <email>konqui@kde.org</email></para>
-</listitem>
-<listitem><para>Tux the &Linux; Penguin <email>tux@linux.org</email></para>
-</listitem>
-</itemizedlist>
-</para>
-
-<para>
-Documentation Copyright © 2012-2014 George N. Ugnacious <email>gnu@kde.org</email>
-</para>
-
-<!-- TRANS:CREDIT_FOR_TRANSLATORS -->
-
-<!-- License for new documents after 2017-07-27 (or relicensed) -->
-
-&underCCBYSA4; <!-- CC BY-SA 4.0: do not remove -->
-
-<!-- FDL: old license; only for reference (and old documents) -->
-<!--
-&underFDL;
--->
-
-<!-- Determine which license your application is licensed under,
- and delete all the remaining licenses below:
-
- (NOTE: All documentation are licensed under the CC BY-SA 4.0,
- regardless of what license the application uses) -->
-
-&underGPL; <!-- GPL License -->
-&underBSDLicense; <!-- BSD License -->
-&underArtisticLicense; <!-- BSD Artistic License -->
-&underX11License; <!-- X11 License -->
+ Copyright 2023 Soren Stoutner <soren@stoutner.com>.
-</chapter>
+ This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
-<!-- Appendix Installation is optional, usually not required
+ Permission is granted to copy, distribute and/or modify this document
+ under the terms of the GNU Free Documentation License, Version 1.3
+ or any later version published by the Free Software Foundation;
+ with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
-Entities &install.intro.documentation; + &install.compile.documentation; will be removed in later kdoctools
+ You should have received a copy of the GNU Free Documentation License
+ along with Privacy Browser PC. If not, see <http://www.gnu.org/licenses/>. -->
--->
-
-<appendix id="installation">
-<title>Installation</title>
-
-<sect1 id="getting-kapp">
-<title>How to obtain &kmyapplication;</title>
-
-<!-- This first entity contains boiler plate for applications that are
-part of KDE archive. You should remove it if you are releasing your
-application -->
+<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.5-Based Variant V1.1//EN" "dtd/kdedbx45.dtd" [
+ <!-- Privacy Browser’s name -->
+ <!ENTITY privacybrowser "<application>Privacy Browser</application>">
-&install.intro.documentation;
+ <!-- People. -->
+ <!ENTITY Soren.Stoutner "<personname><firstname>Soren</firstname><surname>Stoutner</surname></personname>">
+ <!ENTITY Soren.Stoutner.mail "<email>soren@stoutner.com</email>">
-</sect1>
+ <!-- Set the language of this documentation. -->
+ <!ENTITY % English "INCLUDE">
-<sect1 id="requirements">
-<title>Requirements</title>
+ <!-- Default entries. May not be needed. -->
+ <!ENTITY i18n-translatable-entity "<application>Translatable Entity</application>">
+ <!ENTITY % addindex "IGNORE">
+]>
-<!--
-List any special requirements for your application here. This should include:
-.Libraries or other software that is not included in kdesupport or kf5
-.Hardware requirements like amount of RAM, disk space, graphics card
-capabilities, screen resolution, special expansion cards, etc.
-.Operating systems the app will run on. If your app is designed only for a
-specific OS, (you wrote a graphical LILO configurator for example) put this
-information here.
--->
-
-<para>
-In order to successfully use &kmyapplication;, you need few libraries from
-&kf5; 5.1 (bar, baz). Foobar.lib is
-required in order to support the advanced &kmyapplication; features. &kmyapplication; uses
-about 5 megs of memory to run, but this may vary depending on your
-platform and configuration.
-</para>
-
-<para>
-All required libraries as well as &kmyapplication; itself can be found
-on <ulink url="ftp://ftp.kapp.org">The &kmyapplication; home page</ulink>.
-</para>
-
-<!-- For a list of updates, you may refer to the application web site
-or the ChangeLog file, or ... -->
-<para>
-You can find a list of changes at <ulink
-url="http://apps.kde.org/kapp">http://apps.kde.org/kapp</ulink>.
-</para>
-</sect1>
-
-<sect1 id="compilation">
-<title>Compilation and Installation</title>
-
-<!-- This entity contains the boilerplate text for standard -->
-<!-- compilation instructions. If your application requires any -->
-<!-- special handling, remove it, and replace with your own text. -->
-
-&install.compile.documentation;
-
-</sect1>
-
-<sect1 id="configuration">
-<title>Configuration</title>
-
-<para>Don't forget to tell your system to start the <filename>dtd</filename>
-dicer-toaster daemon first, or &kmyapplication; won't work!</para>
-
-</sect1>
-
-</appendix>
-
-&documentation.index;
+<book id="privacybrowser" lang="&language;">
+ <bookinfo>
+ <title>The &privacybrowser; Handbook</title>
+
+ <authorgroup>
+ <author>&Soren.Stoutner; &Soren.Stoutner.mail;</author>
+
+ <!-- Add translators here. TRANS:ROLES_OF_TRANSLATORS -->
+ </authorgroup>
+
+ <copyright>
+ <year>2016-2017, 2021-2023</year>
+ <holder>&Soren.Stoutner;</holder>
+ </copyright>
+
+ <!-- Documentation license. -->
+ <legalnotice>&FDLNotice;</legalnotice>
+
+ <!-- Last update. -->
+ <date>2023-02-22</date>
+
+ <!-- The version of Privacy Browser this documentation is written for. -->
+ <releaseinfo>&privacybrowser; version 0.1</releaseinfo>
+
+
+ <!-- Abstract about this handbook -->
+ <abstract>
+ <para>
+ &privacybrowser; is a web browser that respects your privacy.
+ </para>
+ </abstract>
+
+ <!-- This is a set of Keywords for indexing by search engines. -->
+ <keywordset>
+ <keyword>KDE</keyword>
+ <keyword>privacy</keyword>
+ <keyword>browser</keyword>
+ </keywordset>
+ </bookinfo>
+
+ <!-- Introduction. -->
+ <chapter id="introduction">
+ <title>Introduction</title>
+
+ <para>
+ &privacybrowser; is currently in an early alpha state.
+ Most of the features are not yet implemented, but I thought it would be useful to publish it so that users can track the progress and submit feedback.
+ </para>
+
+ <para>
+ To distinguish between the Android and the PC version, the website, issue tracker,
+ and code base refer to this version as <ulink url="https://www.stoutner.com/privacy-browser-pc/">Privacy Browser PC</ulink>.
+ There is a list of feature requests and known bugs at <ulink url="https://redmine.stoutner.com/projects/privacy-browser-pc/issues">redmine.stoutner.com</ulink>.
+ Users should anticipate that all the current features of <ulink url="https://www.stoutner.com/privacy-browser-android/">Privacy Browser Android</ulink>
+ will also be implemented in Privacy Browser PC.
+ There is no need at this point to create features requests for these as they will be added as I start working on each feature and have a better idea of how they will be implemented.
+ However, each feature that has already been implemented should be bug free.
+ If you discover a bug that is not already documented at <ulink url="https://redmine.stoutner.com/projects/privacy-browser-pc/issues">redmine.stoutner.com</ulink> please add it.
+ </para>
+
+ <para>
+ The best place to discuss the development of Privacy Browser is <ulink url="https://redmine.stoutner.com/projects/privacy-browser-pc/boards">on the forum</ulink>.
+ I also frequently post on my <ulink url="https://fosstodon.org/@privacybrowser">Mastodon account</ulink> regarding the development status.
+ </para>
+ </chapter>
+
+ <!-- Using Privacy Browser. -->
+ <chapter id="using-privacy-browser">
+ <title>Using &privacybrowser;</title>
+
+ <para>
+ <screenshot>
+ <screeninfo>Here's a screenshot of &privacybrowser;</screeninfo>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="screenshot.png" format="PNG"/>
+ </imageobject>
+ <textobject>
+ <phrase>Screenshot</phrase>
+ </textobject>
+ </mediaobject>
+ </screenshot>
+ </para>
+
+ <sect1 id="kapp-features">
+ <title>More &privacybrowser; features</title>
+
+ <para>
+ It slices! It dices! and it comes with a free toaster!
+ </para>
+
+ <para>
+ The Squiggle Tool <guiicon><inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="squiggle.png" format="PNG"/>
+ </imageobject>
+ <textobject>
+ <phrase>Squiggle</phrase>
+ </textobject>
+ </inlinemediaobject></guiicon> is used to draw squiggly lines all over the &privacybrowser; main window. It's not a bug, it's a feature!
+ </para>
+ </sect1>
+ </chapter>
+
+ <!-- Commands. -->
+ <chapter id="commands">
+ <title>Command Reference</title>
+
+ <sect1 id="kapp-mainwindow">
+ <title>The main &privacybrowser; window</title>
+
+ <sect2>
+ <title>The File Menu</title>
+
+ <para>
+ <variablelist>
+ <varlistentry id="file-new">
+ <!-- Tip: With id's here, then you can use them like
+ "select <xref linkend="file-new"/> to open the file dialog"
+ which will be expanded to:
+ "select File->New (Ctrl+N) to open the file dialog"
+ -->
+ <term>
+ <menuchoice>
+ <shortcut>
+ <keycombo action="simul">&Ctrl;<keycap>N</keycap></keycombo>
+ </shortcut>
+ <guimenu>File</guimenu>
+ <guimenuitem>New</guimenuitem>
+ </menuchoice>
+ </term>
+
+ <listitem>
+ <para>
+ <action>Creates a new document</action>
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="file-save">
+ <term>
+ <menuchoice>
+ <shortcut>
+ <keycombo action="simul">&Ctrl;<keycap>S</keycap></keycombo>
+ </shortcut>
+ <guimenu>File</guimenu>
+ <guimenuitem>Save</guimenuitem>
+ </menuchoice>
+ </term>
+
+ <listitem>
+ <para>
+ <action>Saves the document</action>
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="file-quit">
+ <term>
+ <menuchoice>
+ <shortcut>
+ <keycombo action="simul">&Ctrl;<keycap>Q</keycap></keycombo>
+ </shortcut>
+ <guimenu>File</guimenu>
+ <guimenuitem>Quit</guimenuitem>
+ </menuchoice>
+ </term>
+
+ <listitem>
+ <para>
+ <action>Quits</action> &privacybrowser;
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </sect2>
+
+ <!-- Examples how to use the common menus Settings and Help -->
+ <sect2 id="settings-help-menu">
+ <title>The Settings and Help Menu</title>
+
+ <para>
+ &privacybrowser; has the common &kde; <guimenu>Settings</guimenu> and <guimenu>Help</guimenu>
+ menu items, for more information read the sections about the <ulink url="help:/fundamentals/ui.html#menus-settings"
+ >Settings Menu</ulink> and <ulink url="help:/fundamentals/ui.html#menus-help">Help Menu</ulink>
+ of the &kde; Fundamentals.
+ </para>
+ </sect2>
+
+ <sect2 id="help-menu1">
+ <title>The Help Menu</title>
+
+ <para>
+ &privacybrowser; has the common &kde; <guimenu>Help</guimenu> menu item, for more information read the section
+ about the <ulink url="help:/fundamentals/ui.html#menus-help">Help Menu</ulink> of the &kde; Fundamentals.
+ </para>
+ </sect2>
+
+ <sect2 id="menu-commands">
+ <title>Menu Items</title>
+
+ <para>
+ Apart from the common &kde; menus described in the <ulink url="help:/fundamentals/ui.html#menus">Menu</ulink>
+ chapter of the &kde; Fundamentals documentation &privacybrowser; has these application specific menu entries:
+ </para>
+ </sect2>
+
+ <sect2 id="help-menu2">
+ <title>The Help Menu</title>
+
+ <para>
+ &privacybrowser; has a default &kde; <guimenu>Help</guimenu> menu as described in the
+ <ulink url="help:/fundamentals/ui.html#menus-help">&kde; Fundamentals</ulink>
+ with two additional entries:
+ </para>
+ </sect2>
+ </sect1>
+ </chapter>
+
+ <!-- FAQ. -->
+ <chapter id="faq">
+ <title>Questions and Answers</title>
+
+ <!-- (OPTIONAL but recommended) This chapter should include all of the silly
+ (and not-so-silly) newbie questions that fill up your mailbox. This chapter
+ should be reserved for BRIEF questions and answers! If one question uses more
+ than a page or so then it should probably be part of the
+ "Using this Application" chapter instead. You should use links to
+ cross-reference questions to the parts of your documentation that answer them.
+ This is also a great place to provide pointers to other FAQ's if your users
+ must do some complicated configuration on other programs in order for your
+ application work. -->
+
+ <qandaset id="faqlist">
+ <qandaentry>
+ <question>
+ <para>My Mouse doesn't work. How do I quit &privacybrowser;?</para>
+ </question>
+
+ <answer>
+ <para>You silly goose! Check out the <link linkend="commands">Commands Section</link> for the answer.</para>
+ </answer>
+ </qandaentry>
+
+ <qandaentry>
+ <question>
+ <para>Why can I not twiddle my documents?</para>
+ </question>
+
+ <answer>
+ <para>
+ You can only twiddle your documents if you have the foobar.lib installed.
+ </para>
+ </answer>
+ </qandaentry>
+ </qandaset>
+ </chapter>
+
+ <!-- Credits. -->
+ <chapter id="credits">
+ <title>Credits and License</title>
+
+ <para>
+ Program copyright 2016-2017,2021-2023 Soren Stoutner <ulink url="mailto:soren@stoutner.com">soren@stoutner.com</ulink>.
+ </para>
+
+ <para>
+ Translators:
+ <itemizedlist>
+ <listitem><para>Translations will be added in a future release.</para></listitem>
+ </itemizedlist>
+ </para>
+
+ <!-- The program license. -->
+ &underGPL;
+
+ <para>
+ Documentation copyright 2023 Soren Stoutner <ulink url="mailto:soren@stoutner.com">soren@stoutner.com</ulink>.
+ </para>
+
+ <!-- The documentation license. -->
+ &underFDL;
+ </chapter>
</book>
-
-<!--
-Local Variables:
-mode: xml
-sgml-minimize-attributes:nil
-sgml-general-insert-case:lower
-sgml-indent-step:0
-sgml-indent-data:nil
-End:
-
-vim:tabstop=2:shiftwidth=2:expandtab
-kate: space-indent on; indent-width 2; tab-width 2; indent-mode none;
--->
/*
- * Copyright © 2022 Soren Stoutner <soren@stoutner.com>.
+ * Copyright 2022-2023 Soren Stoutner <soren@stoutner.com>.
*
* This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
*
// Application headers.
#include "PrivacyWebEngineView.h"
+#include "Settings.h"
#include "databases/CookiesDatabase.h"
+#include "databases/DomainsDatabase.h"
+#include "interceptors/UrlRequestInterceptor.h"
#include "windows/BrowserWindow.h"
// Qt toolkit headers.
#include <QMenu>
// Construct the class.
-PrivacyWebEngineView::PrivacyWebEngineView() : QWebEngineView(nullptr) {}
+PrivacyWebEngineView::PrivacyWebEngineView() : QWebEngineView(nullptr)
+{
+ // Create an off-the-record profile (the default when no profile name is specified).
+ webEngineProfilePointer = new QWebEngineProfile(QLatin1String(""));
+
+ // Create a WebEngine page.
+ QWebEnginePage *webEnginePagePointer = new QWebEnginePage(webEngineProfilePointer);
+
+ // Set the WebEngine page.
+ setPage(webEnginePagePointer);
+
+ // Get handles for the various aspects of the WebEngine.
+ webEngineSettingsPointer = webEnginePagePointer->settings();
+
+ // Instantiate the URL request interceptor.
+ UrlRequestInterceptor *urlRequestInterceptorPointer = new UrlRequestInterceptor();
+
+ // Set the URL request interceptor.
+ webEngineProfilePointer->setUrlRequestInterceptor(urlRequestInterceptorPointer);
+
+ // Reapply the domain settings when the host changes.
+ connect(urlRequestInterceptorPointer, SIGNAL(applyDomainSettings(QString)), this, SLOT(applyDomainSettingsWithoutReloading(QString)));
+}
void PrivacyWebEngineView::addCookieToList(const QNetworkCookie &cookie) const
{
emit updateCookiesAction(cookieListPointer->size());
}
+void PrivacyWebEngineView::applyDomainSettingsWithoutReloading(const QString &hostname)
+{
+ // Apply the domain settings `false` does not reload the website.
+ applyDomainSettings(hostname, false);
+}
+
+void PrivacyWebEngineView::applyDomainSettings(const QString &hostname, const bool reloadWebsite)
+{
+ // Get the record for the hostname.
+ QSqlQuery domainQuery = DomainsDatabase::getDomainQuery(hostname);
+
+ // Check if the hostname has domain settings.
+ if (domainQuery.isValid()) // The hostname has domain settings.
+ {
+ // Get the domain record.
+ QSqlRecord domainRecord = domainQuery.record();
+
+ // Store the domain settings name.
+ domainSettingsName = domainRecord.field(DomainsDatabase::DOMAIN_NAME).value().toString();
+
+ // Set the JavaScript status.
+ switch (domainRecord.field(DomainsDatabase::JAVASCRIPT).value().toInt())
+ {
+ // Set the default JavaScript status.
+ case (DomainsDatabase::SYSTEM_DEFAULT):
+ {
+ webEngineSettingsPointer->setAttribute(QWebEngineSettings::JavascriptEnabled, Settings::javaScriptEnabled());
+
+ break;
+ }
+
+ // Disable JavaScript.
+ case (DomainsDatabase::DISABLED):
+ {
+ webEngineSettingsPointer->setAttribute(QWebEngineSettings::JavascriptEnabled, false);
+
+ break;
+ }
+
+ // Enable JavaScript.
+ case (DomainsDatabase::ENABLED):
+ {
+ webEngineSettingsPointer->setAttribute(QWebEngineSettings::JavascriptEnabled, true);
+
+ break;
+ }
+ }
+
+ // Set the local storage status.
+ switch (domainRecord.field(DomainsDatabase::LOCAL_STORAGE).value().toInt())
+ {
+ // Set the default local storage status.
+ case (DomainsDatabase::SYSTEM_DEFAULT):
+ {
+ localStorageEnabled = Settings::localStorageEnabled();
+
+ break;
+ }
+
+ // Disable local storage.
+ case (DomainsDatabase::DISABLED):
+ {
+ localStorageEnabled = false;
+
+ break;
+ }
+
+ // Enable local storage.
+ case (DomainsDatabase::ENABLED):
+ {
+ localStorageEnabled = true;
+
+ break;
+ }
+ }
+
+ // Set the DOM storage status.
+ switch (domainRecord.field(DomainsDatabase::DOM_STORAGE).value().toInt())
+ {
+ // Set the default DOM storage status. QWebEngineSettings confusingly calls this local storage.
+ case (DomainsDatabase::SYSTEM_DEFAULT):
+ {
+ webEngineSettingsPointer->setAttribute(QWebEngineSettings::LocalStorageEnabled, Settings::domStorageEnabled());
+
+ break;
+ }
+
+ // Disable DOM storage. QWebEngineSettings confusingly calls this local storage.
+ case (DomainsDatabase::DISABLED):
+ {
+ webEngineSettingsPointer->setAttribute(QWebEngineSettings::LocalStorageEnabled, false);
+
+ break;
+ }
+
+ // Enable DOM storage. QWebEngineSettings confusingly calls this local storage.
+ case (DomainsDatabase::ENABLED):
+ {
+ webEngineSettingsPointer->setAttribute(QWebEngineSettings::LocalStorageEnabled, true);
+
+ break;
+ }
+ }
+
+ // Set the user agent.
+ webEngineProfilePointer->setHttpUserAgent(UserAgentHelper::getResultingDomainSettingsUserAgent(domainRecord.field(DomainsDatabase::USER_AGENT).value().toString()));
+
+ // Check if a custom zoom factor is set.
+ if (domainRecord.field(DomainsDatabase::ZOOM_FACTOR).value().toInt())
+ {
+ // Store the current zoom factor.
+ setZoomFactor(domainRecord.field(DomainsDatabase::CUSTOM_ZOOM_FACTOR).value().toDouble());
+ }
+ else
+ {
+ // Reset the current zoom factor.
+ setZoomFactor(Settings::zoomFactor());
+ }
+ }
+ else // The hostname does not have domain settings.
+ {
+ // Reset the domain settings name.
+ domainSettingsName = QLatin1String("");
+
+ // Set the JavaScript status.
+ webEngineSettingsPointer->setAttribute(QWebEngineSettings::JavascriptEnabled, Settings::javaScriptEnabled());
+
+ // Set the local storage status.
+ localStorageEnabled = Settings::localStorageEnabled();
+
+ // Set DOM storage. In QWebEngineSettings it is called Local Storage.
+ webEngineSettingsPointer->setAttribute(QWebEngineSettings::LocalStorageEnabled, Settings::domStorageEnabled());
+
+ // Set the user agent.
+ webEngineProfilePointer->setHttpUserAgent(UserAgentHelper::getUserAgentFromDatabaseName(Settings::userAgent()));
+
+ // Set the zoom factor.
+ setZoomFactor(Settings::zoomFactor());
+ }
+
+ // Reload the website if requested.
+ if (reloadWebsite)
+ reload();
+
+ // Update the UI.
+ emit updateUi(this);
+}
+
void PrivacyWebEngineView::contextMenuEvent(QContextMenuEvent *contextMenuEvent) {
// Get a handle for the
QWebEnginePage *webEnginePagePointer = page();
// Get a handle for the browser window.
BrowserWindow *browserWindowPointer = qobject_cast<BrowserWindow*>(window());
- // Create the requsted window type.
+ // Create the requested window type.
switch (webWindowType)
{
case QWebEnginePage::WebBrowserTab:
default:
{
- // Return an null pointer for opening a background tab and opening a web dialog.
+ // Return a null pointer for opening a web dialog.
return nullptr;
}
}
/*
- * Copyright © 2022 Soren Stoutner <soren@stoutner.com>.
+ * Copyright 2022-2023 Soren Stoutner <soren@stoutner.com>.
*
* This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
*
int loadProgressInt = -1;
bool localStorageEnabled = false;
+ // The public functions.
+ void applyDomainSettings(const QString &hostname, const bool reloadWebsite);
+
signals:
// The signals.
void updateCookiesAction(const int numberOfCookies) const;
+ void updateUi(const PrivacyWebEngineView *privacyWebEngineViewPointer) const;
public Q_SLOTS:
// The public slots.
void addCookieToList(const QNetworkCookie &cookie) const;
void removeCookieFromList(const QNetworkCookie &cookie) const;
+private Q_SLOTS:
+ // The private slots.
+ void applyDomainSettingsWithoutReloading(const QString &hostname);
+
+private:
+ // The private variables.
+ QWebEngineProfile *webEngineProfilePointer;
+ QWebEngineSettings *webEngineSettingsPointer;
+
protected:
// The protected functions.
void contextMenuEvent(QContextMenuEvent *contextMenuEvent) override;
#include "ui_AddTabWidget.h"
#include "ui_TabWidget.h"
#include "databases/CookiesDatabase.h"
-#include "databases/DomainsDatabase.h"
#include "dialogs/SaveDialog.h"
#include "filters/MouseEventFilter.h"
#include "helpers/SearchEngineHelper.h"
-#include "interceptors/UrlRequestInterceptor.h"
#include "windows/BrowserWindow.h"
// KDE Framework headers.
tabWidgetUi.setupUi(this);
// Get a handle for the tab widget.
- tabWidgetPointer = tabWidgetUi.tabWidget;
+ qTabWidgetPointer = tabWidgetUi.tabWidget;
// Setup the add tab UI.
- addTabWidgetUi.setupUi(tabWidgetPointer);
+ addTabWidgetUi.setupUi(qTabWidgetPointer);
// Get handles for the add tab widgets.
QWidget *addTabWidgetPointer = addTabWidgetUi.addTabQWidget;
QPushButton *addTabButtonPointer = addTabWidgetUi.addTabButton;
// Display the add tab widget.
- tabWidgetPointer->setCornerWidget(addTabWidgetPointer);
+ qTabWidgetPointer->setCornerWidget(addTabWidgetPointer);
// Add the first tab.
addFirstTab();
// Process tab events.
- connect(tabWidgetPointer, SIGNAL(currentChanged(int)), this, SLOT(updateUiWithTabSettings()));
+ connect(qTabWidgetPointer, SIGNAL(currentChanged(int)), this, SLOT(updateUiWithTabSettings()));
connect(addTabButtonPointer, SIGNAL(clicked()), this, SLOT(addTab()));
- connect(tabWidgetPointer, SIGNAL(tabCloseRequested(int)), this, SLOT(deleteTab(int)));
+ connect(qTabWidgetPointer, SIGNAL(tabCloseRequested(int)), this, SLOT(deleteTab(int)));
// Store a copy of the WebEngine default user agent.
webEngineDefaultUserAgent = currentWebEngineProfilePointer->httpUserAgent();
TabWidget::~TabWidget()
{
// Manually delete each WebEngine page.
- for (int i = 0; i < tabWidgetPointer->count(); ++i)
+ for (int i = 0; i < qTabWidgetPointer->count(); ++i)
{
// Get the privacy WebEngine view.
- PrivacyWebEngineView *privacyWebEngineViewPointer = qobject_cast<PrivacyWebEngineView *>(tabWidgetPointer->widget(i));
+ PrivacyWebEngineView *privacyWebEngineViewPointer = qobject_cast<PrivacyWebEngineView *>(qTabWidgetPointer->widget(i));
// Deletion the WebEngine page to prevent the following error: `Release of profile requested but WebEnginePage still not deleted. Expect troubles !`
delete privacyWebEngineViewPointer->page();
// The cookie is copied instead of referenced so that changes made to the cookie do not create a race condition with the display of the cookie in the dialog.
void TabWidget::addCookieToStore(QNetworkCookie cookie, QWebEngineCookieStore *webEngineCookieStorePointer) const
{
- // Create a url.
+ // Create a URL.
QUrl url;
// Check to see if the domain does not start with a `.` because Qt makes this harder than it should be. <https://doc.qt.io/qt-5/qwebenginecookiestore.html#setCookie>
updateUiWithTabSettings();
// Set the focus on the current tab widget. This prevents the tab bar from showing a blue bar under the label of the first tab.
- tabWidgetPointer->currentWidget()->setFocus();
+ qTabWidgetPointer->currentWidget()->setFocus();
}
PrivacyWebEngineView* TabWidget::addTab(const bool removeUrlLineEditFocus, const bool backgroundTab)
PrivacyWebEngineView *privacyWebEngineViewPointer = new PrivacyWebEngineView();
// Add a new tab.
- int newTabIndex = tabWidgetPointer->addTab(privacyWebEngineViewPointer, i18nc("New tab label.", "New Tab"));
+ int newTabIndex = qTabWidgetPointer->addTab(privacyWebEngineViewPointer, i18nc("New tab label.", "New Tab"));
// Set the default tab icon.
- tabWidgetPointer->setTabIcon(newTabIndex, defaultTabIcon);
+ qTabWidgetPointer->setTabIcon(newTabIndex, defaultTabIcon);
- // Create an off-the-record profile (the default when no profile name is specified).
- QWebEngineProfile *webEngineProfilePointer = new QWebEngineProfile(QLatin1String(""));
-
- // Create a WebEngine page.
- QWebEnginePage *webEnginePagePointer = new QWebEnginePage(webEngineProfilePointer);
-
- // Set the WebEngine page.
- privacyWebEngineViewPointer->setPage(webEnginePagePointer);
+ // Get handles for the WebEngine page and profile.
+ QWebEnginePage *webEnginePagePointer = privacyWebEngineViewPointer->page();
+ QWebEngineProfile *webEngineProfilePointer = webEnginePagePointer->profile();
// Get handles for the web engine elements.
QWebEngineCookieStore *webEngineCookieStorePointer = webEngineProfilePointer->cookieStore();
emit updateBackAction(currentWebEngineHistoryPointer->canGoBack());
emit updateForwardAction(currentWebEngineHistoryPointer->canGoForward());
}
-
- // Reapply the zoom factor. This is a bug in QWebEngineView that resets the zoom with every load. It can be removed once <https://redmine.stoutner.com/issues/799> is fixed.
- privacyWebEngineViewPointer->setZoomFactor(currentZoomFactor);
});
// Update the progress bar when a load is started.
// Handle file downloads.
connect(webEngineProfilePointer, SIGNAL(downloadRequested(QWebEngineDownloadItem *)), this, SLOT(showSaveDialog(QWebEngineDownloadItem *)));
- // Instantiate the URL request interceptor.
- UrlRequestInterceptor *urlRequestInterceptorPointer = new UrlRequestInterceptor();
-
- // Set the URL request interceptor.
- webEngineProfilePointer->setUrlRequestInterceptor(urlRequestInterceptorPointer);
-
- // Reapply the domain settings when the host changes.
- connect(urlRequestInterceptorPointer, SIGNAL(applyDomainSettings(QString)), this, SLOT(applyDomainSettingsWithoutReloading(QString)));
-
// Set the local storage filter.
webEngineCookieStorePointer->setCookieFilter([privacyWebEngineViewPointer](const QWebEngineCookieStore::FilterRequest &filterRequest)
{
connect(privacyWebEngineViewPointer, &PrivacyWebEngineView::titleChanged, [this, privacyWebEngineViewPointer] (const QString &title)
{
// Get the index for this tab.
- int tabIndex = tabWidgetPointer->indexOf(privacyWebEngineViewPointer);
+ int tabIndex = qTabWidgetPointer->indexOf(privacyWebEngineViewPointer);
// Update the title for this tab.
- tabWidgetPointer->setTabText(tabIndex, title);
+ qTabWidgetPointer->setTabText(tabIndex, title);
// Update the window title if this is the current tab.
- if (tabIndex == tabWidgetPointer->currentIndex())
+ if (tabIndex == qTabWidgetPointer->currentIndex())
emit updateWindowTitle(title);
});
connect(privacyWebEngineViewPointer, &PrivacyWebEngineView::iconChanged, [privacyWebEngineViewPointer, this] (const QIcon &icon)
{
// Get the index for this tab.
- int tabIndex = tabWidgetPointer->indexOf(privacyWebEngineViewPointer);
+ int tabIndex = qTabWidgetPointer->indexOf(privacyWebEngineViewPointer);
// Update the icon for this tab.
if (icon.isNull())
- tabWidgetPointer->setTabIcon(tabIndex, defaultTabIcon);
+ qTabWidgetPointer->setTabIcon(tabIndex, defaultTabIcon);
else
- tabWidgetPointer->setTabIcon(tabIndex, icon);
+ qTabWidgetPointer->setTabIcon(tabIndex, icon);
});
// Enable spell checking.
// Populate the zoom factor. This is necessary if a URL is being loaded, like a local URL, that does not trigger `applyDomainSettings()`.
privacyWebEngineViewPointer->setZoomFactor(Settings::zoomFactor());
+ // Update the UI when domain settings are applied.
+ connect(privacyWebEngineViewPointer, SIGNAL(updateUi(const PrivacyWebEngineView*)), this, SLOT(updateUiFromWebEngineView(const PrivacyWebEngineView*)));
+
// Move to the new tab if it is not a background tab.
if (!backgroundTab)
- tabWidgetPointer->setCurrentIndex(newTabIndex);
+ qTabWidgetPointer->setCurrentIndex(newTabIndex);
// Clear the URL line edit focus so that it populates correctly when opening a new tab from the context menu.
if (removeUrlLineEditFocus)
{
// Set the tab position.
if (Settings::tabsOnTop())
- tabWidgetPointer->setTabPosition(QTabWidget::North);
+ qTabWidgetPointer->setTabPosition(QTabWidget::North);
else
- tabWidgetPointer->setTabPosition(QTabWidget::South);
+ qTabWidgetPointer->setTabPosition(QTabWidget::South);
// Set the search engine URL.
searchEngineUrl = SearchEngineHelper::getSearchUrl(Settings::searchEngine());
emit updateSearchEngineActions(Settings::searchEngine(), true);
}
-// This exists as a separate function from `applyDomainSettings()` so it can be listed as a slot and function without the need for a boolean argument.
-// Once <https://redmine.stoutner.com/issues/799> has been resolved this can be `const`.
void TabWidget::applyDomainSettingsAndReload()
{
// Apply the domain settings. `true` reloads the website.
- applyDomainSettings(currentPrivacyWebEngineViewPointer->url().host(), true);
-}
-
-// This exists as a separate function from `applyDomainSettings()` so it can be listed as a slot and function without the need for a boolean argument.
-// Once <https://redmine.stoutner.com/issues/799> has been resolved this can be `const`.
-void TabWidget::applyDomainSettingsWithoutReloading(const QString &hostname)
-{
- // Apply the domain settings `false` does not reload the website.
- applyDomainSettings(hostname, false);
-}
-
-// Once <https://redmine.stoutner.com/issues/799> has been resolved this can be `const`.
-void TabWidget::applyDomainSettings(const QString &hostname, const bool reloadWebsite)
-{
- // Get the record for the hostname.
- QSqlQuery domainQuery = DomainsDatabase::getDomainQuery(hostname);
-
- // Check if the hostname has domain settings.
- if (domainQuery.isValid()) // The hostname has domain settings.
- {
- // Get the domain record.
- QSqlRecord domainRecord = domainQuery.record();
-
- // Store the domain settings name.
- currentPrivacyWebEngineViewPointer->domainSettingsName = domainRecord.field(DomainsDatabase::DOMAIN_NAME).value().toString();
-
- // Set the JavaScript status.
- switch (domainRecord.field(DomainsDatabase::JAVASCRIPT).value().toInt())
- {
- // Set the default JavaScript status.
- case (DomainsDatabase::SYSTEM_DEFAULT):
- {
- currentWebEngineSettingsPointer->setAttribute(QWebEngineSettings::JavascriptEnabled, Settings::javaScriptEnabled());
-
- break;
- }
-
- // Disable JavaScript.
- case (DomainsDatabase::DISABLED):
- {
- currentWebEngineSettingsPointer->setAttribute(QWebEngineSettings::JavascriptEnabled, false);
-
- break;
- }
-
- // Enable JavaScript.
- case (DomainsDatabase::ENABLED):
- {
- currentWebEngineSettingsPointer->setAttribute(QWebEngineSettings::JavascriptEnabled, true);
-
- break;
- }
- }
-
- // Set the local storage status.
- switch (domainRecord.field(DomainsDatabase::LOCAL_STORAGE).value().toInt())
- {
- // Set the default local storage status.
- case (DomainsDatabase::SYSTEM_DEFAULT):
- {
- currentPrivacyWebEngineViewPointer->localStorageEnabled = Settings::localStorageEnabled();
-
- break;
- }
-
- // Disable local storage.
- case (DomainsDatabase::DISABLED):
- {
- currentPrivacyWebEngineViewPointer->localStorageEnabled = false;
-
- break;
- }
-
- // Enable local storage.
- case (DomainsDatabase::ENABLED):
- {
- currentPrivacyWebEngineViewPointer->localStorageEnabled = true;
-
- break;
- }
- }
-
- // Set the DOM storage status.
- switch (domainRecord.field(DomainsDatabase::DOM_STORAGE).value().toInt())
- {
- // Set the default DOM storage status. QWebEngineSettings confusingly calls this local storage.
- case (DomainsDatabase::SYSTEM_DEFAULT):
- {
- currentWebEngineSettingsPointer->setAttribute(QWebEngineSettings::LocalStorageEnabled, Settings::domStorageEnabled());
-
- break;
- }
-
- // Disable DOM storage. QWebEngineSettings confusingly calls this local storage.
- case (DomainsDatabase::DISABLED):
- {
- currentWebEngineSettingsPointer->setAttribute(QWebEngineSettings::LocalStorageEnabled, false);
-
- break;
- }
-
- // Enable DOM storage. QWebEngineSettings confusingly calls this local storage.
- case (DomainsDatabase::ENABLED):
- {
- currentWebEngineSettingsPointer->setAttribute(QWebEngineSettings::LocalStorageEnabled, true);
-
- break;
- }
- }
-
- // Set the user agent.
- currentWebEngineProfilePointer->setHttpUserAgent(UserAgentHelper::getResultingDomainSettingsUserAgent(domainRecord.field(DomainsDatabase::USER_AGENT).value().toString()));
-
- // Check if a custom zoom factor is set.
- if (domainRecord.field(DomainsDatabase::ZOOM_FACTOR).value().toInt())
- {
- // Store the current zoom factor.
- currentZoomFactor = domainRecord.field(DomainsDatabase::CUSTOM_ZOOM_FACTOR).value().toDouble();
- }
- else
- {
- // Reset the current zoom factor.
- currentZoomFactor = Settings::zoomFactor();
- }
-
- // Set the zoom factor. The use of `currentZoomFactor` can be removed once <https://redmine.stoutner.com/issues/799> has been resolved.
- currentPrivacyWebEngineViewPointer->setZoomFactor(currentZoomFactor);
- }
- else // The hostname does not have domain settings.
- {
- // Reset the domain settings name.
- currentPrivacyWebEngineViewPointer->domainSettingsName = QLatin1String("");
-
- // Set the JavaScript status.
- currentWebEngineSettingsPointer->setAttribute(QWebEngineSettings::JavascriptEnabled, Settings::javaScriptEnabled());
-
- // Set the local storage status.
- currentPrivacyWebEngineViewPointer->localStorageEnabled = Settings::localStorageEnabled();
-
- // Set DOM storage. In QWebEngineSettings it is called Local Storage.
- currentWebEngineSettingsPointer->setAttribute(QWebEngineSettings::LocalStorageEnabled, Settings::domStorageEnabled());
-
- // Set the user agent.
- currentWebEngineProfilePointer->setHttpUserAgent(UserAgentHelper::getUserAgentFromDatabaseName(Settings::userAgent()));
-
- // Store the current zoom factor. This can be removed once <https://redmine.stoutner.com/issues/799> has been resolved.
- currentZoomFactor = Settings::zoomFactor();
-
- // Set the zoom factor.
- currentPrivacyWebEngineViewPointer->setZoomFactor(Settings::zoomFactor());
- }
-
- // Update the UI.
- emit updateDomainSettingsIndicator(currentPrivacyWebEngineViewPointer->domainSettingsName != QLatin1String(""));
- emit updateJavaScriptAction(currentWebEngineSettingsPointer->testAttribute(QWebEngineSettings::JavascriptEnabled));
- emit updateLocalStorageAction(currentPrivacyWebEngineViewPointer->localStorageEnabled);
- emit updateDomStorageAction(currentWebEngineSettingsPointer->testAttribute(QWebEngineSettings::LocalStorageEnabled));
- emit updateUserAgentActions(currentWebEngineProfilePointer->httpUserAgent(), true);
- emit updateZoomFactorAction(currentPrivacyWebEngineViewPointer->zoomFactor());
-
- // Reload the website if requested.
- if (reloadWebsite)
- currentPrivacyWebEngineViewPointer->reload();
+ currentPrivacyWebEngineViewPointer->applyDomainSettings(currentPrivacyWebEngineViewPointer->url().host(), true);
}
void TabWidget::applyOnTheFlySearchEngine(QAction *searchEngineActionPointer)
currentPrivacyWebEngineViewPointer->reload();
}
-// This can be const once <https://redmine.stoutner.com/issues/799> has been resolved.
-void TabWidget::applyOnTheFlyZoomFactor(const double &zoomFactor)
+void TabWidget::applyOnTheFlyZoomFactor(const double &zoomFactor) const
{
- // Update the current zoom factor. This can be removed once <https://redmine.stoutner.com/issues/799> has been resolved.
- currentZoomFactor = zoomFactor;
-
// Set the zoom factor.
currentPrivacyWebEngineViewPointer->setZoomFactor(zoomFactor);
}
void TabWidget::applySpellCheckLanguages() const
{
// Get the number of tab.
- int numberOfTabs = tabWidgetPointer->count();
+ int numberOfTabs = qTabWidgetPointer->count();
// Set the spell check languages for each tab.
for (int i = 0; i < numberOfTabs; ++i)
{
// Get the WebEngine view pointer.
- PrivacyWebEngineView *webEngineViewPointer = qobject_cast<PrivacyWebEngineView *>(tabWidgetPointer->currentWidget());
+ PrivacyWebEngineView *webEngineViewPointer = qobject_cast<PrivacyWebEngineView *>(qTabWidgetPointer->currentWidget());
// Get the WebEngine page pointer.
QWebEnginePage *webEnginePagePointer = webEngineViewPointer->page();
void TabWidget::deleteTab(const int tabIndex)
{
// Get the privacy WebEngine view.
- PrivacyWebEngineView *privacyWebEngineViewPointer = qobject_cast<PrivacyWebEngineView *>(tabWidgetPointer->widget(tabIndex));
+ PrivacyWebEngineView *privacyWebEngineViewPointer = qobject_cast<PrivacyWebEngineView *>(qTabWidgetPointer->widget(tabIndex));
- // Proccess the tab delete according to the number of tabs.
- if (tabWidgetPointer->count() > 1) // There is more than one tab.
+ // Process the tab delete according to the number of tabs.
+ if (qTabWidgetPointer->count() > 1) // There is more than one tab.
{
// Delete the tab.
- tabWidgetPointer->removeTab(tabIndex);
+ qTabWidgetPointer->removeTab(tabIndex);
// Delete the WebEngine page to prevent the following error: `Release of profile requested but WebEnginePage still not deleted. Expect troubles !`
delete privacyWebEngineViewPointer->page();
void TabWidget::setTabBarVisible(const bool visible) const
{
// Set the tab bar visibility.
- tabWidgetPointer->tabBar()->setVisible(visible);
+ qTabWidgetPointer->tabBar()->setVisible(visible);
}
void TabWidget::showSaveDialog(QWebEngineDownloadItem *webEngineDownloadItemPointer)
currentPrivacyWebEngineViewPointer->reload();
}
+void TabWidget::updateUiFromWebEngineView(const PrivacyWebEngineView *privacyWebEngineViewPointer) const
+{
+ // Only update the UI if the signal was emitted from the current privacy WebEngine.
+ if (privacyWebEngineViewPointer == currentPrivacyWebEngineViewPointer)
+ {
+ // Update the UI.
+ emit updateDomainSettingsIndicator(currentPrivacyWebEngineViewPointer->domainSettingsName != QLatin1String(""));
+ emit updateJavaScriptAction(currentWebEngineSettingsPointer->testAttribute(QWebEngineSettings::JavascriptEnabled));
+ emit updateLocalStorageAction(currentPrivacyWebEngineViewPointer->localStorageEnabled);
+ emit updateDomStorageAction(currentWebEngineSettingsPointer->testAttribute(QWebEngineSettings::LocalStorageEnabled));
+ emit updateUserAgentActions(currentWebEngineProfilePointer->httpUserAgent(), true);
+ emit updateZoomFactorAction(currentPrivacyWebEngineViewPointer->zoomFactor());
+ }
+}
+
void TabWidget::updateUiWithTabSettings()
{
// Update the current WebEngine pointers.
- currentPrivacyWebEngineViewPointer = qobject_cast<PrivacyWebEngineView *>(tabWidgetPointer->currentWidget());
+ currentPrivacyWebEngineViewPointer = qobject_cast<PrivacyWebEngineView *>(qTabWidgetPointer->currentWidget());
currentWebEngineSettingsPointer = currentPrivacyWebEngineViewPointer->settings();
currentWebEnginePagePointer = currentPrivacyWebEngineViewPointer->page();
currentWebEngineProfilePointer = currentWebEnginePagePointer->profile();
~TabWidget();
// The public functions.
- void applyOnTheFlyZoomFactor(const double &zoomFactor);
+ void applyOnTheFlyZoomFactor(const double &zoomFactor) const;
void applySpellCheckLanguages() const;
PrivacyWebEngineView* loadBlankInitialWebsite();
void loadInitialWebsite();
PrivacyWebEngineView* addTab(const bool removeUrlLineEditFocus=false, const bool backgroundTab=false);
void applyApplicationSettings();
void applyDomainSettingsAndReload();
- void applyDomainSettingsWithoutReloading(const QString &hostname);
void applyOnTheFlySearchEngine(QAction *searchEngineActionPointer);
void applyOnTheFlyUserAgent(QAction *userAgentActionPointer) const;
void back() const;
void pageLinkHovered(const QString &linkUrl) const;
void printWebpage(QPrinter *printerPointer) const;
void showSaveDialog(QWebEngineDownloadItem *downloadItemPointer);
+ void updateUiFromWebEngineView(const PrivacyWebEngineView *privacyWebEngineViewPointer) const;
void updateUiWithTabSettings();
void useNativeDownloader(QUrl &downloadUrl, QString &suggestedFileName);
private:
// The private variables.
- double currentZoomFactor; // This can be removed once <https://redmine.stoutner.com/issues/799> has been resolved.
PrivacyWebEngineView *currentPrivacyWebEngineViewPointer;
QWebEngineCookieStore *currentWebEngineCookieStorePointer;
QWebEngineHistory *currentWebEngineHistoryPointer;
QWebEngineSettings *currentWebEngineSettingsPointer;
QIcon defaultTabIcon = QIcon::fromTheme(QStringLiteral("globe"));
QString searchEngineUrl;
- QTabWidget *tabWidgetPointer;
+ QTabWidget *qTabWidgetPointer;
UserAgentHelper *userAgentHelperPointer;
bool wipingCurrentFindTextSelection = false;
-
- // The private functions.
- void applyDomainSettings(const QString &hostname, const bool reloadWebsite);
};
#endif