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))); }
void DeleteDialog::slotUser1Clicked() { // Save user's preference AlbumSettings* settings = AlbumSettings::instance(); if (m_saveShouldDeleteUserPreference) { settings->setUseTrash(!shouldDelete()); } if (m_saveDoNotShowAgainTrash) { kDebug() << "setShowTrashDeleteDialog " << !m_widget->m_doNotShowAgain->isChecked(); settings->setShowTrashDeleteDialog(!m_widget->m_doNotShowAgain->isChecked()); } if (m_saveDoNotShowAgainPermanent) { kDebug() << "setShowPermanentDeleteDialog " << !m_widget->m_doNotShowAgain->isChecked(); settings->setShowPermanentDeleteDialog(!m_widget->m_doNotShowAgain->isChecked()); } settings->saveSettings(); KDialog::accept(); }
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())); }
void CPortmap::freePorts(San2::Utils::CProducerConsumer<std::shared_ptr<San2::Network::CCapsule> > *applicationQueue) { FILE_LOG(logDEBUG4) << "CPortmap::freePorts():: freeing ports \n"; // thanks to http://stackoverflow.com/questions/4600567/c-deleting-elements-with-iterator std::function<bool (std::pair<unsigned short int, San2::Utils::CProducerConsumer<std::shared_ptr<San2::Network::CCapsule> >*>)> shouldDelete = [applicationQueue] (std::pair<unsigned short int, San2::Utils::CProducerConsumer<std::shared_ptr<San2::Network::CCapsule> >*> pair) -> bool { return pair.second == applicationQueue; }; std::map<unsigned short int, San2::Utils::CProducerConsumer<std::shared_ptr<San2::Network::CCapsule> >*>::iterator itr = mapPorts.begin(); while (itr != mapPorts.end()) { if (shouldDelete(*itr)) { std::map<unsigned short int, San2::Utils::CProducerConsumer<std::shared_ptr<San2::Network::CCapsule> >*>::iterator toErase = itr; ++itr; mapPorts.erase(toErase); FILE_LOG(logDEBUG4) << "CPortmap::freePorts():: port has been freed OK\n"; } else { ++itr; } } }
void DeleteDialog::accept() { KConfigGroup messageGroup(KGlobal::config(), "FileRemover"); // Save user's preference messageGroup.writeEntry("deleteInsteadOfTrash", shouldDelete()); messageGroup.sync(); KDialogBase::accept(); }
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))); }