PassRefPtr<ParsedCookie> CookieMap::removeOldestCookie() { // FIXME: Make sure it finds the GLOBAL oldest cookie, not the first oldestcookie it finds. RefPtr<ParsedCookie> oldestCookie = m_oldestCookie; // If this map has an oldestCookie, remove it. If not, do a DFS to search for a child that does if (!oldestCookie) { CookieLog("CookieMap - no oldestCookie exist"); // Base case is if the map has no child and no cookies, we return a null. if (!m_subdomains.size()) { CookieLog("CookieMap - no subdomains, base case reached, return 0"); return 0; } CookieLog("CookieMap - looking into subdomains"); for (HashMap<String, CookieMap*>::iterator it = m_subdomains.begin(); it != m_subdomains.end(); ++it) { oldestCookie = it->value->removeOldestCookie(); if (oldestCookie) break; } } else { CookieLog("CookieMap - oldestCookie exist."); oldestCookie = removeCookie(m_oldestCookie); } return oldestCookie; }
CookieManager::CookieManager(QWidget* parent) : QWidget(parent) , ui(new Ui::CookieManager) , m_refreshCookieJar(true) { ui->setupUi(this); qz_centerWidgetOnScreen(this); // Stored Cookies connect(ui->cookieTree, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), this, SLOT(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*))); connect(ui->removeAll, SIGNAL(clicked()), this, SLOT(removeAll())); connect(ui->removeOne, SIGNAL(clicked()), this, SLOT(removeCookie())); connect(ui->close, SIGNAL(clicked(QAbstractButton*)), this, SLOT(close())); connect(ui->close2, SIGNAL(clicked(QAbstractButton*)), this, SLOT(close())); connect(ui->search, SIGNAL(textChanged(QString)), ui->cookieTree, SLOT(filterString(QString))); // Cookie Filtering connect(ui->whiteAdd, SIGNAL(clicked()), this, SLOT(addWhitelist())); connect(ui->whiteRemove, SIGNAL(clicked()), this, SLOT(removeWhitelist())); connect(ui->blackAdd, SIGNAL(clicked()), this, SLOT(addBlacklist())); connect(ui->blackRemove, SIGNAL(clicked()), this, SLOT(removeBlacklist())); ui->search->setPlaceholderText(tr("Search")); ui->cookieTree->setDefaultItemShowMode(TreeWidget::ItemsCollapsed); ui->cookieTree->sortItems(0, Qt::AscendingOrder); ui->cookieTree->header()->setDefaultSectionSize(220); ui->cookieTree->setFocus(); QShortcut* removeShortcut = new QShortcut(QKeySequence("Del"), this); connect(removeShortcut, SIGNAL(activated()), this, SLOT(deletePressed())); }
void CookiesContentsWidget::populateCookies() { CookieJar *cookieJar = qobject_cast<CookieJar*>(NetworkManagerFactory::getCookieJar()); const QList<QNetworkCookie> cookies = cookieJar->getCookies(); for (int i = 0; i < cookies.count(); ++i) { addCookie(cookies.at(i)); } m_model->sort(0); m_ui->cookiesViewWidget->setViewMode(ItemViewWidget::TreeViewMode); m_ui->cookiesViewWidget->setModel(m_model); m_isLoading = false; emit loadingStateChanged(WindowsManager::FinishedLoadingState); connect(cookieJar, SIGNAL(cookieAdded(QNetworkCookie)), this, SLOT(addCookie(QNetworkCookie))); connect(cookieJar, SIGNAL(cookieRemoved(QNetworkCookie)), this, SLOT(removeCookie(QNetworkCookie))); connect(m_model, SIGNAL(modelReset()), this, SLOT(updateActions())); connect(m_ui->cookiesViewWidget, SIGNAL(needsActionsUpdate()), this, SLOT(updateActions())); }
CookieManager::CookieManager(QWidget* parent) : QDialog(parent) , ui(new Ui::CookieManager) , m_refreshCookieJar(true) { ui->setupUi(this); QzTools::centerWidgetOnScreen(this); if (isRightToLeft()) { ui->cookieTree->headerItem()->setTextAlignment(0, Qt::AlignRight | Qt::AlignVCenter); ui->cookieTree->headerItem()->setTextAlignment(1, Qt::AlignRight | Qt::AlignVCenter); ui->cookieTree->setLayoutDirection(Qt::LeftToRight); ui->whiteList->setLayoutDirection(Qt::LeftToRight); ui->blackList->setLayoutDirection(Qt::LeftToRight); } // Stored Cookies connect(ui->cookieTree, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*))); connect(ui->removeAll, SIGNAL(clicked()), this, SLOT(removeAll())); connect(ui->removeOne, SIGNAL(clicked()), this, SLOT(removeCookie())); connect(ui->close, SIGNAL(clicked(QAbstractButton*)), this, SLOT(close())); connect(ui->close2, SIGNAL(clicked(QAbstractButton*)), this, SLOT(close())); connect(ui->close3, SIGNAL(clicked(QAbstractButton*)), this, SLOT(close())); connect(ui->search, SIGNAL(textChanged(QString)), this, SLOT(filterString(QString))); // Cookie Filtering connect(ui->whiteAdd, SIGNAL(clicked()), this, SLOT(addWhitelist())); connect(ui->whiteRemove, SIGNAL(clicked()), this, SLOT(removeWhitelist())); connect(ui->blackAdd, SIGNAL(clicked()), this, SLOT(addBlacklist())); connect(ui->blackRemove, SIGNAL(clicked()), this, SLOT(removeBlacklist())); // Cookie Settings Settings settings; settings.beginGroup("Cookie-Settings"); ui->saveCookies->setChecked(settings.value("allowCookies", true).toBool()); if (!ui->saveCookies->isChecked()) { ui->deleteCookiesOnClose->setEnabled(false); } ui->deleteCookiesOnClose->setChecked(settings.value("deleteCookiesOnClose", false).toBool()); ui->allowThirdPartyCookies->setCurrentIndex(settings.value("allowThirdPartyCookies", 0).toInt()); ui->filterTracking->setChecked(settings.value("filterTrackingCookie", false).toBool()); settings.endGroup(); connect(ui->saveCookies, SIGNAL(toggled(bool)), this, SLOT(saveCookiesChanged(bool))); ui->search->setPlaceholderText(tr("Search")); ui->cookieTree->setDefaultItemShowMode(TreeWidget::ItemsCollapsed); ui->cookieTree->sortItems(0, Qt::AscendingOrder); ui->cookieTree->header()->setDefaultSectionSize(220); ui->cookieTree->setFocus(); QShortcut* removeShortcut = new QShortcut(QKeySequence("Del"), this); connect(removeShortcut, SIGNAL(activated()), this, SLOT(deletePressed())); QzTools::setWmClass("Cookies", this); refreshTable(); }
FCM_Dialog::FCM_Dialog(FCM_Plugin* manager, QWidget* parent) : QDialog(parent, Qt::WindowStaysOnTopHint) , ui(new Ui::FCM_Dialog) , m_manager(manager) { ui->setupUi(this); QzTools::centerWidgetOnScreen(this); ui->path->hide(); ui->labelPath->hide(); if (isRightToLeft()) { ui->flashCookieTree->headerItem()->setTextAlignment(0, Qt::AlignRight | Qt::AlignVCenter); ui->flashCookieTree->setLayoutDirection(Qt::LeftToRight); ui->whiteList->setLayoutDirection(Qt::LeftToRight); ui->blackList->setLayoutDirection(Qt::LeftToRight); } connect(ui->flashCookieTree, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*))); connect(ui->removeAll, SIGNAL(clicked()), this, SLOT(removeAll())); connect(ui->removeOne, SIGNAL(clicked()), this, SLOT(removeCookie())); connect(ui->close, SIGNAL(clicked(QAbstractButton*)), this, SLOT(close())); connect(ui->close2, SIGNAL(clicked(QAbstractButton*)), this, SLOT(close())); connect(ui->close3, SIGNAL(clicked(QAbstractButton*)), this, SLOT(close())); connect(ui->search, SIGNAL(textChanged(QString)), this, SLOT(filterString(QString))); connect(ui->reloadFromDisk, SIGNAL(clicked()), this, SLOT(reloadFromDisk())); connect(ui->whiteAdd, SIGNAL(clicked()), this, SLOT(addWhitelist())); connect(ui->whiteRemove, SIGNAL(clicked()), this, SLOT(removeWhitelist())); connect(ui->blackAdd, SIGNAL(clicked()), this, SLOT(addBlacklist())); connect(ui->blackRemove, SIGNAL(clicked()), this, SLOT(removeBlacklist())); connect(ui->autoMode, SIGNAL(toggled(bool)), ui->notification, SLOT(setEnabled(bool))); connect(ui->autoMode, SIGNAL(toggled(bool)), ui->labelNotification, SLOT(setEnabled(bool))); connect(ui->browseFlashDataPath, SIGNAL(clicked()), this, SLOT(selectFlashDataPath())); ui->autoMode->setChecked(m_manager->readSettings().value("autoMode").toBool()); ui->notification->setEnabled(m_manager->readSettings().value("autoMode").toBool()); ui->notification->setChecked(m_manager->readSettings().value("notification").toBool()); ui->deleteAllOnStartExit->setChecked(m_manager->readSettings().value("deleteAllOnStartExit").toBool()); ui->flashDataPath->setText(m_manager->flashPlayerDataPath()); ui->labelNotification->setEnabled(ui->autoMode->isChecked()); ui->search->setPlaceholderText(tr("Search")); ui->flashCookieTree->setDefaultItemShowMode(TreeWidget::ItemsCollapsed); ui->flashCookieTree->sortItems(0, Qt::AscendingOrder); ui->flashCookieTree->header()->setDefaultSectionSize(220); ui->flashCookieTree->setFocus(); QShortcut* removeShortcut = new QShortcut(QKeySequence("Del"), this); connect(removeShortcut, SIGNAL(activated()), this, SLOT(deletePressed())); QzTools::setWmClass("FlashCookies", this); }
void CookiesContentsWidget::populateCookies() { CookieJar *cookieJar = qobject_cast<CookieJar*>(NetworkManagerFactory::getCookieJar()); const QList<QNetworkCookie> cookies = cookieJar->getCookies(); for (int i = 0; i < cookies.count(); ++i) { addCookie(cookies.at(i)); } m_model->sort(0); m_ui->cookiesView->setModel(m_model); m_isLoading = false; emit loadingChanged(false); connect(cookieJar, SIGNAL(cookieAdded(QNetworkCookie)), this, SLOT(addCookie(QNetworkCookie))); connect(cookieJar, SIGNAL(cookieRemoved(QNetworkCookie)), this, SLOT(removeCookie(QNetworkCookie))); connect(m_model, SIGNAL(modelReset()), this, SLOT(updateActions())); connect(m_ui->cookiesView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(updateActions())); }