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

calendarsupport

  • sources
  • kde-4.12
  • kdepim
  • calendarsupport
messagewidget.cpp
Go to the documentation of this file.
1 /*
2  This file is part of KOrganizer.
3 
4  Copyright (c) 2013 Sérgio Martins <iamsergio@gmail.com>
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License along
17  with this program; if not, write to the Free Software Foundation, Inc.,
18  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 
20  As a special exception, permission is given to link this program
21  with any edition of Qt, and distribute the resulting executable,
22  without including the source code for Qt in the source distribution.
23 */
24 
25 #include "messagewidget.h"
26 
27 #include <QApplication>
28 #include <QMouseEvent>
29 
30 using namespace CalendarSupport;
31 
32 MessageWidget::MessageWidget(QWidget *parent) : KMessageWidget(parent)
33 {
34  hide();
35  setCloseButtonVisible(false);
36  setWordWrap(true);
37 }
38 
39 MessageWidget::~MessageWidget()
40 {
41 }
42 
43 void MessageWidget::showEvent(QShowEvent *event)
44 {
45  qApp->installEventFilter(this);
46  KMessageWidget::showEvent(event);
47 }
48 
49 void MessageWidget::hideEvent(QHideEvent *event)
50 {
51  // No need to spend cycles on an event-filter when this is going to
52  // me hidden most of the time
53  qApp->removeEventFilter(this);
54  KMessageWidget::hideEvent(event);
55 }
56 
57 bool MessageWidget::eventFilter(QObject *, QEvent *event)
58 {
59  if (event->type() == QEvent::MouseButtonPress)
60  hide();
61 
62  if (event->type() == QEvent::KeyPress) {
63  QKeyEvent *ev = dynamic_cast<QKeyEvent*>(event);
64  hide();
65  if (ev->key() == Qt::Key_Escape) {
66  return true; // We eat this one, it's for us
67  }
68  }
69 
70  return false; // we don't want it
71 }
messagewidget.h
QWidget
CalendarSupport::MessageWidget::MessageWidget
MessageWidget(QWidget *parent=0)
Definition: messagewidget.cpp:32
QObject
CalendarSupport::MessageWidget::showEvent
void showEvent(QShowEvent *event)
reimp
Definition: messagewidget.cpp:43
CalendarSupport::MessageWidget::~MessageWidget
~MessageWidget()
Definition: messagewidget.cpp:39
CalendarSupport::MessageWidget::hideEvent
void hideEvent(QHideEvent *event)
reimp
Definition: messagewidget.cpp:49
CalendarSupport::event
CALENDARSUPPORT_EXPORT KCalCore::Event::Ptr event(const Akonadi::Item &item)
returns the event from an akonadi item, or a null pointer if the item has no such payload ...
Definition: utils.cpp:85
CalendarSupport::MessageWidget::eventFilter
bool eventFilter(QObject *watched, QEvent *event)
reimp
Definition: messagewidget.cpp:57
KMessageWidget
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:54:59 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

calendarsupport

Skip menu "calendarsupport"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

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