LibGUI: Make ModelSelection non-copyable and non-movable

These are meant to be attached to an AbstractView at all times.
This commit is contained in:
Andreas Kling 2020-08-14 12:04:03 +02:00
commit b97e42dcaa
Notes: sideshowbarker 2024-07-19 03:39:18 +09:00
2 changed files with 5 additions and 1 deletions

View file

@ -775,7 +775,7 @@ int run_in_windowed_mode(RefPtr<Core::ConfigFile> config, String initial_locatio
directory_view.on_selection_change = [&](GUI::AbstractView& view) {
// FIXME: Figure out how we can enable/disable the paste action, based on clipboard contents.
auto selection = view.selection();
auto& selection = view.selection();
delete_action->set_enabled(!selection.is_empty() && access(directory_view.path().characters(), W_OK) == 0);
copy_action->set_enabled(!selection.is_empty());

View file

@ -31,10 +31,14 @@
#include <AK/TemporaryChange.h>
#include <AK/Vector.h>
#include <LibGUI/ModelIndex.h>
#include <AK/Noncopyable.h>
namespace GUI {
class ModelSelection {
AK_MAKE_NONCOPYABLE(ModelSelection);
AK_MAKE_NONMOVABLE(ModelSelection);
public:
ModelSelection(AbstractView& view)
: m_view(view)