diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cookiedialog.cpp | 67 | ||||
-rw-r--r-- | src/cookiedialog.h | 2 | ||||
-rw-r--r-- | src/cookieexceptiondialog.cpp | 64 | ||||
-rw-r--r-- | src/cookieexceptiondialog.h | 2 | ||||
-rw-r--r-- | src/cookies.ui | 10 | ||||
-rw-r--r-- | src/cookiesexceptions.ui | 4 |
6 files changed, 95 insertions, 54 deletions
diff --git a/src/cookiedialog.cpp b/src/cookiedialog.cpp index e9399e51..bc704f0b 100644 --- a/src/cookiedialog.cpp +++ b/src/cookiedialog.cpp @@ -160,6 +160,12 @@ void CookieModel::cookiesChanged() // Ui Includes #include "ui_cookies.h" +// Qt Includes +#include <QtCore/QRect> +#include <QtCore/QSize> + +#include <QtGui/QDesktopWidget> + CookiesDialog::CookiesDialog(CookieJar *cookieJar, QWidget *parent) : KDialog(parent) @@ -183,6 +189,7 @@ CookiesDialog::CookiesDialog(CookieJar *cookieJar, QWidget *parent) m_proxyModel->setSourceModel(model); + cookieWidget->cookiesTable->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); cookieWidget->cookiesTable->verticalHeader()->hide(); cookieWidget->cookiesTable->setSelectionBehavior(QAbstractItemView::SelectRows); cookieWidget->cookiesTable->setModel(m_proxyModel); @@ -191,31 +198,39 @@ CookiesDialog::CookiesDialog(CookieJar *cookieJar, QWidget *parent) 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); +// 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); + +// for (int i = 0; i < model->columnCount(); ++i) +// { +// int header = cookieWidget->cookiesTable->horizontalHeader()->sectionSizeHint(i); +// switch (i) +// { +// case 0: +// header = fm.width(QLatin1String("averagehost.domain.com")); +// break; +// case 1: +// header = fm.width(QLatin1String("_session_id")); +// break; +// case 4: +// header = fm.width(QDateTime::currentDateTime().toString(Qt::LocalDate)); +// break; +// } +// int buffer = fm.width(QLatin1String("xx")); +// header += buffer; +// cookieWidget->cookiesTable->horizontalHeader()->resizeSection(i, header); +// } +// cookieWidget->cookiesTable->horizontalHeader()->setStretchLastSection(true); +} - for (int i = 0; i < model->columnCount(); ++i) - { - int header = cookieWidget->cookiesTable->horizontalHeader()->sectionSizeHint(i); - switch (i) - { - case 0: - header = fm.width(QLatin1String("averagehost.domain.com")); - break; - case 1: - header = fm.width(QLatin1String("_session_id")); - break; - case 4: - header = fm.width(QDateTime::currentDateTime().toString(Qt::LocalDate)); - break; - } - int buffer = fm.width(QLatin1String("xx")); - header += buffer; - cookieWidget->cookiesTable->horizontalHeader()->resizeSection(i, header); - } - cookieWidget->cookiesTable->horizontalHeader()->setStretchLastSection(true); + +QSize CookiesDialog::sizeHint() const +{ + QRect desktopRect = QApplication::desktop()->screenGeometry(); + QSize size = desktopRect.size() * 0.8; + return size; } diff --git a/src/cookiedialog.h b/src/cookiedialog.h index fa78100c..e1b17356 100644 --- a/src/cookiedialog.h +++ b/src/cookiedialog.h @@ -70,6 +70,8 @@ class CookiesDialog : public KDialog public: explicit CookiesDialog(CookieJar *cookieJar, QWidget *parent = 0); + QSize sizeHint() const; + private: QSortFilterProxyModel *m_proxyModel; }; diff --git a/src/cookieexceptiondialog.cpp b/src/cookieexceptiondialog.cpp index dba47787..9cf95017 100644 --- a/src/cookieexceptiondialog.cpp +++ b/src/cookieexceptiondialog.cpp @@ -172,11 +172,19 @@ bool CookieExceptionsModel::removeRows(int row, int count, const QModelIndex &pa // ---------------------------------------------------------------------------------------------------------------- +// Qt Includes +#include <QtCore/QRect> +#include <QtCore/QSize> + +#include <QtGui/QDesktopWidget> + + CookiesExceptionsDialog::CookiesExceptionsDialog(CookieJar *cookieJar, QWidget *parent) : KDialog(parent) , m_cookieJar(cookieJar) , m_exceptionsWidget(new Ui::CookiesExceptionsWidget) { + setWindowFlags(Qt::Sheet); setCaption("Cookies Exceptions"); setButtons( KDialog::Ok ); @@ -184,11 +192,10 @@ CookiesExceptionsDialog::CookiesExceptionsDialog(CookieJar *cookieJar, QWidget * m_exceptionsWidget->setupUi(widget); setMainWidget(widget); - setWindowFlags(Qt::Sheet); - connect(m_exceptionsWidget->removeButton, SIGNAL(clicked()), m_exceptionsWidget->exceptionTable, SLOT(removeOne())); connect(m_exceptionsWidget->removeAllButton, SIGNAL(clicked()), m_exceptionsWidget->exceptionTable, SLOT(removeAll())); + m_exceptionsWidget->exceptionTable->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); m_exceptionsWidget->exceptionTable->verticalHeader()->hide(); m_exceptionsWidget->exceptionTable->setSelectionBehavior(QAbstractItemView::SelectRows); m_exceptionsWidget->exceptionTable->setAlternatingRowColors(true); @@ -201,6 +208,7 @@ CookiesExceptionsDialog::CookiesExceptionsDialog(CookieJar *cookieJar, QWidget * connect(m_exceptionsWidget->search, SIGNAL(textChanged(QString)), m_proxyModel, SLOT(setFilterFixedString(QString))); + m_exceptionsWidget->exceptionTable->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); m_exceptionsWidget->exceptionTable->setModel(m_proxyModel); connect(m_exceptionsWidget->domainLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(textChanged(const QString &))); @@ -208,28 +216,28 @@ CookiesExceptionsDialog::CookiesExceptionsDialog(CookieJar *cookieJar, QWidget * 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; - m_exceptionsWidget->exceptionTable->verticalHeader()->setDefaultSectionSize(height); - m_exceptionsWidget->exceptionTable->verticalHeader()->setMinimumSectionSize(-1); - for (int i = 0; i < m_exceptionsModel->columnCount(); ++i) - { - int header = m_exceptionsWidget->exceptionTable->horizontalHeader()->sectionSizeHint(i); - switch (i) - { - case 0: - header = fm.width(QLatin1String("averagebiglonghost.domain.com")); - break; - case 1: - header = fm.width(QLatin1String("Allow For Session")); - break; - } - int buffer = fm.width(QLatin1String("xx")); - header += buffer; - m_exceptionsWidget->exceptionTable->horizontalHeader()->resizeSection(i, header); - } +// QFont f = font(); +// f.setPointSize(10); +// QFontMetrics fm(f); +// int height = fm.height() + fm.height() / 3; +// m_exceptionsWidget->exceptionTable->verticalHeader()->setDefaultSectionSize(height); +// m_exceptionsWidget->exceptionTable->verticalHeader()->setMinimumSectionSize(-1); +// for (int i = 0; i < m_exceptionsModel->columnCount(); ++i) +// { +// int header = m_exceptionsWidget->exceptionTable->horizontalHeader()->sectionSizeHint(i); +// switch (i) +// { +// case 0: +// header = fm.width(QLatin1String("averagebiglonghost.domain.com")); +// break; +// case 1: +// header = fm.width(QLatin1String("Allow For Session")); +// break; +// } +// int buffer = fm.width(QLatin1String("xx")); +// header += buffer; +// m_exceptionsWidget->exceptionTable->horizontalHeader()->resizeSection(i, header); +// } } @@ -271,3 +279,11 @@ void CookiesExceptionsDialog::allowForSession() m_exceptionsModel->reset(); } + +QSize CookiesExceptionsDialog::sizeHint() const +{ + QRect desktopRect = QApplication::desktop()->screenGeometry(); + QSize size = desktopRect.size() * 0.6; + return size; +} + diff --git a/src/cookieexceptiondialog.h b/src/cookieexceptiondialog.h index 43afb58e..eb0608d1 100644 --- a/src/cookieexceptiondialog.h +++ b/src/cookieexceptiondialog.h @@ -75,6 +75,8 @@ class CookiesExceptionsDialog : public KDialog public: explicit CookiesExceptionsDialog(CookieJar *cookieJar, QWidget *parent = 0); + QSize sizeHint() const; + private slots: void block(); void allow(); diff --git a/src/cookies.ui b/src/cookies.ui index 6a654a97..ae1c4a2b 100644 --- a/src/cookies.ui +++ b/src/cookies.ui @@ -6,10 +6,16 @@ <rect> <x>0</x> <y>0</y> - <width>636</width> - <height>383</height> + <width>859</width> + <height>478</height> </rect> </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="windowTitle"> <string>Form</string> </property> diff --git a/src/cookiesexceptions.ui b/src/cookiesexceptions.ui index 0a756f56..3e28b42a 100644 --- a/src/cookiesexceptions.ui +++ b/src/cookiesexceptions.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>635</width> - <height>416</height> + <width>1000</width> + <height>400</height> </rect> </property> <property name="windowTitle"> |