• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdenetwork API Reference
  • KDE Home
  • Contact Us
 

kopete/kopete

  • sources
  • kde-4.14
  • kdenetwork
  • kopete
  • kopete
  • chatwindow
chatmemberslistview.cpp
Go to the documentation of this file.
1 /*
2  ChatMembersListView
3 
4  Copyright (c) 2007 by Duncan Mac-Vicar Prett <duncan@kde.org>
5 
6  Kopete (c) 2002-2007 by the Kopete developers <kopete-devel@kde.org>
7 
8  *************************************************************************
9  * *
10  * This library is free software; you can redistribute it and/or *
11  * modify it under the terms of the GNU Lesser General Public *
12  * License as published by the Free Software Foundation; either *
13  * version 2 of the License, or (at your option) any later version. *
14  * *
15  *************************************************************************
16 */
17 
18 #include "chatmemberslistview.h"
19 
20 #include <QToolTip>
21 #include <QHelpEvent>
22 #include <QDrag>
23 #include <QMimeData>
24 
25 #include "kdebug.h"
26 #include "kmenu.h"
27 #include "kopetecontact.h"
28 #include "chatsessionmemberslistmodel.h"
29 
30 using namespace Kopete;
31 
32 ChatMembersListView::ChatMembersListView( QWidget *parent )
33  : QListView( parent )
34 {
35  setContextMenuPolicy (Qt::CustomContextMenu);
36  connect(this, SIGNAL(customContextMenuRequested(QPoint)), SLOT(slotContextMenuRequested(QPoint)));
37 }
38 
39 void ChatMembersListView::slotContextMenuRequested( const QPoint & pos )
40 {
41  kDebug() << "context menu requested";
42  QModelIndex index = indexAt(pos);
43  if ( model() )
44  {
45  ChatSessionMembersListModel *membermodel = dynamic_cast<ChatSessionMembersListModel *>(model());
46  if ( membermodel )
47  {
48  Kopete::Contact *c = membermodel->contactAt(index);
49 
50  if (!c)
51  return;
52 
53  KMenu *p = c->popupMenu();
54  connect( p, SIGNAL(aboutToHide()), p, SLOT(deleteLater()) );
55  p->popup( mapToGlobal(pos) );
56  }
57  }
58 }
59 
60 ChatMembersListView::~ChatMembersListView()
61 {
62 }
63 
64 #include "chatmemberslistview.moc"
65 
66 // vim: set noet ts=4 sts=4 sw=4:
67 
QWidget::customContextMenuRequested
void customContextMenuRequested(const QPoint &pos)
QModelIndex
QWidget
QWidget::mapToGlobal
QPoint mapToGlobal(const QPoint &pos) const
ChatMembersListView::slotContextMenuRequested
void slotContextMenuRequested(const QPoint &pos)
Definition: chatmemberslistview.cpp:39
QPoint
chatmemberslistview.h
QListView
QObject::deleteLater
void deleteLater()
QWidget::setContextMenuPolicy
void setContextMenuPolicy(Qt::ContextMenuPolicy policy)
QListView::indexAt
virtual QModelIndex indexAt(const QPoint &p) const
ChatMembersListView::~ChatMembersListView
virtual ~ChatMembersListView()
Definition: chatmemberslistview.cpp:60
QAbstractItemView::model
QAbstractItemModel * model() const
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
ChatMembersListView::ChatMembersListView
ChatMembersListView(QWidget *parent=0)
Definition: chatmemberslistview.cpp:32
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:29:08 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kopete/kopete

Skip menu "kopete/kopete"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdenetwork API Reference

Skip menu "kdenetwork API Reference"
  • kget
  • kopete
  •   kopete
  •   libkopete
  • krdc
  • krfb

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal