mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-30 09:46:30 -05:00
Enhance FormatStatusText(), other minor cosmetics
This commit is contained in:
parent
705b74b3ba
commit
984602b7a0
@ -138,14 +138,14 @@ void CsvImportWidget::updatePreview() {
|
|||||||
int i;
|
int i;
|
||||||
QStringList list(tr("Not present in CSV file"));
|
QStringList list(tr("Not present in CSV file"));
|
||||||
|
|
||||||
for (i = 1; i < m_parserModel->getCsvCols(); i++) {
|
for (i = 1; i < m_parserModel->getCsvCols(); ++i) {
|
||||||
QString s = QString(tr("Column ")) + QString::number(i);
|
QString s = QString(tr("Column ")) + QString::number(i);
|
||||||
list << s;
|
list << s;
|
||||||
}
|
}
|
||||||
m_comboModel->setStringList(list);
|
m_comboModel->setStringList(list);
|
||||||
|
|
||||||
i=1;
|
i=1;
|
||||||
Q_FOREACH (QComboBox* b, m_combos) {
|
for (QComboBox* b : m_combos) {
|
||||||
if (i < m_parserModel->getCsvCols())
|
if (i < m_parserModel->getCsvCols())
|
||||||
b->setCurrentIndex(i);
|
b->setCurrentIndex(i);
|
||||||
else
|
else
|
||||||
@ -184,20 +184,21 @@ void CsvImportWidget::parse() {
|
|||||||
QString CsvImportWidget::formatStatusText() const {
|
QString CsvImportWidget::formatStatusText() const {
|
||||||
QString text = m_parserModel->getStatus();
|
QString text = m_parserModel->getStatus();
|
||||||
int items = text.count('\n');
|
int items = text.count('\n');
|
||||||
if (items > 2)
|
if (items > 2) {
|
||||||
return text.section('\n', 0, 1)
|
return text.section('\n', 0, 1)
|
||||||
.append("\n[").append(QString::number(items - 2))
|
.append("\n[").append(QString::number(items - 2))
|
||||||
.append(tr(" more messages skipped]"));
|
.append(tr(" more messages skipped]"));
|
||||||
else
|
}
|
||||||
for (int i = 0; i < 2 - items; i++)
|
if (items == 1) {
|
||||||
text.append(QString("\n"));
|
text.append(QString("\n"));
|
||||||
return text;
|
}
|
||||||
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CsvImportWidget::writeDatabase() {
|
void CsvImportWidget::writeDatabase() {
|
||||||
|
|
||||||
setRootGroup();
|
setRootGroup();
|
||||||
for (int r = 0; r < m_parserModel->rowCount(); r++) {
|
for (int r = 0; r < m_parserModel->rowCount(); ++r) {
|
||||||
//use validity of second column as a GO/NOGO for all others fields
|
//use validity of second column as a GO/NOGO for all others fields
|
||||||
if (not m_parserModel->data(m_parserModel->index(r, 1)).isValid())
|
if (not m_parserModel->data(m_parserModel->index(r, 1)).isValid())
|
||||||
continue;
|
continue;
|
||||||
@ -229,7 +230,7 @@ void CsvImportWidget::setRootGroup() {
|
|||||||
bool is_empty = false;
|
bool is_empty = false;
|
||||||
bool is_label = false;
|
bool is_label = false;
|
||||||
|
|
||||||
for (int r = 0; r < m_parserModel->rowCount(); r++) {
|
for (int r = 0; r < m_parserModel->rowCount(); ++r) {
|
||||||
//use validity of second column as a GO/NOGO for all others fields
|
//use validity of second column as a GO/NOGO for all others fields
|
||||||
if (not m_parserModel->data(m_parserModel->index(r, 1)).isValid())
|
if (not m_parserModel->data(m_parserModel->index(r, 1)).isValid())
|
||||||
continue;
|
continue;
|
||||||
|
@ -46,7 +46,7 @@ bool CsvParserModel::parse() {
|
|||||||
QFile csv(m_filename);
|
QFile csv(m_filename);
|
||||||
r = CsvParser::parse(&csv);
|
r = CsvParser::parse(&csv);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < columnCount(); i++)
|
for (int i = 0; i < columnCount(); ++i)
|
||||||
m_columnMap.insert(i,0);
|
m_columnMap.insert(i,0);
|
||||||
addEmptyColumn();
|
addEmptyColumn();
|
||||||
endResetModel();
|
endResetModel();
|
||||||
|
Loading…
Reference in New Issue
Block a user