• 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
  • private
kopeteactivenotification.cpp
Go to the documentation of this file.
1 /*
2  kopeteactivenotification.cpp - View Manager
3 
4  Kopete (c) 2009 by the Kopete developers <kopete-devel@kde.org>
5 
6  *************************************************************************
7  * *
8  * This program is free software; you can redistribute it and/or modify *
9  * it under the terms of the GNU General Public License as published by *
10  * the Free Software Foundation; either version 2 of the License, or *
11  * (at your option) any later version. *
12  * *
13  *************************************************************************
14 */
15 
16 #include "kopeteactivenotification.h"
17 
18 #include <klocale.h>
19 #include <knotification.h>
20 
21 namespace Kopete
22 {
23  ActiveNotification::ActiveNotification( KNotification *notification, const QString& id_, ActiveNotifications& notifications_, const QString& title_, const QString& body_ )
24  : QObject( notification ), id( id_ ),
25  notifications( notifications_ ), nEventsSinceNotified( 0 ), title( title_ ), body( body_ )
26  {
27  notifications.insert( id, this );
28  KNotification* aParent = static_cast<KNotification *>( parent() );
29  if ( !title.isEmpty() )
30  {
31  aParent->setTitle( "<qt>" + title + "</qt>" );
32  }
33  aParent->setText( "<qt>" + body + "</qt>" );
34  }
35 
39  ActiveNotification::~ActiveNotification() {
40  notifications.remove( id );
41  }
42 
46  void ActiveNotification::showNotification() {
47  static_cast<KNotification *>( parent() )->sendEvent();
48  }
49 
53  void ActiveNotification::incrementMessages() {
54  KLocalizedString append = ki18np( "+ %1 more message", "+ %1 more messages");
55  KNotification *aParent = static_cast<KNotification *>( parent() );
56  aParent->setText( "<qt>" + body + "<br/><small><font color=\"yellow\">" + append.subs( ++nEventsSinceNotified ).toString() + "</small></font></qt>" );
57  aParent->sendEvent(); // Show it
58  }
59 }
QHash::insert
iterator insert(const Key &key, const T &value)
Kopete::ActiveNotification::ActiveNotification
ActiveNotification(KNotification *notification, const QString &id_, ActiveNotifications &notifications_, const QString &title_, const QString &body_)
Construct an active notification and add to the specified hash.
Definition: kopeteactivenotification.cpp:23
QHash< QString, ActiveNotification * >
QObject
QString::isEmpty
bool isEmpty() const
QString
QHash::remove
int remove(const Key &key)
Kopete::ActiveNotification::showNotification
void showNotification()
Show this notification.
Definition: kopeteactivenotification.cpp:46
Kopete::ActiveNotification::incrementMessages
void incrementMessages()
received another message from a sender with a notification
Definition: kopeteactivenotification.cpp:53
QObject::parent
QObject * parent() const
kopeteactivenotification.h
Kopete::ActiveNotification::~ActiveNotification
~ActiveNotification()
Remove active notification from queue.
Definition: kopeteactivenotification.cpp:39
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