bool dtcomp(Note left, Note right) { if (left.category() == right.category()) { return left.datetime() > right.datetime(); } else { return left.category() < right.category(); } }
void NotesModel::addNote(const Note ¬e) { if (!m_categories.contains(note.category()) && (!note.category().isEmpty())) { m_categories.append(note.category()); } if ((m_filter == "All") || (m_filter == note.category())) { beginInsertRows(QModelIndex(), rowCount(), rowCount()); m_notes << note; endInsertRows(); } }
void NoteEditWidget::setNote(Note note) { clear(); ui->nameEdit->setText(note.name()); ui->textEdit->setHtml(note.text()); ui->createdLabel->setVisible(true); ui->modifiedLabel->setVisible(true); created_=note.created(); for (int i=0;i<ui->catBox->count();++i) { if (ui->catBox->itemText(i)==note.category()) ui->catBox->setCurrentIndex(i); } ui->createdLabel->setText(tr("Created %1").arg(created_.toString("dd.MM.yy hh:mm"))); ui->modifiedLabel->setText(tr("Modified %1").arg(note.modified().toString("dd.MM.yy hh:mm"))); ui->privateBox->setChecked(note.isPrivate()); }