Commit Graph

2546 Commits

Author SHA1 Message Date
Bernardo Sulzbach
17a1bb25f1 Updated the PT-BR translation 2018-10-14 22:02:36 -03:00
Manuel
5cf00ddd8d Leaving the loading of extensions enabled might be a security risk (#1558)
* Leaving the loading of extensions enabled might be a security risk

Using sqlite3_enable_load_extension not only allows loading extensions
through the C-API but also through the SQL functioon load_extension().
That might be a security risk if the user is unaware that executing an
SQL file can lead to native code execution and not only to database file
modification.

See issue #1551

* Preference for allowing loading extensions from SQL code

New setting that authorizes the execution of load_extension() from SQL
code. Default value, false, following the design decision of SQLite, that
disables this function unless by default.

Added notice about the option in the calltips of the two function
variants.
2018-10-10 21:26:59 +02:00
Manuel
16ba6db2dc Problems with WITHOUT ROWID tables with PK of string type (#1559)
* Problems with WITHOUT ROWID tables with PK of string type

This fixes two related problems:
- When the PK is updated the hidden column 0 must be updated too,
  otherwise any further editing of the same row before a table refresh is
  broken.
- When a new record is inserted and the PK has string type we cannot
  simply make a pseudo auto-increment and insert that value as rowid
  because that added key would be impossible to update because our
  UPDATE clause will try to update a column with a string and it contains
  an integer. In this case it's better to let the user enter the PK value,
  so the new Add Record dialog is directly invoked.

See issue #1332 and (tangentially) #1049. The first should be fixed now.
The later not, but at least there is now a workaround: removing the
AUTOINCREMENT option and use the WITHOUT ROWID one.

* Problems with WITHOUT ROWID tables with PK of string type (alternative 2)

Update after review:

- cached_row is not modified after unlock();

- Alternative solution to initial key value insertion:
  When a new record is inserted and the PK has string type we still make a
  pseudo auto-increment and insert that value as a string literal. In this
  way we can later update that row. When we inserted it as integer an
  actual integer will be inserted by SQLite, and our UPDATE clause, which
  always uses string in the WHERE condition, won't match the row (SQLite
  does not convert to integer when the column is of type string in this
  context).

See issue #1332.
2018-10-09 22:37:27 +02:00
Martin Kleusberg
fb1eba1391 Remove some virtuals and add some overrides
In our case this is more a question of code style.
2018-10-09 20:28:22 +02:00
Justin Clift
00b57a79dd Update version number of the nightly builds to 3.11.99 2018-10-08 17:48:12 +11:00
Justin Clift
b4954f7b3b Update translation strings for the 3.11.0-alpha1 release 2018-10-08 17:35:26 +11:00
Martin Kleusberg
8795ba591c Don't add multiple "All files" filter to the Open/Save file dialogs
See issue #1556.
2018-10-05 13:27:09 +02:00
mgr
629b02ae85 Set a sensible maximum for the browsed table combobox
See issue  #420
2018-10-04 23:08:41 +02:00
mgr
fd0b34265c Printing support #1525: pre-formatted, wrapped output of Schema column
The schema column of objects is pre-formatted with wrapped style. In this
way, if the "db.hideschemalinebreaks" setting is enabled, the printed
output is formatted in the same way, but with a wrapping style, so long
lines do not extend the Schema column too much.

Added tooltip to Preferences dialog, so it isn't a so hidden feature.
Translations updated accordingly for the release.

The header style is not applied in that same case.
2018-10-03 21:40:44 +02:00
mgrojo
c78c03bf0b Avoid unnecessary queries when populating filtered table
When a table is filtered and the browsed tabled is changed and then we
return to this filtered table, the table view shows several incorrect
disabled rows. The same may happen when refreshing this table. This seems
to be produced by a (yet unsolved) concurrency problem triggered by
several consecutive queries, that are signalled by setting the text of
the stored filters in the table header filter.

These unnecessary queries are avoided by setting the stored filter values
at the same time as the table in the SQL table model, making sure that
no intermediate queries are executed while the filters are set.

This seems to work around the concurrency problem and the symptom of the
invalid rows does not appear in those situations.
2018-10-03 15:42:49 +02:00
mgr
dd4a71e380 Update translations
Fix message "Hold %3Shift and click to jump there" in translations.

Removed execution permission in Russian file.
2018-10-02 23:31:24 +02:00
mgr
8b656cdeaa Printing support #1525: add print button to Data Browse tab
For consistency for the other application tabs, a print button is added
to the Data Browse Tab for printing the currently browsed table or
selection of cells.
2018-10-01 23:07:17 +02:00
mgr
d607a675a4 Revert test code
This test code slipped through in 1c06066258
2018-10-01 00:14:23 +02:00
mgr
a90d1b24d3 Special copy for the binary editor including addresses, hex and ASCII #1485
Added a new copy action to the binary editor context menu for copying the
selected text as seen by the user, instead of the stream of hexadecimal
digits copied by default by qhexedit.

In order to support copying from the context menu, qhexedit has been
modified for not resetting the selection when the left mouse button is
pressed. This will be converted to a pull request to qhexedit afterwards.

See related issue #1485
2018-09-30 23:51:49 +02:00
mgr
1c06066258 Printing support #1525: print images in Editor Dialog and menu in hex
Added support for printing images in the Editor Dialog. A new action added
that can be activated through the context menu or shortcut for printing.

The same approach is applied to the hex editor, which also lacked a
context menu. Consequently the specific shortcut can be deleted.
2018-09-30 23:21:49 +02:00
mgr
2e788d79bd Completion doesn't work until DB Structure is refreshed #1549
Apparently setLexer is needed for actually activating the QScintilla
completion after application start-up.
2018-09-30 21:13:52 +02:00
mgr
8b94eabd9d Printing support #1525: shortcuts for the hex and text editors
Print shortcuts are added in the context of the text and hex editors of
the Edit Database Cell dock.
2018-09-30 01:01:56 +02:00
mgr
79983e25cf Printing support #1525: plot printing using preview dialog
Add shortcut and entry in context menu for printing a plot.
2018-09-29 23:54:51 +02:00
Karim ElDeeb
e771662e6c Add the missing printing plugin dll
See #760.
2018-09-29 21:18:51 +02:00
mgr
57f0175a1d Print preview dialog in all cases
Add print preview dialogs to all the cases where we have printable objects.
Remaining were table browsers and Scintilla editors.
2018-09-29 19:21:11 +02:00
mgr
749e7ed78c Add "Hex dump files" as an export option when data source is hex editor
When the data source is the hex editor we are able to save whatever
data type as shown in the widget, so additionally to set the filters
according to the data type a "Hex dump files (*.txt)" filter option is
added.

If the user selects this option for saving, the hexadecimal dump of the
widget content is saved to the file. Note that the check must be performed
using the selected filter by the user and not the file ending, which would
be the same for text data exported as plain text.

The Null case is disregarded as it is useless for exporting.

See issues #1438 and #1485
2018-09-29 18:54:09 +02:00
mgr
f42b614084 A bit of polishing of the main window user-interface
Reorder the context menu of the table header and use separators for
coherent grouping: column actions, misc and encoding.

Set buttons invisible in the DB Structure toolbar when the object is
different to the supported ones. Disabling wasn't enough because the logic
for changing icon and text wasn't working well for fields and other items.

Separate Print from object actions in that same toolbar.

New icon for Project Save so it uses the same metaphor (floppy disk) as
other save actions.

Improved the look in the clear filters icon by editing it in gimp. It had
a glitch in the funnel base.
2018-09-29 17:28:12 +02:00
mgr
071f963fcc Better messages for a table edition when foreign-key check detect problems
The message when there are problems and the user has made changes and
accepted them must be different to the case when the user has cancelled
and any possible changes have been already reverted by the dialog.

In the first case the fault may be ours and we actually revert changes.
In the second case, we know for sure the problems were there before
editing the table. We warn user about it, since we already know.

The last error from the DB is inappropriate for both cases because it
hasn't been updated by the foreign-key check.

Also fixed the typo in a function identifier.

Room for improvement: maybe the check should be done before opening the
dialog, so we don't let the user edit the table until the issues have
been solved.

See issue #1547
2018-09-29 16:22:03 +02:00
Karim ElDeeb
f2fe2c921d Enable logging during installation for Windows
Sometimes the installation log is required to debug failed installs. This commit will make sure the MSI will automatically create a logging file every time it is used to install, repair, or remove the application.

See #1545.
2018-09-29 11:48:14 +02:00
Karim ElDeeb
b6d436db63 Merge branch 'master' of https://github.com/sqlitebrowser/sqlitebrowser 2018-09-28 23:26:43 +02:00
Karim ElDeeb
f683b344af Set Windows Installer to run elevated
See #1545.
2018-09-28 23:23:06 +02:00
Martin Kleusberg
c927d62eda Update translation sources 2018-09-28 23:13:44 +02:00
Martin Kleusberg
2dd1dce09f Use nullptr some more 2018-09-28 18:58:22 +02:00
Martin Kleusberg
072ae15af0 Never quote cells when copying them to clipboard in text mode
This commit make sure that we never quote cells or change their contents
when copying to the text clipboard. This way the data can't be parsed
anymore without being ambigious but for these purposes we have the
internal buffer and the HTML clipboard. This makes sure that for simple
text copies (mainly that should be single cells) the data is never
changed.

This commit also uses the normal copy code for single cells unless they
are image cells. This makes sure that copying a single cell also uses
the internal buffer which in turn avoids problems when copying and
pasting single cells with line breaks in them.

See issue #1244.
2018-09-28 18:53:03 +02:00
Martin Kleusberg
f4867e5c6d Remove unused code
Since we replaced the project file format by a pure XML representation
we don't need this function anymore.
2018-09-28 18:42:34 +02:00
Martin Kleusberg
549f44d108 Fix copying of single cless in Browse Data tab
This was broken in 4b34eb76b5.
2018-09-28 17:50:30 +02:00
Martin Kleusberg
3f8fc34394 tests: Remove broken test
SQLite doesn't even allow the statement we're checking for, so let's
remove it.
2018-09-28 17:25:39 +02:00
Martin Kleusberg
b4b933c158 Use edit role when querying values for completer in Browse Data tab
This makes sure the cell contents are not modified for display purposes
(e.g. by truncating them to a maximum display length).
2018-09-28 16:39:42 +02:00
mgrojo
88d1cbc29d Pop-up completion with distinct values
A QSortFilterProxyModel is used for filtering the values in the column so
only distinct values are accepted for the completion. With this change
the less intrusive pop-up completion can be used, displaying only unique
values in the completion menu.
2018-09-28 16:19:17 +02:00
mgrojo
04f27ccf4b Threshold in row count for disabling value completion
A setting is added for disabling the value completion when the row count
of the table is greater than the threshold.
2018-09-28 16:19:17 +02:00
mgrojo
e1101ae690 Completion of values based on previous entered values in the same column
Using the QCompleter class associated to the QLineEdit, an implementation
of a completion of values in the Extended Table Widget is straightforward.
2018-09-28 16:19:16 +02:00
Martin Kleusberg
517743ff3f grammar: Add window functions to parser
We don't do anything with the extended parser yet but I'm not even sure
the window functions can be used in CREATE TABLE or CREATE INDEX
statements anyway.
2018-09-28 16:11:11 +02:00
mgr
903e66485c Simplify the URL for a feature request
As suggested by @karim at #1497, the template in GitHub can be reused if
set as parameter. Then we can discard the long body parameter and have
a single definition of the Feature Request template text.
2018-09-27 23:43:30 +02:00
Martin Kleusberg
7e23214e61 Add auto completion for window function keywords and functions 2018-09-27 23:22:03 +02:00
Martin Kleusberg
78ae2c3e09 Fix ROWID keyword in auto completion
For some reason instead of using the ROWID keyword for auto completion
we we're only completing it to ROW.
2018-09-27 23:10:43 +02:00
Martin Kleusberg
320c71eed8 Save and load attached databases to/from the project file
We were already saving information on tables, etc. of attached
databases, so it only makes sense to save the path and name of the
databases as well.

See issue #1532.
2018-09-27 22:04:28 +02:00
Martin Kleusberg
07b1d7ba00 Fix memory leak when attaching a database 2018-09-27 21:41:40 +02:00
Martin Kleusberg
717ff075b5 Avoid some possible crashes
This adds some extra sanity checks in the code to avoid possible
crashes. The most likely way to trigger them is loading an outdated
project file which references tables that no longer exist.
2018-09-27 21:36:11 +02:00
mgr
54cf4cf140 Printing support #1525: add print preview dialog
This adds a print preview step before printing in the Database Structure
tab.

This is nice to have, but it also aims to work around the problem found in
Windows, reported at issue #760.
2018-09-27 21:06:59 +02:00
mgr
ab991c5755 Preferences > SQL: Avoid different heights due to having check boxes or not
The uniform row heights property is set so the rows without check boxes is
the same as the rows with them (the difference might only be observable
with some theme engines)
2018-09-27 21:06:59 +02:00
Martin Kleusberg
f9ac3aa711 Fix a possible endless loop on some platforms
See issue #1531.
2018-09-27 11:58:00 +02:00
Martin Kleusberg
7fb570d668 Add missing braces 2018-09-27 11:57:32 +02:00
Martin Kleusberg
2cc900a98e Simplify code 2018-09-26 15:54:42 +02:00
Martin Kleusberg
918248acaa Simplify code 2018-09-26 15:54:39 +02:00
mgr
4f0d3505ed Printing support #1525: print DB structure
New action and button for printing the database structure.

The data in the Database Structure tree widget is converted to HTML and set
in a document that can then be printed, opening the dialog as done for
other components.
2018-09-25 23:00:17 +02:00