Changeset 6151 for trunk/qt4-gui/src/views
- Timestamp:
- 04/15/08 03:53:20 (8 months ago)
- Location:
- trunk/qt4-gui/src/views
- Files:
-
- 7 modified
-
floatyview.cpp (modified) (1 diff)
-
floatyview.h (modified) (1 diff)
-
mmuserview.cpp (modified) (1 diff)
-
userview.cpp (modified) (2 diffs)
-
userview.h (modified) (2 diffs)
-
userviewbase.cpp (modified) (3 diffs)
-
userviewbase.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/qt4-gui/src/views/floatyview.cpp
r5933 r6151 39 39 UserFloatyList FloatyView::floaties; 40 40 41 FloatyView::FloatyView(ContactListModel* contactList, ICQUser* licqUser, UserMenu* userMenu,QWidget* parent)42 : UserViewBase(contactList, userMenu,parent),41 FloatyView::FloatyView(ContactListModel* contactList, ICQUser* licqUser, QWidget* parent) 42 : UserViewBase(contactList, parent), 43 43 myPpid(licqUser->PPID()) 44 44 { -
trunk/qt4-gui/src/views/floatyview.h
r5933 r6151 45 45 * @param contactList The contact list instance 46 46 * @param licqUser The daemon contact to create floaty for 47 * @param userMenu User menu instance48 47 * @param parent Parent object 49 48 */ 50 FloatyView(ContactListModel* contactList, ICQUser* licqUser, UserMenu* userMenu,QWidget* parent = 0);49 FloatyView(ContactListModel* contactList, ICQUser* licqUser, QWidget* parent = 0); 51 50 52 51 /** -
trunk/qt4-gui/src/views/mmuserview.cpp
r5837 r6151 50 50 51 51 MMUserView::MMUserView(QString id, unsigned long ppid, ContactListModel* contactList, QWidget* parent) 52 : UserViewBase(contactList, NULL,parent),52 : UserViewBase(contactList, parent), 53 53 myId(id), 54 54 myPpid(ppid) -
trunk/qt4-gui/src/views/userview.cpp
r6131 r6151 33 33 #include "contactlist/maincontactlistproxy.h" 34 34 35 #include "core/usermenu.h"36 37 35 using namespace LicqQtGui; 38 36 39 UserView::UserView(ContactListModel* contactList, UserMenu* mnuUser,QWidget* parent)40 : UserViewBase(contactList, mnuUser,parent)37 UserView::UserView(ContactListModel* contactList, QWidget* parent) 38 : UserViewBase(contactList, parent) 41 39 { 42 40 // Use a proxy model for sorting and filtering … … 238 236 setExpanded(currentIndex(), !isExpanded(currentIndex())); 239 237 } 240 else if (itemType == ContactListModel::UserItem)238 else 241 239 { 242 QString id = currentIndex().data(ContactListModel::UserIdRole).toString(); 243 unsigned long ppid = currentIndex().data(ContactListModel::PpidRole).toUInt(); 244 245 myUserMenu->popup(viewport()->mapToGlobal(QPoint(40, visualRect(currentIndex()).y())), id, ppid); 240 popupMenu(viewport()->mapToGlobal(QPoint(40, visualRect(currentIndex()).y())), currentIndex()); 246 241 } 247 242 return; -
trunk/qt4-gui/src/views/userview.h
r6130 r6151 28 28 namespace LicqQtGui 29 29 { 30 class UserMenu;31 30 32 31 /** … … 42 41 * 43 42 * @param contactList The contact list instance 44 * @param userMenu User menu instance45 43 * @param parent Parent object 46 44 */ 47 UserView(ContactListModel* contactList, UserMenu* userMenu,QWidget* parent = 0);45 UserView(ContactListModel* contactList, QWidget* parent = 0); 48 46 49 47 /** -
trunk/qt4-gui/src/views/userviewbase.cpp
r6148 r6151 44 44 using namespace LicqQtGui; 45 45 46 UserViewBase::UserViewBase(ContactListModel* contactList, UserMenu* mnuUser,QWidget* parent)46 UserViewBase::UserViewBase(ContactListModel* contactList, QWidget* parent) 47 47 : QTreeView(parent), 48 myContactList(contactList), 49 myUserMenu(mnuUser) 48 myContactList(contactList) 50 49 { 51 50 setItemDelegate(new ContactDelegate(this, this)); … … 124 123 void UserViewBase::contextMenuEvent(QContextMenuEvent* event) 125 124 { 126 if (myUserMenu == NULL)127 return;128 129 125 QModelIndex clickedItem = indexAt(event->pos()); 130 126 if (clickedItem.isValid()) … … 132 128 setCurrentIndex(clickedItem); 133 129 134 if (static_cast<ContactListModel::ItemType> 135 (clickedItem.data(ContactListModel::ItemTypeRole).toInt()) == ContactListModel::UserItem) 136 { 137 QString id = clickedItem.data(ContactListModel::UserIdRole).toString(); 138 unsigned long ppid = clickedItem.data(ContactListModel::PpidRole).toUInt(); 139 140 myUserMenu->popup(viewport()->mapToGlobal(event->pos()), id, ppid); 141 } 130 popupMenu(viewport()->mapToGlobal(event->pos()), clickedItem); 131 } 132 } 133 134 void UserViewBase::popupMenu(QPoint point, QModelIndex item) 135 { 136 ContactListModel::ItemType itemType = static_cast<ContactListModel::ItemType> 137 (item.data(ContactListModel::ItemTypeRole).toInt()); 138 139 if (itemType == ContactListModel::UserItem) 140 { 141 QString id = item.data(ContactListModel::UserIdRole).toString(); 142 unsigned long ppid = item.data(ContactListModel::PpidRole).toUInt(); 143 144 LicqGui::instance()->userMenu()->popup(point, id, ppid); 142 145 } 143 146 } -
trunk/qt4-gui/src/views/userviewbase.h
r6055 r6151 30 30 31 31 class ContactListModel; 32 class UserMenu;33 32 34 33 /** … … 46 45 * 47 46 * @param contactList The contact list instance 48 * @param mnuUser User menu instance49 47 * @param parent Parent object 50 48 */ 51 UserViewBase(ContactListModel* contactList, UserMenu* mnuUser,QWidget* parent = 0);49 UserViewBase(ContactListModel* contactList, QWidget* parent = 0); 52 50 53 51 /** … … 101 99 102 100 /** 101 * Show popup menu for an item 102 * 103 * @param point Coordinate to show menu from 104 * @param item Index to show menu for 105 */ 106 void popupMenu(QPoint point, QModelIndex item); 107 108 /** 103 109 * Item is being dragged 104 110 * … … 123 129 ContactListModel* myContactList; 124 130 QAbstractProxyModel* myListProxy; 125 UserMenu* myUserMenu;126 131 QPoint myMousePressPos; 127 132
