summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cookiedialogs.cpp108
-rw-r--r--src/cookiedialogs.h2
2 files changed, 58 insertions, 52 deletions
diff --git a/src/cookiedialogs.cpp b/src/cookiedialogs.cpp
index 43cbed81..b4e043aa 100644
--- a/src/cookiedialogs.cpp
+++ b/src/cookiedialogs.cpp
@@ -35,10 +35,13 @@
CookiesDialog::CookiesDialog(CookieJar *cookieJar, QWidget *parent)
: KDialog(parent)
{
- Ui::CookiesWidget cookieWidget;
- QWidget widget;
- cookieWidget.setupUi(&widget);
- setMainWidget(&widget);
+ setCaption("Cookies");
+ setButtons( KDialog::Ok );
+
+ Ui::CookiesWidget *cookieWidget = new Ui::CookiesWidget;
+ QWidget *widget = new QWidget(this);
+ cookieWidget->setupUi(widget);
+ setMainWidget(widget);
setWindowFlags(Qt::Sheet);
@@ -46,30 +49,30 @@ CookiesDialog::CookiesDialog(CookieJar *cookieJar, QWidget *parent)
m_proxyModel = new QSortFilterProxyModel(this);
// connecting signals and slots
- connect(cookieWidget.search, SIGNAL(textChanged(QString)), m_proxyModel, SLOT(setFilterFixedString(QString)));
- connect(cookieWidget.removeButton, SIGNAL(clicked()), cookieWidget.cookiesTable, SLOT(removeOne()));
- connect(cookieWidget.removeAllButton, SIGNAL(clicked()), cookieWidget.cookiesTable, SLOT(removeAll()));
+ connect(cookieWidget->search, SIGNAL(textChanged(QString)), m_proxyModel, SLOT(setFilterFixedString(QString)));
+ connect(cookieWidget->removeButton, SIGNAL(clicked()), cookieWidget->cookiesTable, SLOT(removeOne()));
+ connect(cookieWidget->removeAllButton, SIGNAL(clicked()), cookieWidget->cookiesTable, SLOT(removeAll()));
m_proxyModel->setSourceModel(model);
- cookieWidget.cookiesTable->verticalHeader()->hide();
- cookieWidget.cookiesTable->setSelectionBehavior(QAbstractItemView::SelectRows);
- cookieWidget.cookiesTable->setModel(m_proxyModel);
- cookieWidget.cookiesTable->setAlternatingRowColors(true);
- cookieWidget.cookiesTable->setTextElideMode(Qt::ElideMiddle);
- cookieWidget.cookiesTable->setShowGrid(false);
- cookieWidget.cookiesTable->setSortingEnabled(true);
+ cookieWidget->cookiesTable->verticalHeader()->hide();
+ cookieWidget->cookiesTable->setSelectionBehavior(QAbstractItemView::SelectRows);
+ cookieWidget->cookiesTable->setModel(m_proxyModel);
+ cookieWidget->cookiesTable->setAlternatingRowColors(true);
+ cookieWidget->cookiesTable->setTextElideMode(Qt::ElideMiddle);
+ cookieWidget->cookiesTable->setShowGrid(false);
+ cookieWidget->cookiesTable->setSortingEnabled(true);
QFont f = font();
f.setPointSize(10);
QFontMetrics fm(f);
int height = fm.height() + fm.height() / 3;
- cookieWidget.cookiesTable->verticalHeader()->setDefaultSectionSize(height);
- cookieWidget.cookiesTable->verticalHeader()->setMinimumSectionSize(-1);
+ cookieWidget->cookiesTable->verticalHeader()->setDefaultSectionSize(height);
+ cookieWidget->cookiesTable->verticalHeader()->setMinimumSectionSize(-1);
for (int i = 0; i < model->columnCount(); ++i)
{
- int header = cookieWidget.cookiesTable->horizontalHeader()->sectionSizeHint(i);
+ int header = cookieWidget->cookiesTable->horizontalHeader()->sectionSizeHint(i);
switch (i)
{
case 0:
@@ -84,9 +87,9 @@ CookiesDialog::CookiesDialog(CookieJar *cookieJar, QWidget *parent)
}
int buffer = fm.width(QLatin1String("xx"));
header += buffer;
- cookieWidget.cookiesTable->horizontalHeader()->resizeSection(i, header);
+ cookieWidget->cookiesTable->horizontalHeader()->resizeSection(i, header);
}
- cookieWidget.cookiesTable->horizontalHeader()->setStretchLastSection(true);
+ cookieWidget->cookiesTable->horizontalHeader()->setStretchLastSection(true);
}
@@ -96,48 +99,51 @@ CookiesDialog::CookiesDialog(CookieJar *cookieJar, QWidget *parent)
CookiesExceptionsDialog::CookiesExceptionsDialog(CookieJar *cookieJar, QWidget *parent)
: KDialog(parent)
, m_cookieJar(cookieJar)
- , exceptionsWidget(new Ui::CookiesExceptionsWidget)
+ , m_exceptionsWidget(new Ui::CookiesExceptionsWidget)
{
- QWidget widget;
- exceptionsWidget->setupUi(&widget);
- setMainWidget(&widget);
+ setCaption("Cookies Exceptions");
+ setButtons( KDialog::Ok );
+
+ QWidget *widget = new QWidget(this);
+ m_exceptionsWidget->setupUi(widget);
+ setMainWidget(widget);
setWindowFlags(Qt::Sheet);
- connect(exceptionsWidget->removeButton, SIGNAL(clicked()), exceptionsWidget->exceptionTable, SLOT(removeOne()));
- connect(exceptionsWidget->removeAllButton, SIGNAL(clicked()), exceptionsWidget->exceptionTable, SLOT(removeAll()));
+ connect(m_exceptionsWidget->removeButton, SIGNAL(clicked()), m_exceptionsWidget->exceptionTable, SLOT(removeOne()));
+ connect(m_exceptionsWidget->removeAllButton, SIGNAL(clicked()), m_exceptionsWidget->exceptionTable, SLOT(removeAll()));
- exceptionsWidget->exceptionTable->verticalHeader()->hide();
- exceptionsWidget->exceptionTable->setSelectionBehavior(QAbstractItemView::SelectRows);
- exceptionsWidget->exceptionTable->setAlternatingRowColors(true);
- exceptionsWidget->exceptionTable->setTextElideMode(Qt::ElideMiddle);
- exceptionsWidget->exceptionTable->setShowGrid(false);
- exceptionsWidget->exceptionTable->setSortingEnabled(true);
+ m_exceptionsWidget->exceptionTable->verticalHeader()->hide();
+ m_exceptionsWidget->exceptionTable->setSelectionBehavior(QAbstractItemView::SelectRows);
+ m_exceptionsWidget->exceptionTable->setAlternatingRowColors(true);
+ m_exceptionsWidget->exceptionTable->setTextElideMode(Qt::ElideMiddle);
+ m_exceptionsWidget->exceptionTable->setShowGrid(false);
+ m_exceptionsWidget->exceptionTable->setSortingEnabled(true);
m_exceptionsModel = new CookieExceptionsModel(cookieJar, this);
m_proxyModel = new QSortFilterProxyModel(this);
m_proxyModel->setSourceModel(m_exceptionsModel);
- connect(exceptionsWidget->search, SIGNAL(textChanged(QString)), m_proxyModel, SLOT(setFilterFixedString(QString)));
+ connect(m_exceptionsWidget->search, SIGNAL(textChanged(QString)), m_proxyModel, SLOT(setFilterFixedString(QString)));
- exceptionsWidget->exceptionTable->setModel(m_proxyModel);
+ m_exceptionsWidget->exceptionTable->setModel(m_proxyModel);
CookieModel *cookieModel = new CookieModel(cookieJar, this);
- exceptionsWidget->domainLineEdit->setCompleter(new QCompleter(cookieModel, exceptionsWidget->domainLineEdit));
+ m_exceptionsWidget->domainLineEdit->setCompleter(new QCompleter(cookieModel, m_exceptionsWidget->domainLineEdit));
- connect(exceptionsWidget->domainLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(textChanged(const QString &)));
- connect(exceptionsWidget->blockButton, SIGNAL(clicked()), this, SLOT(block()));
- connect(exceptionsWidget->allowButton, SIGNAL(clicked()), this, SLOT(allow()));
- connect(exceptionsWidget->allowForSessionButton, SIGNAL(clicked()), this, SLOT(allowForSession()));
+ connect(m_exceptionsWidget->domainLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(textChanged(const QString &)));
+ connect(m_exceptionsWidget->blockButton, SIGNAL(clicked()), this, SLOT(block()));
+ connect(m_exceptionsWidget->allowButton, SIGNAL(clicked()), this, SLOT(allow()));
+ connect(m_exceptionsWidget->allowForSessionButton, SIGNAL(clicked()), this, SLOT(allowForSession()));
QFont f = font();
f.setPointSize(10);
QFontMetrics fm(f);
int height = fm.height() + fm.height() / 3;
- exceptionsWidget->exceptionTable->verticalHeader()->setDefaultSectionSize(height);
- exceptionsWidget->exceptionTable->verticalHeader()->setMinimumSectionSize(-1);
+ m_exceptionsWidget->exceptionTable->verticalHeader()->setDefaultSectionSize(height);
+ m_exceptionsWidget->exceptionTable->verticalHeader()->setMinimumSectionSize(-1);
for (int i = 0; i < m_exceptionsModel->columnCount(); ++i)
{
- int header = exceptionsWidget->exceptionTable->horizontalHeader()->sectionSizeHint(i);
+ int header = m_exceptionsWidget->exceptionTable->horizontalHeader()->sectionSizeHint(i);
switch (i)
{
case 0:
@@ -149,7 +155,7 @@ CookiesExceptionsDialog::CookiesExceptionsDialog(CookieJar *cookieJar, QWidget *
}
int buffer = fm.width(QLatin1String("xx"));
header += buffer;
- exceptionsWidget->exceptionTable->horizontalHeader()->resizeSection(i, header);
+ m_exceptionsWidget->exceptionTable->horizontalHeader()->resizeSection(i, header);
}
}
@@ -157,17 +163,17 @@ CookiesExceptionsDialog::CookiesExceptionsDialog(CookieJar *cookieJar, QWidget *
void CookiesExceptionsDialog::textChanged(const QString &text)
{
bool enabled = !text.isEmpty();
- exceptionsWidget->blockButton->setEnabled(enabled);
- exceptionsWidget->allowButton->setEnabled(enabled);
- exceptionsWidget->allowForSessionButton->setEnabled(enabled);
+ m_exceptionsWidget->blockButton->setEnabled(enabled);
+ m_exceptionsWidget->allowButton->setEnabled(enabled);
+ m_exceptionsWidget->allowForSessionButton->setEnabled(enabled);
}
void CookiesExceptionsDialog::block()
{
- if (exceptionsWidget->domainLineEdit->text().isEmpty())
+ if (m_exceptionsWidget->domainLineEdit->text().isEmpty())
return;
- m_exceptionsModel->m_blockedCookies.append(exceptionsWidget->domainLineEdit->text());
+ m_exceptionsModel->m_blockedCookies.append(m_exceptionsWidget->domainLineEdit->text());
m_cookieJar->setBlockedCookies(m_exceptionsModel->m_blockedCookies);
m_exceptionsModel->reset();
}
@@ -175,9 +181,9 @@ void CookiesExceptionsDialog::block()
void CookiesExceptionsDialog::allow()
{
- if (exceptionsWidget->domainLineEdit->text().isEmpty())
+ if (m_exceptionsWidget->domainLineEdit->text().isEmpty())
return;
- m_exceptionsModel->m_allowedCookies.append(exceptionsWidget->domainLineEdit->text());
+ m_exceptionsModel->m_allowedCookies.append(m_exceptionsWidget->domainLineEdit->text());
m_cookieJar->setAllowedCookies(m_exceptionsModel->m_allowedCookies);
m_exceptionsModel->reset();
}
@@ -185,9 +191,9 @@ void CookiesExceptionsDialog::allow()
void CookiesExceptionsDialog::allowForSession()
{
- if (exceptionsWidget->domainLineEdit->text().isEmpty())
+ if (m_exceptionsWidget->domainLineEdit->text().isEmpty())
return;
- m_exceptionsModel->m_sessionCookies.append(exceptionsWidget->domainLineEdit->text());
+ m_exceptionsModel->m_sessionCookies.append(m_exceptionsWidget->domainLineEdit->text());
m_cookieJar->setAllowForSessionCookies(m_exceptionsModel->m_sessionCookies);
m_exceptionsModel->reset();
}
diff --git a/src/cookiedialogs.h b/src/cookiedialogs.h
index 9f1a69df..4331ae83 100644
--- a/src/cookiedialogs.h
+++ b/src/cookiedialogs.h
@@ -77,7 +77,7 @@ private:
QSortFilterProxyModel *m_proxyModel;
CookieJar *m_cookieJar;
- Ui::CookiesExceptionsWidget *exceptionsWidget;
+ Ui::CookiesExceptionsWidget *m_exceptionsWidget;
};