240 for (
ModelItemIter i = items->begin(); i != items->end(); ++i) {
242 (*i)->set_checked(checked);
254 for (
ModelItemIter i = items->begin(); i != items->end(); ++i) {
256 (*i)->set_checked(!(*i)->get_checked());
virtual bool filter(bool checked)
Applies the current filter.
ModelItemContainer::iterator ModelItemIter
ModelCategory * find_category(long cat_id)
Category * create_category()
Creates a new category.
Represents a Category combined with GuiState attributes.
virtual void save_model(KitModel *model)=0
Saves the current data model.
virtual void select_items(ModelItemContainer *items, bool checked=true)
Checks or unchecks all the passed items.
virtual void set_dirty(bool dirty=true)
virtual long get_next_category_id()=0
void set_dirty(bool dirty=true)
void set_new_flag(bool flag)
virtual void add_category(ModelCategory *category)
Add a category to the model.
virtual ModelItem * find_item(long id)
Finds an item by it's unique ID.
std::vector< Item * > ItemContainer
virtual ModelCategory * find_category(long id)
Finds a Category by it's unique ID.
void save_model(KitModel *model)
Saves the model as an XML document.
virtual ItemContainer * get_items()
Returns the list of items belonging to the Category.
void open_as_xml(const Glib::ustring &filename)
Loads a new data model from the named XML document.
Comparator used for sorting Items by name.
Service(KitListDao &dao)
Loads the data model from the persistence store.
virtual KitModel * get_model()=0
Loads the data model.
ItemContainer * get_items(long cat_id=-1)
Returns a list of items.
std::vector< ModelItem * > ModelItemContainer
Item * create_item(long cat_id)
Creates a new ModelItem and associates it with the specified category.
bool delete_category(long cat_id)
Flags a category as deleted.
virtual ItemContainer * get_all_items()
Returns a list of all items.
void set_deleted(bool deleted)
virtual long get_next_item_id()=0
KitModel * load_model()
Loads the data model from the persistence store.
Defines the methods that an implementation of this class must implement.
void save_as_xml(const Glib::ustring &filename)
Saves the model's state to an XML document.
CategoryContainer * get_categories()
Returns a list of all categories.
bool update_item(long id, const std::string description, bool checked)
Updates the attributes of an item.
Represents an Item combined with GuiState attributes.
Holds a rich graph of objects representing the application's data model.
virtual void toggle_selected_items(ModelItemContainer *items)
Toggles the checked state of all the passed items.
void copy_items(const ModelItemContainer &items, long cat_id)
Copies items to the specified category.
bool delete_item(long id)
Flags an item as deleted.
virtual CategoryContainer * get_categories()
Returns a list of all categories.
Implementation of a KitListDao using XML as the persistence store.
virtual void set_checked(bool checked)
ItemContainer * get_filtered_items(long cat_id=-1)
Returns a list of items, applying the current filter.
std::vector< Category * > CategoryContainer
virtual void add_item(ModelItem *item)
Adds an item to the model.
void set_model_dirty(bool flag=true)
KitListDao & m_dao
Reference to the perisitence data access object.
virtual void reset()
Resets all contained objects to their default states.
void create_default_model()
Creates a default model.
ModelItem * find_item(long id)
void set_description(const std::string description)
Functor for processing items.
bool operator()(Item &item)
long get_next_category_id()
virtual void copy_items(const ModelItemContainer &items, long cat_id=-1)
Copies items to the specified category.
KitModel * m_model
The application's data model.
FilterItem(KitModel &model)