Log Message: ----------- Auto-discover locally installed servers when registered by the Win32 binary installer.
Modified Files: -------------- pgadmin3: CHANGELOG.txt (r1.119 -> r1.120) pgadmin3/pkg/win32: pgadmin3.wsi (r1.16 -> r1.17) pgadmin3.wsm (r1.1 -> r1.2) pgadmin3/src: pgAdmin3.dsp (r1.105 -> r1.106) pgadmin3/src/include: pgServer.h (r1.34 -> r1.35) pgadmin3/src/ui: frmMain.cpp (r1.97 -> r1.98)
Index: CHANGELOG.txt =================================================================== RCS file: /projects/pgadmin3/CHANGELOG.txt,v retrieving revision 1.119 retrieving revision 1.120 diff -LCHANGELOG.txt -LCHANGELOG.txt -u -w -r1.119 -r1.120 --- CHANGELOG.txt +++ CHANGELOG.txt @@ -16,21 +16,23 @@ </ul> <br> <ul> - <li>2004-01-27 AP Reworked schema prefixing - <li>2004-01-25 AP support of pg_xxx_size if available - <li>2004-01-21 AP Improved disconnect handling - <li>2004-01-21 AP StatusBar with size handle for frmStatus, dlgFunction and dlgView - <li>2004-01-21 AP Update ServerStatus to pg_logdir_ls - <li>2004-01-21 AP catch SIGPIPE - <li>2004-01-20 AP owner, name, comment refactoring in dlgProperty - <li>2004-01-20 AP support of function parameters - <li>2004-01-20 AP tablespace changes - <li>2004-01-19 AP fix dependency display for tablespaces and users - <li>2004-01-18 AP Update ServerStatus to pg_logfiles_ls and pg_file_read/pg_file_length - <li>2004-01-18 AP Allow change of some function attributes - <li>2004-01-12 AP Fix check constraint in table reengineering - <li>2004-01-11 AP Fix combobox size/position issue on gtk - <li>2004-01-11 AP Fix button height issue with modern gtk themes + + <li>2004-08-02 DP Auto-discover locally installed servers when registered by the Win32 binary installer. + <li>2004-07-27 AP Reworked schema prefixing + <li>2004-07-25 AP support of pg_xxx_size if available + <li>2004-07-21 AP Improved disconnect handling + <li>2004-07-21 AP StatusBar with size handle for frmStatus, dlgFunction and dlgView + <li>2004-07-21 AP Update ServerStatus to pg_logdir_ls + <li>2004-07-21 AP catch SIGPIPE + <li>2004-07-20 AP owner, name, comment refactoring in dlgProperty + <li>2004-07-20 AP support of function parameters + <li>2004-07-20 AP tablespace changes + <li>2004-07-19 AP fix dependency display for tablespaces and users + <li>2004-07-18 AP Update ServerStatus to pg_logfiles_ls and pg_file_read/pg_file_length + <li>2004-07-18 AP Allow change of some function attributes + <li>2004-07-12 AP Fix check constraint in table reengineering + <li>2004-07-11 AP Fix combobox size/position issue on gtk + <li>2004-07-11 AP Fix button height issue with modern gtk themes <li>2004-06-30 AP Tablespace ACLs <li>2004-06-23 DP Split Windows installer into a merge module and installer to allow inclusion in other packages. <li>2004-06-23 DP Allow cancelling of queries and termination of backends from server status dialogue for 7.5+. Index: pgAdmin3.dsp =================================================================== RCS file: /projects/pgadmin3/src/pgAdmin3.dsp,v retrieving revision 1.105 retrieving revision 1.106 diff -Lsrc/pgAdmin3.dsp -Lsrc/pgAdmin3.dsp -u -w -r1.105 -r1.106 --- src/pgAdmin3.dsp +++ src/pgAdmin3.dsp @@ -1566,5 +1566,89 @@ SOURCE=..\TODO.txt # End Source File # End Group +# Begin Source File + +SOURCE=.\ui\wx\msw\blank.cur +# End Source File +# Begin Source File + +SOURCE=.\ui\wx\msw\bullseye.cur +# End Source File +# Begin Source File + +SOURCE=.\ui\wx\msw\cdrom.ico +# End Source File +# Begin Source File + +SOURCE=.\ui\wx\msw\computer.ico +# End Source File +# Begin Source File + +SOURCE=.\ui\wx\msw\drive.ico +# End Source File +# Begin Source File + +SOURCE=.\ui\wx\msw\file1.ico +# End Source File +# Begin Source File + +SOURCE=.\ui\wx\msw\floppy.ico +# End Source File +# Begin Source File + +SOURCE=.\ui\wx\msw\folder1.ico +# End Source File +# Begin Source File + +SOURCE=.\ui\wx\msw\folder2.ico +# End Source File +# Begin Source File + +SOURCE=.\ui\wx\msw\hand.cur +# End Source File +# Begin Source File + +SOURCE=.\ui\wx\msw\magnif1.cur +# End Source File +# Begin Source File + +SOURCE=.\ui\wx\msw\noentry.cur +# End Source File +# Begin Source File + +SOURCE=.\ui\wx\msw\pbrush.cur +# End Source File +# Begin Source File + +SOURCE=.\ui\wx\msw\pencil.cur +# End Source File +# Begin Source File + +SOURCE=.\ui\wx\msw\pntleft.cur +# End Source File +# Begin Source File + +SOURCE=.\ui\wx\msw\pntright.cur +# End Source File +# Begin Source File + +SOURCE=.\ui\wx\msw\query.cur +# End Source File +# Begin Source File + +SOURCE=.\ui\wx\msw\removble.ico +# End Source File +# Begin Source File + +SOURCE=.\ui\wx\msw\rightarr.cur +# End Source File +# Begin Source File + +SOURCE=.\ui\wx\msw\roller.cur +# End Source File +# Begin Source File + +SOURCE=.\ui\wx\msw\watch1.cur +# End Source File # End Target # End Project Index: pgServer.h =================================================================== RCS file: /projects/pgadmin3/src/include/pgServer.h,v retrieving revision 1.34 retrieving revision 1.35 diff -Lsrc/include/pgServer.h -Lsrc/include/pgServer.h -u -w -r1.34 -r1.35 --- src/include/pgServer.h +++ src/include/pgServer.h @@ -46,6 +46,11 @@ bool GetTrusted() const { return trusted; } wxString GetLastError() const; + bool GetDiscovered() const { return discovered; } + void iSetDiscovered(const bool b) { discovered=b; } + wxString GetServiceID() const { return serviceId; } + void iSetServiceID(const wxString& s) { serviceId=s; } + bool GetCreatePrivilege() const { return createPrivilege; } void iSetCreatePrivilege(const bool b) { createPrivilege=b; } bool GetSuperUser() const { return superUser; } @@ -93,9 +98,9 @@ pgConn *conn; bool connected; wxString database, username, password, ver, error; - wxString lastDatabase, lastSchema, description; + wxString lastDatabase, lastSchema, description, serviceId; int port, ssl; - bool trusted, createPrivilege, superUser; + bool trusted, discovered, createPrivilege, superUser; OID lastSystemOID; wxString versionNum; frmMain *parentWin; Index: frmMain.cpp =================================================================== RCS file: /projects/pgadmin3/src/ui/frmMain.cpp,v retrieving revision 1.97 retrieving revision 1.98 diff -Lsrc/ui/frmMain.cpp -Lsrc/ui/frmMain.cpp -u -w -r1.97 -r1.98 --- src/ui/frmMain.cpp +++ src/ui/frmMain.cpp @@ -765,12 +765,18 @@ wxTreeItemId item = browser->GetFirstChild(servers, cookie); while (item) { + data = (pgObject *)browser->GetItemData(item); if (data->GetType() == PG_SERVER) { - // We have a sever, so cast the object and save the settings - ++numServers; + + // Cast the object, and check if it was autodiscovered before saving. server = (pgServer *)data; + if (!server->GetDiscovered()) { + + // We have an 'added' server, so save it + ++numServers; + // Hostname key.Printf(wxT("Servers/Server%d"), numServers); settings->Write(key, server->GetName()); @@ -804,6 +810,17 @@ key.Printf(wxT("Servers/SSL%d"), numServers); settings->Write(key, server->GetSSL()); + + } else { + + // This is a discovered server, so just store the lastSchema/lastDatabase + key.Printf(wxT("Servers/LastDatabase-%s"), server->GetServiceID()); + settings->Write(key, server->GetLastDatabase()); + + // last Schema + key.Printf(wxT("Servers/LastSchema-%s"), server->GetServiceID()); + settings->Write(key, server->GetLastSchema()); + } } // Get the next item @@ -812,7 +829,6 @@ // Write the server count settings->Write(wxT("Servers/Count"), numServers); - wxLogInfo(wxT("Stored %d servers."), numServers); } @@ -871,13 +887,61 @@ server = new pgServer(servername, description, database, username, port, StrToBool(trusted), ssl); server->iSetLastDatabase(lastDatabase); server->iSetLastSchema(lastSchema); + server->iSetDiscovered(false); + browser->AppendItem(servers, server->GetFullName(), PGICON_SERVERBAD, -1, server); + } + +#ifdef WIN32 + + // Add local servers. Will currently only work on Win32 with >= BETA3 + // of the Win32 PostgreSQL installer. + wxRegKey *pgKey = new wxRegKey(wxT("HKEY_LOCAL_MACHINE\\Software\\PostgreSQL\\Services")); + + wxString svcName; + long cookie = 0; + bool flag = false; + + flag = pgKey->GetFirstKey(svcName, cookie); + + while (flag != false) + { + key.Printf(wxT("HKEY_LOCAL_MACHINE\\Software\\PostgreSQL\\Services\\%s"), svcName); + wxRegKey *svcKey = new wxRegKey(key); + + // Comment + svcKey->QueryValue(wxT("Display Name"), description); + + // Username + svcKey->QueryValue(wxT("Database Superuser"), username); + + // last Database + key.Printf(wxT("Servers/LastDatabase-%s"), svcName); + settings->Read(key, &lastDatabase, wxT("")); + + // last Schema + key.Printf(wxT("Servers/LastSchema-%s"), svcName); + settings->Read(key, &lastSchema, wxT("")); + + // Add the Server node + server = new pgServer(wxT("127.0.0.1"), description, wxT("template1"), username, 5432, false, false); + server->iSetLastDatabase(lastDatabase); + server->iSetLastSchema(lastSchema); + server->iSetDiscovered(true); + server->iSetServiceID(svcName); browser->AppendItem(servers, server->GetFullName(), PGICON_SERVERBAD, -1, server); + + // Get the next one... + flag = pgKey->GetNextKey(svcName, cookie); } + +#endif //WIN32 + // Reset the Servers node text wxString label; label.Printf(_("Servers (%d)"), browser->GetChildrenCount(servers, FALSE)); browser->SetItemText(servers, label); + }
---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster