Skip to content

Commit

Permalink
Merge pull request #144 from azubieta/fix_wrong_date_texts_in_mmm
Browse files Browse the repository at this point in the history
Fix wrong date texts in the UI.
  • Loading branch information
raoulh authored Nov 5, 2017
2 parents 79641b0 + 6bda9c4 commit fd8e499
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 29 deletions.
16 changes: 8 additions & 8 deletions src/CredentialModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,11 @@ void CredentialModel::load(const QJsonArray &json)

// Update login item created date
QDate dCreatedDate = QDate::fromString(cnode["date_created"].toString(), Qt::ISODate);
pLoginItem->setCreatedDate(dCreatedDate);
pLoginItem->setUpdatedDate(dCreatedDate);

// Update login item updated date
QDate dUpdatedDate = QDate::fromString(cnode["date_last_used"].toString(), Qt::ISODate);
pLoginItem->setUpdatedDate(dUpdatedDate);
pLoginItem->setAccessedDate(dUpdatedDate);

QJsonArray a = cnode["address"].toArray();
if (a.size() < 2)
Expand Down Expand Up @@ -301,22 +301,22 @@ void CredentialModel::updateLoginItem(const QModelIndex &idx, const ItemRole &ro
}
break;
}
case DateCreatedRole:
case DateUpdatedRole:
{
QDate dDate = vValue.toDate();
if (dDate != pLoginItem->createdDate())
if (dDate != pLoginItem->updatedDate())
{
pLoginItem->setCreatedDate(dDate);
pLoginItem->setUpdatedDate(dDate);
bChanged = true;
}
break;
}
case DateUpdatedRole:
case DateAccessedRole:
{
QDate dDate = vValue.toDate();
if (dDate != pLoginItem->updatedDate())
if (dDate != pLoginItem->accessedDate())
{
pLoginItem->setUpdatedDate(dDate);
pLoginItem->setAccessedDate(dDate);
bChanged = true;
}
break;
Expand Down
2 changes: 1 addition & 1 deletion src/CredentialModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class CredentialModel : public QAbstractItemModel
ItemNameRole=Qt::UserRole+1,
PasswordRole,
DescriptionRole,
DateCreatedRole,
DateUpdatedRole,
DateAccessedRole,
FavoriteRole
};

Expand Down
4 changes: 2 additions & 2 deletions src/CredentialsManagement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -605,8 +605,8 @@ void CredentialsManagement::updateLoginDescription(LoginItem *pLoginItem)
ui->credDisplayLoginInput->setText(pLoginItem->name());
ui->credDisplayPasswordInput->setText(pLoginItem->password());
ui->credDisplayDescriptionInput->setText(pLoginItem->description());
ui->credDisplayCreationDateInput->setText(pLoginItem->createdDate().toString(Qt::DefaultLocaleShortDate));
ui->credDisplayModificationDateInput->setText(pLoginItem->updatedDate().toString(Qt::DefaultLocaleShortDate));
ui->credDisplayCreationDateInput->setText(pLoginItem->updatedDate().toString(Qt::DefaultLocaleShortDate));
ui->credDisplayModificationDateInput->setText(pLoginItem->accessedDate().toString(Qt::DefaultLocaleShortDate));
ui->credDisplayPasswordInput->setLocked(pLoginItem->passwordLocked());
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/CredentialsManagement.ui
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ border-right: none;
</font>
</property>
<property name="text">
<string>Creation Date:</string>
<string>Last Modified:</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -568,7 +568,7 @@ border-right: none;
</font>
</property>
<property name="text">
<string>Last Modified:</string>
<string>Last Accessed:</string>
</property>
</widget>
</item>
Expand Down
6 changes: 3 additions & 3 deletions src/LoginItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ QJsonObject LoginItem::toJson() const

QString LoginItem::itemLabel() const
{
QString sTargetDate = createdDate().toString(Qt::DefaultLocaleShortDate);
if (!updatedDate().isNull())
sTargetDate = updatedDate().toString(Qt::DefaultLocaleShortDate);
QString sTargetDate = updatedDate().toString(Qt::DefaultLocaleShortDate);
if (!accessedDate().isNull())
sTargetDate = accessedDate().toString(Qt::DefaultLocaleShortDate);
return m_sName + QString(" (") + sTargetDate + QString(")");
}

Expand Down
20 changes: 10 additions & 10 deletions src/TreeItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ TreeItem::TreeItem(const QString &sName, const QDate &dCreatedDate, const QDate
m_pParentItem(nullptr),
m_eStatus(UNUSED),
m_sName(sName),
m_dCreatedDate(dCreatedDate),
m_dUpdatedDate(dUpdatedDate),
m_dUpdatedDate(dCreatedDate),
m_dAccessedDate(dUpdatedDate),
m_sDescription(sDescription)
{
}
Expand Down Expand Up @@ -70,24 +70,24 @@ void TreeItem::setStatus(const Status &eStatus)
m_eStatus = eStatus;
}

const QDate &TreeItem::createdDate() const
const QDate &TreeItem::updatedDate() const
{
return m_dCreatedDate;
return m_dUpdatedDate;
}

void TreeItem::setCreatedDate(const QDate &dDate)
void TreeItem::setUpdatedDate(const QDate &dDate)
{
m_dCreatedDate = dDate;
m_dUpdatedDate = dDate;
}

const QDate &TreeItem::updatedDate() const
const QDate &TreeItem::accessedDate() const
{
return m_dUpdatedDate;
return m_dAccessedDate;
}

void TreeItem::setUpdatedDate(const QDate &dDate)
void TreeItem::setAccessedDate(const QDate &dDate)
{
m_dUpdatedDate = dDate;
m_dAccessedDate = dDate;
}

const QString &TreeItem::description() const
Expand Down
6 changes: 3 additions & 3 deletions src/TreeItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ class TreeItem
void setParentItem(TreeItem *pParentItem);
const Status &status() const;
void setStatus(const Status &eStatus);
const QDate &createdDate() const;
void setCreatedDate(const QDate &dDate);
const QDate &updatedDate() const;
void setUpdatedDate(const QDate &dDate);
const QDate &accessedDate() const;
void setAccessedDate(const QDate &dDate);
const QString &description() const;
void setDescription(const QString &sDescription);
TreeItem *child(int iIndex);
Expand All @@ -47,8 +47,8 @@ class TreeItem
TreeItem *m_pParentItem;
Status m_eStatus;
QString m_sName;
QDate m_dCreatedDate;
QDate m_dUpdatedDate;
QDate m_dAccessedDate;
QString m_sDescription;
};

Expand Down

0 comments on commit fd8e499

Please sign in to comment.