-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Merge : Synchronising groups. #1165
Merge : Synchronising groups. #1165
Conversation
4ab9691
to
7243dfd
Compare
7243dfd
to
89ea06e
Compare
src/core/Group.cpp
Outdated
const QDateTime timeExisting = existingGroup->timeInfo().lastModificationTime(); | ||
const QDateTime timeOther = otherGroup->timeInfo().lastModificationTime(); | ||
|
||
// only if the other group newer, update the existing one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing "is" 😉
src/core/Group.cpp
Outdated
existingGroup->setName(otherGroup->name()); | ||
existingGroup->setNotes(otherGroup->notes()); | ||
existingGroup->setIcon(otherGroup->iconNumber()); | ||
existingGroup->setIcon(otherGroup->iconUuid()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will either reset the previously set iconNumber or trigger an assertion for !uuid.isNull(). You need to check which one is set: icon number or UUID.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@phoerious you're right, the tests we're indeed failing when building in debug mode. Which makes me think, should we not build in debug mode in travis?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are building both in Debug and Release mode. I have no idea why the tests passed.
src/core/Group.h
Outdated
@@ -126,7 +135,8 @@ class Group : public QObject | |||
* new group into another database. | |||
*/ | |||
Group* clone(Entry::CloneFlags entryFlags = Entry::CloneNewUuid | Entry::CloneResetTimeInfo, | |||
bool shallow = false) const; | |||
CloneFlags groupFlags = static_cast<CloneFlags>(Group::CloneNewUuid | Group::CloneResetTimeInfo | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong indentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's actually the formatting done by clang-format
. How do you think it should be indented?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CloneFlags groupFlags
should be on the same level as Group*
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@phoerious still not sure what you mean. CloneFlags groupFlags
, so it should be aligned with the other parameters.
Anyway, I extracted the default flags for the function, so the signature is much smaller.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just got owned by the inline diff view. Ignore what I said. But not having a static_cast there is a lot cleaner, now, anyway.
@phoerious thanks for the review, back to you! |
19e8817
to
2cd5006
Compare
@phoerious changed formatting + added unit tests for the new flags of |
- Add support for KDBX 4.0, Argon2 and ChaCha20 [#148, #1179, #1230, #1494] - Add SSH Agent feature [#1098, #1450, #1463] - Add preview panel with details of the selected entry [#879, #1338] - Add more and configurable columns to entry table and allow copying of values by double click [#1305] - Add KeePassXC-Browser API as a replacement for KeePassHTTP [#608] - Deprecate KeePassHTTP [#1392] - Add support for Steam one-time passwords [#1206] - Add support for multiple Auto-Type sequences for a single entry [#1390] - Adjust YubiKey HMAC-SHA1 challenge-response key generation for KDBX 4.0 [#1060] - Replace qHttp with cURL for website icon downloads [#1460] - Remove lock file [#1231] - Add option to create backup file before saving [#1385] - Ask to save a generated password before closing the entry password generator [#1499] - Resolve placeholders recursively [#1078] - Add Auto-Type button to the toolbar [#1056] - Improve window focus handling for Auto-Type dialogs [#1204, #1490] - Auto-Type dialog and password generator can now be exited with ESC [#1252, #1412] - Add optional dark tray icon [#1154] - Add new "Unsafe saving" option to work around saving problems with file sync services [#1385] - Add IBus support to AppImage and additional image formats to Windows builds [#1534, #1537] - Add diceware password generator to CLI [#1406] - Add --key-file option to CLI [#816, #824] - Add DBus interface for opening and closing KeePassXC databases [#283] - Add KDBX compression options to database settings [#1419] - Discourage use of old fixed-length key files in favor of arbitrary files [#1326, #1327] - Correct reference resolution in entry fields [#1486] - Fix window state and recent databases not being remembered on exit [#1453] - Correct history item generation when configuring TOTP for an entry [#1446] - Correct multiple TOTP bugs [#1414] - Automatic saving after every change is now a default [#279] - Allow creation of new entries during search [#1398] - Correct menu issues on macOS [#1335] - Allow compilation on OpenBSD [#1328] - Improve entry attachments view [#1139, #1298] - Fix auto lock for Gnome and Xfce [#910, #1249] - Don't remember key files in file dialogs when the setting is disabled [#1188] - Improve database merging and conflict resolution [#807, #1165] - Fix macOS pasteboard issues [#1202] - Improve startup times on some platforms [#1205] - Hide the notes field by default [#1124] - Toggle main window by clicking tray icon with the middle mouse button [#992] - Fix custom icons not copied over when databases are merged [#1008] - Allow use of DEL key to delete entries [#914] - Correct intermittent crash due to stale history items [#1527] - Sanitize newline characters in title, username and URL fields [#1502] - Reopen previously opened databases in correct order [#774] - Use system's zxcvbn library if available [#701] - Implement various i18n improvements [#690, #875, #1436]
This changes the merge function to match the groups using the UUIDs, the same way we match the entries. This allows us to do basic conflict resolution on the groups, so we can update the basic information such as the name and the location.
I also removed the
shallow
parameter toGroup::clone
in favor ofCloneFlags
, just like forEntry::clone
.I think the next step for the merge function would be to separate the change detection (new entries, new groups, entries or groups changed) and the actual modification of the destination database. This would allow us to fix a couple of issues with the merge function. For example, we could easily implement a dry-run functionality, and we could detect when the database was really modified by a merge operation. This would also allow us to do the conflict resolution interactively.
How has this been tested?
Added new unit tests.
Tested locally
Screenshots (if appropriate):
Types of changes
Checklist:
-DWITH_ASAN=ON
. [REQUIRED]