2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Jussi Laitinen - jussi.laitinen@ixonos.com
7 Situare is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 version 2 as published by the Free Software Foundation.
11 Situare is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with Situare; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
25 #include <QListWidget>
31 * @brief View for ListItems.
33 * ListView is used to show ListItems in list view. Items can be added, removed or
36 class ListView : public QListWidget
44 * @param parent QWidget
46 ListView(QWidget *parent = 0);
51 * Calls ListView::clearList().
55 /******************************************************************************
56 * MEMBER FUNCTIONS AND SLOTS
57 ******************************************************************************/
60 * @brief Add item to view and item list.
63 * @param item item to add to view and list
65 void addListItem(const QString &key, ListItem *item);
68 * @brief Adds item to view.
70 * @param item FriendListItem
72 void addListItemToView(ListItem *item);
75 * @brief Clear unused items from view.
77 * Clears items which are not in item ID's list from the view and items list.
79 * @param itemIDs list of item ID's to keep in list view
81 void clearUnused(const QStringList &itemIDs);
84 * @brief Clears filtering from list.
93 * Items are removed from view and item list.
98 * @brief Checks if view contains item with userID.
100 * @param userID user's ID
101 * @return true if view contains item, false otherwise
103 bool contains(const QString &userID);
106 * @brief Filters list by item IDs.
108 * Hide all items that are not in the itemIDs list.
110 * @param itemIDs item ID's for items that are shown
112 void filter(const QList<QString> &itemIDs);
115 * @brief Filters list by text pattern.
117 * Filtering uses item names.
119 * @param pattern text pattern to filter
121 void filter(const QString &pattern);
124 * @brief Takes item from view.
126 * Item is not deleted.
128 * @param itemID item's ID
131 ListItem *takeListItemFromView(const QString &itemID);
134 * @brief Returns ListItem with itemID.
136 * @param itemID item's ID
139 ListItem *listItem(const QString &itemID);
145 * @brief Slot for list item clicked.
147 * Toggles items selection state and emits listItemClicked signal.
149 virtual void listItemClicked(QListWidgetItem *item);
151 /*******************************************************************************
153 ******************************************************************************/
155 QHash<QString, ListItem *> m_listItems; ///< List of items in this view. Key = user ID
157 ListItem *m_previousItem; ///< Previously selected item