Example #1
0
DeleteDialog::DeleteDialog( QWidget *parent, const char *name )
    : KDialog( parent ),
    m_trashGuiItem(i18n("&Send to Trash"), "user-trash-full")
{
//Swallow, Qt::WStyle_DialogBorder, parent, name,
        //true /* modal */, i18n("About to delete selected files"),
       // Ok | Cancel, Cancel /* Default */, true /* separator */
    setObjectName( name );
    setCaption( i18n("About to delete selected files") );
    setModal( true );
    setButtons( Ok | Cancel );
    setDefaultButton( Cancel );
    showButtonSeparator( true );

    m_widget = new DeleteWidget(this);
    m_widget->setObjectName("delete_dialog_widget");
    setMainWidget(m_widget);

    m_widget->setMinimumSize(400, 300);
    setMinimumSize(410, 326);
    adjustSize();

    slotShouldDelete(shouldDelete());
    connect(m_widget->ddShouldDelete, SIGNAL(toggled(bool)), SLOT(slotShouldDelete(bool)));

}
Example #2
0
DeleteDialog::DeleteDialog(QWidget* parent)
    : KDialog(parent),
      m_saveShouldDeleteUserPreference(true),
      m_saveDoNotShowAgainTrash(false),
      m_saveDoNotShowAgainPermanent(false),
      m_trashGuiItem(i18n("&Move to Trash"), "user-trash-full")
{
    setButtons(User1 | Cancel);
    setButtonFocus(User1);
    setModal(true);
    m_widget = new DeleteWidget(this);
    setMainWidget(m_widget);

    m_widget->setMinimumSize(400, 300);
    setMinimumSize(410, 326);
    adjustSize();

    slotShouldDelete(shouldDelete());

    connect(m_widget->m_shouldDelete, SIGNAL(toggled(bool)),
            this, SLOT(slotShouldDelete(bool)));

    connect(this, SIGNAL(user1Clicked()),
            this, SLOT(slotUser1Clicked()));
}
Example #3
0
DeleteWidget::DeleteWidget(QWidget *parent, const char *name)
    : DeleteDialogBase(parent, name)
{
    KConfigGroup messageGroup(KGlobal::config(), "FileRemover");

    bool deleteInstead = messageGroup.readBoolEntry("deleteInsteadOfTrash", false);
    slotShouldDelete(deleteInstead);
    ddShouldDelete->setChecked(deleteInstead);
}
Example #4
0
DeleteDialog::DeleteDialog(QWidget *parent, const char *name) :
    KDialogBase(Swallow, WStyle_DialogBorder, parent, name,
        true /* modal */, i18n("About to delete selected files"),
        Ok | Cancel, Cancel /* Default */, true /* separator */),
    m_trashGuiItem(i18n("&Send to Trash"), "trashcan_full")
{
    m_widget = new DeleteWidget(this, "delete_dialog_widget");
    setMainWidget(m_widget);

    m_widget->setMinimumSize(400, 300);
    setMinimumSize(410, 326);
    adjustSize();

    slotShouldDelete(shouldDelete());
    connect(m_widget->ddShouldDelete, SIGNAL(toggled(bool)), SLOT(slotShouldDelete(bool)));

}
Example #5
0
DeleteWidget::DeleteWidget(QWidget* parent)
    : QWidget(parent),
      m_listMode(DeleteDialogMode::Files),
      m_deleteMode(DeleteDialogMode::UseTrash)
{
    setObjectName("DeleteDialogBase");

    resize(540, 370);
    setMinimumSize(QSize(420, 320));

    m_checkBoxStack = new QStackedWidget(this);

    QLabel* logo = new QLabel(this);
    logo->setPixmap(QPixmap(KStandardDirs::locate("data", "digikam/data/logo-digikam.png"))
                    .scaled(64, 64, Qt::KeepAspectRatio, Qt::SmoothTransformation));

    m_warningIcon = new QLabel(this);
    m_warningIcon->setWordWrap(false);

    QSizePolicy sizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
    sizePolicy.setHeightForWidth(m_warningIcon->sizePolicy().hasHeightForWidth());
    sizePolicy.setHorizontalStretch(0);
    sizePolicy.setVerticalStretch(0);
    m_warningIcon->setSizePolicy(sizePolicy);

    m_deleteText = new QLabel(this);
    m_deleteText->setAlignment(Qt::AlignCenter);
    m_deleteText->setWordWrap(true);

    QHBoxLayout* hbox = new QHBoxLayout();
    hbox->setSpacing(KDialog::spacingHint());
    hbox->setMargin(0);
    hbox->addWidget(logo);
    hbox->addWidget(m_deleteText, 10);
    hbox->addWidget(m_warningIcon);

    m_fileList = new KListWidget(this);
    m_fileList->setSelectionMode(QAbstractItemView::SingleSelection);
    m_fileList->setToolTip(i18n("List of files that are about to be deleted."));
    m_fileList->setWhatsThis(i18n("This is the list of items that are about to be deleted."));

    m_numFiles = new QLabel(this);
    m_numFiles->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    m_numFiles->setWordWrap(false);

    m_shouldDelete = new QCheckBox(m_checkBoxStack);
    m_shouldDelete->setGeometry(QRect(0, 0, 542, 32));
    m_shouldDelete->setToolTip(i18n("If checked, files will be permanently removed instead of being placed "
                                    "in the Trash."));
    m_shouldDelete->setWhatsThis(i18n("<p>If this box is checked, files will be "
                                      "<b>permanently removed</b> instead of "
                                      "being placed in the Trash.</p>"
                                      "<p><em>Use this option with caution</em>: most filesystems "
                                      "are unable to "
                                      "undelete deleted files reliably.</p>"));
    m_shouldDelete->setText(i18n("&Delete files instead of moving them to the trash"));

    connect(m_shouldDelete, SIGNAL(toggled(bool)),
            this, SLOT(slotShouldDelete(bool)));

    m_doNotShowAgain = new QCheckBox(m_checkBoxStack);
    m_doNotShowAgain->setGeometry(QRect(0, 0, 100, 30));
    m_doNotShowAgain->setText(i18n("Do not &ask again"));

    QVBoxLayout* vbox = new QVBoxLayout(this);
    vbox->setSpacing(KDialog::spacingHint());
    vbox->setMargin(KDialog::spacingHint());
    vbox->setContentsMargins(0, 0, 0, 0);
    vbox->addLayout(hbox);
    vbox->addWidget(m_fileList, 10);
    vbox->addWidget(m_numFiles);
    vbox->addWidget(m_checkBoxStack);

    m_checkBoxStack->addWidget(m_shouldDelete);
    m_checkBoxStack->addWidget(m_doNotShowAgain);
    m_checkBoxStack->setCurrentWidget(m_shouldDelete);

    bool deleteInstead = !AlbumSettings::instance()->getUseTrash();
    slotShouldDelete(deleteInstead);
    m_shouldDelete->setChecked(deleteInstead);
}