Skip to content

Commit

Permalink
Show item color in tray menu as the default icon
Browse files Browse the repository at this point in the history
Fixes #2700
  • Loading branch information
hluk committed May 2, 2024
1 parent 3ef6b67 commit 070bd5b
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/gui/traymenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,21 @@ bool TrayMenu::updateIconFromData(QAction *act, const QVariantMap &data)

const QString icon = data.value(mimeIcon).toString();
const QString tag = data.value(COPYQ_MIME_PREFIX "item-tag").toString();
if ( icon.isEmpty() && tag.isEmpty() )
return false;

if ( icon.isEmpty() && tag.isEmpty() ) {
const QString colorName = data.value(mimeColor).toString();
if ( colorName.isEmpty() )
return false;

const QColor color(colorName);
if ( !color.isValid() )
return false;

QPixmap pix(16, 16);
pix.fill(color);
act->setIcon(pix);
return true;
}

const QColor color = getDefaultIconColor(*act->parentWidget());
act->setIcon( iconFromFile(icon, tag, color) );
Expand Down

0 comments on commit 070bd5b

Please sign in to comment.