• 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.12
  • kdenetwork
  • kopete
  • kopete
kopeteidentitystatusbaricon.cpp
Go to the documentation of this file.
1 /*
2  kopeteidentitystatusbaricon.cpp - Kopete Identity StatusBar Dock Icon
3 
4  Copyright (c) 2007 by Gustavo Pichorim Boiko <gustavo.boiko@kdemail.net>
5  Copyright (c) 2001-2003 by Duncan Mac-Vicar Prett <duncan@kde.org>
6 
7  Kopete (c) 2002-2007 by the Kopete developers <kopete-devel@kde.org>
8 
9  *************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  *************************************************************************
17 */
18 
19 #include "kopeteidentitystatusbaricon.h"
20 #include <kopeteidentity.h>
21 #include <kopetestatusmessage.h>
22 #include <kopetestatusrootaction.h>
23 #include <kactionmenu.h>
24 
25 #include <KMenu>
26 
27 KopeteIdentityStatusBarIcon::KopeteIdentityStatusBarIcon( Kopete::Identity *identity, QWidget *parent )
28 : QLabel( parent )
29 {
30  setFixedSize ( 16, 16 );
31  setCursor(QCursor(Qt::PointingHandCursor));
32  show();
33 
34  m_identity = identity;
35 
36 }
37 
38 void KopeteIdentityStatusBarIcon::mousePressEvent( QMouseEvent *me )
39 {
40  if( me->button() == Qt::LeftButton )
41  {
42  emit leftClicked( m_identity, me->globalPos() );
43  }
44  else if( me->button() == Qt::RightButton )
45  {
46  // show the context menu for the left click
47  // creates the action menu
48  KActionMenu *statusMenu = new KActionMenu(m_identity->label(), this);
49 
50  // add a title to the popup menu before the online action
51  statusMenu->menu()->addTitle(m_identity->label());
52 
53  // Will be automatically deleted when the statusMenu is deleted.
54  Kopete::StatusRootAction* statusAction = new Kopete::StatusRootAction( statusMenu );
55 
56  connect( statusAction, SIGNAL(changeStatus(uint,Kopete::StatusMessage)),
57  m_identity, SLOT(setOnlineStatus(uint,Kopete::StatusMessage)) );
58  connect( statusAction, SIGNAL(updateMessage(Kopete::StatusRootAction*)),
59  this, SLOT(updateMessage(Kopete::StatusRootAction*)) );
60  connect( statusAction, SIGNAL(changeMessage(Kopete::StatusMessage)),
61  m_identity, SLOT(setStatusMessage(Kopete::StatusMessage)) );
62 
63  connect( statusMenu->menu(), SIGNAL(aboutToHide()), statusMenu, SLOT(deleteLater()) );
64  statusMenu->menu()->popup( me->globalPos() );
65  }
66 }
67 
68 void KopeteIdentityStatusBarIcon::updateMessage( Kopete::StatusRootAction *statusRootAction )
69 {
70  statusRootAction->setCurrentMessage( m_identity->statusMessage() );
71 }
72 
73 #include "kopeteidentitystatusbaricon.moc"
74 
75 // vim: set noet ts=4 sts=4 sw=4:
76 
Kopete::StatusRootAction
Definition: kopetestatusrootaction.h:43
QWidget
KopeteIdentityStatusBarIcon::leftClicked
void leftClicked(Kopete::Identity *identity, const QPoint &p)
Kopete::StatusRootAction::setCurrentMessage
void setCurrentMessage(const Kopete::StatusMessage &statusMessage)
Set current status message.
Definition: kopetestatusrootaction.cpp:234
kopetestatusrootaction.h
KopeteIdentityStatusBarIcon::KopeteIdentityStatusBarIcon
KopeteIdentityStatusBarIcon(Kopete::Identity *identity, QWidget *parent)
Create a statusbar icon.
Definition: kopeteidentitystatusbaricon.cpp:27
KActionMenu
QLabel
kopeteidentitystatusbaricon.h
KopeteIdentityStatusBarIcon::mousePressEvent
virtual void mousePressEvent(QMouseEvent *me)
Definition: kopeteidentitystatusbaricon.cpp:38
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:53:41 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