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

kget

  • sources
  • kde-4.12
  • kdenetwork
  • kget
  • core
signaturethread.cpp
Go to the documentation of this file.
1 /**************************************************************************
2 * Copyright (C) 2009-2011 Matthias Fuchs <mat69@gmx.net> *
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 *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
18 ***************************************************************************/
19 
20 #include "signaturethread.h"
21 #include "signature_p.h"
22 
23 #include <KDebug>
24 
25 SignatureThread::SignatureThread(QObject *parent)
26  : QThread(parent),
27  m_abort(false)
28 {
29 }
30 
31 SignatureThread::~SignatureThread()
32 {
33  m_mutex.lock();
34  m_abort = true;
35  m_mutex.unlock();
36 
37  wait();
38 }
39 
40 bool SignatureThread::isValid() const
41 {
42 #ifdef HAVE_QGPGME
43  return true;
44 #else //HAVE_QGPGME
45  return false;
46 #endif //HAVE_QGPGME
47 }
48 
49 void SignatureThread::verify(const KUrl &dest, const QByteArray &sig)
50 {
51  QMutexLocker locker(&m_mutex);
52  m_dest.append(dest);
53  m_sig.append(sig);
54 
55  if (!isRunning()) {
56  start();
57  }
58 }
59 
60 void SignatureThread::run()
61 {
62 #ifdef HAVE_QGPGME
63  while (!m_abort && m_dest.count()) {
64  m_mutex.lock();
65  const KUrl dest = m_dest.takeFirst();
66  const QByteArray sig = m_sig.takeFirst();
67  m_mutex.unlock();
68 
69  GpgME::VerificationResult result = SignaturePrivate::verify(dest, sig);
70 
71  if (!m_abort) {
72  emit verified(result);
73  }
74  }
75 #else //HAVE_QGPGME
76  kWarning(5001) << "No QGPGME support.";
77 #endif //HAVE_QGPGME
78 }
SignatureThread::~SignatureThread
~SignatureThread()
Definition: signaturethread.cpp:31
signaturethread.h
QObject
signature_p.h
SignatureThread::SignatureThread
SignatureThread(QObject *parent=0)
Definition: signaturethread.cpp:25
SignatureThread::verify
void verify(const KUrl &dest, const QByteArray &sig)
Definition: signaturethread.cpp:49
SignatureThread::isValid
bool isValid() const
Definition: signaturethread.cpp:40
SignatureThread::run
void run()
Definition: signaturethread.cpp:60
QThread
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:53:17 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kget

Skip menu "kget"
  • Main Page
  • Namespace List
  • Namespace Members
  • 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