void HttpFileDownLoadServlet::initImpl(void) throw (mxcore::Exception&) { std::map<std::string, std::vector<std::string> >::const_iterator it = params_.find("allow"); if (it != params_.end()) { addFilters(allowList_, it->second); } it = params_.find("denine"); if (it != params_.end()) { addFilters(denineList_, it->second); } }
FilterView::FilterView( FilterTool *tool, QWidget* parent ) : AbstractToolWidget( parent ), mTool( tool ) { QVBoxLayout *baseLayout = new QVBoxLayout( this ); baseLayout->setMargin( 0 ); // filter QHBoxLayout *operationLayout = new QHBoxLayout(); QLabel *label = new QLabel( i18nc("@label:listbox operation to use by the filter","Operation:"), this ); mOperationComboBox = new KComboBox( this ); connect( mOperationComboBox, SIGNAL(activated(int)), SLOT(onOperationChange(int)) ); label->setBuddy( mOperationComboBox ); const QString operationToolTip = i18nc("@info:tooltip","The operation to use for the filter."); label->setToolTip( operationToolTip ); mOperationComboBox->setToolTip( operationToolTip ); const QString operationWhatsThis = i18nc("@info:whatsthis","Select the operation to use for the filter."); label->setWhatsThis( operationWhatsThis ); mOperationComboBox->setWhatsThis( operationWhatsThis ); operationLayout->addWidget( label ); operationLayout->addWidget( mOperationComboBox, 10 ); baseLayout->addLayout( operationLayout ); QGroupBox *parameterSetBox = new QGroupBox( i18nc("@title:group","Parameters"), this ); baseLayout->addWidget( parameterSetBox ); QVBoxLayout *parameterSetLayout = new QVBoxLayout; parameterSetBox->setLayout( parameterSetLayout ); mParameterSetEditStack = new QStackedWidget( parameterSetBox ); parameterSetLayout->addWidget( mParameterSetEditStack ); // filter button QHBoxLayout *buttonLayout = new QHBoxLayout(); buttonLayout->addStretch( 10 ); mFilterButton = new KPushButton( KGuiItem(i18nc("@action:button","&Filter"), QLatin1String("run-build"), i18nc("@info:tooltip","Executes the filter for the bytes in the selected range."), i18nc("@info:whatsthis", "If you press the <interface>Filter</interface> button, the operation you selected " "above is executed for the bytes in the selected range with the given options.")), this ); mFilterButton->setEnabled( mTool->hasWriteable() ); connect( mTool, SIGNAL(hasWriteableChanged(bool)), SLOT(onHasWriteableChanged(bool)) ); connect( mTool, SIGNAL(charCodecChanged(QString)), SLOT(onCharCodecChanged(QString)) ); connect( mFilterButton, SIGNAL(clicked(bool)), SLOT(onFilterClicked()) ); addButton( mFilterButton, AbstractToolWidget::Default ); buttonLayout->addWidget( mFilterButton ); baseLayout->addLayout( buttonLayout ); baseLayout->addStretch( 10 ); // automatically set focus to the parameters if a operation has been selected QAbstractItemView* operationComboBoxListView = mOperationComboBox->view(); QObject::connect( operationComboBoxListView, SIGNAL(activated(QModelIndex)), mParameterSetEditStack, SLOT(setFocus()) ); // TODO: is a workaround for Qt 4.5.1 which doesn't emit activated() for mouse clicks QObject::connect( operationComboBoxListView, SIGNAL(pressed(QModelIndex)), mParameterSetEditStack, SLOT(setFocus()) ); // TODO: goto filter button if there are no parameters addFilters(); }