Move notes to General tab on Group Preview Panel (#3336)

This commit is contained in:
Balazs Gyurak 2019-06-29 02:48:25 +01:00 committed by Jonathan White
parent 0e0cba653f
commit a0d1304bfc
5 changed files with 174 additions and 121 deletions

View File

@ -3,6 +3,7 @@
- Group sorting feature [#3282] - Group sorting feature [#3282]
- CLI: Add 'flatten' option to the 'ls' command [#3276] - CLI: Add 'flatten' option to the 'ls' command [#3276]
- Rework the Entry Preview panel [#3306] - Rework the Entry Preview panel [#3306]
- Move notes to General tab on Group Preview Panel [#3336]
2.4.3 (2019-06-12) 2.4.3 (2019-06-12)
========================= =========================

View File

@ -50,7 +50,8 @@ int Analyze::executeWithDatabase(QSharedPointer<Database> database, QSharedPoint
QString hibpDatabase = parser->value(Analyze::HIBPDatabaseOption); QString hibpDatabase = parser->value(Analyze::HIBPDatabaseOption);
QFile hibpFile(hibpDatabase); QFile hibpFile(hibpDatabase);
if (!hibpFile.open(QFile::ReadOnly)) { if (!hibpFile.open(QFile::ReadOnly)) {
errorTextStream << QObject::tr("Failed to open HIBP file %1: %2").arg(hibpDatabase).arg(hibpFile.errorString()) << endl; errorTextStream << QObject::tr("Failed to open HIBP file %1: %2").arg(hibpDatabase).arg(hibpFile.errorString())
<< endl;
return EXIT_FAILURE; return EXIT_FAILURE;
} }

View File

@ -50,7 +50,8 @@ EntryPreviewWidget::EntryPreviewWidget(QWidget* parent)
m_ui->entryTotpButton->setIcon(filePath()->icon("actions", "chronometer")); m_ui->entryTotpButton->setIcon(filePath()->icon("actions", "chronometer"));
m_ui->entryCloseButton->setIcon(filePath()->icon("actions", "dialog-close")); m_ui->entryCloseButton->setIcon(filePath()->icon("actions", "dialog-close"));
m_ui->togglePasswordButton->setIcon(filePath()->onOffIcon("actions", "password-show")); m_ui->togglePasswordButton->setIcon(filePath()->onOffIcon("actions", "password-show"));
m_ui->toggleNotesButton->setIcon(filePath()->onOffIcon("actions", "password-show")); m_ui->toggleEntryNotesButton->setIcon(filePath()->onOffIcon("actions", "password-show"));
m_ui->toggleGroupNotesButton->setIcon(filePath()->onOffIcon("actions", "password-show"));
m_ui->entryAttachmentsWidget->setReadOnly(true); m_ui->entryAttachmentsWidget->setReadOnly(true);
m_ui->entryAttachmentsWidget->setButtonsVisible(false); m_ui->entryAttachmentsWidget->setButtonsVisible(false);
@ -60,7 +61,8 @@ EntryPreviewWidget::EntryPreviewWidget(QWidget* parent)
connect(m_ui->entryTotpButton, SIGNAL(toggled(bool)), m_ui->entryTotpLabel, SLOT(setVisible(bool))); connect(m_ui->entryTotpButton, SIGNAL(toggled(bool)), m_ui->entryTotpLabel, SLOT(setVisible(bool)));
connect(m_ui->entryCloseButton, SIGNAL(clicked()), SLOT(hide())); connect(m_ui->entryCloseButton, SIGNAL(clicked()), SLOT(hide()));
connect(m_ui->togglePasswordButton, SIGNAL(clicked(bool)), SLOT(setPasswordVisible(bool))); connect(m_ui->togglePasswordButton, SIGNAL(clicked(bool)), SLOT(setPasswordVisible(bool)));
connect(m_ui->toggleNotesButton, SIGNAL(clicked(bool)), SLOT(setNotesVisible(bool))); connect(m_ui->toggleEntryNotesButton, SIGNAL(clicked(bool)), SLOT(setEntryNotesVisible(bool)));
connect(m_ui->toggleGroupNotesButton, SIGNAL(clicked(bool)), SLOT(setGroupNotesVisible(bool)));
connect(m_ui->entryTabWidget, SIGNAL(tabBarClicked(int)), SLOT(updateTabIndexes()), Qt::QueuedConnection); connect(m_ui->entryTabWidget, SIGNAL(tabBarClicked(int)), SLOT(updateTabIndexes()), Qt::QueuedConnection);
connect(&m_totpTimer, SIGNAL(timeout()), SLOT(updateTotpLabel())); connect(&m_totpTimer, SIGNAL(timeout()), SLOT(updateTotpLabel()));
@ -107,7 +109,6 @@ void EntryPreviewWidget::setGroup(Group* selectedGroup)
m_currentGroup = selectedGroup; m_currentGroup = selectedGroup;
updateGroupHeaderLine(); updateGroupHeaderLine();
updateGroupGeneralTab(); updateGroupGeneralTab();
updateGroupNotesTab();
#if defined(WITH_XC_KEESHARE) #if defined(WITH_XC_KEESHARE)
updateGroupSharingTab(); updateGroupSharingTab();
@ -181,23 +182,31 @@ void EntryPreviewWidget::setPasswordVisible(bool state)
} }
} }
void EntryPreviewWidget::setNotesVisible(bool state) void EntryPreviewWidget::setEntryNotesVisible(bool state)
{ {
const QString notes = m_currentEntry->notes(); setNotesVisible(m_ui->entryNotesLabel, m_currentEntry->notes(), state);
}
auto flags = m_ui->entryNotesLabel->textInteractionFlags(); void EntryPreviewWidget::setGroupNotesVisible(bool state)
{
setNotesVisible(m_ui->groupNotesLabel, m_currentGroup->notes(), state);
}
void EntryPreviewWidget::setNotesVisible(QLabel* notesLabel, const QString notes, bool state)
{
auto flags = notesLabel->textInteractionFlags();
if (state) { if (state) {
m_ui->entryNotesLabel->setText(notes); notesLabel->setText(notes);
m_ui->entryNotesLabel->setToolTip(notes); notesLabel->setToolTip(notes);
m_ui->entryNotesLabel->setTextInteractionFlags(flags | Qt::TextSelectableByMouse); notesLabel->setTextInteractionFlags(flags | Qt::TextSelectableByMouse);
} else { } else {
if (notes.isEmpty()) { if (notes.isEmpty()) {
m_ui->entryNotesLabel->setText(""); notesLabel->setText("");
} else { } else {
m_ui->entryNotesLabel->setText(QString("\u25cf").repeated(6)); notesLabel->setText(QString("\u25cf").repeated(6));
} }
m_ui->entryNotesLabel->setToolTip({}); notesLabel->setToolTip({});
m_ui->entryNotesLabel->setTextInteractionFlags(flags & ~Qt::TextSelectableByMouse); notesLabel->setTextInteractionFlags(flags & ~Qt::TextSelectableByMouse);
} }
} }
@ -219,12 +228,12 @@ void EntryPreviewWidget::updateEntryGeneralTab()
} }
if (config()->get("security/hidenotes").toBool()) { if (config()->get("security/hidenotes").toBool()) {
setNotesVisible(false); setEntryNotesVisible(false);
m_ui->toggleNotesButton->setVisible(!m_ui->entryNotesLabel->text().isEmpty()); m_ui->toggleEntryNotesButton->setVisible(!m_ui->entryNotesLabel->text().isEmpty());
m_ui->toggleNotesButton->setChecked(false); m_ui->toggleEntryNotesButton->setChecked(false);
} else { } else {
setNotesVisible(true); setEntryNotesVisible(true);
m_ui->toggleNotesButton->setVisible(false); m_ui->toggleEntryNotesButton->setVisible(false);
} }
m_ui->entryUrlLabel->setRawText(m_currentEntry->displayUrl()); m_ui->entryUrlLabel->setRawText(m_currentEntry->displayUrl());
@ -307,14 +316,18 @@ void EntryPreviewWidget::updateGroupGeneralTab()
const QString expiresText = const QString expiresText =
groupTime.expires() ? groupTime.expiryTime().toString(Qt::DefaultLocaleShortDate) : tr("Never"); groupTime.expires() ? groupTime.expiryTime().toString(Qt::DefaultLocaleShortDate) : tr("Never");
m_ui->groupExpirationLabel->setText(expiresText); m_ui->groupExpirationLabel->setText(expiresText);
}
void EntryPreviewWidget::updateGroupNotesTab()
{
Q_ASSERT(m_currentGroup);
const QString notes = m_currentGroup->notes(); const QString notes = m_currentGroup->notes();
setTabEnabled(m_ui->groupTabWidget, m_ui->groupNotesTab, !notes.isEmpty()); m_ui->groupNotesLabel->setText(notes);
m_ui->groupNotesEdit->setText(notes);
if (config()->get("security/hidenotes").toBool()) {
setGroupNotesVisible(false);
m_ui->toggleGroupNotesButton->setVisible(!m_ui->groupNotesLabel->text().isEmpty());
m_ui->toggleGroupNotesButton->setChecked(false);
} else {
setGroupNotesVisible(true);
m_ui->toggleGroupNotesButton->setVisible(false);
}
} }
#if defined(WITH_XC_KEESHARE) #if defined(WITH_XC_KEESHARE)

View File

@ -52,11 +52,12 @@ private slots:
void updateEntryAdvancedTab(); void updateEntryAdvancedTab();
void updateEntryAutotypeTab(); void updateEntryAutotypeTab();
void setPasswordVisible(bool state); void setPasswordVisible(bool state);
void setNotesVisible(bool state); void setEntryNotesVisible(bool state);
void setGroupNotesVisible(bool state);
void setNotesVisible(QLabel* notesLabel, const QString notes, bool state);
void updateGroupHeaderLine(); void updateGroupHeaderLine();
void updateGroupGeneralTab(); void updateGroupGeneralTab();
void updateGroupNotesTab();
#if defined(WITH_XC_KEESHARE) #if defined(WITH_XC_KEESHARE)
void updateGroupSharingTab(); void updateGroupSharingTab();
#endif #endif

View File

@ -463,7 +463,7 @@
<string>Notes</string> <string>Notes</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight</set> <set>Qt::AlignTop|Qt::AlignRight</set>
</property> </property>
</widget> </widget>
</item> </item>
@ -476,7 +476,7 @@
<number>4</number> <number>4</number>
</property> </property>
<item alignment="Qt::AlignTop"> <item alignment="Qt::AlignTop">
<widget class="QToolButton" name="toggleNotesButton"> <widget class="QToolButton" name="toggleEntryNotesButton">
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
@ -841,8 +841,78 @@
<property name="bottomMargin"> <property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<item row="2" column="2"> <item row="0" column="0">
<widget class="QLabel" name="groupExpirationLabel"> <spacer name="groupLeftHorizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QLabel" name="groupAutotypeTitleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Autotype</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="groupAutotypeLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="groupSearchingTitleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Searching</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QLabel" name="groupSearchingLabel">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -873,8 +943,18 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="2" column="3">
<widget class="QLabel" name="groupAutotypeTitleLabel"> <widget class="QLabel" name="groupExpirationLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="groupNotesTitleLabel">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred"> <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -888,106 +968,63 @@
</font> </font>
</property> </property>
<property name="text"> <property name="text">
<string>Autotype</string> <string>Notes</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignTop|Qt::AlignRight</set>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="2"> <item row="3" column="2" colspan="2">
<widget class="QLabel" name="groupAutotypeLabel"> <layout class="QHBoxLayout" name="horizontalLayout_3" stretch="0,0">
<property name="sizePolicy"> <property name="spacing">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <number>6</number>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
</widget> <property name="leftMargin">
</item> <number>4</number>
<item row="1" column="2">
<widget class="QLabel" name="groupSearchingLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
</widget> <item alignment="Qt::AlignTop">
</item> <widget class="QToolButton" name="toggleGroupNotesButton">
<item row="0" column="0"> <property name="text">
<spacer name="groupLeftHorizontalSpacer"> <string/>
<property name="orientation"> </property>
<enum>Qt::Horizontal</enum> <property name="checkable">
</property> <bool>true</bool>
<property name="sizeType"> </property>
<enum>QSizePolicy::Fixed</enum> </widget>
</property> </item>
<property name="sizeHint" stdset="0"> <item>
<size> <widget class="QLabel" name="groupNotesLabel">
<width>20</width> <property name="sizePolicy">
<height>20</height> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
</size> <horstretch>0</horstretch>
</property> <verstretch>0</verstretch>
</spacer> </sizepolicy>
</item> </property>
<item row="1" column="1"> <property name="minimumSize">
<widget class="QLabel" name="groupSearchingTitleLabel"> <size>
<property name="sizePolicy"> <width>100</width>
<sizepolicy hsizetype="Minimum" vsizetype="Preferred"> <height>30</height>
<horstretch>0</horstretch> </size>
<verstretch>0</verstretch> </property>
</sizepolicy> <property name="text">
</property> <string notr="true">notes</string>
<property name="font"> </property>
<font> <property name="alignment">
<weight>75</weight> <set>Qt::AlignTop</set>
<bold>true</bold> </property>
</font> <property name="wordWrap">
</property> <bool>true</bool>
<property name="text"> </property>
<string>Searching</string> </widget>
</property> </item>
<property name="alignment"> </layout>
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="2">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item> </item>
</layout> </layout>
</widget> </widget>
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="groupNotesTab">
<attribute name="title">
<string>Notes</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_11">
<item>
<widget class="QTextEdit" name="groupNotesEdit">
<property name="focusPolicy">
<enum>Qt::ClickFocus</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="groupShareTab"> <widget class="QWidget" name="groupShareTab">
<attribute name="title"> <attribute name="title">
<string>Share</string> <string>Share</string>
@ -1106,7 +1143,7 @@
<tabstop>entryCloseButton</tabstop> <tabstop>entryCloseButton</tabstop>
<tabstop>entryTotpButton</tabstop> <tabstop>entryTotpButton</tabstop>
<tabstop>togglePasswordButton</tabstop> <tabstop>togglePasswordButton</tabstop>
<tabstop>toggleNotesButton</tabstop> <tabstop>toggleEntryNotesButton</tabstop>
<tabstop>entryAutotypeTree</tabstop> <tabstop>entryAutotypeTree</tabstop>
<tabstop>groupCloseButton</tabstop> <tabstop>groupCloseButton</tabstop>
<tabstop>groupTabWidget</tabstop> <tabstop>groupTabWidget</tabstop>