2009-03-26 12:58:06 -04:00
|
|
|
#ifndef __ConnectFriendWizard__
|
|
|
|
#define __ConnectFriendWizard__
|
|
|
|
|
2009-05-18 15:51:40 -04:00
|
|
|
#include <map>
|
2009-03-26 12:58:06 -04:00
|
|
|
#include <QWizard>
|
|
|
|
|
2009-05-07 15:54:40 -04:00
|
|
|
//QT_BEGIN_NAMESPACE
|
2009-03-26 12:58:06 -04:00
|
|
|
class QCheckBox;
|
|
|
|
class QLabel;
|
|
|
|
class QTextEdit;
|
|
|
|
class QLineEdit;
|
|
|
|
class QRadioButton;
|
|
|
|
class QVBoxLayout;
|
|
|
|
class QHBoxLayout;
|
|
|
|
class QGroupBox;
|
|
|
|
class QGridLayout;
|
2009-05-18 15:51:40 -04:00
|
|
|
class QComboBox;
|
|
|
|
class QTableWidget;
|
2009-05-07 15:54:40 -04:00
|
|
|
//QT_END_NAMESPACE
|
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
|
|
|
|
//!
|
|
|
|
//! So, there are five possible pages in this wizard.
|
|
|
|
|
2009-03-26 12:58:06 -04:00
|
|
|
class ConnectFriendWizard : public QWizard
|
2009-03-28 06:41:49 -04:00
|
|
|
{//
|
2009-03-26 12:58:06 -04:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2010-07-07 19:13:40 -04:00
|
|
|
enum { Page_Intro, Page_Text, Page_Cert, Page_ErrorMessage, Page_Conclusion,Page_Foff, Page_Rsid, Page_Email };
|
2009-03-26 12:58:06 -04:00
|
|
|
|
|
|
|
ConnectFriendWizard(QWidget *parent = 0);
|
|
|
|
|
2010-09-29 15:30:59 -04:00
|
|
|
void setGroup(const std::string &groupId);
|
|
|
|
|
2009-03-26 12:58:06 -04:00
|
|
|
void accept();
|
|
|
|
|
|
|
|
private slots:
|
2009-03-28 06:41:49 -04:00
|
|
|
// void showHelp(); // we'll have to implement it in future
|
2009-03-26 12:58:06 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
//============================================================================
|
2009-03-28 06:41:49 -04:00
|
|
|
//! Introduction page for "Add friend" wizard.
|
2009-03-26 12:58:06 -04:00
|
|
|
class IntroPage : public QWizardPage
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
IntroPage(QWidget *parent = 0);
|
|
|
|
|
|
|
|
int nextId() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
QLabel *topLabel;
|
|
|
|
QRadioButton *textRadioButton;
|
|
|
|
QRadioButton *certRadioButton;
|
2009-05-18 15:51:40 -04:00
|
|
|
QRadioButton *foffRadioButton;
|
2010-06-30 17:57:46 -04:00
|
|
|
QRadioButton *rsidRadioButton;
|
2010-07-07 19:13:40 -04:00
|
|
|
QRadioButton *emailRadioButton;
|
2009-03-26 12:58:06 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
//============================================================================
|
2009-03-28 06:41:49 -04:00
|
|
|
//! Text page (for exchnging text certificates) for "Add friend" wizard.
|
2009-03-26 12:58:06 -04:00
|
|
|
class TextPage : public QWizardPage
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
TextPage(QWidget *parent = 0);
|
|
|
|
|
|
|
|
int nextId() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
QLabel* userCertLabel;
|
|
|
|
QTextEdit* userCertEdit;
|
|
|
|
QHBoxLayout* userCertLayout;
|
|
|
|
QVBoxLayout* userCertButtonsLayout;
|
|
|
|
QPushButton* userCertHelpButton;
|
2009-07-14 09:29:49 -04:00
|
|
|
QPushButton* userCertCopyButton;
|
2010-02-12 14:11:52 -05:00
|
|
|
QPushButton* userCertSaveButton;
|
2009-03-26 12:58:06 -04:00
|
|
|
QPushButton* userCertMailButton;//! on Windows, click on this button
|
|
|
|
//! launches default email client
|
|
|
|
QLabel* friendCertLabel;
|
|
|
|
QTextEdit* friendCertEdit;
|
|
|
|
|
|
|
|
QVBoxLayout* textPageLayout;
|
2010-02-12 14:11:52 -05:00
|
|
|
|
|
|
|
void setCurrentFileName(const QString &fileName);
|
|
|
|
|
|
|
|
QString fileName;
|
2009-03-26 12:58:06 -04:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void showHelpUserCert();
|
2009-07-14 09:29:49 -04:00
|
|
|
void copyCert();
|
2009-03-26 12:58:06 -04:00
|
|
|
|
2010-02-12 14:11:52 -05:00
|
|
|
bool fileSave();
|
|
|
|
bool fileSaveAs();
|
|
|
|
|
2010-02-24 17:02:10 -05:00
|
|
|
|
2009-03-26 12:58:06 -04:00
|
|
|
//! launches default email client (on windows)
|
|
|
|
|
|
|
|
//! Tested on Vista, it work normally... But a bit slowly.
|
|
|
|
void runEmailClient();
|
|
|
|
};
|
|
|
|
|
|
|
|
//============================================================================
|
2009-03-28 06:41:49 -04:00
|
|
|
//! A page for exchanging *.pqi files, for "Add friend" wizard.
|
2009-03-26 12:58:06 -04:00
|
|
|
class CertificatePage : public QWizardPage
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
CertificatePage(QWidget *parent = 0);
|
|
|
|
|
|
|
|
int nextId() const;
|
|
|
|
bool isComplete() const ;
|
|
|
|
|
2010-06-09 19:46:24 -04:00
|
|
|
void dropEvent(QDropEvent *event);
|
|
|
|
void dragEnterEvent(QDragEnterEvent *event);
|
|
|
|
|
2009-03-26 12:58:06 -04:00
|
|
|
private:
|
|
|
|
QGroupBox* userFileFrame;
|
|
|
|
QLabel *userFileLabel;
|
|
|
|
QPushButton* userFileCreateButton;
|
|
|
|
QHBoxLayout* userFileLayout;
|
|
|
|
|
|
|
|
QLabel* friendFileLabel;
|
|
|
|
QLineEdit *friendFileNameEdit;
|
|
|
|
QPushButton* friendFileNameOpenButton;
|
|
|
|
QHBoxLayout* friendFileLayout;
|
|
|
|
|
|
|
|
QVBoxLayout* certPageLayout;
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void generateCertificateCalled();
|
|
|
|
void loadFriendCert();
|
2010-06-09 19:46:24 -04:00
|
|
|
|
|
|
|
|
2009-03-26 12:58:06 -04:00
|
|
|
};
|
|
|
|
|
2009-05-18 15:51:40 -04:00
|
|
|
//============================================================================
|
|
|
|
//! A page for signing certificates from some people on the network (e.g. friends
|
|
|
|
// of friends, people trusting me...)
|
|
|
|
//
|
|
|
|
class FofPage : public QWizardPage
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
FofPage(QWidget *parent = 0);
|
|
|
|
|
|
|
|
int nextId() const;
|
|
|
|
bool isComplete() const ;
|
|
|
|
|
|
|
|
private:
|
2009-05-25 07:33:27 -04:00
|
|
|
// QGroupBox* userFileFrame;
|
2009-05-18 15:51:40 -04:00
|
|
|
QLabel *userFileLabel;
|
|
|
|
QVBoxLayout *userFileLayout;
|
|
|
|
QComboBox *userSelectionCB;
|
|
|
|
QPushButton* makeFriendButton;
|
|
|
|
QTableWidget *selectedPeersTW;
|
|
|
|
|
|
|
|
QVBoxLayout* certPageLayout;
|
|
|
|
|
|
|
|
bool _friends_signed ;
|
2010-01-13 16:22:52 -05:00
|
|
|
std::map<QCheckBox*,std::string> _id_boxes ;
|
|
|
|
std::map<QCheckBox*,std::string> _gpg_id_boxes ;
|
2009-05-18 15:51:40 -04:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void signAllSelectedUsers() ;
|
|
|
|
void updatePeersList(int) ;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-03-26 12:58:06 -04:00
|
|
|
//============================================================================
|
2009-03-28 06:41:49 -04:00
|
|
|
//! Page for displaying error messages (for "Add friend" wizard).
|
2009-03-26 12:58:06 -04:00
|
|
|
class ErrorMessagePage : public QWizardPage
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
ErrorMessagePage(QWidget *parent = 0);
|
|
|
|
|
|
|
|
int nextId() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
QLabel *messageLabel;
|
|
|
|
QVBoxLayout* errMessLayout;
|
|
|
|
};
|
|
|
|
|
|
|
|
//============================================================================
|
2009-03-28 06:41:49 -04:00
|
|
|
//! Page for filling peer details in "Add friend" wizard.
|
|
|
|
|
|
|
|
//! Warning: This page duplicates functionality of the ConnectDialo class (and
|
|
|
|
//! also some pieces of code). TODO: remove this duplication
|
2009-03-26 12:58:06 -04:00
|
|
|
class ConclusionPage : public QWizardPage
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
ConclusionPage(QWidget *parent = 0);
|
|
|
|
|
|
|
|
void initializePage();
|
|
|
|
int nextId() const;
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
// void printButtonClicked();
|
2010-09-29 15:30:59 -04:00
|
|
|
void groupCurrentIndexChanged(int index);
|
2009-03-26 12:58:06 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
QGroupBox* peerDetailsFrame;
|
2010-01-13 16:22:52 -05:00
|
|
|
QGridLayout* peerDetailsLayout;
|
2009-03-26 12:58:06 -04:00
|
|
|
QLabel* trustLabel;
|
2010-01-13 16:22:52 -05:00
|
|
|
QLabel* trustEdit;
|
2009-03-26 12:58:06 -04:00
|
|
|
QLabel* nameLabel;
|
2010-01-13 16:22:52 -05:00
|
|
|
QLabel* nameEdit;
|
|
|
|
QLabel* emailLabel;
|
|
|
|
QLabel* emailEdit;
|
2009-03-26 12:58:06 -04:00
|
|
|
QLabel* locLabel;
|
2010-01-13 16:22:52 -05:00
|
|
|
QLabel* locEdit;
|
2009-03-26 12:58:06 -04:00
|
|
|
QLabel* signersLabel;
|
|
|
|
QTextEdit* signersEdit;
|
2010-09-29 15:30:59 -04:00
|
|
|
QComboBox* groupComboBox;
|
|
|
|
QLabel* groupLabel;
|
2010-01-13 16:22:52 -05:00
|
|
|
|
|
|
|
QLabel* radioButtonsLabel;
|
2010-02-26 18:44:12 -05:00
|
|
|
QCheckBox *signGPGCheckBox;
|
|
|
|
QCheckBox *acceptNoSignGPGCheckBox;
|
2009-03-26 12:58:06 -04:00
|
|
|
|
|
|
|
QVBoxLayout* conclusionPageLayout;
|
|
|
|
|
|
|
|
//! peer id
|
|
|
|
|
2010-01-13 16:22:52 -05:00
|
|
|
// //! It's a hack; This widget is used only to register "id" field in the
|
|
|
|
// //! wizard. Really the widget isn't displayed.
|
2009-03-26 12:58:06 -04:00
|
|
|
QLineEdit* peerIdEdit;
|
2010-01-13 16:22:52 -05:00
|
|
|
QLineEdit* peerGPGIdEdit;
|
|
|
|
QLineEdit* peerLocation;
|
|
|
|
QLineEdit* peerCertStringEdit;
|
2009-09-06 15:53:22 -04:00
|
|
|
QLineEdit* ext_friend_ip;
|
|
|
|
QLineEdit* ext_friend_port;
|
|
|
|
QLineEdit* local_friend_ip;
|
|
|
|
QLineEdit* local_friend_port;
|
2010-04-23 14:50:32 -04:00
|
|
|
QLineEdit* dyndns;
|
2009-03-26 12:58:06 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
//============================================================================
|
2010-06-30 17:57:46 -04:00
|
|
|
//! A page for exchanging RSID , for "Add friend" wizard.
|
|
|
|
class RsidPage : public QWizardPage
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
RsidPage(QWidget *parent = 0);
|
|
|
|
|
|
|
|
int nextId() const;
|
|
|
|
bool isComplete() const ;
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
QGroupBox* userRsidFrame;
|
|
|
|
QLabel *userFileLabel;
|
|
|
|
QHBoxLayout* userRsidLayout;
|
|
|
|
|
|
|
|
QLabel* friendRsidLabel;
|
|
|
|
QLineEdit *friendRsidEdit;
|
|
|
|
QHBoxLayout* friendRSIDLayout;
|
|
|
|
|
|
|
|
QVBoxLayout* RsidLayout;
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
|
2010-07-07 19:13:40 -04:00
|
|
|
//============================================================================
|
|
|
|
//! A page for Email Invite
|
|
|
|
class EmailPage : public QWizardPage
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
EmailPage(QWidget *parent = 0);
|
|
|
|
|
|
|
|
int nextId() const;
|
|
|
|
bool isComplete() const ;
|
2010-07-07 19:54:47 -04:00
|
|
|
bool validatePage();
|
2010-07-07 19:13:40 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
QLabel* addressLabel;
|
|
|
|
QLineEdit *addressEdit;
|
|
|
|
|
|
|
|
QLabel* subjectLabel;
|
|
|
|
QLineEdit *subjectEdit;
|
|
|
|
|
|
|
|
QTextEdit* inviteTextEdit;
|
|
|
|
|
|
|
|
QHBoxLayout* emailhbox2Layout;
|
|
|
|
QHBoxLayout* emailhbox3Layout;
|
|
|
|
|
|
|
|
QVBoxLayout* emailvboxLayout;
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
//============================================================================
|
2009-03-26 12:58:06 -04:00
|
|
|
|
|
|
|
#endif
|