Skip to content

Introducing a file-based database wlx.#40

Open
pplupo wants to merge 11 commits into
doublecmd:masterfrom
pplupo:dbview
Open

Introducing a file-based database wlx.#40
pplupo wants to merge 11 commits into
doublecmd:masterfrom
pplupo:dbview

Conversation

@pplupo

@pplupo pplupo commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

It can open and export data from the most popular file-based databases. Some have SQL execution capabilities, and some can even change data. Check the readme file for detailed info.

pplupo added 11 commits June 16, 2026 11:04
- Add createEditor/setEditorData/setModelData/updateEditorGeometry to
  WrapAnywhereDelegate so all grid cells edit with QPlainTextEdit,
  preserving newlines correctly
- Let Enter/Return and Up/Down pass through to QPlainTextEdit so they
  work as expected within multi-line text
- Ctrl+Enter commits and closes the editor
- Remove the temporary MultiLineDelegate from StructViewWidget.cpp now
  that the fix lives in the shared delegate
- Enter: commit and close the editor (was Ctrl+Enter)
- Ctrl+Enter: insert a newline (was plain Enter)
Move QPlainTextEdit Enter handling to WrapAnywhereDelegate::eventFilter.
Qt installs the delegate as event filter on the editor widget, so that
is the correct interception point — not EditableGridWidget::eventFilter
which only sees events on m_view (never reached during editing).

Qt's QAbstractItemDelegate::eventFilter deliberately skips the
Enter→commit behavior for QPlainTextEdit, so we must override it here.

- Enter: commit and close
- Ctrl+Enter: insert newline
Instead of calling insertPlainText() from the event filter (which was
silently failing in dbview with AnyKeyPressed + proxy model), simply
do not intercept Ctrl+Enter at all.

QAbstractItemDelegate::eventFilter already skips the commit behavior
for QPlainTextEdit editors, so the event falls through to
QPlainTextEdit::keyPressEvent which inserts a newline naturally.
This approach is robust regardless of edit trigger or model setup.
Reverts:
- Fix Ctrl+Enter: let QPlainTextEdit handle newline natively
- Fix Enter key in multi-line cell editor
- Swap Enter/Ctrl+Enter in multi-line cell editor
- Fix multi-line editing: use QPlainTextEdit in WrapAnywhereDelegate

Multi-line cell editing is not working correctly in dbview.
- Add lc_newparams handler returning LISTPLUGIN_OK to prevent DC
  destroy/recreate cycle on file-change events
- Add no-op logger and redirect db_log_dir to /tmp/dbview_logs/
  to prevent LOG file writes in the watched DB directory
- Suppress BDB stderr errors on format mismatch (fallback probe noise)
- Open read-only with OpenForReadOnly (no file writes, no bg threads)
- LevelDB: writable open with background threads disabled
  (max_background_jobs=0, disable_auto_compactions) to prevent
  RocksDB compaction threads from crashing Qt/Breeze theme
- RocksDB: writable open with wal_dir + db_log_dir redirected
- Both engines: supportsSubmitRevert() -> true
- Widget tracking (Kate pattern): hide-not-delete in ListCloseWindow,
  same-file reuse in ListLoad, parent-lifetime cleanup
- Track loaded file path in DbViewWidget for reload detection
- KeyValueModel now buffers edits in m_pendingEdits map instead of
  writing to DB immediately via putValue
- submitAll() flushes buffered edits to DB, revertAll() discards them
- data() returns pending values when present, revert invalidates cache
- loadValueFromFile() also buffers instead of writing directly
- All 4 KV engines (RocksDB, LevelDB, LMDB, BDB) now override
  submitAll/revertAll delegating to KeyValueModel
- supportsSubmitRevert() -> true for all KV engines
- Only MS Access remains read-only (libmdb limitation)
- Updated README with unified Engine Capabilities table
When the user navigates away from a DB file (to a non-DB file viewed
by a different plugin) and then comes back, the widget is reused via
the g_instances map. Previously, pending edits survived this cycle.
Now, revertAll() is called on the KeyValueModel before showing the
reused widget, ensuring the user sees the current DB state.
- Added discardPendingChanges() to DbViewWidget which delegates to
  m_engine->revertAll(), handling both SQL and KV engines
- Called from ListLoad when reusing a widget for the same file
- Replaces the previous KeyValueModel-only qobject_cast approach
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant