Commit Graph

2198 Commits

Author SHA1 Message Date
mgrojo
a41394ad4a Fix copy in internal buffer
There was an omission of the last_row update in
968b8d55f0

That had an effect of converting all copied selections to one column.
2017-12-07 21:13:06 +01:00
mgrojo
2e881659a5 Fix crash and blocking condition while removing hidden columns at copy
It uses QMutableListIterator for removing while iterating and it can also
be made forwards, sot it is clearer.

This fixes #1256 in my environment.
2017-12-07 18:31:54 +01:00
Martin Kleusberg
409d02f9ea plot: Remove axis labels when there is no plot
See issue #950.
2017-12-07 16:14:15 +01:00
Martin Kleusberg
968b8d55f0 Fix possible crash when copying data into the internal copy-paste buffer
This fixes a crash which happens if you copy a range which contains at
least one cell of binary data and which has a hidden column in the
middle of it.
2017-12-07 14:08:46 +01:00
Martin Kleusberg
298d8c22c0 Fix NULL check in copy-paste code
Fix a bug introduced by commit ebd96c6a03.
Thanks for @mgrojo for pointing this out.
2017-12-07 13:38:36 +01:00
mgrojo
4a0f6f790d Valid HTML clipboard content
Copied HTML now passes validation from https://validator.w3.org/check

Thunderbird accepts now our HTML version of the copied data.

Added a meta generator key. See discussion in issue #1244
<meta name="generator" content="DB Browser for SQLite">
2017-12-06 23:04:40 +01:00
mgrojo
05149150a5 Disable 'Attach Database' when appropiate. Better 'Choose...' messages
Disable 'Attach Database' when no database is opened.
Added to the function that enables and disable actions depending on
database state. See issue #1254

Display more specific 'Choose a file...' messages in two places. See issue
#331.
2017-12-06 19:26:59 +01:00
mgrojo
a4728ff5f6 Fixed inconsistencies in new toolbar buttons
Restored menu entries for 'Open Project' and 'Save Project'. They were
accidentally removed in 8fbf44bffe

Set the status-tip to all the toolbar buttons for consistency. This
displays a message in the status bar when hovering over the toolbar button,
and (depending on platform), when the menu entry is the current. Set to the
the same text than the tool-tip following previous example.

Both tips for 'Close Database' were added.
2017-12-06 18:08:37 +01:00
mgrojo
678079a77a Cell editor fixes and improvements
Valid JSON is detected as a new first-class data type. See issue #1173.

Text data length is always calculated in characters and not in bytes (UTF-8
gives different results).

Text in read-only mode is also selectable by keyboard and the caret is
visible. See issue #1123
2017-12-06 00:01:09 +01:00
mgrojo
8fbf44bffe New toolbars, new action icons and toolbar style preference
Two new application toolbars: Extra DB (attach, close database) and Project
(Open, Save). Can be disabled and moved as usual.

Icons for Close Database and Attach Database actions, which lacked ones.

Different icon for the dock configuration, so they are visually
distinguishable from the toolbar configurations.

New preference for the toolbar style, with default value: text besides icon
as before. But in order for the style to change, the value in UI must be
ToolButtonIconOnly.

Needed new icons from famfamfam.com's Silk collection.

See related issue #331
2017-12-04 22:49:48 +01:00
Martin Kleusberg
5707b3139f Fix quoting of data copied to clipboard in one more occasion 2017-12-04 13:56:57 +01:00
Martin Kleusberg
a9e04080e9 Clean up the code for pasting clipboard contents
We have two different sources when pasting data into a table view: the
system clipboard and the internal copy-paste buffer. Both work slightly
different but most code is duplicated between them. This commit cleans
up the pasting code by merging the two code paths into a single one.
This does not only reduce the amount of duplicated code but also enables
some features for both sources that were only available for one of the
sources. This includes duplicating data by copying from a single cell to
multiple cells and the message box asking for confirmation when the
source and destination ranges do not match. These features were only
available for the system clipboard before and should now work for both
sources.
2017-12-04 13:26:08 +01:00
Martin Kleusberg
ebd96c6a03 Add helper function for escaping strings which are copied into clipboard
Introduce a helper function for escaping special characters and for
adding quotes when copying data into the system clipboard.
2017-12-04 13:03:56 +01:00
Martin Kleusberg
316860a709 Make sure to properly clear the system clipboard when copying data
When copying binary data or similar using the internal copy-paste buffer
we need to clear the system clipboard first in order to avoid confusion
between the two paste sources. Just calling clear() on the clipboard
doesn't seem to work on my system, so this commit manually sets the
clipboard text to a null string.
2017-12-04 12:55:29 +01:00
Martin Kleusberg
47b07490de Share internal copy-paste buffer between different table views
Use a shared internal copy-paste buffer for all table views in the
application instead of having one buffer per view. This is not only less
confusing because it more closely resembles the behaviour of the system
clipboard but it also allows copying BLOB data from a Execute SQL result
view to a Browse Data table.
2017-12-04 12:47:37 +01:00
Martin Kleusberg
9db70e0750 Don't paste NULL value when pasting from empty clipboard
When the clipboard is empty and trying to paste from it we would set the
selected field to NULL. This is fixed by this commit, so that nothing
happens.
2017-12-04 12:44:35 +01:00
Martin Kleusberg
b3a0c574e8 Don't treat trailing line break as NULL value when pasting from clipboard
When copying cells from a spreadsheet application an extra line break is
appended to the clipboard text. This commit adds some extra code to our
parser to remove this line break. Without this we would paste a single
NULL value into an additional line.

See issue #1244.
2017-12-04 12:38:25 +01:00
Martin Kleusberg
2b1004602f Don't copy data from hidden columns to clipboard
Copying data from hidden columns is not only confusing but does also
break some common use cases. This commit makes sure that we're not
copying any data from hidden columns. That means the only way to get the
old behaviour now is to unhide all columns, including the rowid column.

See issue #1094.
2017-12-04 12:10:22 +01:00
mgrojo
cef1e9020b Improve the user interactions over plot: zooming and range dragging.
The rectangle selection is no longer possible. Control+click can be used
for selecting a range of items.

This allows more freedom for performing customisations as requested in
issue "Change axis limits #838".

The "Load all data" button tool-tip and icon have been readjusted so they
hint the additional use pattern of resetting the plot to the original
zoom and range limits.

New and more appropriate icon for the "Save Plot" button. Icon from the
Silk set from famfamfam.com.
2017-12-02 17:41:41 +01:00
mgrojo
bbe460c349 Improvements in the new "Save filter as view" functionality
The query used in sqlitetablemodel does not rename the columns, instead
it applies the display formats in the WHERE part. In this way the saved
view has the original column names.

Changes in Button "Save filter as view": more information in tooltip and it
is disabled when no database is open.

See discussion in PR #1246
2017-12-02 16:09:55 +01:00
mgrojo
cc61e47279 Prevent crash with "Save SQL file as" when no SQL tab is open
The same check performed in MainWindow::saveSqlFile() is applied here.

See issue #1248
2017-12-02 14:57:00 +01:00
mgrojo
5a8d6bbf62 Avoid crash when starting without a database and activating the find frame
See issue #1248
2017-12-02 00:16:31 +01:00
mgrojo
aa2aa137f2 Quote only data with end-of-lines, tabs or double-quotes
Headers are also quoted if they contain end-of-lines or tabs.

See #1244
2017-12-01 23:58:06 +01:00
mgrojo
882fc8d3d3 Merge pull request #1246 from sqlitebrowser/save_filter_as_view
Save current filter, sort column and display formats as a new view
2017-12-01 21:51:47 +01:00
mgrojo
5da3d14ee3 Fixed issues from @MKleusber's review
New view name validated with isNull().

Text in information box reworded.

Column names are preserved in the new view, except for the ones with
display formats, for which an underline is appended in order to fix the
reported filtering defect.
2017-12-01 19:28:57 +01:00
Martin Kleusberg
e79c5db308 Manually set the keyboard shortcut for the Find/Replace dialog to Ctrl+H
Make sure the keyboard shortcut for the Find & Replace dialog is always
set to Ctrl+H instead of using Qt's QKeySequence::Replace. At least on
KDE desktops but probably on other systems too it break the Ctrl+R
shortcut which is used for refresh and SQL execution.
2017-12-01 13:52:02 +01:00
Martin Kleusberg
16263452c8 plot: Correctly restore Y axis check states
When restoring the plot state we always checked set the use-on-y-axis
checkbox when a colour was defined for a field. This is correct most of
the times because a field doesn't have a colour as long as it's not used
in the plot. However, when you uncheck a field it keeps its colour which
starts causing issues as soon these settings are reloaded.

The solution is to not only store the colour but also the check state
independently. This changes the project files format though, so the code
needs to support loading old and new file formats.

See issue #1245.
2017-12-01 13:03:48 +01:00
mgrojo
dcc0c32c39 Avoid adding an empty row in the clipboard data
This part from 3aef8adc9a is undone, because
it adds an empty row in the clipboard data. The whole loop can be rethought
later, if necessary.
2017-11-30 22:48:45 +01:00
mgrojo
c1f2306106 Remove no longer used method SqlExecutionArea::saveAsView()
It was moved to MainWindow for reuse and this copy was no longer used.
2017-11-30 22:44:16 +01:00
mgrojo
e5f7456863 Save current filter, sort column and display formats as a new view
A new button is added to the Browse Data tab for saving the current display
of the table (current filter, sort column and display formats) as a new
view. This allows (specially for non advanced users) the creation of simple
views. It can be seen, either as a way of storing the current
filtering or as an easy way of creating views.

This reuses the query set in sqlitetablemodel, but the column aliases when
a display format is used has been changed from col%1 to the original column
names, i.e. format(`orig`) AS `orig`.
2017-11-30 20:41:21 +01:00
Martin Kleusberg
b1e42d08c6 Avoid some warnings 2017-11-29 22:22:05 +01:00
Martin Kleusberg
3aef8adc9a Clean up copy & paste code
Also add some TODO comments in preparation for #1244.
2017-11-29 22:17:22 +01:00
mgrojo
d486a9ff64 Error indicators in JSON mode editor
Improve the feedback to the user for invalid JSON data using error
indicators like the SQL editor.

Do not select all the text in the JSON mode, in order to see the
syntax highlighting while browsing.

Fix the logic in the case of not compacting/prettifying.

Change "Indent" to "Pretty print" in preferences for coherence to
JSON Export dialog (actually it is not only indentation).

Do not underline error style font, so it does not overlap with
error indicators.

See issue #1173
2017-11-27 22:10:10 +01:00
mgrojo
42d2feb99b Actually change the shortcut for Copy with Headers to Ctrl+Shift+C
The change in commit 82665e3f09 only
affected the label in the context menu.
2017-11-26 14:21:20 +01:00
mgrojo
c9bf5f87cb Find/Replace dialog improvements
Find/Replace dialog does not block the main window.

Dialog reused, so checks changed by user are preserved.

The selection of the last occurrence in Find All and Replace All
is cleared, so all the occurrences have the same appearance.
2017-11-26 01:19:33 +01:00
mgrojo
82665e3f09 Find/Replace dialog for SQL editors and logs
A classic Find/Replace dialog including all the options provided
by the QScintilla editor. Additionally a "Replace All" and a
Find All" button are implemented. This complements issue #191

New shortcut in main window for opening the find/replace dialog
connected to the focused widget. Standard for Replace is Ctrl+H.
Consequently the shortcut for Copy with Headers is changed to
Ctrl+Shift+C (see issue #1058).

For SQL text widgets not embedded in the main window, the standard
shortcut cannot be enabled, otherwise it conflicts with the main
window. Therefore the shortcut Ctrl+Shift+H is enabled for all the
SQL widgets as fallback. A better solution would be desirable.
2017-11-25 21:39:41 +01:00
mgrojo
ce06845b36 Folding issues related to the Scintilla JSON lexer
Applied patch from:
https://sourceforge.net/p/scintilla/code/merge-requests/19/

See this thread for info:
https://groups.google.com/forum/#!topic/scintilla-interest/w4sW3sM6Cek

This is merged into Scintilla, so it might come fixed in a future
release.

This should solve the folding issue reported in #1173
2017-11-24 19:31:47 +01:00
mgrojo
189f19695a JSON validation before applying data to cell
A warning dialog is popped-up for confirming application of
invalid JSON data. Parse error is shown in the dialog.

*.json added to import filter.

See issue #1173
2017-11-24 00:27:48 +01:00
Martin Kleusberg
8687bfa3c3 Also apply table view settings to the SQL result tables
Use the same font settings for the result table views in the Execute SQL
tabs as for the Browse Data table view.

See issue #1240.
2017-11-23 17:15:29 +01:00
Martin Kleusberg
0d7ca9b5be Support pasting single value into multiple cells
This adds support for pasting a single value into all selected cells in
the Browse Data tab in order to mimic the behaviour of standard
spreadsheet application more closely.
2017-11-23 17:03:57 +01:00
mgrojo
67c5ed963e Compact and indent on JSON cell editor
New setting for enabling the following feature:
when JSON data is loaded in the JSON cell editor, the text is
indented. Before JSON data written back into the cell, the text
is compacted.

See issue #1173

Minor adjustment in preference label: removed ":" for consistency.
2017-11-23 00:39:17 +01:00
Justin Clift
24267749ea Updated OSX section to mention 10.13 works 2017-11-22 00:28:44 +00:00
SourceTrigger
0a995423fa Source trigger patch file drop (#1236)
* Add Signal if File dropped

* Check if Index is valid

Send Signal and return if Index is invalid and File was dropped

* Connect Dropsignal to fileopen
2017-11-20 21:05:47 +01:00
Justin Clift
09e170f75d Fix typo in German translation. Thanks @weldwatcher :) 2017-11-20 15:58:25 +00:00
SourceTrigger
de2131daea Improve 4k/5k resolution rendering speed on macOS/OSX (#1233)
Initialize OpenGL rendering on macOS by add a hidden QOpenGLWidget.
2017-11-20 14:44:37 +00:00
Justin Clift
12ee94cee9 Adding our license files to the Win install list 2017-11-19 21:29:41 +00:00
mgrojo
b26948da14 Fix white over grey at invalid JSON in current line
The default style for invalid JSON or unclosed strings uses red
background and white foreground, but the current line has
precedence, so it is by default white over grey. We change the
default to something more readable for the current line at
invalid JSON. See issue #1173.
2017-11-19 21:20:33 +01:00
mgrojo
24a573dc68 Minor icon changes
New icons in resources from our icon set: Silk from
famfamfam.com

Icon for close. Applied to the find bar (see issue #191).

New icon for special copy. Applied to the "Copy with
Headers" option.

Removed the execution permission from some icon files.
2017-11-19 14:59:55 +01:00
mgrojo
a457d29fe2 Fix one case for the error visual hint in the SQL results pane 2017-11-19 01:11:20 +01:00
mgrojo
87e1b9bc7c Usability improvements for Extended Table Widget and SQL
results pane

Copy for multi-line text data surrounds the text with the
<pre> tag in the HTML version for avoiding line white-space
adjustments in the pasted text. See #1058

Do not use binary data in the "Use as Filter" option.

Indicate the existence of an error in the background of the
SQL results frame. The error-indicators is reused for
disabling this functionality.

When nothing is shown, a placeholder text hints the
objective of the results pane.

The preference label for the font size of this pane is
modified for consistency (SQL Log is another widget).
2017-11-19 00:57:42 +01:00