domainNameLineEditPointer = domainSettingsDialogUi.domainNameLineEdit;
javaScriptComboBoxPointer = domainSettingsDialogUi.javaScriptComboBox;
javaScriptLabelPointer = domainSettingsDialogUi.javaScriptLabel;
+ localStorageComboBoxPointer = domainSettingsDialogUi.localStorageComboBox;
+ localStorageLabelPointer = domainSettingsDialogUi.localStorageLabel;
domStorageComboBoxPointer = domainSettingsDialogUi.domStorageComboBox;
domStorageLabelPointer = domainSettingsDialogUi.domStorageLabel;
userAgentComboBoxPointer = domainSettingsDialogUi.userAgentComboBox;
// 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);
domainsListViewPointer->setCurrentIndex(domainsTableModelPointer->index(0, domainsTableModelPointer->fieldIndex(DomainsDatabaseHelper::DOMAIN_NAME)));
// Populate the domain settings.
- domainSelected(domainsListViewPointer->selectionModel()->currentIndex());
+ domainSelected(domainsSelectionModelPointer->currentIndex());
break;
}
domainsListViewPointer->setCurrentIndex(newDomainIndex[0]);
// Populate the domain settings.
- domainSelected(domainsListViewPointer->selectionModel()->currentIndex());
+ domainSelected(domainsSelectionModelPointer->currentIndex());
+
+ break;
}
}
// 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)));
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.
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();
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();
// 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());
// Populate the labels.
populateJavaScriptLabel();
+ populateLocalStorageLabel();
populateDomStorageLabel();
populateUserAgentLabel(userAgentComboBoxPointer->currentText());
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();
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();
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.
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();
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());
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.
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);
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();
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;
// 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;
};
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";
// 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.
_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, " +
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;
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>
<!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>
<default>false</default>
</entry>
- <entry name="cookiesEnabled" type="Bool">
+ <entry name="localStorageEnabled" type="Bool">
<default>false</default>
</entry>
// Construct the struct.
PrivacyWebEngine::PrivacyWebEngine(QWebEngineView *inputWebEngineViewPointer) : webEngineViewPointer(inputWebEngineViewPointer)
{
- // Initialize the cookie status.
- cookiesEnabled = false;
+ // Initialize the local storage status.
+ localStorageEnabled = false;
}
PrivacyWebEngine(QWebEngineView *inputWebEngineViewPointer);
// The public variables.
- bool cookiesEnabled;
+ bool localStorageEnabled;
QWebEngineView *webEngineViewPointer;
};
#endif
<!-- 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>
</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>
</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>
<!-- 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">
// 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("")))
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;
}
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;
// 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;
// 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());
// 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());
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();
// 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();
// 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;
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;
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);
{
// Initialize the variables.
cookieListPointer = new std::list<QNetworkCookie>;
- cookiesEnabled = false;
javaScriptEnabled = false;
+ localStorageEnabled = false;
// Instantiate the main view pointer.
browserViewPointer = new BrowserView(this);
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
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);
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);
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.
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)));
// 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.
// 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
// 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
}
}
-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
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)
// 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
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);
KConfigDialog *configDialogPointer;
std::list<QNetworkCookie> *cookieListPointer;
QAction *cookiesActionPointer;
- bool cookiesEnabled;
QString currentDomainSettingsDomain;
QUrl currentUrl;
double currentZoomFactor;
QPalette domainSettingsPalette;
QAction *javaScriptActionPointer;
bool javaScriptEnabled;
+ QAction *localStorageActionPointer;
+ bool localStorageEnabled;
QPalette noDomainSettingsPalette;
- QAction *onTheFlyCookiesActionPointer;
QProgressBar *progressBarPointer;
QLabel *searchEngineLabelPointer;
QAction *searchEngineMojeekActionPointer;