+void CookiesDialog::addCookieFromDialog(const QNetworkCookie &cookie) const
+{
+ // Add the cookie to the cookie list and the cookie store.
+ emit addCookie(cookie);
+
+ // Add the cookie to the VBox layout.
+ addCookieToLayout(cookie);
+}
+
+void CookiesDialog::addCookieToLayout(const QNetworkCookie &cookie) const
+{
+ // Create a cookie display widget.
+ QWidget *cookieDisplayWidgetPointer = new QWidget();
+
+ // Instantiate the cookie widget dialog UI.
+ Ui::CookieDisplayWidget cookieDisplayWidgetUi;
+
+ // Setup the UI.
+ cookieDisplayWidgetUi.setupUi(cookieDisplayWidgetPointer);
+
+ // Get handles for the views.
+ QLabel *domainLabelPointer = cookieDisplayWidgetUi.domainLabel;
+ QLabel *nameLabelPointer = cookieDisplayWidgetUi.nameLabel;
+ QLabel *expirationDateLabelPointer = cookieDisplayWidgetUi.expirationDateLabel;
+ QLabel *pathLabelPointer = cookieDisplayWidgetUi.pathLabel;
+ QCheckBox *httpOnlyCheckBoxPointer = cookieDisplayWidgetUi.httpOnlyCheckBox;
+ QCheckBox *secureCheckBoxPointer = cookieDisplayWidgetUi.secureCheckBox;
+ QLabel *valueLabelPointer = cookieDisplayWidgetUi.valueLabel;
+
+ // Populate the views.
+ domainLabelPointer->setText("<font size=\"+1\"><b>" + cookie.domain() + "</b></font>");
+ nameLabelPointer->setText("<font size=\"+1\"><b>" + cookie.name() + "</b></font>");
+ expirationDateLabelPointer->setText("<b>" + cookie.expirationDate().toString() + "</b>");
+ pathLabelPointer->setText("<b>" + cookie.path() + "</b>");
+ httpOnlyCheckBoxPointer->setChecked(cookie.isHttpOnly());
+ secureCheckBoxPointer->setChecked(cookie.isSecure());
+ valueLabelPointer->setText("<b>" + cookie.value() + "</b>");
+
+ // Add the cookie display widget to the cookies VBox layout.
+ cookiesVBoxLayoutPointer->addWidget(cookieDisplayWidgetPointer);
+
+ // Create a line.
+ QFrame *lineFrame = new QFrame();
+
+ // Format the line.
+ lineFrame->setFrameShape(QFrame::HLine);
+ lineFrame->setFrameShadow(QFrame::Sunken);
+
+ // Add the line to the cookies VBox layout.
+ cookiesVBoxLayoutPointer->addWidget(lineFrame);
+}
+
+void CookiesDialog::showAddCookieMessageBox() const
+{
+ // Instantiate an add cookie dialog.
+ QDialog *addCookieDialogPointer = new AddCookieDialog();
+
+ // Show the dialog.
+ addCookieDialogPointer->show();
+
+ // Add the cookie if directed.
+ connect(addCookieDialogPointer, SIGNAL(addCookie(QNetworkCookie)), this, SLOT(addCookieFromDialog(QNetworkCookie)));
+}
+