Created attachment 53965 [details] screenshot of MySQL-specific UI When connecting to a PostgreSQL database (through PostgreSQL-SDBC driver), we currently just ask the user to type a conninfo string. That's familiar to PostgreSQL experts, but other people would benefit from some hand-holding. Implement a PostgreSQL-specific UI to get the connection info, along the lines of the MySQL-specific UI we already have. The file you need to change in LibreOffice is dbaccess/source/ui/dlg/ConnectionHelper.cxx, in function IMPL_LINK(OConnectionHelper, OnBrowseConnections, PushButton*, /*_pButton*/) there is a big switch ( eType ) We need to add a case for PostgreSQL. You can take inspiration from the MySQL case. You may also need to adapt ODbDataSourceAdministrationHelper::getConnectionURL() in file DbAdminImpl.cxx, as well as ODbTypeWizDialog::determineNextState in file dbwiz to activate a new state ADDITIONAL_PAGE_PGSQL, which you have to create first. Finally, the dialog itself would be in file dbaccess/source/ui/dlg/dbadminsetup.src, in a to-be-created section TabPage PAGE_DBWIZARD_PGSQL. You could just generate a conninfo string from that, but I'd prefer if you set it as properties of the datasouce/database/..., so that the driver gets it through the same interface as the username and password; cf handling of these for inspiration. There is already support for that in the driver, see connectivity/source/drivers/postgresql/pq_connection.cxx, function properties2arrays. POssibly you need to extend the handling there to support more keywords. Please *also* allow advanced users to enter a conninfo string, and mixing of entering a conninfo string (like now) and information through widgets in the specific UI. See http://developer.postgresql.org/pgdocs/postgres/libpq-connect.html#LIBPQ-PQCONNECTDBPARAMS for an up-to-date list of all recognised connection settings. Make a decision on which of these settings make or do not make sense to give a friendly UI for.
I also renamed Date::IsValid() to Date::IsValidAndGregorian() to clarify and added Date::IsValidDate() that does not check for the Gregorian
(In reply to comment #1) > I also renamed Date::IsValid() to Date::IsValidAndGregorian() to clarify > and added Date::IsValidDate() that does not check for the Gregorian I think that was in the wrong bug.
I apologise for the noise I contributed in comment 1; I intended only to add myself to the cc of the bug. (I do not even remember having copied that text at all, let alone having pasted it.)
adding LibreOffice developer list as CC to unresolved EasyHacks for better visibility. see e.g. http://nabble.documentfoundation.org/minutes-of-ESC-call-td4076214.html for details
Adding self to CC if not already on
Migrating Whiteboard tags to Keywords: (EasyHack SkillCpp SkillVcl TopicUI) [NinjaEdit]
JanI is default CC for Easy Hacks (Add Jan; remove LibreOffice Dev List from CC) [NinjaEdit]
I sent following for this patch; https://gerrit.libreoffice.org/#/c/23602/
You'll need to create new dialogs (.ui files) for that. This is done with a tool called "Glade", run from a shell after doing export GLADE_CATALOG_SEARCH_PATH=${PATH_TO_BUILT_LIBREOFFICE_SOURCE_TREE}/instdir/share/glade You can use the ones we have for MySQL as inspiration: dbaccess/uiconfig/ui/dbwizmysqlnativepage.ui dbaccess/uiconfig/ui/mysqlnativepage.ui dbaccess/uiconfig/ui/mysqlnativesettings.ui
Please add keyword 'needsUXEval' and CC 'libreoffice-ux-advise@lists.freedesktop.org' if input from UX is needed.
*** Bug 132476 has been marked as a duplicate of this bug. ***
Current Link for PQconnectdbParams https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PQCONNECTDBPARAMS
Hi. I'd love to work on this feature. I have two questions: 1) I cannot find the file dbaccess/source/ui/dlg/dbadminsetup.src. It seems like there is no file with this name anymore. Was this changed in some patch? 2) I didn't understand this part: "but I'd prefer if you set it as properties of the datasouce/database/..., so that the driver gets it through the same interface as the username and password". Can someone please explain what this means? Also, I have postgres installed on my machine. Will that be enough to test all aspects of this feature? Thanks!
(In reply to Siddhant Chaudhary from comment #13) > 1) I cannot find the file dbaccess/source/ui/dlg/dbadminsetup.src. It seems > like there is no file with this name anymore. Was this changed in some patch? Yes, all .src files were removed in commit 00657aef09d854c74fb426a935a3e8b1fc390bb0 Author: Caolán McNamara <caolanm@redhat.com> Date: Sun Jun 11 20:56:30 2017 +0100 migrate to boost::gettext AS the commit message says: * all .src files go away and the english source strings folded into the .hrc as NC_("context", "source string") So this is now in dbaccess/inc/strings.hrc > 2) I didn't understand this part: "but I'd prefer if you set it as > properties of the datasouce/database/..., so that the driver gets it through > the same interface as the username and password". Can someone please explain > what this means? It means that the values set in the UI should be set as properties on the data source object, in the same way the username and password already are now. Now, the password is set in property PROPERTY_PASSWORD (which is "Password"), the username in PROPERTY_USER ("User"). You will put the TCP port to connect to in property "port", the database name in property "dbname", etc. > > Also, I have postgres installed on my machine. Will that be enough to test > all aspects of this feature? > > Thanks!
@Lionel Elie Mamane could please state all the updated requirements. Just to be sure that I do not work on unnecessary things
(In reply to nirnaykorde from comment #15) > @Lionel Elie Mamane could please state all the updated requirements. Just to > be sure that I do not work on unnecessary things See https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PARAMKEYWORDS for the list of recognised connection keywords; at first glance the following make sense to include in the UI, the others can be typed in manually in the connstring by experts: host port dbname user password service MAYBE (but maybe too confusing for newbies? behind an "advanced fold option"... or leave them out altogether): gssencmode sslmode sslcert passfile sslkey sslpassword sslrootcert sslcrl sslcrldir requirepeer ssl_min_protocol_version ssl_max_protocol_version krbsrvname gsslib (on Windows only) DO NOT include in the UI: client_encoding application_name
I am assigning this hack to myself
(In reply to Lionel Elie Mamane from comment #0) > Created attachment 53965 [details] > screenshot of MySQL-specific UI > > When connecting to a PostgreSQL database (through PostgreSQL-SDBC driver), > we currently just ask the user to type a conninfo string. That's familiar to > PostgreSQL experts, but other people would benefit from some hand-holding. > > Implement a PostgreSQL-specific UI to get the connection info, along the > lines of the MySQL-specific UI we already have. > > > The file you need to change in LibreOffice is > dbaccess/source/ui/dlg/ConnectionHelper.cxx, in function > > IMPL_LINK(OConnectionHelper, OnBrowseConnections, PushButton*, > /*_pButton*/) > > there is a big > > switch ( eType ) > > We need to add a case for PostgreSQL. You can take inspiration from the > MySQL case. > > You may also need to adapt > ODbDataSourceAdministrationHelper::getConnectionURL() in file > DbAdminImpl.cxx, as well as ODbTypeWizDialog::determineNextState in file > dbwiz to activate a new state ADDITIONAL_PAGE_PGSQL, which you have to > create first. > > Finally, the dialog itself would be in file > dbaccess/source/ui/dlg/dbadminsetup.src, in a to-be-created section TabPage > PAGE_DBWIZARD_PGSQL. > > You could just generate a conninfo string from that, but I'd prefer if you > set it as properties of the datasouce/database/..., so that the driver gets > it through the same interface as the username and password; cf handling of > these for inspiration. There is already support for that in the driver, see > connectivity/source/drivers/postgresql/pq_connection.cxx, function > properties2arrays. POssibly you need to extend the handling there to support > more keywords. I cant find datasouce/database/... has the name of the directory changed ? > Please *also* allow advanced users to enter a conninfo string, and mixing of > entering a conninfo string (like now) and information through widgets in the > specific UI. See > http://developer.postgresql.org/pgdocs/postgres/libpq-connect.html#LIBPQ- > PQCONNECTDBPARAMS for an up-to-date list of all recognised connection > settings. Make a decision on which of these settings make or do not make > sense to give a friendly UI for.
(In reply to nirnaykorde from comment #20) > (In reply to Lionel Elie Mamane from comment #0) > > You could just generate a conninfo string from that, but I'd prefer if you > > set it as properties of the datasouce/database/..., so that the driver gets > > it through the same interface as the username and password; cf handling of > > these for inspiration. There is already support for that in the driver, see > > connectivity/source/drivers/postgresql/pq_connection.cxx, function > > properties2arrays. POssibly you need to extend the handling there to support > > more keywords. > > I cant find datasouce/database/... has the name of the directory changed ? That is not referring to any directory. Read it as "datasource or database".
My proposed solution for this bug is as follows: For postgres to have a gui similar to mysql(in connect to existing database) we can: 1)instead of starting of the connection settings start of a page similar to mysql where instead of choosing the drivers we allow the user to use either a connstring or a gui interface. 2)if the the user selects connstring the next page would be the original connection settings page which appears after choosing postgres OR if the user chooses the GUI the users next page would be a copy of the MySQL JDBC driver connection page and the data would be used to feed the data in properties. 3)Both the page lead to user authentication page and rest is same Do let me know if something seems wrong.
(In reply to nirnaykorde from comment #22) > My proposed solution for this bug is as follows: Your plan is reasonable. However, I would rather do it in a way that "the GUI" has an extra field for "connstring" and the user can fill in things in "the GUI" and also at the same time in the connstring. All the information given, both in "the GUI" and in the connstring is given to libpq (whichever takes precedence is up to the postgresql-sdbc layer and/or libpq)
I was able to find the JDBC GUI by searching but the connstring for postgresql,I havent been able to find. Is it being implemented through generalpage.cxx ?
Yes, PostgreSQL currently just uses the generic UI.
I have for the most part figured it out. One of the questions I have is if I implement something of the sort OGeneralSpecialJDBCConnectionPageSetup::OGeneralSpecialJDBCConnectionPageSetup( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rCoreAttrs ,sal_uInt16 _nPortId, TranslateId pDefaultPortResId, TranslateId pHelpTextResId, TranslateId pHeaderTextResId, TranslateId pDriverClassId) from DBSetupConnectionPages.cxx How would the postgres driver class need to be handled in that case since in the generic code it somewhat difficult to figure out
nirnay committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/afe99617707c92460e66486c0057ef327e8aa017 tdf#43369: Specific UI for collecting PostgreSQL connection settings It will be available in 7.6.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Perhaps this should be added to the release notes of version 7.6 so it would show some advances in Base
Similarly, the Help page must be updated https://help.libreoffice.org/master/en-US/text/sdatabase/dabawiz02pgsql.html?DbPAR=BASE#bm_id861587404584956
Olivier Hallot committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/90f40e996fe1aaa93606f7e1b1fb60882bcf058b tdf#43369 Refactor PosgresSQL connection setup It will be available in 24.2.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.