2012-05-22 18:24:10 -04:00
|
|
|
#ifndef CONNECTFRIENDWIZARD_H
|
|
|
|
#define CONNECTFRIENDWIZARD_H
|
2009-03-26 12:58:06 -04:00
|
|
|
|
|
|
|
#include <QWizard>
|
2012-05-22 18:24:10 -04:00
|
|
|
#include <retroshare/rspeers.h>
|
|
|
|
#include <map>
|
2009-03-26 12:58:06 -04:00
|
|
|
|
|
|
|
class QCheckBox;
|
2012-05-22 18:24:10 -04:00
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class ConnectFriendWizard;
|
|
|
|
}
|
2009-03-26 12:58:06 -04:00
|
|
|
|
|
|
|
//============================================================================
|
2009-03-28 06:41:49 -04:00
|
|
|
//! A wizard for adding friends. Based on standard QWizard component
|
|
|
|
|
|
|
|
//! The process of adding friends follows this scheme:
|
|
|
|
//! /-> Use text certificates \ /-> errorpage(if went wrong)
|
|
|
|
//! intro -| |-> ->
|
|
|
|
//! \-> Use *.pqi files / \-> fill peer details
|
2012-05-22 18:24:10 -04:00
|
|
|
//!
|
2009-03-28 06:41:49 -04:00
|
|
|
|
2009-03-26 12:58:06 -04:00
|
|
|
class ConnectFriendWizard : public QWizard
|
|
|
|
{
|
2012-05-22 18:24:10 -04:00
|
|
|
Q_OBJECT
|
2009-03-26 12:58:06 -04:00
|
|
|
|
|
|
|
public:
|
2013-09-02 18:51:26 -04:00
|
|
|
enum Page { Page_Intro, Page_Text, Page_Cert, Page_ErrorMessage, Page_Conclusion, Page_Foff, Page_Rsid, Page_Email, Page_FriendRequest, Page_FriendRecommendations };
|
2009-03-26 12:58:06 -04:00
|
|
|
|
2012-05-22 18:24:10 -04:00
|
|
|
ConnectFriendWizard(QWidget *parent = 0);
|
|
|
|
~ConnectFriendWizard();
|
2009-03-26 12:58:06 -04:00
|
|
|
|
2012-08-16 06:20:34 -04:00
|
|
|
void setCertificate(const QString &certificate, bool friendRequest);
|
2014-03-17 16:56:06 -04:00
|
|
|
void setGpgId(const RsPgpId &gpgId, const RsPeerId &sslId, bool friendRequest);
|
2009-03-26 12:58:06 -04:00
|
|
|
|
2012-05-22 18:24:10 -04:00
|
|
|
virtual bool validateCurrentPage();
|
|
|
|
virtual int nextId() const;
|
|
|
|
virtual void accept();
|
2009-03-26 12:58:06 -04:00
|
|
|
|
2012-05-22 18:24:10 -04:00
|
|
|
void setGroup(const std::string &id);
|
2011-04-08 14:53:12 -04:00
|
|
|
|
2012-05-22 18:24:10 -04:00
|
|
|
protected:
|
|
|
|
void initializePage(int id);
|
2009-03-26 12:58:06 -04:00
|
|
|
|
|
|
|
private slots:
|
2012-05-22 18:24:10 -04:00
|
|
|
/* TextPage */
|
|
|
|
void updateOwnCert();
|
2012-08-14 19:20:33 -04:00
|
|
|
void toggleSignatureState(bool doUpdate = true);
|
|
|
|
void toggleFormatState(bool doUpdate = true);
|
2012-05-22 18:24:10 -04:00
|
|
|
void runEmailClient();
|
|
|
|
void showHelpUserCert();
|
|
|
|
void copyCert();
|
|
|
|
void saveCert();
|
2012-08-14 19:20:33 -04:00
|
|
|
void friendCertChanged();
|
2012-05-22 18:24:10 -04:00
|
|
|
void cleanFriendCert();
|
|
|
|
|
2012-12-01 14:22:22 -05:00
|
|
|
ServicePermissionFlags serviceFlags() const ;
|
|
|
|
|
2012-05-22 18:24:10 -04:00
|
|
|
/* CertificatePage */
|
|
|
|
void loadFriendCert();
|
|
|
|
void generateCertificateCalled();
|
|
|
|
|
|
|
|
/* FofPage */
|
|
|
|
void updatePeersList(int index);
|
|
|
|
void signAllSelectedUsers();
|
|
|
|
|
|
|
|
/* ConclusionPage */
|
|
|
|
void groupCurrentIndexChanged(int index);
|
2010-06-09 19:46:24 -04:00
|
|
|
|
2009-03-26 12:58:06 -04:00
|
|
|
private:
|
2012-12-22 16:22:03 -05:00
|
|
|
// returns the translated error string for the error code (to be found in rspeers.h)
|
|
|
|
QString getErrorString(uint32_t) ;
|
|
|
|
|
2012-05-22 18:24:10 -04:00
|
|
|
bool error;
|
|
|
|
RsPeerDetails peerDetails;
|
2012-08-16 06:20:34 -04:00
|
|
|
std::string mCertificate;
|
2009-03-26 12:58:06 -04:00
|
|
|
|
2012-08-16 06:20:34 -04:00
|
|
|
/* TextPage */
|
|
|
|
QTimer *cleanfriendCertTimer;
|
2012-08-14 19:20:33 -04:00
|
|
|
|
2012-08-16 06:20:34 -04:00
|
|
|
/* FofPage */
|
2014-03-17 16:56:06 -04:00
|
|
|
std::map<QCheckBox*, RsPeerId> _id_boxes;
|
|
|
|
std::map<QCheckBox*, RsPgpId> _gpg_id_boxes;
|
2009-03-26 12:58:06 -04:00
|
|
|
|
2012-05-22 18:24:10 -04:00
|
|
|
/* ConclusionPage */
|
|
|
|
QString groupId;
|
2010-06-09 19:46:24 -04:00
|
|
|
|
2012-05-22 18:24:10 -04:00
|
|
|
Ui::ConnectFriendWizard *ui;
|
2009-03-26 12:58:06 -04:00
|
|
|
};
|
|
|
|
|
2012-05-22 18:24:10 -04:00
|
|
|
class ConnectFriendPage : public QWizardPage
|
2009-05-18 15:51:40 -04:00
|
|
|
{
|
2012-05-22 18:24:10 -04:00
|
|
|
friend class ConnectFriendWizard; // for access to registerField
|
2009-05-18 15:51:40 -04:00
|
|
|
|
2012-05-22 18:24:10 -04:00
|
|
|
Q_OBJECT
|
2009-03-26 12:58:06 -04:00
|
|
|
|
|
|
|
public:
|
2012-05-22 18:24:10 -04:00
|
|
|
ConnectFriendPage(QWidget *parent = 0);
|
2009-03-26 12:58:06 -04:00
|
|
|
|
2012-05-22 18:24:10 -04:00
|
|
|
void setComplete(bool isComplete);
|
|
|
|
virtual bool isComplete() const;
|
2009-03-26 12:58:06 -04:00
|
|
|
|
|
|
|
private:
|
2012-05-22 18:24:10 -04:00
|
|
|
bool useComplete;
|
|
|
|
bool complete;
|
2009-03-26 12:58:06 -04:00
|
|
|
};
|
|
|
|
|
2012-05-22 18:24:10 -04:00
|
|
|
#endif // CONNECTFRIENDWIZARD_H
|