/** Default constructor */
ConfCertDialog::ConfCertDialog(const std::string& id, QWidget *parent, Qt::WindowFlags flags)
  : QDialog(parent, flags), mId(id)
{
    /* Invoke Qt Designer generated QObject setup routine */
    ui.setupUi(this);

	 ui._useOldFormat_CB->setChecked(true) ;

	ui.headerFrame->setHeaderImage(QPixmap(":/images/user/identityinfo64.png"));
	ui.headerFrame->setHeaderText(tr("Friend Details"));

	ui._chat_CB->hide() ;

	setAttribute(Qt::WA_DeleteOnClose, true);

    connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(applyDialog()));
    connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(close()));
    connect(ui.make_friend_button, SIGNAL(clicked()), this, SLOT(makeFriend()));
    connect(ui.denyFriendButton, SIGNAL(clicked()), this, SLOT(denyFriend()));
    connect(ui.signKeyButton, SIGNAL(clicked()), this, SLOT(signGPGKey()));
    connect(ui.trusthelpButton, SIGNAL(clicked()), this, SLOT(showHelpDialog()));
    connect(ui._shouldAddSignatures_CB, SIGNAL(toggled(bool)), this, SLOT(loadInvitePage()));
    connect(ui._useOldFormat_CB, SIGNAL(toggled(bool)), this, SLOT(loadInvitePage()));
    // connect(ui._anonymous_routing_CB, SIGNAL(toggled(bool)), this, SLOT(setServiceFlags()));
    // connect(ui._discovery_CB, SIGNAL(toggled(bool)), this, SLOT(setServiceFlags()));
    // connect(ui._forums_channels_CB, SIGNAL(toggled(bool)), this, SLOT(setServiceFlags()));

    ui.avatar->setFrameType(AvatarWidget::NORMAL_FRAME);

    MainWindow *w = MainWindow::getInstance();
    if (w) {
        connect(this, SIGNAL(configChanged()), w->getPage(MainWindow::Network), SLOT(insertConnect()));
    }
}
Example #2
0
void NetworkDialog::connecttreeWidgetCostumPopupMenu( QPoint /*point*/ )
{
	//std::cerr << "NetworkDialog::connecttreeWidgetCostumPopupMenu( QPoint point ) called" << std::endl;
	QTreeWidgetItem *wi = getCurrentNeighbour();
	if (!wi)
		return;

	QMenu *contextMnu = new QMenu;

	std::string peer_id = wi->text(COLUMN_PEERID).toStdString() ;

	// That's what context menus are made for
	RsPeerDetails detail;
	if(!rsPeers->getGPGDetails(peer_id, detail))		// that is not suppose to fail.
		return ;

	if(peer_id != rsPeers->getGPGOwnId())
	{
		if(detail.accept_connection)
		{
			QAction* denyFriendAct = new QAction(QIcon(IMAGE_DENIED), tr( "Deny friend" ), contextMnu );

			connect( denyFriendAct , SIGNAL( triggered() ), this, SLOT( denyFriend() ) );
			contextMnu->addAction( denyFriendAct);
		}
		else	// not a friend
		{
			QAction* makefriendAct = new QAction(QIcon(IMAGE_MAKEFRIEND), tr( "Make friend" ), contextMnu );

			connect( makefriendAct , SIGNAL( triggered() ), this, SLOT( makeFriend() ) );
			contextMnu->addAction( makefriendAct);
#ifdef TODO
			if(detail.validLvl > RS_TRUST_LVL_MARGINAL)		// it's a denied old friend.
			{
				QAction* deleteCertAct = new QAction(QIcon(IMAGE_PEERDETAILS), tr( "Delete certificate" ), contextMnu );
				connect( deleteCertAct, SIGNAL( triggered() ), this, SLOT( deleteCert() ) );
				contextMnu->addAction( deleteCertAct );
			}

#endif
		}
	}
	if(peer_id == rsPeers->getGPGOwnId())
	{
		QAction* exportcertAct = new QAction(QIcon(IMAGE_EXPORT), tr( "Export my Cert" ), contextMnu );
		connect( exportcertAct , SIGNAL( triggered() ), this, SLOT( on_actionExportKey_activated() ) );
		contextMnu->addAction( exportcertAct);
	}

	QAction* peerdetailsAct = new QAction(QIcon(IMAGE_PEERDETAILS), tr( "Peer details..." ), contextMnu );
	connect( peerdetailsAct , SIGNAL( triggered() ), this, SLOT( peerdetails() ) );
	contextMnu->addAction( peerdetailsAct);

	contextMnu->addAction(QIcon(IMAGE_COPYLINK), tr("Copy RetroShare Link"), this, SLOT(copyLink()));

	contextMnu->exec(QCursor::pos());
}
Example #3
0
void NetworkDialog::connecttreeWidgetCostumPopupMenu( QPoint point )
{

    QTreeWidgetItem *wi = getCurrentNeighbour();
    if (!wi)
    	return;

//		 return ;

      QMenu contextMnu( this );
      QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier );
      contextMnu.clear();

		std::string peer_id = wi->text(9).toStdString() ;

			// That's what context menus are made for
		RsPeerDetails detail;
		if(!rsPeers->getPeerDetails(peer_id, detail))		// that is not suppose to fail.
			return ;

		if(peer_id != rsPeers->getOwnId())
			if(detail.state & RS_PEER_STATE_FRIEND)
			{
				denyFriendAct = new QAction(QIcon(IMAGE_DENIED), tr( "Deny friend" ), this );

				connect( denyFriendAct , SIGNAL( triggered() ), this, SLOT( denyFriend() ) );
				contextMnu.addAction( denyFriendAct);
			}
			else	// not a friend
			{
				if(detail.trustLvl > RS_TRUST_LVL_MARGINAL)		// it's a denied old friend.
					makefriendAct = new QAction(QIcon(IMAGE_MAKEFRIEND), tr( "Accept friend" ), this );
				else
					makefriendAct = new QAction(QIcon(IMAGE_MAKEFRIEND), tr( "Make friend" ), this );

				connect( makefriendAct , SIGNAL( triggered() ), this, SLOT( makeFriend() ) );
				contextMnu.addAction( makefriendAct);
#ifdef TODO
				if(detail.trustLvl > RS_TRUST_LVL_MARGINAL)		// it's a denied old friend.
				{
					deleteCertAct = new QAction(QIcon(IMAGE_PEERDETAILS), tr( "Delete certificate" ), this );
					connect( deleteCertAct, SIGNAL( triggered() ), this, SLOT( deleteCert() ) );
					contextMnu.addAction( deleteCertAct );
				}
#endif
			}

		peerdetailsAct = new QAction(QIcon(IMAGE_PEERDETAILS), tr( "Peer details..." ), this );
		connect( peerdetailsAct , SIGNAL( triggered() ), this, SLOT( peerdetails() ) );
		contextMnu.addAction( peerdetailsAct);

		contextMnu.exec( mevent->globalPos() );
}
Example #4
0
/** Default constructor */
ConfCertDialog::ConfCertDialog(const std::string& id, QWidget *parent, Qt::WFlags flags)
  : QDialog(parent, flags), mId(id)
{
    /* Invoke Qt Designer generated QObject setup routine */
    ui.setupUi(this);

    setAttribute(Qt::WA_DeleteOnClose, true);

    connect(ui.applyButton, SIGNAL(clicked()), this, SLOT(applyDialog()));
    connect(ui.cancelButton, SIGNAL(clicked()), this, SLOT(close()));
    connect(ui.make_friend_button, SIGNAL(clicked()), this, SLOT(makeFriend()));
    connect(ui.denyFriendButton, SIGNAL(clicked()), this, SLOT(denyFriend()));
    connect(ui.signKeyButton, SIGNAL(clicked()), this, SLOT(signGPGKey()));
    connect(ui.trusthelpButton, SIGNAL(clicked()), this, SLOT(showHelpDialog()));
    connect(ui._shouldAddSignatures_CB, SIGNAL(toggled(bool)), this, SLOT(loadInvitePage()));

    MainWindow *w = MainWindow::getInstance();
    if (w) {
        connect(this, SIGNAL(configChanged()), w->getPage(MainWindow::Network), SLOT(insertConnect()));
    }
}
Example #5
0
void NetworkDialog::connectTreeWidgetCostumPopupMenu( QPoint /*point*/ )
{
	//std::cerr << "NetworkDialog::connectTreeWidgetCostumPopupMenu( QPoint point ) called" << std::endl;
	QTreeWidgetItem *wi = getCurrentNeighbour();
	if (!wi)
		return;

	QMenu *contextMnu = new QMenu;

    RsPgpId peer_id(wi->text(COLUMN_PEERID).toStdString()) ;

	// That's what context menus are made for
	RsPeerDetails detail;
	if(!rsPeers->getGPGDetails(peer_id, detail))		// that is not suppose to fail.
		return ;

    if(peer_id != rsPeers->getGPGOwnId())
    {
        if(detail.accept_connection)
            contextMnu->addAction(QIcon(IMAGE_DENIED), tr("Deny friend"), this, SLOT(denyFriend()));
        else	// not a friend
            contextMnu->addAction(QIcon(IMAGE_MAKEFRIEND), tr("Make friend..."), this, SLOT(makeFriend()));
    }
	if(peer_id == rsPeers->getGPGOwnId())
		contextMnu->addAction(QIcon(IMAGE_EXPORT), tr("Export/create a new node"), this, SLOT(on_actionExportKey_activated()));

	contextMnu->addAction(QIcon(IMAGE_PEERDETAILS), tr("Peer details..."), this, SLOT(peerdetails()));
   //contextMnu->addAction(QIcon(IMAGE_MESSAGE), tr("Send Message"), this, SLOT(sendDistantMessage()));
	//contextMnu->addAction(QIcon(IMAGE_COPYLINK), tr("Copy RetroShare Link"), this, SLOT(copyLink()));
	contextMnu->addSeparator() ;
	contextMnu->addAction(QIcon(IMAGE_CLEAN_UNUSED), tr("Remove unused keys..."), this, SLOT(removeUnusedKeys()));

	contextMnu->exec(QCursor::pos());
}