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

kgpg

  • sources
  • kde-4.14
  • kdeutils
  • kgpg
  • transactions
kgpgchangeexpire.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008,2009,2012 Rolf Eike Beer <kde@opensource.sf-tec.de>
3  */
4 
5 /***************************************************************************
6  * *
7  * This program 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  ***************************************************************************/
13 
14 #include "kgpgchangeexpire.h"
15 
16 #include "detailedconsole.h"
17 
18 #include <KLocale>
19 #include <KMessageBox>
20 
21 KGpgChangeExpire::KGpgChangeExpire(QObject *parent, const QString &keyid, const QDateTime &date)
22  : KGpgEditKeyTransaction(parent, keyid, QLatin1String( "expire" ), false)
23 {
24  setDate(date);
25 }
26 
27 KGpgChangeExpire::~KGpgChangeExpire()
28 {
29 }
30 
31 bool
32 KGpgChangeExpire::nextLine(const QString &line)
33 {
34  if (!line.startsWith(QLatin1String("[GNUPG:]")))
35  return false;
36 
37  if (line.contains(QLatin1String( "GOOD_PASSPHRASE" ))) {
38  setSuccess(TS_OK);
39 
40  return false;
41  } else if (line.contains(QLatin1String( "keygen.valid" ))) {
42  if (m_date.isNull())
43  write("0");
44  else
45  write(QByteArray::number(QDate::currentDate().daysTo(m_date.date())));
46 
47  return false;
48  } else {
49  return KGpgEditKeyTransaction::nextLine(line);
50  }
51 }
52 
53 void
54 KGpgChangeExpire::setDate(const QDateTime &date)
55 {
56  m_date = date;
57 }
58 
59 #include "kgpgchangeexpire.moc"
KGpgTransaction::TS_OK
everything went fine
Definition: kgpgtransaction.h:60
KGpgTransaction::write
void write(const QByteArray &a, const bool lf=true)
write data to standard input of gpg process
Definition: kgpgtransaction.cpp:413
KGpgEditKeyTransaction
edit a single property of a key
Definition: kgpgeditkeytransaction.h:24
KGpgChangeExpire::setDate
void setDate(const QDateTime &date)
Definition: kgpgchangeexpire.cpp:54
kgpgchangeexpire.h
KGpgChangeExpire::KGpgChangeExpire
KGpgChangeExpire(QObject *parent, const QString &keyid, const QDateTime &date)
Definition: kgpgchangeexpire.cpp:21
KGpgChangeExpire::~KGpgChangeExpire
virtual ~KGpgChangeExpire()
Definition: kgpgchangeexpire.cpp:27
QObject
QByteArray::number
QByteArray number(int n, int base)
QString::startsWith
bool startsWith(const QString &s, Qt::CaseSensitivity cs) const
KGpgEditKeyTransaction::nextLine
virtual bool nextLine(const QString &line)
handle standard GnuPG prompts
Definition: kgpgeditkeytransaction.cpp:60
QString
KGpgChangeExpire::nextLine
virtual bool nextLine(const QString &line)
handle standard GnuPG prompts
Definition: kgpgchangeexpire.cpp:32
QString::contains
bool contains(QChar ch, Qt::CaseSensitivity cs) const
QDateTime::isNull
bool isNull() const
QDateTime::date
QDate date() const
QLatin1String
KGpgTransaction::setSuccess
void setSuccess(const int v)
set the success value that will be returned with the done signal
Definition: kgpgtransaction.cpp:448
QDate::currentDate
QDate currentDate()
detailedconsole.h
QDateTime
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:42:08 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kgpg

Skip menu "kgpg"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeutils API Reference

Skip menu "kdeutils API Reference"
  • ark
  • filelight
  • kcalc
  • kcharselect
  • kdf
  • kfloppy
  • kgpg
  • ktimer
  • kwallet
  • sweeper

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