mirror of https://github.com/OpenTTD/OpenTTD
Cleanup: remove warning about server administrators being able to read passwords
parent
849d1fa1b3
commit
1a3cbaec56
|
@ -308,7 +308,6 @@ STR_SHOW_HIDDEN_ENGINES_VEHICLE_AIRCRAFT_TOOLTIP :{BLACK}By enabl
|
|||
STR_BUTTON_DEFAULT :{BLACK}Default
|
||||
STR_BUTTON_CANCEL :{BLACK}Cancel
|
||||
STR_BUTTON_OK :{BLACK}OK
|
||||
STR_WARNING_PASSWORD_SECURITY :{YELLOW}Warning: Server administrators may be able to read any text entered here.
|
||||
|
||||
# On screen keyboard window
|
||||
STR_OSK_KEYBOARD_LAYOUT :`1234567890-=\qwertyuiop[]asdfghjkl;' zxcvbnm,./ .
|
||||
|
|
|
@ -948,7 +948,6 @@ struct QueryStringWindow : public Window
|
|||
{
|
||||
QueryString editbox; ///< Editbox.
|
||||
QueryStringFlags flags; ///< Flags controlling behaviour of the window.
|
||||
Dimension warning_size; ///< How much space to use for the warning text
|
||||
|
||||
QueryStringWindow(StringID str, StringID caption, uint max_bytes, uint max_chars, WindowDesc *desc, Window *parent, CharSetFilter afilter, QueryStringFlags flags) :
|
||||
Window(desc), editbox(max_bytes, max_chars)
|
||||
|
@ -965,27 +964,12 @@ struct QueryStringWindow : public Window
|
|||
this->flags = flags;
|
||||
|
||||
this->InitNested(WN_QUERY_STRING);
|
||||
this->UpdateWarningStringSize();
|
||||
|
||||
this->parent = parent;
|
||||
|
||||
this->SetFocusedWidget(WID_QS_TEXT);
|
||||
}
|
||||
|
||||
void UpdateWarningStringSize()
|
||||
{
|
||||
if (this->flags & QSF_PASSWORD) {
|
||||
assert(this->nested_root->smallest_x > 0);
|
||||
this->warning_size.width = this->nested_root->current_x - WidgetDimensions::scaled.frametext.Horizontal() - WidgetDimensions::scaled.framerect.Horizontal();
|
||||
this->warning_size.height = GetStringHeight(STR_WARNING_PASSWORD_SECURITY, this->warning_size.width);
|
||||
this->warning_size.height += WidgetDimensions::scaled.frametext.Vertical() + WidgetDimensions::scaled.framerect.Vertical();
|
||||
} else {
|
||||
this->warning_size = Dimension{ 0, 0 };
|
||||
}
|
||||
|
||||
this->ReInit();
|
||||
}
|
||||
|
||||
void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override
|
||||
{
|
||||
if (widget == WID_QS_DEFAULT && (this->flags & QSF_ENABLE_DEFAULT) == 0) {
|
||||
|
@ -994,20 +978,6 @@ struct QueryStringWindow : public Window
|
|||
resize.width = 0;
|
||||
size.width = 0;
|
||||
}
|
||||
|
||||
if (widget == WID_QS_WARNING) {
|
||||
size = this->warning_size;
|
||||
}
|
||||
}
|
||||
|
||||
void DrawWidget(const Rect &r, WidgetID widget) const override
|
||||
{
|
||||
if (widget != WID_QS_WARNING) return;
|
||||
|
||||
if (this->flags & QSF_PASSWORD) {
|
||||
DrawStringMultiLine(r.Shrink(WidgetDimensions::scaled.framerect).Shrink(WidgetDimensions::scaled.frametext),
|
||||
STR_WARNING_PASSWORD_SECURITY, TC_FROMSTRING, SA_CENTER);
|
||||
}
|
||||
}
|
||||
|
||||
void SetStringParameters(WidgetID widget) const override
|
||||
|
@ -1061,7 +1031,6 @@ static constexpr NWidgetPart _nested_query_string_widgets[] = {
|
|||
NWidget(WWT_PANEL, COLOUR_GREY),
|
||||
NWidget(WWT_EDITBOX, COLOUR_GREY, WID_QS_TEXT), SetMinimalSize(256, 12), SetFill(1, 1), SetPadding(2, 2, 2, 2),
|
||||
EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, WID_QS_WARNING), EndContainer(),
|
||||
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
|
||||
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_QS_DEFAULT), SetMinimalSize(87, 12), SetFill(1, 1), SetDataTip(STR_BUTTON_DEFAULT, STR_NULL),
|
||||
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_QS_CANCEL), SetMinimalSize(86, 12), SetFill(1, 1), SetDataTip(STR_BUTTON_CANCEL, STR_NULL),
|
||||
|
|
|
@ -20,7 +20,6 @@ enum QueryStringFlags {
|
|||
QSF_ACCEPT_UNCHANGED = 0x01, ///< return success even when the text didn't change
|
||||
QSF_ENABLE_DEFAULT = 0x02, ///< enable the 'Default' button ("\0" is returned)
|
||||
QSF_LEN_IN_CHARS = 0x04, ///< the length of the string is counted in characters
|
||||
QSF_PASSWORD = 0x08, ///< password entry box, show warning about password security
|
||||
};
|
||||
|
||||
DECLARE_ENUM_AS_BIT_SET(QueryStringFlags)
|
||||
|
|
|
@ -32,7 +32,6 @@ enum AboutWidgets : WidgetID {
|
|||
enum QueryStringWidgets : WidgetID {
|
||||
WID_QS_CAPTION, ///< Caption of the window.
|
||||
WID_QS_TEXT, ///< Text of the query.
|
||||
WID_QS_WARNING, ///< Warning label about password security
|
||||
WID_QS_DEFAULT, ///< Default button.
|
||||
WID_QS_CANCEL, ///< Cancel button.
|
||||
WID_QS_OK, ///< OK button.
|
||||
|
|
Loading…
Reference in New Issue