Skip to content

Commit

Permalink
TagsEdit code improvements and crash fix
Browse files Browse the repository at this point in the history
Fix crash when pressing home on empty tag field

Move completer to TagsEdit.
Move cursor blink status to TagsEdit.
Move paint implementation to impl.
Simplify calcRect and drawTag.

Hide editing_index and cursor position.
Fix bug where an empty tag was shown if the tag edit was unfocused.
Fix a bug where the scollbar was not updated when a tag was removed.

Hide remaining TextEdit internal fields.
Refactor to use QLinkedList.
Remove obsolete EmptyTagIterator.
Encapsulate tags and selected index in tags manager.
  • Loading branch information
libklein authored and droidmonkey committed Dec 22, 2024
1 parent 0cb0373 commit 571f7ba
Show file tree
Hide file tree
Showing 6 changed files with 486 additions and 422 deletions.
2 changes: 1 addition & 1 deletion src/gui/EntryPreviewWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ void EntryPreviewWidget::updateEntryGeneralTab()
const TimeInfo entryTime = m_currentEntry->timeInfo();
const QString expires = entryTime.expires() ? Clock::toString(entryTime.expiryTime().toLocalTime()) : tr("Never");
m_ui->entryExpirationLabel->setText(expires);
m_ui->entryTagsList->tags(m_currentEntry->tagList());
m_ui->entryTagsList->setTags(m_currentEntry->tagList());
m_ui->entryTagsList->setReadOnly(true);
}

Expand Down
4 changes: 2 additions & 2 deletions src/gui/entry/EditEntryWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -948,8 +948,8 @@ void EditEntryWidget::setForms(Entry* entry, bool restore)
m_mainUi->usernameComboBox->lineEdit()->setReadOnly(m_history);
m_mainUi->urlEdit->setReadOnly(m_history);
m_mainUi->passwordEdit->setReadOnly(m_history);
m_mainUi->tagsList->tags(entry->tagList());
m_mainUi->tagsList->completion(m_db->tagList());
m_mainUi->tagsList->setTags(entry->tagList());
m_mainUi->tagsList->setCompletion(m_db->tagList());
m_mainUi->expireCheck->setEnabled(!m_history);
m_mainUi->expireDatePicker->setReadOnly(m_history);
m_mainUi->revealNotesButton->setIcon(icons()->onOffIcon("password-show", false));
Expand Down
16 changes: 14 additions & 2 deletions src/gui/entry/EditEntryWidgetMain.ui
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,25 @@
</widget>
</item>
<item row="5" column="1">
<widget class="TagsEdit" name="tagsList" native="true">
<widget class="TagsEdit" name="tagsList">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>70</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="accessibleName">
<string>Tags list</string>
</property>
<property name="frameShape">
<enum>QFrame::Panel</enum>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustToContents</enum>
</property>
</widget>
</item>
<item row="7" column="1">
Expand Down Expand Up @@ -345,7 +357,7 @@
<customwidgets>
<customwidget>
<class>TagsEdit</class>
<extends>QWidget</extends>
<extends>QScrollArea</extends>
<header>gui/tag/TagsEdit.h</header>
<container>1</container>
</customwidget>
Expand Down
Loading

0 comments on commit 571f7ba

Please sign in to comment.