• 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
kopeteutils_private.cpp
Go to the documentation of this file.
1 /*
2  Kopete Utils.
3  Copyright (c) 2005 Duncan Mac-Vicar Prett <duncan@kde.org>
4 
5  Kopete (c) 2002-2005 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 "kopeteutils_private.h"
17 
18 #include <qapplication.h>
19 #include <qmap.h>
20 
21 #include <kmessagebox.h>
22 
23 #include <kdebug.h>
24 
25 #include "knotification.h"
26 #include "kopeteuiglobal.h"
27 
28 namespace Kopete
29 {
30 namespace Utils
31 {
32 
33 NotifyHelper* NotifyHelper::s_self = 0L;
34 
35 NotifyHelper::NotifyHelper() : QObject(qApp)
36 {
37 }
38 
39 NotifyHelper::~NotifyHelper()
40 {
41  s_self = 0L;
42 }
43 
44 NotifyHelper* NotifyHelper::self()
45 {
46  if (!s_self)
47  s_self = new NotifyHelper();
48 
49  return s_self;
50 }
51 
52 void NotifyHelper::slotEventActivated(unsigned int /*action*/)
53 {
54  const KNotification *n = dynamic_cast<const KNotification *>(QObject::sender());
55  if (n)
56  {
57  ErrorNotificationInfo info = m_events[n];
58  if ( info.debugInfo.isEmpty() )
59  KMessageBox::queuedMessageBox( Kopete::UI::Global::mainWidget(), KMessageBox::Information, info.explanation, info.caption);
60  else
61  KMessageBox::queuedDetailedError( Kopete::UI::Global::mainWidget(), info.explanation, info.debugInfo, info.caption);
62 
63  unregisterNotification(n);
64  }
65 }
66 
67 void NotifyHelper::slotEventClosed()
68 {
69  const KNotification *n = dynamic_cast<const KNotification *>(QObject::sender());
70  if (n)
71  unregisterNotification(n);
72 }
73 
74 void NotifyHelper::registerNotification(const KNotification* event, ErrorNotificationInfo error)
75 {
76  m_events.insert( event, error);
77 }
78 
79 void NotifyHelper::unregisterNotification(const KNotification* event)
80 {
81  m_events.remove(event);
82 }
83 
84 } // end ns ErrorNotifier
85 } // end ns Kopete
86 
87 #include "kopeteutils_private.moc"
Kopete::Utils::ErrorNotificationInfo::debugInfo
QString debugInfo
Definition: kopeteutils_private.h:38
QObject::sender
QObject * sender() const
kopeteuiglobal.h
QObject
Kopete::Utils::ErrorNotificationInfo::explanation
QString explanation
Definition: kopeteutils_private.h:37
QString::isEmpty
bool isEmpty() const
Kopete::Utils::ErrorNotificationInfo
Definition: kopeteutils_private.h:34
Kopete::Utils::NotifyHelper
Definition: kopeteutils_private.h:41
Kopete::UI::Global::mainWidget
KOPETE_EXPORT QWidget * mainWidget()
Returns the main widget - this is the widget that message boxes and KNotify stuff should use as a par...
Definition: kopeteuiglobal.cpp:37
Kopete::Utils::ErrorNotificationInfo::caption
QString caption
Definition: kopeteutils_private.h:36
kopeteutils_private.h
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