Make style.
Improve the handling of the dirty flag in the query tool:

Attached patch adds member variable to track last origin of query
modification:
    ORIGIN_MANUAL - edited directly by user
    ORIGIN_FILE - loaded from file
    ORIGIN_INITIAL - passed into constructor
    ORIGIN_HISTORY - picked from "previous queries"
    ORIGIN_GQB - generated by query builder

Such approach allows for some enhancements of user's experience.
I've implemented the following in this patch:

1. Text initialization in constructor isn't considered a change, so it
will not ask for save confirmation if left intact.

2. Allow to "Save As" the initial text immediately, without having to
modify text in order to enable save button. Also the behaviour
shouldn't depend on settings->GetStickySql(), because there are other
use-cases not related to this option (for example, insert-scripts on a
table).

3. Skip confirmation to replace query text by GQB if previously it was
generated by GQB and was left intact.