Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add flag to avoid UI prompt if a style already exists in the DB #6968

Closed
wants to merge 1 commit into from

Conversation

Gustry
Copy link
Contributor

@Gustry Gustry commented May 10, 2018

Description

Adding a flag to avoid this window when you save styles in DB programmatically:
screenshot from 2018-05-10 19-38-06

I think I'm not doing a API break like this. Is-it fine?

Checklist

Reviewing is a process done by project maintainers, mostly on a volunteer basis. We try to keep the overhead as small as possible and appreciate if you help us to do so by completing the following items. Feel free to ask in a comment if you have troubles with any of them.

  • Commit messages are descriptive and explain the rationale for changes
  • Commits which fix bugs include fixes #11111 in the commit message next to the description
  • Commits which add new features are tagged with [FEATURE] in the commit message
  • Commits which change the UI or existing user workflows are tagged with [needs-docs] in the commit message and contain sufficient information in the commit message to be documented
  • I have read the QGIS Coding Standards and this PR complies with them
  • This PR passes all existing unit tests (test results will be reported by travis-ci after opening this PR)
  • New unit tests have been added for core changes
  • I have run the scripts/prepare-commit.sh script before each commit

@nyalldawson
Copy link
Collaborator

Hmm.. current handling of this is pretty gross -- we really shouldn't be mixing the gui in here at all.

What do you think about instead adding a "style exists" method, and then moving the messagebox up to app, and making saveStyleToDatabase always overwrite?

@Gustry
Copy link
Contributor Author

Gustry commented May 22, 2018

I did it for postgresql provider. Spatialite and OGR look tedious ;-)

@nyalldawson
Copy link
Collaborator

New code looks good -- you'll just need to update the postgres provider tests to match (and add some tests for the new function)

QgsDataSourceUri dsUri( mLayer->dataProvider()->uri() );
if ( mLayer->styleExistsInDatabase( dsUri.table(), errorMsg ) )
{
if ( QMessageBox::question( nullptr, QObject::tr( "Save style in database" ),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Title case for the messageBox dialog... There are few other places concerned.

@nyalldawson nyalldawson added the API API improvement only, no visible user interface changes label Jun 10, 2018
@m-kuhn m-kuhn added the Requires Tests! Waiting on the submitter to add unit tests before eligible for merging label Jun 12, 2018
@Gustry
Copy link
Contributor Author

Gustry commented Jun 20, 2018

I will come back on that in the next few weeks

@Gustry Gustry closed this Jun 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API API improvement only, no visible user interface changes Requires Tests! Waiting on the submitter to add unit tests before eligible for merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants