Merge #17956: gui: Disable unavailable context menu items in transactions tab

2b18fd2242 Disable unavailable context menu items in transactions tab (Kristaps Kaupe)

Pull request description:

  Fixes #9192.

ACKs for top commit:
  jonatack:
    Re-ACK 2b18fd2242
  jonasschnelli:
    codereview utACK 2b18fd2242

Tree-SHA512: 4ea19c7b5976f1f0b1baecccb3077cf82f078af7257f92162686bcce2188efe49511a5f557853bc5fe0b10616708957d61c006944babbe60b8105e78751e865f
This commit is contained in:
Jonas Schnelli
2020-05-29 10:28:47 +02:00
4 changed files with 31 additions and 14 deletions

View File

@@ -232,7 +232,7 @@ QString HtmlEscape(const std::string& str, bool fMultiLine)
return HtmlEscape(QString::fromStdString(str), fMultiLine);
}
void copyEntryData(QAbstractItemView *view, int column, int role)
void copyEntryData(const QAbstractItemView *view, int column, int role)
{
if(!view || !view->selectionModel())
return;
@@ -245,13 +245,20 @@ void copyEntryData(QAbstractItemView *view, int column, int role)
}
}
QList<QModelIndex> getEntryData(QAbstractItemView *view, int column)
QList<QModelIndex> getEntryData(const QAbstractItemView *view, int column)
{
if(!view || !view->selectionModel())
return QList<QModelIndex>();
return view->selectionModel()->selectedRows(column);
}
bool hasEntryData(const QAbstractItemView *view, int column, int role)
{
QModelIndexList selection = getEntryData(view, column);
if (selection.isEmpty()) return false;
return !selection.at(0).data(role).toString().isEmpty();
}
QString getDefaultDataDirectory()
{
return boostPathToQString(GetDefaultDataDir());