remove root group from path, resize icons to 16x16

This commit is contained in:
thez3ro 2017-09-28 20:48:49 +02:00
parent eb65822665
commit d0f8d43739
No known key found for this signature in database
GPG Key ID: F628F9E41DD7C073

View File

@ -70,17 +70,20 @@ void DetailsWidget::getSelectedEntry(Entry* selectedEntry)
m_ui->totpWidget->hide(); m_ui->totpWidget->hide();
m_ui->totpButton->setChecked(false); m_ui->totpButton->setChecked(false);
m_ui->entryIcon->setPixmap(m_currentEntry->iconPixmap()); auto icon = m_currentEntry->iconPixmap();
if (icon.width() > 16 || icon.height() > 16) {
QString title = " / "; icon = icon.scaled(16, 16);
}
m_ui->entryIcon->setPixmap(icon);
QString title = QString(" / ");
Group* entry_group = m_currentEntry->group(); Group* entry_group = m_currentEntry->group();
if (entry_group) { if (entry_group) {
QStringList hierarchy = entry_group->hierarchy(); QStringList hierarchy = entry_group->hierarchy();
hierarchy.removeFirst();
for (QString parent : hierarchy) { title += hierarchy.join(" / ");
title.append(parent); if (hierarchy.size() > 0) {
title.append(" / "); title += " / ";
} }
} }
title.append(m_currentEntry->resolveMultiplePlaceholders(m_currentEntry->title())); title.append(m_currentEntry->resolveMultiplePlaceholders(m_currentEntry->title()));
@ -162,15 +165,18 @@ void DetailsWidget::getSelectedGroup(Group* selectedGroup)
m_ui->totpButton->hide(); m_ui->totpButton->hide();
m_ui->totpWidget->hide(); m_ui->totpWidget->hide();
m_ui->entryIcon->setPixmap(m_currentGroup->iconPixmap()); auto icon = m_currentGroup->iconPixmap();
if (icon.width() > 32 || icon.height() > 32) {
icon = icon.scaled(32, 32);
}
m_ui->entryIcon->setPixmap(icon);
QString title = " / "; QString title = " / ";
QStringList hierarchy = m_currentGroup->hierarchy(); QStringList hierarchy = m_currentGroup->hierarchy();
hierarchy.removeFirst();
for (QString parent : hierarchy) { title += hierarchy.join(" / ");
title.append(parent); if (hierarchy.size() > 0) {
title.append(" / "); title += " / ";
} }
m_ui->titleLabel->setText(title); m_ui->titleLabel->setText(title);