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

kopete/libkopete

  • sources
  • kde-4.14
  • kdenetwork
  • kopete
  • libkopete
kopeteinfoevent.cpp
Go to the documentation of this file.
1 /*
2  kopeteinfoevent.cpp - Kopete Info Event
3 
4  Copyright (c) 2008 by Roman Jarosz <kedgedev@centrum.cz>
5  Kopete (c) 2008 by the Kopete developers <kopete-devel@kde.org>
6 
7  *************************************************************************
8  * *
9  * This library is free software; you can redistribute it and/or *
10  * modify it under the terms of the GNU Lesser General Public *
11  * License as published by the Free Software Foundation; either *
12  * version 2 of the License, or (at your option) any later version. *
13  * *
14  *************************************************************************
15 */
16 #include "kopeteinfoevent.h"
17 #include "kopeteinfoeventmanager.h"
18 
19 #include <QStringList>
20 
21 #include <kdebug.h>
22 
23 namespace Kopete {
24 
25 class InfoEvent::Private
26 {
27 public:
28  QMap<uint, QString> actions;
29  QString title;
30  QString text;
31  QString additionalText;
32  bool showOnSend;
33  bool closed;
34 };
35 
36 InfoEvent::InfoEvent( QObject *parent )
37  : QObject( parent ), d( new Private )
38 {
39  d->showOnSend = false;
40  d->closed = false;
41 }
42 
43 InfoEvent::~InfoEvent()
44 {
45  if ( !d->closed )
46  emit eventClosed( this );
47 
48  delete d;
49 }
50 
51 void InfoEvent::sendEvent()
52 {
53  InfoEventManager::self()->addEvent( this );
54 }
55 
56 QString InfoEvent::title() const
57 {
58  return d->title;
59 }
60 
61 void InfoEvent::setTitle( const QString& title )
62 {
63  d->title = title;
64  emit changed();
65 }
66 
67 QString InfoEvent::text() const
68 {
69  return d->text;
70 }
71 
72 void InfoEvent::setText( const QString& text )
73 {
74  d->text = text;
75  emit changed();
76 }
77 
78 QString InfoEvent::additionalText() const
79 {
80  return d->additionalText;
81 }
82 
83 void InfoEvent::setAdditionalText( const QString& text )
84 {
85  d->additionalText = text;
86  emit changed();
87 }
88 
89 QMap<uint, QString> InfoEvent::actions() const
90 {
91  return d->actions;
92 }
93 
94 void InfoEvent::addAction( uint actionId, const QString& actionText )
95 {
96  d->actions[actionId] = actionText;
97  emit changed();
98 }
99 
100 bool InfoEvent::showOnSend() const
101 {
102  return d->showOnSend;
103 }
104 
105 void InfoEvent::setShowOnSend( bool showOnSend )
106 {
107  d->showOnSend = showOnSend;
108 }
109 
110 void InfoEvent::activate( uint actionId )
111 {
112  emit actionActivated( actionId );
113 }
114 
115 bool InfoEvent::isClosed() const
116 {
117  return d->closed;
118 }
119 
120 void InfoEvent::close()
121 {
122  if ( d->closed )
123  {
124  kDebug( 14010 ) << "Closing more the once!!!";
125  return;
126  }
127 
128  d->closed = true;
129  emit eventClosed( this );
130  deleteLater();
131 }
132 
133 }
134 
135 #include "kopeteinfoevent.moc"
Kopete::InfoEventManager::self
static InfoEventManager * self()
The Info Event Manager is a singleton class of which only a single instance will exist.
Definition: kopeteinfoeventmanager.cpp:44
Kopete::InfoEvent::setAdditionalText
void setAdditionalText(const QString &text)
Set the additional text.
Definition: kopeteinfoevent.cpp:83
Kopete::InfoEvent::title
QString title() const
Definition: kopeteinfoevent.cpp:56
Kopete::InfoEvent::showOnSend
bool showOnSend() const
Definition: kopeteinfoevent.cpp:100
QMap< uint, QString >
Kopete::InfoEvent::text
QString text() const
Definition: kopeteinfoevent.cpp:67
Kopete::InfoEvent::additionalText
QString additionalText() const
Definition: kopeteinfoevent.cpp:78
Kopete::InfoEvent::addAction
void addAction(uint actionId, const QString &actionText)
Set the list of actions link.
Definition: kopeteinfoevent.cpp:94
Kopete::InfoEvent::actionActivated
void actionActivated(uint actionId)
A action has been activated.
Kopete::InfoEvent::actions
QMap< uint, QString > actions() const
Definition: kopeteinfoevent.cpp:89
Kopete::InfoEvent::close
void close()
Close the info event.
Definition: kopeteinfoevent.cpp:120
Kopete::InfoEvent::setShowOnSend
void setShowOnSend(bool showOnSend)
Set if event should automatically be shown in contact list window.
Definition: kopeteinfoevent.cpp:105
Kopete::InfoEvent::InfoEvent
InfoEvent(QObject *parent=0)
Definition: kopeteinfoevent.cpp:36
QObject
kopeteinfoeventmanager.h
Kopete::InfoEvent::activate
virtual void activate(uint actionId)
Activate the action specified action.
Definition: kopeteinfoevent.cpp:110
Kopete::InfoEvent::setTitle
void setTitle(const QString &title)
Set the Info Event title.
Definition: kopeteinfoevent.cpp:61
Kopete::InfoEvent::setText
void setText(const QString &text)
Set the Info Event text.
Definition: kopeteinfoevent.cpp:72
Kopete::InfoEvent::eventClosed
void eventClosed(Kopete::InfoEvent *event)
Emitted when the info event is closed.
QObject::deleteLater
void deleteLater()
QString
kopeteinfoevent.h
Kopete::InfoEvent::changed
void changed()
User visible data has been changed.
Kopete::InfoEvent::sendEvent
virtual void sendEvent()
Emit the event.
Definition: kopeteinfoevent.cpp:51
Kopete::InfoEvent::isClosed
bool isClosed() const
Definition: kopeteinfoevent.cpp:115
Kopete::InfoEvent::~InfoEvent
~InfoEvent()
Definition: kopeteinfoevent.cpp:43
Kopete::InfoEventManager::addEvent
void addEvent(Kopete::InfoEvent *event)
Add info event.
Definition: kopeteinfoeventmanager.cpp:52
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:29:19 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kopete/libkopete

Skip menu "kopete/libkopete"
  • 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