Skip to content

Commit 0a2238d

Browse files
committed
Implement keepassxreboot#1208: CSV Import Created and Modified Dates
1 parent 8f99764 commit 0a2238d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/gui/csvImport/CsvImportWidget.cpp

+14
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ const QStringList CsvImportWidget::m_columnHeader = QStringList()
3737
<< QObject::tr("Password")
3838
<< QObject::tr("URL")
3939
<< QObject::tr("Notes")
40+
<< QObject::tr("Last Modified")
41+
<< QObject::tr("Created")
4042
// << QObject::tr("Future field1")
4143
// << QObject::tr("Future field2")
4244
// << QObject::tr("Future field3")
@@ -223,6 +225,18 @@ void CsvImportWidget::writeDatabase() {
223225
entry->setPassword(m_parserModel->data(m_parserModel->index(r, 3)).toString());
224226
entry->setUrl(m_parserModel->data(m_parserModel->index(r, 4)).toString());
225227
entry->setNotes(m_parserModel->data(m_parserModel->index(r, 5)).toString());
228+
229+
if (m_parserModel->data(m_parserModel->index(r, 6)).isValid()) {
230+
qint64 lastModified = m_parserModel->data(m_parserModel->index(r, 6)).toString().toLongLong();
231+
qint64 created = m_parserModel->data(m_parserModel->index(r, 7)).toString().toLongLong();
232+
if (!lastModified || !created)
233+
continue;
234+
235+
TimeInfo timeInfo;
236+
timeInfo.setLastModificationTime(QDateTime::fromSecsSinceEpoch(lastModified).toTimeSpec(Qt::UTC));
237+
timeInfo.setCreationTime(QDateTime::fromSecsSinceEpoch(created).toTimeSpec(Qt::UTC));
238+
entry->setTimeInfo(timeInfo);
239+
}
226240
}
227241
QBuffer buffer;
228242
buffer.open(QBuffer::ReadWrite);

0 commit comments

Comments
 (0)