/* Update the global counters due to mail status transitions or mail deletion */ void query_listview::update_status_counters() { display_counter(query_lvitem::new_all); display_counter(query_lvitem::nonproc_all); display_counter(query_lvitem::new_not_tagged); }
void query_listview::refresh() { msg_status_cache::reset(); free_mail_maps(); fetch_tag_map(); if (m_item_current) delete m_item_current; tags_definition_list tag_list; tag_list.fetch(); tag_node root; root.get_child_tags(tag_list); create_branch_current(&root); display_counter(query_lvitem::new_all); display_counter(query_lvitem::nonproc_all); display_counter(query_lvitem::new_not_tagged); }
void query_listview::init() { setHeaderLabel(tr("Quick selection")); setRootIsDecorated(true); fetch_tag_map(); tags_definition_list tag_list; tag_list.fetch(); tag_node root; root.get_child_tags(tag_list); // New messages query_lvitem* item_new = new query_lvitem(this, tr("Unread messages")); m_item_new_all = new query_lvitem(item_new, query_lvitem::new_all, tr("All")); m_item_new_untagged = new query_lvitem(item_new, query_lvitem::new_not_tagged, tr("Not tagged")); item_new->setExpanded(true); create_branch_current(&root); // Tagged messages // The root is a pseudo-tag with an id=0 m_item_tags = new query_tag_lvitem(this, query_lvitem::archived_tagged, tr("Archived tagged mail")); insert_child_tags(&root, m_item_tags, query_lvitem::archived_tagged, NULL); m_item_tags->sortChildren(0, Qt::AscendingOrder); m_item_virtfold_sent = new query_lvitem(this, tr("Sent mail")); m_item_virtfold_sent->set_type(query_lvitem::virtfold_sent); m_item_virtfold_trashcan = new query_lvitem(this, tr("Trashcan")); m_item_virtfold_trashcan->set_type(query_lvitem::virtfold_trashcan); // User queries m_item_user_queries = new query_lvitem(this, tr("User queries")); reload_user_queries(); display_counter(query_lvitem::new_all); display_counter(query_lvitem::nonproc_all); display_counter(query_lvitem::new_not_tagged); }
/* Called by an msg_list_window to update counters when a mail tag has changed. 'added' is true if the tag has been added, false if removed */ void query_listview::mail_tag_changed(const mail_msg& msg, uint tag_id, bool added) { DBG_PRINTF(8, "mail_tag_changed mail_id=%u, tag=%u %s\n", msg.get_id(), tag_id, added?"added":"removed"); qs_tag_map::iterator itt = m_tagged.find(tag_id); qs_tag_map::iterator it_no_tag = m_tagged.find(0); if (itt!=m_tagged.end()) { // the leaf for the tag already exists qs_mail_map* m = itt->second; if (added) { (*m)[msg.get_id()] = msg.status(); } else { m->erase(msg.get_id()); // if the message no longer has any tag, update the 'Not Tagged' branches if (msg.get_cached_tags().empty() && it_no_tag!=m_tagged.end()) { qs_mail_map* m_no_tag = it_no_tag->second; (*m_no_tag)[msg.get_id()] = msg.status(); update_tag_current_counter(0); display_counter(query_lvitem::new_not_tagged); } } update_tag_current_counter(tag_id); // update the 'Not Tagged' branch counter if the mail was counted in it if (added) { if (it_no_tag!=m_tagged.end()) { m = it_no_tag->second; qs_mail_map::iterator qi; qi = m->find(msg.get_id()); if (qi!=m->end()) { m->erase(msg.get_id()); update_tag_current_counter(0); } } } } else { DBG_PRINTF(8, "create a new tag branch for '%u' in query_listview\n", tag_id); add_current_tag(tag_id); // adds tag_id to m_tagged itt = m_tagged.find(tag_id); if (itt!=m_tagged.end()) { qs_mail_map* m = itt->second; (*m)[msg.get_id()] = msg.status(); update_tag_current_counter(tag_id); } else DBG_PRINTF(1, "ERR: couldn't find tag map for tag_id=%u just added\n", tag_id); } }
void window_load(){ create_counter(); create_text(); display_counter(); }
void down_clicked(ClickRecognizerRef recognizer, void* context) { decrement_counter(); display_counter(); }
void select_clicked(ClickRecognizerRef recognizer, void* context) { reset_counter(); display_counter(); }
void up_clicked(ClickRecognizerRef recognizer, void* context) { increment_counter(); display_counter(); }