diff --git a/transactions/kgpgaddphoto.cpp b/transactions/kgpgaddphoto.cpp index aa7f4f57..5e86639c 100644 --- a/transactions/kgpgaddphoto.cpp +++ b/transactions/kgpgaddphoto.cpp @@ -1,58 +1,65 @@ /* * Copyright (C) 2008,2009,2012 Rolf Eike Beer */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "kgpgaddphoto.h" #include #include KGpgAddPhoto::KGpgAddPhoto(QObject *parent, const QString &keyid, const QString &imagepath) : KGpgEditKeyTransaction(parent, keyid, QLatin1String( "addphoto" ), false) { setImagePath(imagepath); } KGpgAddPhoto::~KGpgAddPhoto() { } bool KGpgAddPhoto::nextLine(const QString &line) { if (!line.startsWith(QLatin1String("[GNUPG:] "))) return false; if (line.contains(QLatin1String( "GOOD_PASSPHRASE" ))) { setSuccess(TS_MSG_SEQUENCE); } else if (line.endsWith(QLatin1String("photoid.jpeg.add"))) { write(m_photourl.toUtf8()); setSuccess(TS_OK); - } else if (line.contains(QLatin1String( "photoid.jpeg.size" ))) { + } else { + return KGpgEditKeyTransaction::nextLine(line); + } + + return false; +} + +KGpgTransaction::ts_boolanswer KGpgAddPhoto::boolQuestion(const QString &line) +{ + if (line == QLatin1String("photoid.jpeg.size")) { 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) { - write("YES"); + return BA_YES; } else { setSuccess(TS_USER_ABORTED); - return true; + return BA_NO; } - } else { - return KGpgEditKeyTransaction::nextLine(line); } - return false; + return BA_UNKNOWN; } void KGpgAddPhoto::setImagePath(const QString &photourl) { m_photourl = photourl; } diff --git a/transactions/kgpgaddphoto.h b/transactions/kgpgaddphoto.h index e1db1811..9c57c097 100644 --- a/transactions/kgpgaddphoto.h +++ b/transactions/kgpgaddphoto.h @@ -1,40 +1,41 @@ /* * Copyright (C) 2008,2009 Rolf Eike Beer */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef KGPGADDPHOTO_H #define KGPGADDPHOTO_H #include #include "kgpgeditkeytransaction.h" class QString; class KGpgAddPhoto: public KGpgEditKeyTransaction { Q_OBJECT Q_DISABLE_COPY(KGpgAddPhoto) public: KGpgAddPhoto(QObject *parent, const QString &keyid, const QString &imagepath); virtual ~KGpgAddPhoto(); void setImagePath(const QString &imagepath); protected: bool nextLine(const QString &line) override; + KGpgTransaction::ts_boolanswer boolQuestion(const QString &line) override; private: QString m_photourl; }; #endif // KGPGADDPHOTO_H