示例#1
0
void VEditTab::checkFileChangeOutside()
{
    if (!m_checkFileChange) {
        return;
    }

    if (m_file->isChangedOutside()) {
        int ret = VUtils::showMessage(QMessageBox::Information,
                                      tr("Information"),
                                      tr("Note <span style=\"%1\">%2</span> has been modified by another program.")
                                        .arg(g_config->c_dataTextStyle).arg(m_file->fetchPath()),
                                      tr("Do you want to reload it?"),
                                      QMessageBox::Yes | QMessageBox::No,
                                      QMessageBox::Yes,
                                      this);
        switch (ret) {
        case QMessageBox::Yes:
            reloadFromDisk();
            break;

        case QMessageBox::No:
            m_checkFileChange = false;
            m_fileDiverged = true;
            updateStatus();
            break;

        default:
            Q_ASSERT(false);
            break;
        }
    }
}
示例#2
0
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);
}