diff --git a/ctl/ctlNavigatePanel.cpp b/ctl/ctlNavigatePanel.cpp index cf5605e..5baadfc 100644 --- a/ctl/ctlNavigatePanel.cpp +++ b/ctl/ctlNavigatePanel.cpp @@ -437,6 +437,7 @@ bool ctlNavigatePanel::RunKeyCommand(wxKeyEvent& event,int numCmd) { } if (help) { wxMessageBox(helpstr, _("Help")); + return true; } } return false; diff --git a/ctl/ctlSQLResult.cpp b/ctl/ctlSQLResult.cpp index 37a9007..bc07136 100644 --- a/ctl/ctlSQLResult.cpp +++ b/ctl/ctlSQLResult.cpp @@ -387,7 +387,7 @@ wxString ctlSQLResult::GenerateTemplate(wxString &templ,int action) if (c=='a') isalign=true; else if (c=='e') e.flags.no_quote=true; else { - wxString msg=wxString::Format(_("Incorrect flag at the %s column."),col); + wxString msg=wxString::Format(_("Incorrect flag at the '%s' column."),col); if (action == 0) wxMessageBox(msg); return msg; } @@ -409,13 +409,13 @@ wxString ctlSQLResult::GenerateTemplate(wxString &templ,int action) if (c=='@') { isvar=false; if (col.Len()==0) { - wxString msg=wxString::Format(_("The column name empty. %s ."),templ.substr(startvarpos,pos-startvarpos)); + wxString msg=wxString::Format(_("The column name empty. '%s' ."),templ.substr(startvarpos,pos-startvarpos)); if (action == 0) wxMessageBox(msg); return msg; } int idx=colNames.Index(col); if (idx==wxNOT_FOUND) { - wxString msg=wxString::Format(_("The column name %s was not found in the query results."),col); + wxString msg=wxString::Format(_("The column name '%s' was not found in the query results."),col); if (action == 0) wxMessageBox(msg); return msg; } @@ -439,7 +439,7 @@ wxString ctlSQLResult::GenerateTemplate(wxString &templ,int action) } if (isvar ) { - wxString msg=wxString::Format(_("The column name %s is not closed."),col); + wxString msg=wxString::Format(_("The column name '%s' is not closed."),col); if (action == 0) wxMessageBox(msg); return msg; } diff --git a/frm/frmLog.cpp b/frm/frmLog.cpp index 17672c3..ccddaf4 100644 --- a/frm/frmLog.cpp +++ b/frm/frmLog.cpp @@ -406,6 +406,10 @@ void MyThread::getFilename() { while (!set->Eof()) { wxString fn = set->GetVal(wxT("filename")); + if (fn.AfterLast(sepPath).CmpNoCase("db.csv")==0) { + set->MoveNext(); + continue; + } wxString key = wxString::Format("%lu_server_%s",i,fn); info_files inf; long len= set->GetLong(wxT("len")); diff --git a/frm/frmQuery.cpp b/frm/frmQuery.cpp index 0c3dbbe..939649a 100644 --- a/frm/frmQuery.cpp +++ b/frm/frmQuery.cpp @@ -575,20 +575,22 @@ frmQuery::frmQuery(frmMain *form, const wxString &_title, pgConn *_conn, const w entries[idx++].Set(wxACCEL_CTRL, (int)'E', MNU_EXECUTE); entries[idx++].Set(wxACCEL_CTRL, (int)'O', MNU_OPEN); entries[idx++].Set(wxACCEL_CTRL, (int)'S', MNU_SAVE); - entries[idx++].Set(wxACCEL_CMD, (int)'S', MNU_SAVE); entries[idx++].Set(wxACCEL_CTRL, (int)'F', MNU_FIND); entries[idx++].Set(wxACCEL_CTRL, (int)'R', MNU_REPLACE); entries[idx++].Set(wxACCEL_NORMAL, WXK_F8, MNU_EXECUTE); entries[idx++].Set(wxACCEL_NORMAL, WXK_F7, MNU_EXPLAIN); entries[idx++].Set(wxACCEL_ALT, WXK_PAUSE, MNU_CANCEL); entries[idx++].Set(wxACCEL_CTRL, (int)'A', MNU_SELECTALL); - entries[idx++].Set(wxACCEL_CMD, (int)'A', MNU_SELECTALL); entries[idx++].Set(wxACCEL_NORMAL, WXK_F1, MNU_HELP); entries[idx++].Set(wxACCEL_CTRL, (int)'N', MNU_NEW); entries[idx++].Set(wxACCEL_NORMAL, WXK_F6, MNU_EXECPGS); entries[idx++].Set(wxACCEL_NORMAL, WXK_F5, MNU_EXECFILE); entries[idx++].Set(wxACCEL_CTRL, (int)'T', MNU_NEWSQLTAB); + entries[idx++].Set(wxACCEL_CTRL, (int)'1', MNU_GENERATESQL+1); + entries[idx++].Set(wxACCEL_CTRL, (int)'2', MNU_GENERATESQL+2); + + wxAcceleratorTable accel(idx, entries); SetAcceleratorTable(accel); wxLogInfo(wxT("frmQuery::Create key map Ok")); @@ -2311,14 +2313,17 @@ void frmQuery::OnCopy_WhereList(wxCommandEvent& ev) void frmQuery::OnGenerateInvoke(wxCommandEvent& ev) { // if (currentControl() == sqlResult) - int id=ev.GetId(); - wxMenu* mi = static_cast(ev.GetEventObject()); - wxString templ = mi->GetHelpString(id); + int id=ev.GetId()-MNU_GENERATESQL-1; + wxString s = _("No template generate."); + //wxMenu* mi = static_cast(ev.GetEventObject()); + if (id>=0 && idGenerateTemplate(templ,0); SetStatusText(s, STATUSPOS_MSGS); } + } else + SetStatusText(s, STATUSPOS_MSGS); } void frmQuery::OnCopy_TableToHtml(wxCommandEvent& ev) { @@ -4577,13 +4582,15 @@ void frmQuery::OnSqlBookPageChanging(wxAuiNotebookEvent& event) } if (sqlQueryBook->GetPageCount() > 1) { - size_t curpage = sqlQueryBook->GetSelection(); - sqlQuery = wxDynamicCast(sqlQueryBook->GetPage(curpage), ctlSQLBox); - if (sqlQuery != NULL) - { - //wxString activePage = sqlNotebook->GetPageText(curpage); - wxString activePage = sqlQuery->GetTitle(false); - fileMarkerActive(false, activePage); + int curpage = sqlQueryBook->GetSelection(); + if (curpage!=wxNOT_FOUND) { + sqlQuery = wxDynamicCast(sqlQueryBook->GetPage(curpage), ctlSQLBox); + if (sqlQuery != NULL) + { + //wxString activePage = sqlNotebook->GetPageText(curpage); + wxString activePage = sqlQuery->GetTitle(false); + fileMarkerActive(false, activePage); + } } } } diff --git a/frm/frmStatus.cpp b/frm/frmStatus.cpp index 529cc28..e9c5b4f 100644 --- a/frm/frmStatus.cpp +++ b/frm/frmStatus.cpp @@ -4803,9 +4803,18 @@ void frmStatus::OnMoveMouseLog(wxMouseEvent& event) void frmStatus::OnRightClickLogGrid(wxListEvent& event) { delayHitLog->Stop(); - wxMenu* logListPopupMenu; - logListPopupMenu = nav->GetPopupMenu(); - logList->PopupMenu(logListPopupMenu, event.GetPoint()); + lastmouse = wxGetMousePosition(); + wxTimerEvent tm; + //logList->GetItem(); + //int flags = wxLIST_HITTEST_ONITEMLABEL; + //long item=logList->HitTest(mp,flags); + long item=event.GetIndex(); + lastlogitem=item; + lastlogitemShow=-1; + OnTimerHintLog(tm); +// wxMenu* logListPopupMenu; +// logListPopupMenu = nav->GetPopupMenu(); +// logList->PopupMenu(logListPopupMenu, event.GetPoint()); } diff --git a/frm/plugins.cpp b/frm/plugins.cpp index 25593d6..71831d7 100644 --- a/frm/plugins.cpp +++ b/frm/plugins.cpp @@ -259,6 +259,9 @@ wxWindow *pluginUtilityFactory::StartDialog(frmMain *form, pgObject *obj) // Remember this as the last plugin used form->SetLastPluginUtility(this); + if (!(form->GetLastPluginUtility() && form->GetLastPluginUtility()->CheckEnable(obj))) { + return 0; + } // Replace all the place holders with appropriate values if (HaveDatabase(obj)) @@ -297,6 +300,7 @@ wxWindow *pluginUtilityFactory::StartDialog(frmMain *form, pgObject *obj) // Blank the rest if (obj && obj->GetMetaType() == PGM_SERVER) { pgServer* srv = (pgServer*) obj; + execCmd.Replace(wxT("$$TITLE"), title); execCmd.Replace(wxT("$$HOSTNAME"), srv->GetName()); execCmd.Replace(wxT("$$USERNAME"), srv->GetUsername()); execCmd.Replace(wxT("$$PORT"), NumToStr((long)srv->GetPort())); @@ -405,7 +409,60 @@ bool pluginUtilityFactory::CheckEnable(pgObject *obj) if (obj && applies_to.Count() > 0) { if (applies_to.Index(wxString(obj->GetFactory()->GetTypeName()).Lower()) == wxNOT_FOUND) - return false; + if (applies_to.Index("puttyforward") == wxNOT_FOUND) + return false; + else { + //"puttyforward" + int id=GetId(); + if (winMain==NULL) return false; + wxMenu *m=winMain->GetPluginsMenu(); + m->SetLabel(id,"[Putty tunnel forward]"); + if (obj->GetMetaType()==PGM_SERVER) { + pgServer* srv = (pgServer*) obj; + wxString host=obj->GetName(); + wxString sport=NumToStr((long)srv->GetPort()); + wxString f ; + bool isfound=false; + title="[puttyforward]"; + if (host.CmpNoCase("localhost")==0 ||host=="127.0.0.1") { + wxString path=wxFileName::GetHomeDir()+sepPath+".putty"+sepPath+"sessions"; + if (wxDirExists(path)) { + f = wxFindFirstFile(path+sepPath+"*"); + while ( !f.empty() ) + { + wxString filename=f.AfterLast(sepPath); + { + wxString fcont=FileRead(f); + wxStringTokenizer tkz(fcont, wxT("\n")); + + // Loop round the lines in the file. Everytime we find a new 'Title' value + // we create the current plugin and start a new one + while(tkz.HasMoreTokens()) + { + wxString token = tkz.GetNextToken(); + if (token.Lower().StartsWith(wxT("portforwardings="))) + { + wxString forward = token.AfterFirst('=').Trim(); + wxString port=forward.BeforeFirst('=').Trim(); + if (port.Len()>0 && port[0]=='L' && sport==port.substr(1)) { + // found putty config + title=filename; + m->SetLabel(id,title); + isfound=true; + return true; + } + } + + } + + } + f = wxFindNextFile(); + } + } + } + } + return false; + } } // If we don't need a database, we're always OK. diff --git a/tests/test_Formatter.cpp b/tests/test_Formatter.cpp index c86ed8d..6de21cd 100644 --- a/tests/test_Formatter.cpp +++ b/tests/test_Formatter.cpp @@ -317,7 +317,7 @@ delete from t2 using t4,t5 where t4.id=t5 and t2.id=t4.id returning t2.id; end )"); std::vector list = f2.ParsePLpgsql(); o=f2.GetListTable(list); - exp = "[ f1,] \n[ f2,] \n[ tab1,] \n[ f3,] \n[ f4,] \n[ t2,] \n[ t5,] \n"; + exp = "[ f1,] \n[ f2,] \n[ tab1,] \n[ f3,] \n[ f4,] \n[ t2,] \n[ t4,] \n[ t5,] \n"; CHECK(o==exp); } diff --git a/x64/Release/pgAdmin3.exe b/x64/Release/pgAdmin3.exe index db73c52..01ade00 100644 Binary files a/x64/Release/pgAdmin3.exe and b/x64/Release/pgAdmin3.exe differ