Skip to content
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

Fixed type associations and added "Default Application" #635

Merged
merged 1 commit into from
Jul 19, 2020

Conversation

tsujan
Copy link
Member

@tsujan tsujan commented Jul 8, 2020

This is a relatively big code change:

  1. Scheme protocols are added to the end of associations list.
  2. A tab for default apps is added. For now, it supports the default browser and email client.
  3. Default associations are done in a DE-specific way, so that they don't affect other DEs.
  4. The current changes can be undone correctly and reliably.
  5. The deprecated class XdgDesktopFileCache and the inefficient class LXQt::SettingsCache are removed from the code. XdgMimeApps is used instead of the former. The latter had bugs and couldn't do a correct and clean resetting; QTemporaryFile is used instead of it.
  6. All memory leaks are fixed. They were found both by rereading the code and by using valgrind.

NOTE 1: The patch relies on the latest git libqtxdg and SHOULD NOT be used without it.

NOTE 2: lxqt-config-file-associations only supports setting of default apps. The support for removing/sorting associations is still missing. Association removal is supported by libqtxdgXdgMimeApps and sorting can be added to it.

Closes lxqt/lxqt#1513

This is a relatively big code change:

 1. Scheme protocols are added to the end of associations list.
 2. A tab for default apps is added. For now, it supports the default browser and email client.
 3. Default associations are done in a DE-specific way, so that they don't affect other DEs.
 4. The current changes can be undone correctly and reliably.
 5. The deprecated class `XdgDesktopFileCache` and the inefficient class `LXQt::SettingsCache` are removed from the code. `XdgMimeApps` is used instead of the former. The latter had bugs and couldn't do a correct and clean resetting; `QTemporaryFile` is used instead of it.
 6. All memory leaks are fixed. They were found both by rereading the code and by using `valgrind`.

NOTE 1: The patch relies on the latest git `libqtxdg` and SHOULD NOT be used without it.

NOTE 2: `lxqt-config-file-associations` only supports setting of default apps. The support for removing/sorting associations is still missing. Association removal is supported by `libqtxdg` → `XdgMimeApps` and sorting can be added to it.

Closes lxqt/lxqt#1513
@tsujan tsujan requested a review from luis-pereira July 8, 2020 17:39
Copy link
Member

@luis-pereira luis-pereira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read the code and played with the app a little bit. Did not find something not Ok.

The Default Apps get and set check code (the browser section) led me to think, that that code and criteria should be in a lib.
A kind of XdgPreferredApps for applications which a simple mimetype association is not enough.

A app writer could write something like:
XdgDesktopFile *prefApp = XdgPreferredApps::webBrowser();

and could also be used as a base for a new qtxdg-mat module to plug into xdg-settings.

Will implement ASAP.

@tsujan
Copy link
Member Author

tsujan commented Jul 9, 2020

So fast!

The Default Apps get and set check code (the browser section) led me to think, that that code and criteria should be in a lib.

I can't think of another use for it but if you believe that it should be in the lib, it's OK with me.

IMHO, LXQt::SettingsCache needs more attention (→ lxqt/liblxqt#262). I doubt that it can be fixed based on QSettings because its problem is inherited from QSettings. Maybe, it can be replaced by QTemporaryFile everywhere, in which case, it might not be needed at all.

@tsujan tsujan merged commit eff9efd into master Jul 19, 2020
@tsujan tsujan deleted the fixed_associations branch July 19, 2020 05:07
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.

set default browser
2 participants