move filter consts to each db file

This commit is contained in:
mappu 2024-07-14 15:27:54 +12:00
parent 53e9b6555e
commit 1ac96eb133
3 changed files with 9 additions and 4 deletions

View File

@ -14,6 +14,10 @@ import (
"go.etcd.io/bbolt/version" "go.etcd.io/bbolt/version"
) )
const (
boltFilter = "Bolt database|*.db|All files|*.*"
)
type boltLoadedDatabase struct { type boltLoadedDatabase struct {
displayName string displayName string
path string path string

View File

@ -14,6 +14,7 @@ import (
const ( const (
sqliteTablesCaption = "Tables" sqliteTablesCaption = "Tables"
sqliteFilter = "SQLite database|*.db;*.db3;*.sqlite;*.sqlite3|All files|*.*"
) )
type sqliteLoadedDatabase struct { type sqliteLoadedDatabase struct {

View File

@ -332,7 +332,7 @@ func (f *TMainForm) OnFormCreate(sender vcl.IObject) {
func (f *TMainForm) OnMnuFileBoltNewClick(sender vcl.IObject) { func (f *TMainForm) OnMnuFileBoltNewClick(sender vcl.IObject) {
dlg := vcl.NewSaveDialog(f) dlg := vcl.NewSaveDialog(f)
dlg.SetTitle("Save database as...") dlg.SetTitle("Save database as...")
dlg.SetFilter("Bolt database|*.db|All files|*.*") dlg.SetFilter(boltFilter)
ret := dlg.Execute() // Fake blocking ret := dlg.Execute() // Fake blocking
if ret { if ret {
f.boltAddDatabaseFromFile(dlg.FileName(), false) f.boltAddDatabaseFromFile(dlg.FileName(), false)
@ -342,7 +342,7 @@ func (f *TMainForm) OnMnuFileBoltNewClick(sender vcl.IObject) {
func (f *TMainForm) OnMnuFileBoltOpenClick(sender vcl.IObject) { func (f *TMainForm) OnMnuFileBoltOpenClick(sender vcl.IObject) {
dlg := vcl.NewOpenDialog(f) dlg := vcl.NewOpenDialog(f)
dlg.SetTitle("Select a database file...") dlg.SetTitle("Select a database file...")
dlg.SetFilter("Bolt database|*.db|All files|*.*") dlg.SetFilter(boltFilter)
ret := dlg.Execute() // Fake blocking ret := dlg.Execute() // Fake blocking
if ret { if ret {
f.boltAddDatabaseFromFile(dlg.FileName(), false) f.boltAddDatabaseFromFile(dlg.FileName(), false)
@ -352,7 +352,7 @@ func (f *TMainForm) OnMnuFileBoltOpenClick(sender vcl.IObject) {
func (f *TMainForm) OnMnuFileBoltOpenReadonlyClick(sender vcl.IObject) { func (f *TMainForm) OnMnuFileBoltOpenReadonlyClick(sender vcl.IObject) {
dlg := vcl.NewOpenDialog(f) dlg := vcl.NewOpenDialog(f)
dlg.SetTitle("Select a database file...") dlg.SetTitle("Select a database file...")
dlg.SetFilter("Bolt database|*.db|All files|*.*") dlg.SetFilter(boltFilter)
ret := dlg.Execute() // Fake blocking ret := dlg.Execute() // Fake blocking
if ret { if ret {
f.boltAddDatabaseFromFile(dlg.FileName(), true) f.boltAddDatabaseFromFile(dlg.FileName(), true)
@ -364,7 +364,7 @@ func (f *TMainForm) OnMnuFileSqliteOpenClick(sender vcl.IObject) {
dlg := vcl.NewOpenDialog(f) dlg := vcl.NewOpenDialog(f)
dlg.SetTitle("Select a database file...") dlg.SetTitle("Select a database file...")
dlg.SetFilter("SQLite database|*.db;*.db3;*.sqlite;*.sqlite3|All files|*.*") dlg.SetFilter(sqliteFilter)
ret := dlg.Execute() // Fake blocking ret := dlg.Execute() // Fake blocking
if ret { if ret {
f.sqliteAddDatabaseFromFile(dlg.FileName(), cliDriver) f.sqliteAddDatabaseFromFile(dlg.FileName(), cliDriver)