wxArrayString DbSettingDialog::DoLoadSqliteHistory() { clConfig config(DBE_CONFIG_FILE); DbExplorerSettings settings; config.ReadItem(&settings); return settings.GetRecentFiles(); }
void SQLCommandPanel::OnHistoryToolClicked(wxAuiToolBarEvent& event) { wxAuiToolBar* auibar = dynamic_cast<wxAuiToolBar*>(event.GetEventObject()); if ( auibar ) { clAuiToolStickness ts(auibar, event.GetToolId()); wxRect rect = auibar->GetToolRect(event.GetId()); wxPoint pt = auibar->ClientToScreen(rect.GetBottomLeft()); pt = ScreenToClient(pt); DbExplorerSettings settings; clConfig conf(DBE_CONFIG_FILE); conf.ReadItem(&settings); settings.GetRecentFiles(); wxArrayString sqls = settings.GetSqlHistory(); wxMenu menu; for(size_t i=0; i<sqls.GetCount(); ++i) { menu.Append(wxID_HIGHEST+i, sqls.Item(i)); } int pos = GetPopupMenuSelectionFromUser(menu, pt); if ( pos == wxID_NONE ) return; size_t index = pos - wxID_HIGHEST; if ( index > sqls.GetCount() ) return; m_scintillaSQL->SetText( sqls.Item(index) ); CallAfter( &SQLCommandPanel::ExecuteSql ); } }
void DbSettingDialog::DoSaveSqliteHistory() { // Save the recent opened files clConfig config(DBE_CONFIG_FILE); DbExplorerSettings settings; config.ReadItem(&settings); wxArrayString files = settings.GetRecentFiles(); wxString filename = m_filePickerSqlite->GetPath(); filename.Trim().Trim(false); if(filename.IsEmpty()) return; files.Insert(filename, 0); settings.SetRecentFiles(files); config.WriteItem(&settings); }