Esempio n. 1
0
bool NoteOfTheDay::has_changed(const gnote::Note::Ptr & note)
{
  const sharp::DateTime & date_time = note->create_date();
  const std::string original_xml
    = get_content(Glib::Date(
                    date_time.day(),
                    static_cast<Glib::Date::Month>(date_time.month()),
                    date_time.year()),
                  note->manager());

  return get_content_without_title(note->text_content())
           == get_content_without_title(
                gnote::utils::XmlDecoder::decode(original_xml))
         ? false
         : true;
}
Esempio n. 2
0
bool BacklinksNoteAddin::check_note_has_match(const gnote::Note::Ptr & note, 
                                              const std::string & encoded_title)
{
  Glib::ustring note_text = note->xml_content();
  note_text = note_text.lowercase();
  return note_text.find(encoded_title) != Glib::ustring::npos;
}
Esempio n. 3
0
std::string NoteOfTheDay::get_content(
                            const Glib::Date & date,
                            const gnote::NoteManager & manager)
{
  const std::string title = get_title(date);

  // Attempt to load content from template
  const gnote::Note::Ptr template_note = manager.find(
                                                   s_template_title);

  if (0 != template_note) {
    std::string xml_content = template_note->xml_content();
    return xml_content.replace(xml_content.find(s_template_title, 0),
                               s_template_title.length(),
                               title);
  }
  else {
    return get_template_content(title);
  }
}