Don't save clipboard history when we load it
It used to be that when the clipboard history was loaded from disk at Klipper/plasmashell startup, it triggered the `changed` event, and so it also caused the clipboard history to be saved to disk. This is very expensive, since it requires re-encoding every image in the clipboard as a PNG, and is generally just a waste of computation and IO - so let's not do that. As part of fixing this so that we don't save the clipboard history when we load it, the signal setup is changed. Now, rather than destructing and constructing the timer as the user changes the keepContents setting, the timer is created at Klipper construction, and just checks the setting when the History::changed signal is emitted, to see whether to actually activate the timer. This is a much cleaner way of doing it (credit to @davidedmundson for this idea) and means that it's very easy to avoid loading triggering a save: just don't connect the History::changed signal until after we've loaded in the history.
parent
13cfe10b