Ejemplo n.º 1
0
void Search::buttonClicked(Button *button)
{
	if(button == searchUsersButton)
	{
		searchUserView();
		
	} else if(button == uButton)
	{
		searchUsers();
	} else if(button == backButton)
	{
		searchUserView();
	} else if(button == followButton)
	{
		if(!dash->getAccount()->findUsernameMatch(dash->getAccount(),searchedAccount->getUsername()))
		{
			if(dash->getAccount()->getUsername() != searchedAccount->getUsername())
			{
				dash->getAccount()->addFollowing(searchedAccount);
				dash->updateFollowingCount();
				searchedAccount->addFollower(dash->getAccount());
			}
			else
			{
				AlertWindow::showMessageBoxAsync(AlertWindow::InfoIcon, T("Follow Error"),T("You cannot follow yourself!"));
			}
			
		}
		else
		{
			AlertWindow::showMessageBoxAsync(AlertWindow::InfoIcon, T("Follow Error"),T("You are already following this person!"));
		}
	}
	
}//end method buttonClicked
Ejemplo n.º 2
0
// METODO ClientWindow::initUI
void ClientWindow::initUI() {
    logoutAct = new QAction( tr( "Log Out" ), this );

    menuWidget = new QWidget( this );

    homeButton = new QPushButton( this );
    backButton = new QPushButton( this );
    connect( backButton, SIGNAL( clicked() ), this, SLOT( backFromProfileView() ) );

    linqedinLabel = new QLabel( "<h2>LinQedIn</h2>", this );

    profileButton = new QPushButton( tr( "Profile" ), this );
    connect( profileButton, SIGNAL( clicked() ), this, SLOT( showPersonalProfile() ) );

    sectionButtons.append( profileButton );

    openSearchButton = new QPushButton( this );
    connect( openSearchButton, SIGNAL( clicked() ), this, SLOT( openSearchBox() ) );

    searchWidget = new QWidget( this );

    closeSearchButton = new QPushButton( this );
    connect( closeSearchButton, SIGNAL( clicked() ), this, SLOT( closeSearchBox() ) );
    searchText = new QLineEdit( this );
    searchButton = new QPushButton( this );
    connect( searchButton, SIGNAL( clicked() ), this, SLOT( searchUsers() ) );

    scrollArea = new QScrollArea( this );

    profileWidget = new PersonalProfileWidget( client->user, this );
    connect( profileWidget, SIGNAL( showContactSignal( SmartUtente ) ),
             this, SLOT( showUserSlot( SmartUtente ) ) );

    searchResultsWidget = 0;
}
Ejemplo n.º 3
0
void *processConnection(threadOptions *options) {
	char buf[2048];
	char type[128];
	int len;
	int sd = options->sd;
	free((void *)options);
	struct timeval tv;
	tv.tv_sec = 30;
	tv.tv_usec = 0;
	setsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv,  sizeof tv);
	len = recv(sd,buf,sizeof(buf),MSG_NOSIGNAL);
	if(len == -1) { //timeout
		sendError(sd,"The search has timedout");
		return NULL;
	}
	makeStringSafe((char *)&buf, sizeof(buf));
	if(!find_param(0, buf, type,sizeof(type))) {
		sendError(sd,"Error recieving request");
		return NULL;	
	}
	//TODO: pmatch(product matching), others(showing buddies),otherslist(wait until GPCM is implemented)
	if(stricmp(type,"valid") == 0) {
		checkEmailValid(sd,buf);
	} else if(stricmp(type,"nicks") == 0) {
		sendNicks(sd,buf);
	} else if(stricmp(type,"check") == 0) {
		checkNick(sd,buf);
	} else if(stricmp(type,"newuser") == 0) {
		newUser(sd,buf);
	} else if(stricmp(type,"search") == 0) { 
		searchUsers(sd,buf);
	} else if(stricmp(type,"others") == 0) {
		sendReverseBuddies(sd,buf);
	} else if(stricmp(type,"otherslist") == 0) {
		sendReverseBuddies(sd,buf);
	} else if(stricmp(type,"uniquesearch") == 0) { //nameinator
	} else if(stricmp(type,"profilelist") == 0) { //nameinator
	}else {
		sendError(sd,"Error recieving request");	
		return NULL;
	}
	close(sd);
	return NULL;
}