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

krdc

  • sources
  • kde-4.12
  • kdenetwork
  • krdc
  • krdc_approver
approvermanager.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2009 Collabora Ltd <info@collabora.co.uk>
4 ** Copyright (C) 2009 Abner Silva <abner.silva@kdemail.net>
5 **
6 ** This file is part of KDE.
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 ** This program is distributed in the hope that it will be useful,
14 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ** GNU General Public License for more details.
17 **
18 ** You should have received a copy of the GNU General Public License
19 ** along with this program; see the file COPYING. If not, write to
20 ** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 ** Boston, MA 02110-1301, USA.
22 **
23 ****************************************************************************/
24 
25 #include "approvermanager.h"
26 #include "approver.h"
27 
28 #include <QDBusObjectPath>
29 #include <QDBusConnection>
30 
31 #include <KApplication>
32 #include <KDebug>
33 
34 #include <TelepathyQt/Account>
35 #include <TelepathyQt/ChannelClassSpecList>
36 #include <TelepathyQt/ChannelDispatchOperation>
37 #include <TelepathyQt/Connection>
38 #include <TelepathyQt/PendingOperation>
39 #include <TelepathyQt/PendingReady>
40 #include <TelepathyQt/Debug>
41 
42 static inline Tp::ChannelClassSpecList channelClassSpecList()
43 {
44  Tp::ChannelClassSpec spec = Tp::ChannelClassSpec();
45  spec.setChannelType(TP_QT_IFACE_CHANNEL_TYPE_STREAM_TUBE);
46  spec.setTargetHandleType(Tp::HandleTypeContact);
47  spec.setRequested(false);
48  spec.setProperty(TP_QT_IFACE_CHANNEL_TYPE_STREAM_TUBE + ".Service",
49  QVariant("rfb"));
50  return Tp::ChannelClassSpecList() << spec;
51 }
52 
53 ApproverManager::ApproverManager(QObject *parent)
54  : QObject(parent),
55  AbstractClientApprover(channelClassSpecList())
56 {
57  kDebug() << "Initializing approver manager";
58 }
59 
60 ApproverManager::~ApproverManager()
61 {
62  kDebug() << "Destroying approver manager";
63 }
64 
65 void ApproverManager::addDispatchOperation(const Tp::MethodInvocationContextPtr<> &context,
66  const Tp::ChannelDispatchOperationPtr &dispatchOperation)
67 {
68  kDebug() << "New channel for approving arrived";
69 
70  Approver *approver = new Approver(context, dispatchOperation->channels(), dispatchOperation, this);
71  connect(approver, SIGNAL(finished()), SLOT(onFinished()));
72 
73  m_approvers << approver;
74 }
75 
76 void ApproverManager::onFinished()
77 {
78  kDebug() << "Approver finished";
79 
80  Approver *approver = qobject_cast<Approver*>(sender());
81  m_approvers.removeOne(approver);
82  approver->deleteLater();
83 
84  if (m_approvers.empty()) {
85  kDebug() << "Quitting approver manager";
86  KApplication::kApplication()->quit();
87  }
88 }
approvermanager.h
QObject
approver.h
channelClassSpecList
static Tp::ChannelClassSpecList channelClassSpecList()
Definition: approvermanager.cpp:42
ApproverManager::ApproverManager
ApproverManager(QObject *parent)
Definition: approvermanager.cpp:53
Approver
Definition: approver.h:34
ApproverManager::~ApproverManager
virtual ~ApproverManager()
Definition: approvermanager.cpp:60
ApproverManager::addDispatchOperation
virtual void addDispatchOperation(const Tp::MethodInvocationContextPtr<> &context, const Tp::ChannelDispatchOperationPtr &dispatchOperation)
Definition: approvermanager.cpp:65
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:54:04 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

krdc

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

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