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

kleopatra

  • sources
  • kde-4.12
  • kdepim
  • kleopatra
  • view
keylistcontroller.h
Go to the documentation of this file.
1 /* -*- mode: c++; c-basic-offset:4 -*-
2  controllers/keylistcontroller.h
3 
4  This file is part of Kleopatra, the KDE keymanager
5  Copyright (c) 2007 Klarälvdalens Datakonsult AB
6 
7  Kleopatra is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation; either version 2 of the License, or
10  (at your option) any later version.
11 
12  Kleopatra is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 
21  In addition, as a special exception, the copyright holders give
22  permission to link the code of this program with any edition of
23  the Qt library by Trolltech AS, Norway (or with modified versions
24  of Qt that use the same license as Qt), and distribute linked
25  combinations including the two. You must obey the GNU General
26  Public License in all respects for all of the code used other than
27  Qt. If you modify this file, you may extend this exception to
28  your version of the file, but you are not obligated to do so. If
29  you do not wish to do so, delete this exception statement from
30  your version.
31 */
32 #ifndef __KLEOPATRA_CONTROLLERS_KEYLISTCONTROLLER_H__
33 #define __KLEOPATRA_CONTROLLERS_KEYLISTCONTROLLER_H__
34 
35 #include <QObject>
36 
37 #include <commands/command.h>
38 
39 #include <utils/pimpl_ptr.h>
40 
41 #include <vector>
42 
43 class QAbstractItemView;
44 class QAction;
45 class QPoint;
46 class QItemSelectionModel;
47 class KActionCollection;
48 
49 namespace Kleo {
50 
51  class AbstractKeyListModel;
52  class Command;
53  class TabWidget;
54 
55  class KeyListController : public QObject {
56  Q_OBJECT
57  public:
58  explicit KeyListController( QObject * parent=0 );
59  ~KeyListController();
60 
61  std::vector<QAbstractItemView*> views() const;
62 
63  void setFlatModel( AbstractKeyListModel * model );
64  AbstractKeyListModel * flatModel() const;
65 
66  void setHierarchicalModel( AbstractKeyListModel * model );
67  AbstractKeyListModel * hierarchicalModel() const;
68 
69  void setParentWidget( QWidget * parent );
70  QWidget * parentWidget() const;
71 
72  QAbstractItemView * currentView() const;
73 
74  void setTabWidget( TabWidget * tabs );
75  TabWidget * tabWidget() const;
76 
77  void registerCommand( Command * cmd );
78 
79  void createActions( KActionCollection * collection );
80 
81  template <typename T_Command>
82  void registerActionForCommand( QAction * action ) {
83  this->registerAction( action, T_Command::restrictions(), &KeyListController::template create<T_Command> );
84  }
85 
86  void enableDisableActions( const QItemSelectionModel * sm ) const;
87 
88  bool hasRunningCommands() const;
89  bool shutdownWarningRequired() const;
90 
91  private:
92  void registerAction( QAction * action, Command::Restrictions restrictions , Command * (*create)( QAbstractItemView*, KeyListController* ) );
93 
94  template <typename T_Command>
95  static Command * create( QAbstractItemView * v, KeyListController * c ) { return new T_Command( v, c ); }
96 
97  public Q_SLOTS:
98  void addView( QAbstractItemView * view );
99  void removeView( QAbstractItemView * view );
100  void setCurrentView( QAbstractItemView * view );
101 
102  void cancelCommands();
103  void updateConfig();
104 
105  Q_SIGNALS:
106  void progress( int current, int total );
107  void message( const QString & msg, int timeout=0 );
108 
109  void commandsExecuting( bool );
110 
111  void contextMenuRequested( QAbstractItemView * view, const QPoint & p );
112 
113  private:
114  class Private;
115  kdtools::pimpl_ptr<Private> d;
116 
117  Q_PRIVATE_SLOT( d, void slotDestroyed(QObject*) )
118  Q_PRIVATE_SLOT( d, void slotDoubleClicked(QModelIndex) )
119  Q_PRIVATE_SLOT( d, void slotActivated(QModelIndex) )
120  Q_PRIVATE_SLOT( d, void slotSelectionChanged(QItemSelection,QItemSelection) )
121  Q_PRIVATE_SLOT( d, void slotContextMenu(QPoint) )
122  Q_PRIVATE_SLOT( d, void slotCommandFinished() )
123  Q_PRIVATE_SLOT( d, void slotAddKey(GpgME::Key) )
124  Q_PRIVATE_SLOT( d, void slotAboutToRemoveKey(GpgME::Key) )
125  Q_PRIVATE_SLOT( d, void slotProgress(QString,int,int) )
126  Q_PRIVATE_SLOT( d, void slotActionTriggered() )
127  Q_PRIVATE_SLOT( d, void slotCurrentViewChanged(QAbstractItemView*) )
128  };
129 
130 }
131 
132 #endif /* __KLEOPATRA_CONTROLLERS_KEYLISTCONTROLLER_H__ */
Kleo::KeyListController::contextMenuRequested
void contextMenuRequested(QAbstractItemView *view, const QPoint &p)
Kleo::KeyListController::removeView
void removeView(QAbstractItemView *view)
Definition: keylistcontroller.cpp:227
Kleo::KeyListController::~KeyListController
~KeyListController()
Definition: keylistcontroller.cpp:200
Kleo::KeyListController::shutdownWarningRequired
bool shutdownWarningRequired() const
Definition: keylistcontroller.cpp:476
Kleo::KeyListController::tabWidget
TabWidget * tabWidget() const
Definition: keylistcontroller.cpp:326
kdtools::pimpl_ptr< Private >
pimpl_ptr.h
Kleo::KeyListController::addView
void addView(QAbstractItemView *view)
Definition: keylistcontroller.cpp:221
Kleo::TabWidget
Definition: tabwidget.h:56
Kleo::KeyListController::setCurrentView
void setCurrentView(QAbstractItemView *view)
Definition: keylistcontroller.cpp:233
Kleo::KeyListController
Definition: keylistcontroller.h:55
Kleo::KeyListController::setFlatModel
void setFlatModel(AbstractKeyListModel *model)
Definition: keylistcontroller.cpp:241
QWidget
Kleo::KeyListController::setTabWidget
void setTabWidget(TabWidget *tabs)
Definition: keylistcontroller.cpp:267
Kleo::KeyListController::setHierarchicalModel
void setHierarchicalModel(AbstractKeyListModel *model)
Definition: keylistcontroller.cpp:254
Kleo::KeyListController::KeyListController
KeyListController(QObject *parent=0)
Definition: keylistcontroller.cpp:194
Kleo::KeyListController::message
void message(const QString &msg, int timeout=0)
d
#define d
Definition: adduseridcommand.cpp:90
Kleo::KeyListController::updateConfig
void updateConfig()
Definition: keylistcontroller.cpp:679
Kleo::KeyListController::registerCommand
void registerCommand(Command *cmd)
Definition: keylistcontroller.cpp:463
Kleo::KeyListController::cancelCommands
void cancelCommands()
Definition: keylistcontroller.cpp:481
Kleo::KeyListController::registerActionForCommand
void registerActionForCommand(QAction *action)
Definition: keylistcontroller.h:82
Kleo::AbstractKeyListModel
Definition: keylistmodel.h:49
Kleo::KeyListController::parentWidget
QWidget * parentWidget() const
Definition: keylistcontroller.cpp:284
Kleo::KeyListController::flatModel
AbstractKeyListModel * flatModel() const
Definition: keylistcontroller.cpp:314
Kleo::KeyListController::setParentWidget
void setParentWidget(QWidget *parent)
Definition: keylistcontroller.cpp:280
Kleo::KeyListController::commandsExecuting
void commandsExecuting(bool)
command.h
Kleo::KeyListController::progress
void progress(int current, int total)
Kleo::KeyListController::createActions
void createActions(KActionCollection *collection)
Definition: keylistcontroller.cpp:330
Kleo::KeyListController::currentView
QAbstractItemView * currentView() const
Definition: keylistcontroller.cpp:322
Kleo::KeyListController::enableDisableActions
void enableDisableActions(const QItemSelectionModel *sm) const
Definition: keylistcontroller.cpp:562
Kleo::Command
Definition: commands/command.h:58
Kleo::KeyListController::views
std::vector< QAbstractItemView * > views() const
Definition: keylistcontroller.cpp:237
Kleo::KeyListController::hasRunningCommands
bool hasRunningCommands() const
Definition: keylistcontroller.cpp:472
Kleo::KeyListController::hierarchicalModel
AbstractKeyListModel * hierarchicalModel() const
Definition: keylistcontroller.cpp:318
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:56:41 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kleopatra

Skip menu "kleopatra"
  • 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