• 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
kgpgaddphoto.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 "kgpgaddphoto.h"
15 
16 #include <KMessageBox>
17 #include <KLocale>
18 
19 KGpgAddPhoto::KGpgAddPhoto(QObject *parent, const QString &keyid, const QString &imagepath)
20  : KGpgEditKeyTransaction(parent, keyid, QLatin1String( "addphoto" ), false)
21 {
22  setImagePath(imagepath);
23 }
24 
25 KGpgAddPhoto::~KGpgAddPhoto()
26 {
27 }
28 
29 bool
30 KGpgAddPhoto::nextLine(const QString &line)
31 {
32  if (!line.startsWith(QLatin1String("[GNUPG:] ")))
33  return false;
34 
35  if (line.contains(QLatin1String( "GOOD_PASSPHRASE" ))) {
36  setSuccess(TS_MSG_SEQUENCE);
37  } else if (line.endsWith(QLatin1String("photoid.jpeg.add"))) {
38  write(m_photourl.toUtf8());
39  setSuccess(TS_OK);
40  } else if (line.contains(QLatin1String( "photoid.jpeg.size" ))) {
41  if (KMessageBox::questionYesNo(0, i18n("This image is very large. Use it anyway?"), QString(), KGuiItem(i18n("Use Anyway")), KGuiItem(i18n("Do Not Use"))) == KMessageBox::Yes) {
42  write("YES");
43  } else {
44  setSuccess(TS_USER_ABORTED);
45  return true;
46  }
47  } else {
48  return KGpgEditKeyTransaction::nextLine(line);
49  }
50 
51  return false;
52 }
53 
54 void
55 KGpgAddPhoto::setImagePath(const QString &photourl)
56 {
57  m_photourl = photourl;
58 }
59 
60 #include "kgpgaddphoto.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
KGpgAddPhoto::setImagePath
void setImagePath(const QString &imagepath)
Definition: kgpgaddphoto.cpp:55
kgpgaddphoto.h
QObject
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::endsWith
bool endsWith(const QString &s, Qt::CaseSensitivity cs) const
QString
KGpgTransaction::TS_MSG_SEQUENCE
unexpected sequence of GnuPG messages
Definition: kgpgtransaction.h:62
KGpgAddPhoto::KGpgAddPhoto
KGpgAddPhoto(QObject *parent, const QString &keyid, const QString &imagepath)
Definition: kgpgaddphoto.cpp:19
QString::contains
bool contains(QChar ch, Qt::CaseSensitivity cs) const
KGpgTransaction::TS_USER_ABORTED
the user aborted the transaction
Definition: kgpgtransaction.h:63
QLatin1String
KGpgTransaction::setSuccess
void setSuccess(const int v)
set the success value that will be returned with the done signal
Definition: kgpgtransaction.cpp:448
KGpgAddPhoto::~KGpgAddPhoto
virtual ~KGpgAddPhoto()
Definition: kgpgaddphoto.cpp:25
KGpgAddPhoto::nextLine
virtual bool nextLine(const QString &line)
handle standard GnuPG prompts
Definition: kgpgaddphoto.cpp:30
QString::toUtf8
QByteArray toUtf8() const
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