Commit Graph

623 Commits

Author SHA1 Message Date
Martin Kleusberg
3da520cdd1 Clean up multi threading patch, fix build and some bugs
Make strings translatable, remove some more debug code, fix tests,
reduce size of patch slightly, remove weird tooltip, don't crash when
closing database, simplify code, fix filters, don't link agains pthread
on Windows.
2018-06-08 22:46:47 +02:00
Martin Kleusberg
51dbe72e23 Multi-threading patch
This was done by Michael Krause.
https://lists.sqlitebrowser.org/pipermail/db4s-dev/2018-February/000305.html

In this commit I only fixed two compiler warnings, some whitespace
issues and removed some debug messages.
2018-06-08 22:46:47 +02:00
Martin Kleusberg
f51b44d8d7 Add support for deleting rows in views which are unlocked for editing
If a view has been unlocked for editing by specifiying a pseudo primary
key, with this commit you can now delete records from the view if an
appropriate trigger exists.

See issue #141.
2018-06-07 16:08:08 +02:00
Martin Kleusberg
ea25618f22 Don't ask for PK again when chaging back to a editing-enabled view
When unlocking a view for editing by specifying a pseudo-PK, then
switching to another table, and then coming back to the original view,
you would be asked again for the pseudo-PK even though it was stored.
The same applies when loading a project file for this case. This is
fixed by this commit.
2018-06-07 14:44:30 +02:00
Martin Kleusberg
72506fb902 Fix table view after unlocking view editing 2018-06-07 14:38:25 +02:00
mgrojo
e50022c11e Export to CSV the currently browsed data as displayed
A new option is added to the Browse Data tab toolbar for exporting the data
of the browsed table as currently displayed (after filters, display formats
and order column) to a CSV file. This is done in coherence to the same
popup options in the SQL tab for execution results.

See issue #1402
2018-06-02 01:04:55 +02:00
Martin Kleusberg
39302f5b60 Also fix rowid column being shown when changing the sort order
Apply the same fix as in 189b750a00 for
the filters for the sort order.
2018-05-25 23:47:47 +02:00
Martin Kleusberg
b647026051 Show warning when opening a project file with the old file format
Thanks to Iulian for idea!
2018-05-25 18:49:27 +02:00
Martin Kleusberg
189b750a00 Fix e6a4326e9b
Fix the fix for a Qt issue which messes up the table view when using the
filters. Without any fix, the rowid column is always shown when changing
the filters, but because the filter bar isn't regenerated the filters
are all displaced. With the first commit this is fixed, however changing
the filters always regenerated the filter bar which in turn deleted the
current filter value. With this commit this is fixed. The filters are
now working as expected.
2018-05-20 20:22:55 +02:00
GortiZ
e7752d7398 KUbuntu 14.04 support restored (#1298)
* - [NEW] Add new interface and functionality to manage database file extension. (Implements feature request #659)

* - [FIX] Fixed CMake file to src.pro

* - Applied changes requested by mgrojo to uniform code with sqlitebrowser standards
- Add "history" when closing editor window, but reopen before closing preferences
- Revert some changes done by QtCreator

* Refuse from previous commit

* Additional changes requested by MKleusberg:
- [CHG] Always add "All files (*)" to filters
- [FIX] Removed unused include

* merged from master

* Merge sqlitebrowser master

* [FIX] Fixed compatibility to compile on KUbuntu 14.04 with Qt 5.2.1

* [FIX] Fix Qt version for QOpenGLWidget support on previous commit

* [CHG] Uniformed QT_VERSION_CHECK style
[CHG] Reverted macOS check on Mainwindow for OpenGL context creation
2018-05-20 15:56:01 +02:00
Martin Kleusberg
4ab2bee2ac When selecting an entire row and deleting it, remove the record
When selecting an entire row or multiple entire rows in the table view
and hitting the delete key, delete the records and not just the cell
contents.

See issue #1391.
2018-05-20 13:22:13 +02:00
Karim ElDeeb
817de2d3f5 Update Report bug link to include the system information (#1388)
When reporting an issue from the application, via the menu 'Help | Bug report', the new link will add the label 'bug' and include the system information automatically.

See issue #1386
2018-05-16 19:01:13 +02:00
Martin Kleusberg
13d9f98aab Fix the text of the toolbar actions for deleting and modifying objects
When selecting an object other than a table the toolbar actions would
say "Modify/Delete Table" nonetheless. I don't remember it being this
way, so I suspect this was changed by updating to Qt 5. Either way, this
commit makes absolutely sure the texts are updated properly.
2018-05-16 18:39:51 +02:00
Martin Kleusberg
a5d36694db Simplify code 2018-05-16 18:26:48 +02:00
Martin Kleusberg
aebfc5151e No need to commit when setting defer_foreign_keys pragma
Don't commit the current transaction when setting the defer_foreign_keys
pragma in the Execute SQL tab. Not only isn't it required by SQLite but
it's quite contrary to the point of a pragma the purpose of which is
to change the current transaction.
2018-05-16 16:18:03 +02:00
Martin Kleusberg
e6a4326e9b Fix filters
Fix a bug that causes the rowid column to be always shown when changing
the filters. I *believe* this was happening since updating to Qt 5.10.
2018-05-16 15:01:22 +02:00
Karim ElDeeb
86960a5952 Update project links to HTTPS 2018-05-07 17:42:29 +02:00
mgrojo
211f7341ff New XML format for browse data table settings in project files
Browse data table settings are now saved in the project files using a pure
tagged XML format. This would make easier the generation of our project
files by external tools or direct human edition of the project files.

Compatibility with the older format is preserved in the loading. Previous
software versions have been tested with the new format, and they are also
able to load the new project files ignoring these new tags.

See related issue #1306
2018-03-03 20:06:49 +01:00
mgrojo
3277174cb1 Problems with WITHOUT ROWID tables
Quoted values in DELETE FROM and UPDATE SET take into account that value
could have a single quote and they are now doubled.

Detect tables without rowid in order to make invisible the "Show rowid
column"

See issue #1332
2018-02-28 23:18:49 +01:00
Martin Kleusberg
1110b87d95 Fix structure view after changing settings
This is fixing a follow-up issue of
012ad9217a.

See issue #1288.
2018-01-26 14:44:13 +01:00
mgrojo
7d1ddbd717 Preserve format in Copy Create Statement
The original Create statement formatting is preserved when the menu option
"Copy Create statement" is selected, regardless of the setting that removes
the line breaks in the schema view.

The Edit Role is requested to the model for getting the original text data.

See issue #1300
2018-01-18 20:59:02 +01:00
mgrojo
6a8c2e7a57 Revert "Preserve format in Copy Create Statement"
This reverts commit d1261146b3.
2018-01-18 20:35:08 +01:00
mgrojo
d1261146b3 Preserve format in Copy Create Statement
The original Create statement formatting is preserved when the menu option
"Copy Create statement" is selected, regardless of the setting that removes
the line breaks in the schema view.

The Edit Role is requested to the model for getting the original text data.

See issue #1300
2018-01-18 20:32:07 +01:00
mgrojo
33801d5285 Synchronize PlotDock with 'Execute SQL' table. Continuation of PR #1271
Make use of signals to connect the selection in plot to the associated
table widget. Every time that the plot is updated from the Main Window
the table widget associated to the table or query is connected to the plot
and the previous widget is disconnected. This allows the selection of the
correct table widget.

Line selection methods moved to the Extended Table Widget to be used as
slots for this connection.

The destroyed signal is also connected for resetting the plot. This fixes
a crash that already existed before this PR, when closing a SQL tab while
the plot is still associated to the table results model.
2018-01-16 00:37:42 +01:00
Martin Kleusberg
404f48c5a9 Fix possible 'database locked' error when detaching a database
Revert the savepoint in the Execute SQL whenever possible. We need to
do this after each statement because there are some rare cases where
the next statement might be affected by what is only a temporary and
unnecessary savepoint. For example in this case:

ATTACH 'xxx' AS 'db2'
SELECT * FROM db2.xy;    -- Savepoint created here
DETACH db2;              -- Savepoint makes this statement fail

See issue #1249.
2018-01-15 23:51:30 +01:00
Martin Kleusberg
012ad9217a Fix drag & drop of tables onto the structure view
When dragging and dropping a table from one instance of the application
to the other, the tree structure representing the database was broken.
We would show the 'Browsables' and 'All' nodes at the top level instead
of the child nodes of the 'All' node. This happened because after
dropping a table, we would reload the database structure and rebuild the
tree structure but didn't notify the tree view in the main window about
the update. This is fixed by this commit, so the main window's widgets
are always notified about the new tree structure.

See issue #1288.
2018-01-15 23:10:23 +01:00
Manuel
dbbd268fa2 Merge pull request #1271 from FabianInostroza/plot_table_sync
Synchronize PlotDock with 'Execute SQL' table.
2018-01-15 20:53:54 +01:00
mgrojo
b08960f504 Plot: Respect the "Order by" clause when plotting
The tables/queries sorted by X are drawn using QCPGraph as before.

Since QCPGraph does automatically sort by X, we change to QCPCurve that
requires a third data vector to reflect the order. We get that from the
current row order.

In the case of curves, only None and Line is supported as line style.

Since the order is now important for the plot, it is automatically updated
whenever the user sorts by another column in the browsed table.

This addresses issue #821 and indirectly fixes the problem of incorrect
point->row selection link when the table is not sorted by X, reported in
issue #838.
2018-01-07 14:54:29 +01:00
mgrojo
cb98e29a7c Allow deleting and duplicating a selection of rows
Before bbac655499 it was possible to delete
a set of selected rows. This makes it possible again by only selecting the
row if it is not already inside the selected rows. See issue #1283.

Additionally and for coherence, the "Duplicate record" from the context
menu is also made to apply to the list of selected rows. See issue #1090
2018-01-05 20:51:36 +01:00
mgrojo
bbac655499 Select the pointed table row when right clicking on the vertical header
This makes sense from the user point of view, since it remarks that the
options from the menu applies to that row. This change will also fix the
different behaviour of the "Delete record" and "Duplicate record" in the
context menu. See issue #1283
2018-01-05 18:26:34 +01:00
Martin Kleusberg
5f702db0e0 Don't set modified flag for database when attaching/detaching database
Don't set the modified flag of the main database if we're attaching or
detaching another database since these actions don't alter the original
database.

See issue #1249.
2018-01-05 16:07:18 +01:00
mgrojo
6f5e507556 Right click on vertical header to delete the selected record(s)
The text is got from the "Delete record" button, so the text is updated to
"Delete records" when appropriate.

See feature request #1283
2018-01-04 21:48:19 +01:00
mgrojo
7ce7f0c05b Use current encoding for the binary check and being able to reset encoding
The current table encoding is used in the binary check, so text encoded in
8-bit encodings is properly recognised as text in the table widget.

Make it possible to reset the encoding used in the way suggested to the
user: "Leave the field empty for using the database encoding". Currently it
was rejecting it with the message: "This encoding is either not valid or
not supported."

See issue #1279
2017-12-31 12:59:29 +01:00
Fabián Inostroza
25381a57d9 Use Tabs enum for tab identification. 2017-12-18 17:02:27 -03:00
Fabián Inostroza
9185b34922 Synchronize PlotDock with 'Execute SQL' table. 2017-12-16 13:47:37 -03:00
mgrojo
de260d32c5 Always open the find/replace dialog with Ctrl+H and option in context menu
The shortcut is constrained to the Widget context so it does not conflict
with other SqlTextEdit widgets in the application. Now all SqlTextEdit
widgets are able of opening the dialog with the same shortcut and behave
in the same way (do not block the parent window).

The find/replace dialog can now be discovered by the user in the context
menu at the SqlTextEdit widgets.
2017-12-15 21:15:39 +01:00
mgrojo
4a9f1a2a50 Avoid two calls to dittoRecord in 'Duplicate record' called from shortcut
This was mistakenly introduced in 7ed1b1db05

The unwanted effect was two new duplicate records inserted.

Additionally the shortcut is made self-documented for the user in the
corresponding context menu.
2017-12-11 00:48:55 +01:00
mgrojo
7ed1b1db05 Do not ignore error when inserting rows in 'Duplicate record'
That avoids overwriting existing record as reported in issue #1255.

This doesn't improve the underlying situation, that is inserting empty rows
before duplicating the content. But it is safer to not ignore the error in
the initial row insertion.
2017-12-10 15:34:05 +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
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
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
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
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
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
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