From 4681e405efa2a920340782b9bb545ba304c2eb5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 13 Jan 2016 22:24:07 +0100 Subject: [PATCH] MatchHeader: Fixed crash with action, use tooltips. * When an action was already set, a menu item was being selected before the menu had been created -- must have happened on some refactoring. * Use tooltips rather than fill the header/value text controls with some help texts. --- .../match_header/ConfigView.cpp | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/add-ons/mail_daemon/inbound_filters/match_header/ConfigView.cpp b/src/add-ons/mail_daemon/inbound_filters/match_header/ConfigView.cpp index 7f3172e442..1d8ba84aaa 100644 --- a/src/add-ons/mail_daemon/inbound_filters/match_header/ConfigView.cpp +++ b/src/add-ons/mail_daemon/inbound_filters/match_header/ConfigView.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2004-2012, Haiku, Inc. All rights reserved. + * Copyright 2004-2016, Haiku, Inc. All rights reserved. * Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved. * * Distributed under the terms of the MIT License. @@ -70,13 +70,14 @@ RuleFilterConfig::RuleFilterConfig(const BMailAddOnSettings& addOnSettings) MatchHeaderSettings settings(addOnSettings); fAction = settings.Action(); - fAttributeControl = new BTextControl("attr", B_TRANSLATE("If"), - B_TRANSLATE("header (e.g. Subject)"), NULL); + fAttributeControl = new BTextControl("attr", B_TRANSLATE("If"), NULL, NULL); + fAttributeControl->SetToolTip( + B_TRANSLATE("Header field (e.g. Subject, From, ...)")); fAttributeControl->SetText(settings.Attribute()); - fRegexControl = new BTextControl("regex", B_TRANSLATE("has"), - B_TRANSLATE("value (use REGEX: in front of regular expressions like " - "*spam*)"), NULL); + fRegexControl = new BTextControl("regex", B_TRANSLATE("has"), NULL, NULL); + fRegexControl->SetToolTip(B_TRANSLATE("Wildcard value like \"*spam*\".\n" + "Prefix with \"REGEX:\" in order to use regular expressions.")); fRegexControl->SetText(settings.Expression()); fFileControl = new FileControl("arg", NULL, @@ -108,14 +109,8 @@ RuleFilterConfig::RuleFilterConfig(const BMailAddOnSettings& addOnSettings) item->SetMarked(true); } - fAccountField = new BMenuField("reply", "Foo", fAccountMenu); - if (fAction >= 0) { - BMenuItem* item = fActionMenu->ItemAt(fAction); - if (item != NULL) { - item->SetMarked(true); - MessageReceived(item->Message()); - } - } + fAccountField = new BMenuField("reply", B_TRANSLATE("Account"), + fAccountMenu); // Popuplate action menu @@ -140,6 +135,13 @@ RuleFilterConfig::RuleFilterConfig(const BMailAddOnSettings& addOnSettings) BMenuField* actionField = new BMenuField("action", B_TRANSLATE("Then"), fActionMenu); + if (fAction >= 0) { + BMenuItem* item = fActionMenu->ItemAt(fAction); + if (item != NULL) { + item->SetMarked(true); + MessageReceived(item->Message()); + } + } // Build layout