Skip to content

Commit

Permalink
Disallow selecting hidden items from script
Browse files Browse the repository at this point in the history
Fixes hluk#785
  • Loading branch information
hluk committed Sep 10, 2017
1 parent ae63eb8 commit 3dbddc4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/gui/clipboardbrowser.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@ class ClipboardBrowser : public QListView
*/
bool loadItems();

/**
* Return true only if row is filtered and should be hidden.
*/
bool isFiltered(int row) const;

public slots:
/**
* Save items to configuration.
Expand Down Expand Up @@ -321,8 +326,6 @@ class ClipboardBrowser : public QListView
private:
bool isLoaded() const;

bool isFiltered(int row) const;

/**
* Hide row if filtered out, otherwise show.
* @return true only if hidden
Expand Down
2 changes: 1 addition & 1 deletion src/scriptable/scriptableproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ bool ScriptableProxy::selectItems(const QList<int> &items)

for (int i : items) {
const QModelIndex index = c->index(i);
if (index.isValid())
if ( index.isValid() && !c->isFiltered(i) )
c->selectionModel()->select(index, QItemSelectionModel::Select);
}
}
Expand Down

0 comments on commit 3dbddc4

Please sign in to comment.