Qt: Apply selected bookmark display filter
When selecting a display filter from the bookmark list this filter should be applied, because that's the most common action for a user. Holding down the the Alt key will only prepare the filter. Change-Id: I567ee8a2a70a3de07fea33fa5763d9efba591de3 Reviewed-on: https://code.wireshark.org/review/20317 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Roland Knall <rknall@gmail.com>
This commit is contained in:
parent
807fe8ed99
commit
cf1d07c8e3
|
@ -379,7 +379,7 @@ void DisplayFilterEdit::updateBookmarkMenu()
|
|||
|
||||
QAction *prep_action = bb_menu->addAction(prep_text);
|
||||
prep_action->setData(df_def->strval);
|
||||
connect(prep_action, SIGNAL(triggered(bool)), this, SLOT(prepareFilter()));
|
||||
connect(prep_action, SIGNAL(triggered(bool)), this, SLOT(applyOrPrepareFilter()));
|
||||
}
|
||||
|
||||
checkFilter();
|
||||
|
@ -564,12 +564,17 @@ void DisplayFilterEdit::showExpressionPrefs()
|
|||
emit showPreferencesDialog(PreferencesDialog::ppFilterExpressions);
|
||||
}
|
||||
|
||||
void DisplayFilterEdit::prepareFilter()
|
||||
void DisplayFilterEdit::applyOrPrepareFilter()
|
||||
{
|
||||
QAction *pa = qobject_cast<QAction*>(sender());
|
||||
if (!pa || pa->data().toString().isEmpty()) return;
|
||||
|
||||
setText(pa->data().toString());
|
||||
|
||||
// Holding down the Alt key will only prepare filter.
|
||||
if (!(QApplication::keyboardModifiers() & Qt::AltModifier)) {
|
||||
applyDisplayFilter();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -62,7 +62,7 @@ private slots:
|
|||
void removeFilter();
|
||||
void showFilters();
|
||||
void showExpressionPrefs();
|
||||
void prepareFilter();
|
||||
void applyOrPrepareFilter();
|
||||
|
||||
private:
|
||||
DisplayFilterEditType type_;
|
||||
|
|
|
@ -1682,7 +1682,10 @@ void MainWindow::displayFilterButtonClicked()
|
|||
|
||||
if (dfb_action) {
|
||||
df_combo_box_->lineEdit()->setText(dfb_action->data().toString());
|
||||
df_combo_box_->applyDisplayFilter();
|
||||
// Holding down the Alt key will only prepare filter.
|
||||
if (!(QApplication::keyboardModifiers() & Qt::AltModifier)) {
|
||||
df_combo_box_->applyDisplayFilter();
|
||||
}
|
||||
df_combo_box_->lineEdit()->setFocus();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue