File indexing completed on 2024-05-19 04:59:14

0001 /* ============================================================
0002 * FlashCookieManager plugin for Falkon
0003 * Copyright (C) 2014  S. Razi Alavizadeh <s.r.alavizadeh@gmail.com>
0004 *
0005 * This program is free software: you can redistribute it and/or modify
0006 * it under the terms of the GNU General Public License as published by
0007 * the Free Software Foundation, either version 3 of the License, or
0008 * (at your option) any later version.
0009 *
0010 * This program is distributed in the hope that it will be useful,
0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013 * GNU General Public License for more details.
0014 *
0015 * You should have received a copy of the GNU General Public License
0016 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
0017 * ============================================================ */
0018 #include "fcm_notification.h"
0019 #include "ui_fcm_notification.h"
0020 #include "iconprovider.h"
0021 #include "fcm_plugin.h"
0022 
0023 FCM_Notification::FCM_Notification(FCM_Plugin* manager, int newOriginsCount)
0024     : AnimatedWidget(AnimatedWidget::Down, 300, nullptr)
0025     , ui(new Ui::FCM_Notification)
0026     , m_manager(manager)
0027 {
0028     setAutoFillBackground(true);
0029     ui->setupUi(widget());
0030 
0031     ui->close->setIcon(IconProvider::standardIcon(QStyle::SP_DialogCloseButton));
0032 
0033     if (newOriginsCount == 1) {
0034         ui->textLabel->setText(tr("A new flash cookie was detected"));
0035     }
0036     else {
0037         ui->textLabel->setText(tr("%1 new flash cookies were detected").arg(newOriginsCount));
0038     }
0039     connect(ui->buttonView, SIGNAL(clicked()), m_manager, SLOT(showFlashCookieManager()));
0040     connect(ui->buttonView, SIGNAL(clicked()), this, SLOT(hide()));
0041     connect(ui->close, SIGNAL(clicked()), this, SLOT(hide()));
0042 
0043     startAnimation();
0044 }
0045 
0046 FCM_Notification::~FCM_Notification()
0047 {
0048     delete ui;
0049 }