Improve headline in EditEntryWidget.

This commit is contained in:
Florian Geyer 2012-10-21 21:45:54 +02:00
parent 92bf7c94d0
commit 08415bd824
3 changed files with 25 additions and 6 deletions

View File

@ -403,7 +403,7 @@ void DatabaseWidget::switchToView(bool accepted)
void DatabaseWidget::switchToHistoryView(Entry* entry) void DatabaseWidget::switchToHistoryView(Entry* entry)
{ {
m_historyEditEntryWidget->loadEntry(entry, false, true, "", m_db); m_historyEditEntryWidget->loadEntry(entry, false, true, m_editEntryWidget->entryTitle(), m_db);
setCurrentWidget(m_historyEditEntryWidget); setCurrentWidget(m_historyEditEntryWidget);
} }

View File

@ -209,7 +209,18 @@ void EditEntryWidget::useExpiryPreset(QAction* action)
m_mainUi->expireDatePicker->setDateTime(expiryDateTime); m_mainUi->expireDatePicker->setDateTime(expiryDateTime);
} }
void EditEntryWidget::loadEntry(Entry* entry, bool create, bool history, const QString& groupName, QString EditEntryWidget::entryTitle() const
{
if (m_entry) {
return m_entry->title();
}
else {
return QString();
}
}
void EditEntryWidget::loadEntry(Entry* entry, bool create, bool history, const QString& parentName,
Database* database) Database* database)
{ {
m_entry = entry; m_entry = entry;
@ -218,14 +229,21 @@ void EditEntryWidget::loadEntry(Entry* entry, bool create, bool history, const Q
m_history = history; m_history = history;
if (history) { if (history) {
setHeadline("Entry history"); setHeadline(QString("%1 > %2")
.arg(parentName)
.arg(tr("Entry history")));
} }
else { else {
if (create) { if (create) {
setHeadline(groupName+" > "+tr("Add entry")); setHeadline(QString("%1 > %2")
.arg(parentName)
.arg(tr("Add entry")));
} }
else { else {
setHeadline(groupName+" > "+tr("Edit entry")); setHeadline(QString("%1 > %2 > %3")
.arg(parentName)
.arg(entry->title())
.arg(tr("Edit entry")));
} }
} }

View File

@ -55,13 +55,14 @@ public:
explicit EditEntryWidget(QWidget* parent = Q_NULLPTR); explicit EditEntryWidget(QWidget* parent = Q_NULLPTR);
~EditEntryWidget(); ~EditEntryWidget();
void loadEntry(Entry* entry, bool create, bool history, const QString& groupName, void loadEntry(Entry* entry, bool create, bool history, const QString& parentName,
Database* database); Database* database);
static const QColor CorrectSoFarColor; static const QColor CorrectSoFarColor;
static const QColor ErrorColor; static const QColor ErrorColor;
void createPresetsMenu(QMenu* expirePresetsMenu); void createPresetsMenu(QMenu* expirePresetsMenu);
QString entryTitle() const;
Q_SIGNALS: Q_SIGNALS:
void editFinished(bool accepted); void editFinished(bool accepted);
void historyEntryActivated(Entry* entry); void historyEntryActivated(Entry* entry);