~ubuntu-branches/ubuntu/karmic/kdepim/karmic-backports

« back to all changes in this revision

Viewing changes to akonadi/akonadiconsole/notificationmonitor.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi, Alessandro Ghersi, Harald Sitter
  • Date: 2009-06-27 04:40:05 UTC
  • mfrom: (1.1.39 upstream)
  • Revision ID: james.westby@ubuntu.com-20090627044005-4y2vm9xz7rvmzi4p
Tags: 4:4.2.95svn20090701-0ubuntu1
[ Alessandro Ghersi ]
* New upstream release
  - Bump build-deps
* Remove akonadi-kde and libmaildir4 packages
  - remove akonadi-kde.install and libmaildir4.install
  - remove libmaildir4 from debian/rules
  - remove akonadi-kde and libmaildir4 from depends
  - remove akonadi-kde and libmaildir4 from installgen
* Update kdepim-dev.install
* Update kpilot.install
* Add akonadi-kde and libmaildir4 transitional packages

[ Harald Sitter ]
* KAddressbook replaces Kontact << 4.2.85 (LP: #378373)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    Copyright (c) 2009 Volker Krause <vkrause@kde.org>
 
3
 
 
4
    This program is free software; you can redistribute it and/or modify
 
5
    it under the terms of the GNU General Public License as published by
 
6
    the Free Software Foundation; either version 2 of the License, or
 
7
    (at your option) any later version.
 
8
 
 
9
    This program is distributed in the hope that it will be useful,
 
10
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 
12
    GNU General Public License for more details.
 
13
 
 
14
    You should have received a copy of the GNU General Public License
 
15
    along with this program; if not, write to the Free Software
 
16
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
 
17
    USA.
 
18
*/
 
19
 
 
20
#include "notificationmonitor.h"
 
21
#include "notificationmodel.h"
 
22
 
 
23
#include <Akonadi/Control>
 
24
 
 
25
#include <KLocale>
 
26
 
 
27
#include <QHeaderView>
 
28
#include <QMenu>
 
29
#include <QTreeView>
 
30
#include <QVBoxLayout>
 
31
 
 
32
NotificationMonitor::NotificationMonitor(QWidget* parent) :
 
33
  QWidget( parent )
 
34
{
 
35
  QVBoxLayout *layout = new QVBoxLayout( this );
 
36
 
 
37
  QTreeView *tv = new QTreeView( this );
 
38
  m_model = new NotificationModel( this );
 
39
  tv->setModel( m_model );
 
40
  tv->expandAll();
 
41
  tv->setAlternatingRowColors( true );
 
42
  tv->setContextMenuPolicy( Qt::CustomContextMenu );
 
43
  tv->header()->setResizeMode( QHeaderView::ResizeToContents );
 
44
  connect( tv, SIGNAL(customContextMenuRequested(QPoint)), SLOT(contextMenu(QPoint)) );
 
45
  layout->addWidget( tv );
 
46
  m_model->setEnabled( false ); // since it can be slow, default to off
 
47
 
 
48
  Akonadi::Control::widgetNeedsAkonadi( this );
 
49
}
 
50
 
 
51
void NotificationMonitor::contextMenu(const QPoint& pos)
 
52
{
 
53
  QMenu menu;
 
54
  menu.addAction( i18n( "Clear View" ), m_model, SLOT(clear()) );
 
55
  QAction *action = new QAction(&menu);
 
56
  action->setCheckable( true );
 
57
  action->setChecked( m_model->isEnabled() );
 
58
  action->setText( i18n("Enabled") );
 
59
  connect( action, SIGNAL(toggled(bool)), m_model, SLOT(setEnabled(bool)) );
 
60
  menu.addAction( action );
 
61
  menu.exec( mapToGlobal( pos ) );
 
62
}
 
63
 
 
64
#include "notificationmonitor.moc"