]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/commitdiff
Add local storage domain settings.
authorSoren Stoutner <soren@stoutner.com>
Thu, 19 May 2022 20:14:04 +0000 (13:14 -0700)
committerSoren Stoutner <soren@stoutner.com>
Thu, 19 May 2022 20:14:04 +0000 (13:14 -0700)
18 files changed:
src/dialogs/DomainSettingsDialog.cpp
src/dialogs/DomainSettingsDialog.h
src/helpers/DomainsDatabaseHelper.cpp
src/helpers/DomainsDatabaseHelper.h
src/icons/cookies-off.svg [deleted file]
src/icons/cookies-on.svg [deleted file]
src/resources.qrc
src/settings/Settings.kcfg
src/structs/PrivacyWebEngine.cpp
src/structs/PrivacyWebEngine.h
src/ui.rcs/browser_ui.rc
src/uis/DomainSettingsDialog.ui
src/uis/SettingsGeneral.ui
src/uis/SettingsPrivacy.ui
src/views/BrowserView.cpp
src/views/BrowserView.h
src/windows/BrowserWindow.cpp
src/windows/BrowserWindow.h

index eb43fb560ec7431b94dd1e1bbbf2721af5a604d0..151a0b4926be9930962306e38fc1beeebfcd3e52 100644 (file)
@@ -55,6 +55,8 @@ DomainSettingsDialog::DomainSettingsDialog(const int &startType, const QString &
     domainNameLineEditPointer = domainSettingsDialogUi.domainNameLineEdit;
     javaScriptComboBoxPointer = domainSettingsDialogUi.javaScriptComboBox;
     javaScriptLabelPointer = domainSettingsDialogUi.javaScriptLabel;
+    localStorageComboBoxPointer = domainSettingsDialogUi.localStorageComboBox;
+    localStorageLabelPointer = domainSettingsDialogUi.localStorageLabel;
     domStorageComboBoxPointer = domainSettingsDialogUi.domStorageComboBox;
     domStorageLabelPointer = domainSettingsDialogUi.domStorageLabel;
     userAgentComboBoxPointer = domainSettingsDialogUi.userAgentComboBox;
@@ -85,6 +87,9 @@ DomainSettingsDialog::DomainSettingsDialog(const int &startType, const QString &
     // Set the visible column to be the domain name.
     domainsListViewPointer->setModelColumn(1);
 
+    // Get the domains selection model pointer.
+    domainsSelectionModelPointer = domainsListViewPointer->selectionModel();
+
     // Disable editing of the list view.
     domainsListViewPointer->setEditTriggers(QAbstractItemView::NoEditTriggers);
 
@@ -100,7 +105,7 @@ DomainSettingsDialog::DomainSettingsDialog(const int &startType, const QString &
             domainsListViewPointer->setCurrentIndex(domainsTableModelPointer->index(0, domainsTableModelPointer->fieldIndex(DomainsDatabaseHelper::DOMAIN_NAME)));
 
             // Populate the domain settings.
-            domainSelected(domainsListViewPointer->selectionModel()->currentIndex());
+            domainSelected(domainsSelectionModelPointer->currentIndex());
 
             break;
         }
@@ -123,7 +128,9 @@ DomainSettingsDialog::DomainSettingsDialog(const int &startType, const QString &
             domainsListViewPointer->setCurrentIndex(newDomainIndex[0]);
 
             // Populate the domain settings.
-            domainSelected(domainsListViewPointer->selectionModel()->currentIndex());
+            domainSelected(domainsSelectionModelPointer->currentIndex());
+
+            break;
         }
     }
 
@@ -133,6 +140,7 @@ DomainSettingsDialog::DomainSettingsDialog(const int &startType, const QString &
     // Process changes to the domain settings.
     connect(domainNameLineEditPointer, SIGNAL(textEdited(QString)), this, SLOT(domainNameChanged(QString)));
     connect(javaScriptComboBoxPointer, SIGNAL(currentIndexChanged(int)), this, SLOT(javaScriptChanged(int)));
+    connect(localStorageComboBoxPointer, SIGNAL(currentIndexChanged(int)), this, SLOT(localStorageChanged(int)));
     connect(domStorageComboBoxPointer, SIGNAL(currentIndexChanged(int)), this, SLOT(domStorageChanged(int)));
     connect(userAgentComboBoxPointer, SIGNAL(currentTextChanged(QString)), this, SLOT(userAgentChanged(QString)));
     connect(zoomFactorComboBoxPointer, SIGNAL(currentIndexChanged(int)), this, SLOT(zoomFactorComboBoxChanged(int)));
@@ -177,13 +185,12 @@ void DomainSettingsDialog::addDomain(const QString &domainName) const
     domainsListViewPointer->setCurrentIndex(newDomainIndex[newDomainIndex.size() - 1]);
 
     // Populate the domain settings.
-    domainSelected(domainsListViewPointer->selectionModel()->currentIndex());
+    domainSelected(domainsSelectionModelPointer->currentIndex());
 
     // Update the UI.
     updateUi();
 }
 
-
 void DomainSettingsDialog::apply() const
 {
     // Get the current index.
@@ -221,8 +228,19 @@ void DomainSettingsDialog::cancel()
 void DomainSettingsDialog::customZoomFactorChanged(const double &newValue) const
 {
     // Update the domains table model.
-    domainsTableModelPointer->setData(domainsListViewPointer->selectionModel()->currentIndex().siblingAtColumn(domainsTableModelPointer->fieldIndex(DomainsDatabaseHelper::CUSTOM_ZOOM_FACTOR)),
-                                      newValue);
+    domainsTableModelPointer->setData(domainsSelectionModelPointer->currentIndex().siblingAtColumn(domainsTableModelPointer->fieldIndex(DomainsDatabaseHelper::CUSTOM_ZOOM_FACTOR)), newValue);
+
+    // Update the UI.
+    updateUi();
+}
+
+void DomainSettingsDialog::domStorageChanged(const int &newIndex) const
+{
+    // Update the domains table model.
+    domainsTableModelPointer->setData(domainsSelectionModelPointer->currentIndex().siblingAtColumn(domainsTableModelPointer->fieldIndex(DomainsDatabaseHelper::DOM_STORAGE)), newIndex);
+
+    // Populate the DOM storage label.
+    populateDomStorageLabel();
 
     // Update the UI.
     updateUi();
@@ -231,7 +249,7 @@ void DomainSettingsDialog::customZoomFactorChanged(const double &newValue) const
 void DomainSettingsDialog::domainNameChanged(const QString &updatedDomainName) const
 {
     // Update the domains table model.
-    domainsTableModelPointer->setData(domainsListViewPointer->selectionModel()->currentIndex(), updatedDomainName);
+    domainsTableModelPointer->setData(domainsSelectionModelPointer->currentIndex(), updatedDomainName);
 
     // Update the UI.
     updateUi();
@@ -245,6 +263,9 @@ void DomainSettingsDialog::domainSelected(const QModelIndex &modelIndex) const
     // Populate the JavaScript combo box.
     javaScriptComboBoxPointer->setCurrentIndex(modelIndex.siblingAtColumn(domainsTableModelPointer->fieldIndex(DomainsDatabaseHelper::JAVASCRIPT)).data().toInt());
 
+    // Populate the local storage combo box.
+    localStorageComboBoxPointer->setCurrentIndex(modelIndex.siblingAtColumn(domainsTableModelPointer->fieldIndex(DomainsDatabaseHelper::LOCAL_STORAGE)).data().toInt());
+
     // Populate the DOM storage combo box.
     domStorageComboBoxPointer->setCurrentIndex(modelIndex.siblingAtColumn(domainsTableModelPointer->fieldIndex(DomainsDatabaseHelper::DOM_STORAGE)).data().toInt());
 
@@ -283,6 +304,7 @@ void DomainSettingsDialog::domainSelected(const QModelIndex &modelIndex) const
 
     // Populate the labels.
     populateJavaScriptLabel();
+    populateLocalStorageLabel();
     populateDomStorageLabel();
     populateUserAgentLabel(userAgentComboBoxPointer->currentText());
 
@@ -293,8 +315,7 @@ void DomainSettingsDialog::domainSelected(const QModelIndex &modelIndex) const
 void DomainSettingsDialog::javaScriptChanged(const int &newIndex) const
 {
     // Update the domains table model.
-    domainsTableModelPointer->setData(domainsListViewPointer->selectionModel()->currentIndex().siblingAtColumn(domainsTableModelPointer->fieldIndex(DomainsDatabaseHelper::JAVASCRIPT)),
-                                      newIndex);
+    domainsTableModelPointer->setData(domainsSelectionModelPointer->currentIndex().siblingAtColumn(domainsTableModelPointer->fieldIndex(DomainsDatabaseHelper::JAVASCRIPT)), newIndex);
 
     // Populate the JavaScript label.
     populateJavaScriptLabel();
@@ -303,14 +324,13 @@ void DomainSettingsDialog::javaScriptChanged(const int &newIndex) const
     updateUi();
 }
 
-void DomainSettingsDialog::domStorageChanged(const int &newIndex) const
+void DomainSettingsDialog::localStorageChanged(const int &newIndex) const
 {
     // Update the domains table model.
-    domainsTableModelPointer->setData(domainsListViewPointer->selectionModel()->currentIndex().siblingAtColumn(domainsTableModelPointer->fieldIndex(DomainsDatabaseHelper::DOM_STORAGE)),
-                                      newIndex);
+    domainsTableModelPointer->setData(domainsSelectionModelPointer->currentIndex().siblingAtColumn(domainsTableModelPointer->fieldIndex(DomainsDatabaseHelper::LOCAL_STORAGE)), newIndex);
 
-    // Populate the DOM storage label.
-    populateDomStorageLabel();
+    // Poplate the local storage label.
+    populateLocalStorageLabel();
 
     // Update the UI.
     updateUi();
@@ -328,74 +348,109 @@ void DomainSettingsDialog::ok()
     accept();
 }
 
+void DomainSettingsDialog::populateDomStorageLabel() const
+{
+    // Populate the label according to the currently selected index.
+    switch (domStorageComboBoxPointer->currentIndex())
+    {
+        // Set the text according to the system default.
+        case (DomainsDatabaseHelper::SYSTEM_DEFAULT):
+        {
+            if (Settings::domStorageEnabled())
+                domStorageLabelPointer->setText(i18nc("Domain settings DOM storage label.", "DOM storage enabled"));
+            else
+                domStorageLabelPointer->setText(i18nc("Domain settings DOM storage label.", "DOM storage disabled"));
+
+            break;
+        }
+
+        // Set the disabled text in bold.
+        case (DomainsDatabaseHelper::DISABLED):
+        {
+            domStorageLabelPointer->setText(i18nc("Domain settings DOM storage label.  The <b> tags should be retained.", "<b>DOM storage disabled</b>"));
+
+            break;
+        }
+
+        // Set the enabled text in bold.
+        case (DomainsDatabaseHelper::ENABLED):
+        {
+            domStorageLabelPointer->setText(i18nc("Domain settings DOM storage label.  The <b> tags should be retained.", "<b>DOM storage enabled</b>"));
+
+            break;
+        }
+    }
+}
+
 void DomainSettingsDialog::populateJavaScriptLabel() const
 {
     // Populate the label according to the currently selected index.
     switch (javaScriptComboBoxPointer->currentIndex())
     {
+        // Set the text according to the system default.
         case (DomainsDatabaseHelper::SYSTEM_DEFAULT):
         {
-            // Set the text according to the system default.
             if (Settings::javaScriptEnabled())
-                javaScriptLabelPointer->setText(i18nc("Domains settings label", "JavaScript enabled"));
+                javaScriptLabelPointer->setText(i18nc("Domain settings JavaScript label.", "JavaScript enabled"));
             else
-                javaScriptLabelPointer->setText(i18nc("Domain settings label", "JavaScript disabled"));
+                javaScriptLabelPointer->setText(i18nc("Domain settings JavaScript label.", "JavaScript disabled"));
 
             break;
         }
 
+        // Set the disabled text in bold.
         case (DomainsDatabaseHelper::DISABLED):
         {
-            // Set the label text in bold.
-            javaScriptLabelPointer->setText(i18nc("Domain settings label.  The <b> tags should be retained.", "<b>JavaScript disabled</b>"));
+            javaScriptLabelPointer->setText(i18nc("Domain settings JavaScript label.  The <b> tags should be retained.", "<b>JavaScript disabled</b>"));
 
             break;
         }
 
+        // Set the enabled text in bold.
         case (DomainsDatabaseHelper::ENABLED):
         {
-            // Set the label text in bold.
-            javaScriptLabelPointer->setText(i18nc("Domains settings label.  The <b> tags should be retained.", "<b>JavaScript enabled</b>"));
+            javaScriptLabelPointer->setText(i18nc("Domain settings JavaScript label.  The <b> tags should be retained.", "<b>JavaScript enabled</b>"));
 
             break;
         }
     }
 }
 
-void DomainSettingsDialog::populateDomStorageLabel() const
+void DomainSettingsDialog::populateLocalStorageLabel() const
 {
     // Populate the label according to the currently selected index.
-    switch (domStorageComboBoxPointer->currentIndex())
+    switch (localStorageComboBoxPointer->currentIndex())
     {
+        // Set the text according to the system default.
         case (DomainsDatabaseHelper::SYSTEM_DEFAULT):
         {
-            // Set the text according to the system default.
-            if (Settings::domStorageEnabled())
-                domStorageLabelPointer->setText(i18nc("DOM storage label", "DOM storage enabled"));
+            if (Settings::localStorageEnabled())
+                localStorageLabelPointer->setText(i18nc("Domain settings local storage label.", "Local storage enabled"));
             else
-                domStorageLabelPointer->setText(i18nc("DOM storage label", "DOM storage disabled"));
+                localStorageLabelPointer->setText(i18nc("Domain settings local storage label.", "Local storage disabled"));
 
             break;
         }
 
+        // Set the disabled text in bold.
         case (DomainsDatabaseHelper::DISABLED):
         {
-            // Set the label text in bold.
-            domStorageLabelPointer->setText(i18nc("DOM storage label.  The <b> tags should be retained.", "<b>DOM storage disabled</b>"));
+            localStorageLabelPointer->setText(i18nc("Domain settings local storage label.  The <b> tags should be retained.", "<b>Local storage disabled</b>"));
 
             break;
         }
 
+        // Set the enabled text in bold.
         case (DomainsDatabaseHelper::ENABLED):
         {
-            // Set the label text in bold.
-            domStorageLabelPointer->setText(i18nc("DOM storage label.  The <b> tags should be retained.", "<b>DOM storage enabled</b>"));
+            localStorageLabelPointer->setText(i18nc("Domain settings local storage label.  The <b> tabs should be retained.", "<b>Local storage enabled</b>"));
 
             break;
         }
     }
 }
 
+
 void DomainSettingsDialog::populateUserAgentLabel(const QString &userAgentName) const
 {
     // Populate the label according to the type.
@@ -472,7 +527,7 @@ void DomainSettingsDialog::showDeleteMessageBox() const
         QModelIndex currentIndex = domainsListViewPointer->currentIndex();
 
         // Delete the current row.
-        domainsTableModelPointer->removeRow(domainsListViewPointer->selectionModel()->currentIndex().row());
+        domainsTableModelPointer->removeRow(domainsSelectionModelPointer->currentIndex().row());
 
         // Submit all pending changes.
         domainsTableModelPointer->submitAll();
@@ -504,7 +559,7 @@ void DomainSettingsDialog::showDeleteMessageBox() const
 void DomainSettingsDialog::updateUi() const
 {
     // Update the delete button status.
-    deleteDomainButtonPointer->setEnabled(domainsListViewPointer->selectionModel()->hasSelection());
+    deleteDomainButtonPointer->setEnabled(domainsSelectionModelPointer->hasSelection());
 
     // Update the apply button status.
     applyButtonPointer->setEnabled(domainsTableModelPointer->isDirty());
@@ -519,7 +574,7 @@ void DomainSettingsDialog::updateUi() const
 void DomainSettingsDialog::userAgentChanged(const QString &updatedUserAgent) const
 {
     // Update the domains table model.
-    domainsTableModelPointer->setData(domainsListViewPointer->selectionModel()->currentIndex().siblingAtColumn(domainsTableModelPointer->fieldIndex(DomainsDatabaseHelper::USER_AGENT)),
+    domainsTableModelPointer->setData(domainsSelectionModelPointer->currentIndex().siblingAtColumn(domainsTableModelPointer->fieldIndex(DomainsDatabaseHelper::USER_AGENT)),
                                       UserAgentHelper::getDatabaseUserAgentNameFromTranslatedName(updatedUserAgent));
 
     // Populate the user agent label.
@@ -532,7 +587,7 @@ void DomainSettingsDialog::userAgentChanged(const QString &updatedUserAgent) con
 void DomainSettingsDialog::zoomFactorComboBoxChanged(const int &newIndex) const
 {
     // Get the current model index.
-    QModelIndex modelIndex = domainsListViewPointer->selectionModel()->currentIndex();
+    QModelIndex modelIndex = domainsSelectionModelPointer->currentIndex();
 
     // Update the domains table model.
     domainsTableModelPointer->setData(modelIndex.siblingAtColumn(domainsTableModelPointer->fieldIndex(DomainsDatabaseHelper::ZOOM_FACTOR)), newIndex);
index a96c0d0df8b3496352ae80abdff138c4e52539d4..fb4590211a99fd6bdddf7ce1f068fa3a26f304a4 100644 (file)
@@ -55,6 +55,7 @@ private Q_SLOTS:
     void domainNameChanged(const QString &updatedDomainName) const;
     void domainSelected(const QModelIndex &modelIndex) const;
     void javaScriptChanged(const int &newIndex) const;
+    void localStorageChanged(const int &newIndex) const;
     void ok();
     void reset() const;
     void showAddMessageBox();
@@ -69,12 +70,15 @@ private:
     QPushButton *deleteDomainButtonPointer;
     QComboBox *domStorageComboBoxPointer;
     QLabel *domStorageLabelPointer;
-    QListView *domainsListViewPointer;
     KLineEdit *domainNameLineEditPointer;
     QWidget *domainSettingsWidgetPointer;
+    QListView *domainsListViewPointer;
     QSqlTableModel *domainsTableModelPointer;
+    QItemSelectionModel *domainsSelectionModelPointer;
     QComboBox *javaScriptComboBoxPointer;
     QLabel *javaScriptLabelPointer;
+    QComboBox *localStorageComboBoxPointer;
+    QLabel *localStorageLabelPointer;
     QPushButton *resetButtonPointer;
     QComboBox *userAgentComboBoxPointer;
     QLabel *userAgentLabelPointer;
@@ -82,8 +86,9 @@ private:
 
     // The private functions.
     void addDomain(const QString &domainName) const;
-    void populateJavaScriptLabel() const;
     void populateDomStorageLabel() const;
+    void populateJavaScriptLabel() const;
+    void populateLocalStorageLabel() const;
     void populateUserAgentLabel(const QString &userAgentName) const;
     void updateUi() const;
 };
index 2d63bd9c785c956abcc688e18b6ddbc27878fa2f..d1f8b22f8f5d30089f18fab42388ac6e573af211 100644 (file)
@@ -26,12 +26,13 @@ const QString DomainsDatabaseHelper::CONNECTION_NAME = "domains_database";
 const QString DomainsDatabaseHelper::DOMAINS_TABLE = "domains";
 
 // Define the private static schema constants.
-const int DomainsDatabaseHelper::SCHEMA_VERSION = 4;
+const int DomainsDatabaseHelper::SCHEMA_VERSION = 5;
 
 // Define the public static database field names.
 const QString DomainsDatabaseHelper::_ID = "_id";
 const QString DomainsDatabaseHelper::DOMAIN_NAME = "domain_name";
 const QString DomainsDatabaseHelper::JAVASCRIPT = "javascript";
+const QString DomainsDatabaseHelper::LOCAL_STORAGE = "local_storage";
 const QString DomainsDatabaseHelper::DOM_STORAGE = "dom_storage";
 const QString DomainsDatabaseHelper::USER_AGENT = "user_agent";
 const QString DomainsDatabaseHelper::ZOOM_FACTOR = "zoom_factor";
@@ -102,8 +103,22 @@ void DomainsDatabaseHelper::addDatabase()
 
                     // Upgrade from schema version 3 to schema version 4.
                     case 3:
+                    {
                         // Add the DOM Storage column.
                         domainsDatabase.exec("ALTER TABLE " + DOMAINS_TABLE + " ADD COLUMN " + DOM_STORAGE + " INTEGER DEFAULT 0");
+
+                        // Fallthrough to the next case.
+                        [[fallthrough]];
+                    }
+
+                    case 4:
+                    {
+                        // Add the Local Storage column.
+                        domainsDatabase.exec("ALTER TABLE " + DOMAINS_TABLE + " ADD COLUMN " + LOCAL_STORAGE + " INTEGER DEFAULT 0");
+
+                        // Fallthrough to the next case.
+                        // [[fallthrough]];
+                    }
                 }
 
                 // Update the schema version.
@@ -120,6 +135,7 @@ void DomainsDatabaseHelper::addDatabase()
                 _ID + " INTEGER PRIMARY KEY, " +
                 DOMAIN_NAME + " TEXT, " +
                 JAVASCRIPT + " INTEGER DEFAULT 0, " +
+                LOCAL_STORAGE + " INTEGER DEFAULT 0, " +
                 DOM_STORAGE + " INTEGER DEFAULT 0, " +
                 USER_AGENT + " TEXT DEFAULT '" + UserAgentHelper::SYSTEM_DEFAULT_DATABASE + "', " +
                 ZOOM_FACTOR + " INTEGER DEFAULT 0, " +
index 9ab0f92698758257d7a5ccbfaaa9b875e76ee052..50058dba256860b471b5de5484a0313418370c33 100644 (file)
@@ -47,6 +47,7 @@ public:
     static const QString DOMAIN_NAME;
     static const QString DOMAINS_TABLE;
     static const QString JAVASCRIPT;
+    static const QString LOCAL_STORAGE;
     static const QString USER_AGENT;
     static const QString ZOOM_FACTOR;
 
diff --git a/src/icons/cookies-off.svg b/src/icons/cookies-off.svg
deleted file mode 100644 (file)
index 7f84085..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<svg
-   viewBox="0 0 256 256"
-   version="1.1"
-   id="svg8"
-   sodipodi:docname="cookies-off.svg"
-   inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
-   width="256"
-   height="256"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:svg="http://www.w3.org/2000/svg">
-  <sodipodi:namedview
-     id="namedview10"
-     pagecolor="#ffffff"
-     bordercolor="#666666"
-     borderopacity="1.0"
-     inkscape:pageshadow="2"
-     inkscape:pageopacity="0.0"
-     inkscape:pagecheckerboard="0"
-     showgrid="false"
-     inkscape:zoom="6.3203125"
-     inkscape:cx="65.89864"
-     inkscape:cy="135.19901"
-     inkscape:window-width="3644"
-     inkscape:window-height="2015"
-     inkscape:window-x="0"
-     inkscape:window-y="0"
-     inkscape:window-maximized="1"
-     inkscape:current-layer="svg8"
-     fit-margin-top="0"
-     fit-margin-left="0"
-     fit-margin-right="0"
-     fit-margin-bottom="0" />
-  <defs
-     id="defs3051">
-    <style
-       type="text/css"
-       id="current-color-scheme">
-      .ColorScheme-Text {
-        color:#232629;
-      }
-      .ColorScheme-PositiveText {
-        color:#27ae60;
-      }
-      </style>
-  </defs>
-  <path
-     style="fill:currentColor;fill-opacity:1;stroke:none;stroke-width:15.9983"
-     d="M 128,8.0125 A 95.990005,95.990005 0 0 0 56.757416,40.00916 H 16.011659 c -8.863077,0 -15.998334,7.13526 -15.998334,15.99834 v 95.99 c 0,8.86307 7.135257,15.99833 15.998334,15.99833 h 40.589524 a 95.990005,95.990005 0 0 0 71.336327,31.99667 c -8.83345,0.0342 -15.93584,7.15657 -15.93584,15.99833 0,0.44796 0.20198,0.8332 0.24997,1.28115 -25.9493,3.69558 -48.307471,14.71719 -48.307471,14.71719 V 247.9875 H 191.93084 v -15.99833 c 0,0 -22.29418,-11.02161 -48.30747,-14.71722 0.032,-0.44795 0.24997,-0.83319 0.24997,-1.28115 0,-8.82044 -7.06953,-15.93016 -15.87334,-15.9983 a 95.990005,95.990005 0 0 0 71.24257,-31.99667 h 40.74576 c 8.86308,0 15.99834,-7.13526 15.99834,-15.99833 v -95.99 c 0,-8.86308 -7.13526,-15.99834 -15.99834,-15.99834 H 199.39882 A 95.990005,95.990005 0 0 0 128,8.0125 Z m 0,15.99833 a 79.991671,79.991671 0 0 1 49.46359,17.34194 79.991671,79.991671 0 0 1 3.18718,2.62473 79.991671,79.991671 0 0 1 2.93719,2.74971 79.991671,79.991671 0 0 1 2.93719,2.99969 79.991671,79.991671 0 0 1 2.84346,3.21842 79.991671,79.991671 0 0 1 2.49974,3.06218 h 48.11998 V 72.00583 H 223.99 v 63.99333 h 15.99833 v 15.99835 H 191.86835 A 79.991671,79.991671 0 0 1 175.83877,167.99583 79.991671,79.991671 0 0 1 128,183.99418 79.991671,79.991671 0 0 1 78.536398,166.65223 a 79.991671,79.991671 0 0 1 -3.187167,-2.62474 79.991671,79.991671 0 0 1 -2.937195,-2.74971 79.991671,79.991671 0 0 1 -2.937193,-2.99969 79.991671,79.991671 0 0 1 -2.843455,-3.21842 79.991671,79.991671 0 0 1 -2.499739,-3.06217 H 16.011659 V 135.99916 H 32.009993 V 72.00583 H 16.011659 V 56.0075 H 64.162895 A 79.991671,79.991671 0 0 1 69.256115,49.85189 79.991671,79.991671 0 0 1 80.161229,40.00916 79.991671,79.991671 0 0 1 128,24.01083 Z"
-     class="ColorScheme-Text"
-     id="path4" />
-</svg>
diff --git a/src/icons/cookies-on.svg b/src/icons/cookies-on.svg
deleted file mode 100644 (file)
index 191f07a..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<svg
-   viewBox="0 0 256 256"
-   version="1.1"
-   id="svg8"
-   sodipodi:docname="cookies-on.svg"
-   inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
-   width="256"
-   height="256"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:svg="http://www.w3.org/2000/svg">
-  <sodipodi:namedview
-     id="namedview10"
-     pagecolor="#ffffff"
-     bordercolor="#666666"
-     borderopacity="1.0"
-     inkscape:pageshadow="2"
-     inkscape:pageopacity="0.0"
-     inkscape:pagecheckerboard="0"
-     showgrid="false"
-     inkscape:zoom="3.1601563"
-     inkscape:cx="-133.37948"
-     inkscape:cy="4.9048207"
-     inkscape:window-width="3644"
-     inkscape:window-height="2015"
-     inkscape:window-x="0"
-     inkscape:window-y="0"
-     inkscape:window-maximized="1"
-     inkscape:current-layer="svg8" />
-  <defs
-     id="defs3051">
-    <style
-       type="text/css"
-       id="current-color-scheme">
-      .ColorScheme-Text {
-        color:#232629;
-      }
-      .ColorScheme-PositiveText {
-        color:#27ae60;
-      }
-      </style>
-  </defs>
-  <g
-     id="g825"
-     transform="translate(0,7.036695)">
-    <path
-       style="fill:currentColor;fill-opacity:1;stroke:none;stroke-width:15.9951"
-       d="M 127.96086,1 A 95.970643,95.970643 0 0 0 56.732645,32.990214 H 15.995107 C 7.1338178,32.990214 0,40.124032 0,48.985321 v 95.970639 c 0,8.86129 7.1338178,15.99511 15.995107,15.99511 h 40.581337 a 95.970643,95.970643 0 0 0 71.321936,31.99022 c -8.83168,0.0342 -15.93263,7.15512 -15.93263,15.9951 0,0.44787 0.20194,0.83303 0.24992,1.28089 -25.94406,3.69484 -48.297722,14.71422 -48.297722,14.71422 v 15.99511 H 191.87881 V 224.9315 c 0,0 -22.2897,-11.01938 -48.29773,-14.71425 0.032,-0.44786 0.24992,-0.83303 0.24992,-1.28089 0,-8.81866 -7.0681,-15.92695 -15.87014,-15.99507 a 95.970643,95.970643 0 0 0 71.22821,-31.99022 h 40.73754 c 8.86129,0 15.9951,-7.13382 15.9951,-15.99511 V 48.985321 c 0,-8.861289 -7.13381,-15.995107 -15.9951,-15.995107 H 199.34528 A 95.970643,95.970643 0 0 0 127.96086,1 Z m 0,15.995107 a 79.975535,79.975535 0 0 1 49.45362,17.338447 79.975535,79.975535 0 0 1 3.18653,2.624197 79.975535,79.975535 0 0 1 2.93659,2.749159 79.975535,79.975535 0 0 1 2.93661,2.999083 79.975535,79.975535 0 0 1 2.84289,3.217766 79.975535,79.975535 0 0 1 2.49923,3.061562 h 48.11028 V 64.980428 H 223.9315 v 63.980432 h 15.99511 v 15.9951 h -48.11028 a 79.975535,79.975535 0 0 1 -16.02636,15.99511 79.975535,79.975535 0 0 1 -47.82911,15.99511 79.975535,79.975535 0 0 1 -49.453626,-17.33844 79.975535,79.975535 0 0 1 -3.186524,-2.62421 79.975535,79.975535 0 0 1 -2.936603,-2.74916 79.975535,79.975535 0 0 1 -2.936601,-2.99908 79.975535,79.975535 0 0 1 -2.84288,-3.21777 79.975535,79.975535 0 0 1 -2.499236,-3.06156 H 15.995107 v -15.9951 H 31.990214 V 64.980428 H 15.995107 V 48.985321 H 64.13663 a 79.975535,79.975535 0 0 1 5.092193,-6.154367 79.975535,79.975535 0 0 1 10.902914,-9.84074 79.975535,79.975535 0 0 1 47.829123,-15.995107 z"
-       class="ColorScheme-Text"
-       id="path4" />
-    <path
-       style="fill:#f67400;fill-opacity:1;stroke:none;stroke-width:15.9951"
-       class="ColorScheme-PositiveText"
-       d="M 175.94618,96.970406 A 47.985321,47.985321 0 0 1 127.96086,144.95573 47.985321,47.985321 0 0 1 79.975535,96.970406 47.985321,47.985321 0 0 1 127.96086,48.985085 47.985321,47.985321 0 0 1 175.94618,96.970406 Z"
-       id="path6" />
-  </g>
-</svg>
index a311b848c6feea8aa3fda1ca94ed00be1e35e231..cfa6f792ba5ffb28989605ecb2ed2f8579d989f4 100644 (file)
@@ -19,8 +19,6 @@
 <!DOCTYPE RCC>
 <RCC version="1.0">
     <qresource>
-        <file>icons/cookies-off.svg</file>
-        <file>icons/cookies-on.svg</file>
         <file>icons/javascript-warning.svg</file>
         <file>icons/privacy-mode.svg</file>
         <file>icons/sc-apps-privacy-browser.svg</file>
index 10d08f3c972494a22747d575e098805354f186fa..36193bf8f20c184a9e9e65347d5776cc8663ffd5 100644 (file)
@@ -32,7 +32,7 @@
             <default>false</default>
         </entry>
 
-        <entry name="cookiesEnabled" type="Bool">
+        <entry name="localStorageEnabled" type="Bool">
             <default>false</default>
         </entry>
 
index 14ccad7007b1fef222f631672186424f2da53a62..411ac93dad9f844ef0c67f29de3a2cc7781878ed 100644 (file)
@@ -23,6 +23,6 @@
 // Construct the struct.
 PrivacyWebEngine::PrivacyWebEngine(QWebEngineView *inputWebEngineViewPointer) : webEngineViewPointer(inputWebEngineViewPointer)
 {
-    // Initialize the cookie status.
-    cookiesEnabled = false;
+    // Initialize the local storage status.
+    localStorageEnabled = false;
 }
index b536c4f1423bd5281755564e4a8715088d59c203..2d5035a6e916a0fa86f1ae2a67c51cb46135c539 100644 (file)
@@ -30,7 +30,7 @@ public:
     PrivacyWebEngine(QWebEngineView *inputWebEngineViewPointer);
 
     // The public variables.
-    bool cookiesEnabled;
+    bool localStorageEnabled;
     QWebEngineView *webEngineViewPointer;
 };
 #endif
index fd80ccbb3fa1fb55d14ae89e757593e1f2a61781..2f77d1c823d906bfe295ee1e43439d0e311d403c 100644 (file)
@@ -79,7 +79,7 @@
     <!-- The URL toolbar. -->
     <ToolBar name="url_toolbar" iconText="icononly"> <text>URL Toolbar</text>
         <Action name="javascript" />
-        <Action name="on-the-fly_cookies" />
+        <Action name="local_storage" />
         <Action name="dom_storage" />
     </ToolBar>
 </gui>
index 19728482d920f7b7ef45fcbde193099a9c5586ba..9cf73247d81a440e49663e7b827bb063556fbdff 100644 (file)
                                     </widget>
                                 </item>
 
-                                <!-- Cookies storage. -->
+                                <!-- Local storage. -->
                                 <item row="3" column="0">
                                     <widget class="QLabel">
                                         <property name="text">
-                                            <string>Cookies</string>
+                                            <string>Local storage</string>
                                         </property>
 
                                         <property name="toolTip">
                                 </item>
 
                                 <item row="3" column="1">
-                                    <widget class="QComboBox" name="cookiesComboBox">
+                                    <widget class="QComboBox" name="localStorageComboBox">
                                         <item>
                                             <property name="text">
                                                 <string>System default</string>
 
                                         <item>
                                             <property name="text">
-                                                <string>Cookies enabled</string>
+                                                <string>Local storage disabled</string>
                                             </property>
                                         </item>
 
                                         <item>
                                             <property name="text">
-                                                <string>Cookies disabled</string>
+                                                <string>Local storage enabled</string>
                                             </property>
                                         </item>
                                     </widget>
                                 </item>
 
                                 <item row="4" column="1">
-                                    <widget class="QLabel" name="cookiesLabel">
+                                    <widget class="QLabel" name="localStorageLabel">
                                         <property name="textFormat">
                                             <enum>Qt::RichText</enum>
                                         </property>
                                         </property>
 
                                         <property name="toolTip">
-                                            <string>Set the zoom factor between 0.25 and 5.00.</string>
+                                            <string>Valid values for the zoom factor are between 0.25 and 5.00.</string>
                                         </property>
                                     </widget>
                                 </item>
index 425ea65fea1d89a56056f4b67b9f8543f1045ce2..5248663a6d60d6bae2ae774e10bf609ee0c6a74d 100644 (file)
                     </property>
 
                     <property name="toolTip">
-                        <string>Set the zoom factor between 0.25 and 5.00.  The default is 1.00.</string>
+                        <string>Valid values for the zoom factor are between 0.25 and 5.00.  The default is 1.00.</string>
                     </property>
                 </widget>
             </item>
index 6989f2a68f23c92cba5e58bf78f38421d7e1e40e..0affb07f524cd43c1c216cd5acf3235aa6c831da 100644 (file)
@@ -39,9 +39,9 @@
 
             <!-- Cookies. -->
             <item row="1" column="1">
-                <widget class="QCheckBox" name="kcfg_cookiesEnabled">
+                <widget class="QCheckBox" name="kcfg_localStorageEnabled">
                     <property name="text">
-                        <string>Cookies</string>
+                        <string>Local storage</string>
                     </property>
 
                     <property name="toolTip">
index 777d12efcda177e1ed877a615cd03938045625f0..440c694ab02a7ca130bfc58dbeb85ba9fa2a1b8b 100644 (file)
@@ -69,10 +69,10 @@ BrowserView::BrowserView(QWidget *parent) : QWidget(parent)
     // Populate the privacy web engine list.
     privacyWebEngineListPointer->append(currentPrivacyWebEnginePointer);
 
-    // Set the cookie filter.
+    // Set the local storage filter.
     webEngineCookieStorePointer->setCookieFilter([this](const QWebEngineCookieStore::FilterRequest &filterRequest)
     {
-        // qDebug() << "Cookie page URL:  " << filterRequest.firstPartyUrl << ", Cookie URL:  " << filterRequest.origin << ",  Is third-party:  " << filterRequest.thirdParty;
+        // qDebug() << "Page URL:  " << filterRequest.firstPartyUrl << ", Local storage URL:  " << filterRequest.origin << ",  Is third-party:  " << filterRequest.thirdParty;
 
         // Block all third party local storage requests, including the sneaky ones that don't register a first party URL.
         if (filterRequest.thirdParty || (filterRequest.firstPartyUrl == QStringLiteral("")))
@@ -82,7 +82,7 @@ BrowserView::BrowserView(QWidget *parent) : QWidget(parent)
         for (PrivacyWebEngine *privacyWebEnginePointer : *privacyWebEngineListPointer)
         {
             // Allow this local storage request if it comes from a tab with local storage enabled.
-            if (privacyWebEnginePointer->cookiesEnabled && (webEngineViewPointer->url().host() == filterRequest.firstPartyUrl.host()))
+            if (privacyWebEnginePointer->localStorageEnabled && (webEngineViewPointer->url().host() == filterRequest.firstPartyUrl.host()))
                 return true;
         }
 
@@ -152,8 +152,7 @@ BrowserView::~BrowserView()
     webEnginePagePointer->deleteLater();
 }
 
-// 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 BrowserView::addCookieToStore(QNetworkCookie cookie) const
+void BrowserView::addCookieToStore(QNetworkCookie &cookie) const
 {
     // Create a url.
     QUrl url;
@@ -213,56 +212,81 @@ void BrowserView::applyDomainSettings(const QString &hostname, const bool reload
         // Set the JavaScript status.
         switch (domainRecord.field(DomainsDatabaseHelper::JAVASCRIPT).value().toInt())
         {
+            // Set the default JavaScript status.
             case (DomainsDatabaseHelper::SYSTEM_DEFAULT):
             {
-                // Set the default JavaScript status.
                 webEngineSettingsPointer->setAttribute(QWebEngineSettings::JavascriptEnabled, Settings::javaScriptEnabled());
 
                 break;
             }
 
+            // Disable JavaScript.
             case (DomainsDatabaseHelper::DISABLED):
             {
-                // Disable JavaScript.
                 webEngineSettingsPointer->setAttribute(QWebEngineSettings::JavascriptEnabled, false);
 
                 break;
             }
 
+            // Enable JavaScript.
             case (DomainsDatabaseHelper::ENABLED):
             {
-                // Enable JavaScript.
                 webEngineSettingsPointer->setAttribute(QWebEngineSettings::JavascriptEnabled, true);
 
                 break;
             }
         }
 
-        // Set the cookie status.  TODO.
-        currentPrivacyWebEnginePointer->cookiesEnabled = Settings::cookiesEnabled();
+        // Set the local storage status.
+        switch (domainRecord.field(DomainsDatabaseHelper::LOCAL_STORAGE).value().toInt())
+        {
+            // Set the default local storage status.
+            case (DomainsDatabaseHelper::SYSTEM_DEFAULT):
+            {
+                currentPrivacyWebEnginePointer->localStorageEnabled = Settings::localStorageEnabled();
 
-        // Set DOM storage.
+                break;
+            }
+
+            // Disable local storage.
+            case (DomainsDatabaseHelper::DISABLED):
+            {
+                currentPrivacyWebEnginePointer->localStorageEnabled = false;
+
+                break;
+            }
+
+            // Enable local storage.
+            case (DomainsDatabaseHelper::ENABLED):
+            {
+                currentPrivacyWebEnginePointer->localStorageEnabled = true;
+
+                break;
+            }
+        }
+
+        // Set the DOM storage status.
         switch (domainRecord.field(DomainsDatabaseHelper::DOM_STORAGE).value().toInt())
         {
+            // Set the default DOM storage status.
             case (DomainsDatabaseHelper::SYSTEM_DEFAULT):
             {
-                // Set the default DOM storage status.
                 webEngineSettingsPointer->setAttribute(QWebEngineSettings::LocalStorageEnabled, Settings::domStorageEnabled());
 
                 break;
             }
 
+            // Disable DOM storage.
             case (DomainsDatabaseHelper::DISABLED):
             {
-                // Disable DOM storage.
                 webEngineSettingsPointer->setAttribute(QWebEngineSettings::LocalStorageEnabled, false);
 
                 break;
             }
 
+            // Enable DOM storage.
             case (DomainsDatabaseHelper::ENABLED):
             {
-                // Enable DOM storage.
                 webEngineSettingsPointer->setAttribute(QWebEngineSettings::LocalStorageEnabled, true);
 
                 break;
@@ -295,8 +319,8 @@ void BrowserView::applyDomainSettings(const QString &hostname, const bool reload
         // Set the JavaScript status.
         webEngineSettingsPointer->setAttribute(QWebEngineSettings::JavascriptEnabled, Settings::javaScriptEnabled());
 
-        // Set the cookie status.
-        currentPrivacyWebEnginePointer->cookiesEnabled = Settings::cookiesEnabled();
+        // Set the local storage status.
+        currentPrivacyWebEnginePointer->localStorageEnabled = Settings::localStorageEnabled();
 
         // Set DOM storage.
         webEngineSettingsPointer->setAttribute(QWebEngineSettings::LocalStorageEnabled, Settings::domStorageEnabled());
@@ -316,7 +340,7 @@ void BrowserView::applyDomainSettings(const QString &hostname, const bool reload
 
     // Emit the update actions signals.
     emit updateJavaScriptAction(webEngineSettingsPointer->testAttribute(QWebEngineSettings::JavascriptEnabled));
-    emit updateCookiesAction(currentPrivacyWebEnginePointer->cookiesEnabled);
+    emit updateLocalStorageAction(currentPrivacyWebEnginePointer->localStorageEnabled);
     emit updateDomStorageAction(webEngineSettingsPointer->testAttribute(QWebEngineSettings::LocalStorageEnabled));
     emit updateUserAgentActions(webEngineProfilePointer->httpUserAgent());
     emit updateZoomFactorAction(webEngineViewPointer->zoomFactor());
@@ -511,13 +535,13 @@ void BrowserView::refresh() const
     webEngineViewPointer->reload();
 }
 
-void BrowserView::toggleCookies()
+void BrowserView::toggleDomStorage() const
 {
-    // Toggle cookies.
-    currentPrivacyWebEnginePointer->cookiesEnabled = !currentPrivacyWebEnginePointer->cookiesEnabled;
+    // Toggle DOM storage.
+    webEngineSettingsPointer->setAttribute(QWebEngineSettings::LocalStorageEnabled, !webEngineSettingsPointer->testAttribute(QWebEngineSettings::LocalStorageEnabled));
 
-    // Update the cookies icon.
-    emit updateCookiesAction(currentPrivacyWebEnginePointer->cookiesEnabled);
+    // Update the DOM storage action.
+    emit updateDomStorageAction(webEngineSettingsPointer->testAttribute(QWebEngineSettings::LocalStorageEnabled));
 
     // Reload the website.
     webEngineViewPointer->reload();
@@ -528,20 +552,20 @@ void BrowserView::toggleJavaScript() const
     // Toggle JavaScript.
     webEngineSettingsPointer->setAttribute(QWebEngineSettings::JavascriptEnabled, !webEngineSettingsPointer->testAttribute(QWebEngineSettings::JavascriptEnabled));
 
-    // Update the JavaScript icon.
+    // Update the JavaScript action.
     emit updateJavaScriptAction(webEngineSettingsPointer->testAttribute(QWebEngineSettings::JavascriptEnabled));
 
     // Reload the website.
     webEngineViewPointer->reload();
 }
 
-void BrowserView::toggleDomStorage() const
+void BrowserView::toggleLocalStorage()
 {
-    // Toggle DOM storage.
-    webEngineSettingsPointer->setAttribute(QWebEngineSettings::LocalStorageEnabled, !webEngineSettingsPointer->testAttribute(QWebEngineSettings::LocalStorageEnabled));
+    // Toggle local storeage.
+    currentPrivacyWebEnginePointer->localStorageEnabled = !currentPrivacyWebEnginePointer->localStorageEnabled;
 
-    // Update the DOM storage action icon.
-    emit updateDomStorageAction(webEngineSettingsPointer->testAttribute(QWebEngineSettings::LocalStorageEnabled));
+    // Update the local storage action.
+    emit updateLocalStorageAction(currentPrivacyWebEnginePointer->localStorageEnabled);
 
     // Reload the website.
     webEngineViewPointer->reload();
index 031496600d74c36a90589bc956a8ea5d15d5db59..859a93f2ee27c6c0d72e69497461d16236a39e49 100644 (file)
@@ -48,9 +48,9 @@ public:
     // The public functions.
     void applyOnTheFlyZoomFactor(const double &zoomFactor);
     void loadInitialWebsite();
-    void toggleCookies();
     void toggleDomStorage() const;
     void toggleJavaScript() const;
+    void toggleLocalStorage();
 
     // The public static variables.
     static QString webEngineDefaultUserAgent;
@@ -64,11 +64,11 @@ signals:
     void linkHovered(const QString &linkUrl) const;
     void showProgressBar(const int &progress) const;
     void updateBackAction(const bool &isEnabled) const;
-    void updateCookiesAction(const bool &isEnabled) const;
     void updateDomStorageAction(const bool &isEnabled) const;
     void updateDomainSettingsIndicator(const bool &status, const QString &domainSettingsDomain) const;
     void updateForwardAction(const bool &isEnabled) const;
     void updateJavaScriptAction(const bool &isEnabled) const;
+    void updateLocalStorageAction(const bool &isEnabled) const;
     void updateSearchEngineActions(const QString &searchEngine) const;
     void updateUrlLineEdit(const QUrl &newUrl) const;
     void updateUserAgentActions(const QString &userAgent) const;
@@ -76,7 +76,7 @@ signals:
 
 public Q_SLOTS:
     // The public slots.
-    void addCookieToStore(QNetworkCookie cookie) const;
+    void addCookieToStore(QNetworkCookie &cookie) const;
     void applyApplicationSettings();
     void applyDomainSettingsAndReload();
     void applyDomainSettingsWithoutReloading(const QString &hostname);
index ef264a5db5476d3ae05074bbfdb23bd9ca5b8f1d..60ddaa4d6e2f31ca8fe62a1ad3778c76537e31b3 100644 (file)
@@ -41,8 +41,8 @@ BrowserWindow::BrowserWindow() : KXmlGuiWindow()
 {
     // Initialize the variables.
     cookieListPointer = new std::list<QNetworkCookie>;
-    cookiesEnabled = false;
     javaScriptEnabled = false;
+    localStorageEnabled = false;
 
     // Instantiate the main view pointer.
     browserViewPointer = new BrowserView(this);
@@ -83,7 +83,7 @@ BrowserWindow::BrowserWindow() : KXmlGuiWindow()
     QAction *domainSettingsActionPointer = actionCollectionPointer->addAction(QStringLiteral("domain_settings"));
     cookiesActionPointer = actionCollectionPointer->addAction(QStringLiteral("cookies"));
     javaScriptActionPointer = actionCollectionPointer->addAction(QStringLiteral("javascript"));
-    onTheFlyCookiesActionPointer = actionCollectionPointer->addAction(QStringLiteral("on-the-fly_cookies"));
+    localStorageActionPointer = actionCollectionPointer->addAction(QStringLiteral("local_storage"));
     domStorageActionPointer = actionCollectionPointer->addAction(QStringLiteral("dom_storage"));
 
     // Create the action groups
@@ -109,6 +109,9 @@ BrowserWindow::BrowserWindow() : KXmlGuiWindow()
     searchEngineActionGroupPointer->addAction(searchEngineCustomActionPointer);
 
     // Set some actions to be checkable.
+    javaScriptActionPointer->setCheckable(true);
+    localStorageActionPointer->setCheckable(true);
+    domStorageActionPointer->setCheckable(true);
     userAgentPrivacyBrowserActionPointer->setCheckable(true);
     userAgentWebEngineDefaultActionPointer->setCheckable(true);
     userAgentFirefoxLinuxActionPointer->setCheckable(true);
@@ -126,9 +129,6 @@ BrowserWindow::BrowserWindow() : KXmlGuiWindow()
     searchEngineYahooActionPointer->setCheckable(true);
     searchEngineCustomActionPointer->setCheckable(true);
 
-    // Get the number of cookies.
-    int numberOfCookies = cookieListPointer->size();
-
     // Set the action text.
     userAgentPrivacyBrowserActionPointer->setText(UserAgentHelper::PRIVACY_BROWSER_TRANSLATED);
     userAgentWebEngineDefaultActionPointer->setText(UserAgentHelper::WEB_ENGINE_DEFAULT_TRANSLATED);
@@ -145,9 +145,9 @@ BrowserWindow::BrowserWindow() : KXmlGuiWindow()
     searchEngineBingActionPointer->setText(i18nc("Search engine", "Bing"));
     searchEngineYahooActionPointer->setText(i18nc("Search engine", "Yahoo"));
     domainSettingsActionPointer->setText(i18nc("Domain Settings action", "Domain Settings"));
-    cookiesActionPointer->setText(i18nc("The Cookies action, which also displays the number of cookies", "Cookies - %1", numberOfCookies));
+    cookiesActionPointer->setText(i18nc("The Cookies action, which also displays the number of cookies", "Cookies - %1", cookieListPointer->size()));
     javaScriptActionPointer->setText(i18nc("JavaScript action", "JavaScript"));
-    onTheFlyCookiesActionPointer->setText(i18nc("The On-The-Fly Cookies action, which also display the number of cookies", "Cookies - %1", numberOfCookies));
+    localStorageActionPointer->setText(i18nc("The Local Storage action", "Local Storage"));
     domStorageActionPointer->setText(i18nc("DOM Storage action", "DOM Storage"));
 
     // Set the action icons.
@@ -170,7 +170,7 @@ BrowserWindow::BrowserWindow() : KXmlGuiWindow()
     zoomFactorActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("zoom")));
     domainSettingsActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("settings-configure")));
     cookiesActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("preferences-web-browser-cookies")));
-    onTheFlyCookiesActionPointer->setIcon(QIcon(":/icons/cookies-off"));
+    domStorageActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("view-web-browser-dom-tree")));
 
     // Update the on-the-fly menus.
     connect(browserViewPointer, SIGNAL(updateUserAgentActions(QString)), this, SLOT(updateUserAgentActions(QString)));
@@ -188,14 +188,14 @@ BrowserWindow::BrowserWindow() : KXmlGuiWindow()
 
     // Connect the URL toolbar actions.
     connect(javaScriptActionPointer, SIGNAL(triggered()), this, SLOT(toggleJavaScript()));
-    connect(onTheFlyCookiesActionPointer, SIGNAL(triggered()), this, SLOT(toggleCookies()));
+    connect(localStorageActionPointer, SIGNAL(triggered()), this, SLOT(toggleLocalStorage()));
     connect(domStorageActionPointer, SIGNAL(triggered()), this, SLOT(toggleDomStorage()));
 
     // Update the URL toolbar actions.
     connect(browserViewPointer, SIGNAL(updateBackAction(bool)), backActionPointer, SLOT(setEnabled(bool)));
     connect(browserViewPointer, SIGNAL(updateForwardAction(bool)), forwardActionPointer, SLOT(setEnabled(bool)));
     connect(browserViewPointer, SIGNAL(updateJavaScriptAction(bool)), this, SLOT(updateJavaScriptAction(bool)));
-    connect(browserViewPointer, SIGNAL(updateCookiesAction(bool)), this, SLOT(updateCookiesAction(bool)));
+    connect(browserViewPointer, SIGNAL(updateLocalStorageAction(bool)), this, SLOT(updateLocalStorageAction(bool)));
     connect(browserViewPointer, SIGNAL(updateDomStorageAction(bool)), this, SLOT(updateDomStorageAction(bool)));
 
     // Setup the GUI based on the browser_ui.rc file.
@@ -266,12 +266,8 @@ void BrowserWindow::addCookieToList(const QNetworkCookie &newCookie) const
     // Add the new cookie to the list.
     cookieListPointer->push_front(newCookie);
 
-    // Get the number of cookies.
-    int numberOfCookies = cookieListPointer->size();
-
     // Update the action text.
-    cookiesActionPointer->setText(i18nc("The Cookies action, which also displays the number of cookies", "Cookies - %1", numberOfCookies));
-    onTheFlyCookiesActionPointer->setText(i18nc("The On-The-Fly Cookies action, which also display the number of cookies", "Cookies - %1", numberOfCookies));
+    cookiesActionPointer->setText(i18nc("The Cookies action, which also displays the number of cookies", "Cookies - %1", cookieListPointer->size()));
 }
 
 void BrowserWindow::addOrEditDomainSettings() const
@@ -427,12 +423,8 @@ void BrowserWindow::removeCookieFromList(const QNetworkCookie &cookie) const
     // Remove the cookie from the list.
     cookieListPointer->remove(cookie);
 
-    // Get the number of cookies.
-    int numberOfCookies = cookieListPointer->size();
-
     // Update the action text.
-    cookiesActionPointer->setText(i18nc("The Cookies action, which also displays the number of cookies", "Cookies - %1", numberOfCookies));
-    onTheFlyCookiesActionPointer->setText(i18nc("The On-The-Fly Cookies action, which also display the number of cookies", "Cookies - %1", numberOfCookies));
+    cookiesActionPointer->setText(i18nc("The Cookies action, which also displays the number of cookies", "Cookies - %1", cookieListPointer->size()));
 }
 
 void BrowserWindow::showProgressBar(const int &progress) const
@@ -525,13 +517,13 @@ void BrowserWindow::settingsConfigure()
     }
 }
 
-void BrowserWindow::toggleCookies() const
+void BrowserWindow::toggleLocalStorage() const
 {
     // Remove the focus from teh URL line edit.
     urlLineEditPointer->clearFocus();
 
-    // Toggle cookies.
-    browserViewPointer->toggleCookies();
+    // Toggle local storage.
+    browserViewPointer->toggleLocalStorage();
 }
 
 void BrowserWindow::toggleJavaScript() const
@@ -552,19 +544,10 @@ void BrowserWindow::toggleDomStorage() const
     browserViewPointer->toggleDomStorage();
 }
 
-void BrowserWindow::updateCookiesAction(const bool &isEnabled)
+void BrowserWindow::updateDomStorageAction(const bool &isEnabled) const
 {
-    // Update the cookies status.
-    cookiesEnabled = isEnabled;
-
-    // Update the icon.
-    if (cookiesEnabled)
-        onTheFlyCookiesActionPointer->setIcon(QIcon(":/icons/cookies-on"));
-    else
-        onTheFlyCookiesActionPointer->setIcon(QIcon(":/icons/cookies-off"));
-
-    // Update the status of the DOM storage action.
-    domStorageActionPointer->setEnabled(cookiesEnabled & javaScriptEnabled);
+    // Set the action checked status.
+    domStorageActionPointer->setChecked(isEnabled);
 }
 
 void BrowserWindow::updateDomainSettingsIndicator(const bool &status, const QString &domainSettingsDomain)
@@ -586,21 +569,33 @@ void BrowserWindow::updateJavaScriptAction(const bool &isEnabled)
 
     // Set the icon according to the status.
     if (javaScriptEnabled)
-        javaScriptActionPointer->setIcon(QIcon(":/icons/javascript-warning"));
+        javaScriptActionPointer->setIcon(QIcon(QStringLiteral(":/icons/javascript-warning")));
     else
-        javaScriptActionPointer->setIcon(QIcon(":/icons/privacy-mode"));
+        javaScriptActionPointer->setIcon(QIcon(QStringLiteral(":/icons/privacy-mode")));
+
+    // Set the action checked status.
+    javaScriptActionPointer->setChecked(javaScriptEnabled);
 
     // Update the status of the DOM storage action.
-    domStorageActionPointer->setEnabled(javaScriptEnabled & cookiesEnabled);
+    domStorageActionPointer->setEnabled(javaScriptEnabled & localStorageEnabled);
 }
 
-void BrowserWindow::updateDomStorageAction(const bool &isEnabled) const
+void BrowserWindow::updateLocalStorageAction(const bool &isEnabled)
 {
-    // Set the icon according to the status.
-    if (isEnabled)
-        domStorageActionPointer->setIcon(QIcon::fromTheme("disk-quota-low"));
+    // Update the local storage status.
+    localStorageEnabled = isEnabled;
+
+    // Update the icon.
+    if (localStorageEnabled)
+        localStorageActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("disk-quota-high")));
     else
-        domStorageActionPointer->setIcon(QIcon::fromTheme("disk-quota"));
+        localStorageActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("disk-quota")));
+
+    // Set the action checked status.
+    localStorageActionPointer->setChecked(localStorageEnabled);
+
+    // Update the status of the DOM storage action.
+    domStorageActionPointer->setEnabled(localStorageEnabled & javaScriptEnabled);
 }
 
 void BrowserWindow::updateSearchEngineActions(const QString &searchEngine) const
index c66a528ce7679d39372480278f8cfb5ccf2391a0..0239a4e07bc85e70773ca9fa7768490e2d7044c8 100644 (file)
@@ -63,13 +63,13 @@ private Q_SLOTS:
     void removeCookieFromList(const QNetworkCookie &cookie) const;
     void settingsConfigure();
     void showProgressBar(const int &progress) const;
-    void toggleCookies() const;
     void toggleDomStorage() const;
     void toggleJavaScript() const;
-    void updateCookiesAction(const bool &isEnabled);
+    void toggleLocalStorage() const;
     void updateDomStorageAction(const bool &isEnabled) const;
     void updateDomainSettingsIndicator(const bool &status, const QString &domainSettingsDomain);
     void updateJavaScriptAction(const bool &isEnabled);
+    void updateLocalStorageAction(const bool &isEnabled);
     void updateSearchEngineActions(const QString &searchEngine) const;
     void updateUserAgentActions(const QString &userAgent) const;
     void updateZoomFactorAction(const double &zoomFactor);
@@ -83,7 +83,6 @@ private:
     KConfigDialog *configDialogPointer;
     std::list<QNetworkCookie> *cookieListPointer;
     QAction *cookiesActionPointer;
-    bool cookiesEnabled;
     QString currentDomainSettingsDomain;
     QUrl currentUrl;
     double currentZoomFactor;
@@ -91,8 +90,9 @@ private:
     QPalette domainSettingsPalette;
     QAction *javaScriptActionPointer;
     bool javaScriptEnabled;
+    QAction *localStorageActionPointer;
+    bool localStorageEnabled;
     QPalette noDomainSettingsPalette;
-    QAction *onTheFlyCookiesActionPointer;
     QProgressBar *progressBarPointer;
     QLabel *searchEngineLabelPointer;
     QAction *searchEngineMojeekActionPointer;