GaduEditAccount::GaduEditAccount( GaduProtocol* proto, Kopete::Account* ident, QWidget* parent )
: QWidget( parent ), KopeteEditAccountWidget( ident ), protocol_( proto ), rcmd( 0 )
{
	setupUi(this);

#ifdef __GG_LIBGADU_HAVE_OPENSSL
	isSsl = true;
#else
	isSsl = false;
#endif

	useTls_->setDisabled( !isSsl );

	if ( account() == NULL ) {
		useTls_->setCurrentIndex( GaduAccount::TLS_no );
		registerNew->setEnabled( true );
		account_ = NULL;
	}
	else {
		account_ = static_cast<GaduAccount*>(ident);

		registerNew->setDisabled( true );
		loginEdit_->setReadOnly( true );
		loginEdit_->setText( account_->accountId() );

		passwordWidget_->load( &account_->password() );

		nickName->setText( account_->myself()->nickName() );

		autoLoginCheck_->setChecked( account_->excludeConnect() );
		dccCheck_->setChecked( account_->dccEnabled() );
		useTls_->setCurrentIndex( isSsl ? ( account_->useTls() ) : 2 );
		ignoreCheck_->setChecked( account_->ignoreAnons() );
		exportCheck_->setChecked( account_->exportListOnChange() );
		importCheck_->setChecked( account_->importListOnLogin() );

		connect( account(), SIGNAL(pubDirSearchResult(SearchResult,uint)),
					SLOT(slotSearchResult(SearchResult,uint)) );
		connectLabel->setText( i18nc( "personal information being fetched from server",
					"<p align=\"center\">Fetching from server</p>" ) );
		seqNr = account_->getPersonalInformation();
	}

	connect( registerNew, SIGNAL(clicked()), SLOT(registerNewAccount()) );

	QWidget::setTabOrder( loginEdit_, passwordWidget_->mRemembered );
	QWidget::setTabOrder( passwordWidget_->mRemembered, passwordWidget_->mPassword );
	QWidget::setTabOrder( passwordWidget_->mPassword, autoLoginCheck_ );
}
Example #2
0
void
GaduSession::sendResult( gg_pubdir50_t result )
{
	int i, count, age;
	ResLine resultLine;
	SearchResult sres;

	count = gg_pubdir50_count( result );

	if ( !count ) {
		kdDebug(14100) << "there was nothing found in public directory for requested details" << endl;
	}

	for ( i = 0; i < count; i++ ) {
		resultLine.uin		= QString( gg_pubdir50_get( result, i, GG_PUBDIR50_UIN ) ).toInt();
		resultLine.firstname	= textcodec->toUnicode( gg_pubdir50_get( result, i, GG_PUBDIR50_FIRSTNAME ) );
		resultLine.surname	= textcodec->toUnicode( gg_pubdir50_get( result, i, GG_PUBDIR50_LASTNAME ) );
		resultLine.nickname	= textcodec->toUnicode( gg_pubdir50_get( result, i, GG_PUBDIR50_NICKNAME ) );
		resultLine.age		= textcodec->toUnicode( gg_pubdir50_get( result, i, GG_PUBDIR50_BIRTHYEAR ) );
		resultLine.city		= textcodec->toUnicode( gg_pubdir50_get( result, i, GG_PUBDIR50_CITY ) );
		QString stat		= textcodec->toUnicode( gg_pubdir50_get( result, i, GG_PUBDIR50_STATUS ) );
		resultLine.orgin	= textcodec->toUnicode( gg_pubdir50_get( result, i, GG_PUBDIR50_FAMILYCITY ) );
		resultLine.meiden	= textcodec->toUnicode( gg_pubdir50_get( result, i, GG_PUBDIR50_FAMILYNAME ) );
		resultLine.gender	= textcodec->toUnicode( gg_pubdir50_get( result, i, GG_PUBDIR50_GENDER ) );

		resultLine.status	= stat.toInt();
		age = resultLine.age.toInt();
		if ( age ) {
			resultLine.age = QString::number( QDate::currentDate().year() - age );
		}
		else {
			resultLine.age.truncate( 0 );
		}
		sres.append( resultLine );
		kdDebug(14100) << "found line "<< resultLine.uin << " " << resultLine.firstname << endl;
	}

	searchSeqNr_ = gg_pubdir50_next( result );
	emit pubDirSearchResult( sres, gg_pubdir50_seq( result ) );
}