AIMUserInfoDialog::AIMUserInfoDialog( Kopete::Contact *c, AIMAccount *acc, QWidget *parent ) : KDialog( parent ) { setCaption( i18n( "User Information on %1" , c->displayName() ) ); setButtons( KDialog::Cancel | KDialog::Ok ); setDefaultButton(KDialog::Ok); showButtonSeparator(true); kDebug(14200) << "for contact '" << c->contactId() << "'"; m_contact = c; mAccount = acc; QWidget* w = new QWidget( this ); mMainWidget = new Ui::AIMUserInfoWidget(); mMainWidget->setupUi( w ); setMainWidget( w ); QObject::connect(this, SIGNAL(okClicked()), this, SLOT(slotSaveClicked())); QObject::connect(this, SIGNAL(user1Clicked()), this, SLOT(slotUpdateClicked())); QObject::connect(this, SIGNAL(cancelClicked()), this, SLOT(slotCloseClicked())); QObject::connect(c, SIGNAL(updatedProfile()), this, SLOT(slotUpdateProfile())); QObject::connect(c, SIGNAL(statusMessageChanged( Kopete::Contact* )), this, SLOT(slotUpdateProfile())); mMainWidget->txtScreenName->setText( c->contactId() ); mMainWidget->txtNickName->setText( c->customName() ); if(m_contact == mAccount->myself()) // edit own account profile { mMainWidget->lblWarnLevel->hide(); mMainWidget->txtWarnLevel->hide(); mMainWidget->lblIdleTime->hide(); mMainWidget->txtIdleTime->hide(); mMainWidget->lblOnlineSince->hide(); mMainWidget->txtOnlineSince->hide(); mMainWidget->txtAwayMessage->hide(); mMainWidget->lblAwayMessage->hide(); userInfoView=0L; mMainWidget->userInfoFrame->setFrameStyle(QFrame::NoFrame | QFrame::Plain); QVBoxLayout *l = new QVBoxLayout(mMainWidget->userInfoFrame); l->setContentsMargins( 0, 0, 0, 0 ); userInfoEdit = new KTextEdit(QString(), mMainWidget->userInfoFrame); AIMMyselfContact* aimmc = dynamic_cast<AIMMyselfContact*>( c ); if ( aimmc ) userInfoEdit->setPlainText( aimmc->userProfile() ); else userInfoEdit->setPlainText( QString() ); setButtonText(Ok, i18n("&Save Profile")); showButton(User1, false); l->addWidget(userInfoEdit); } else { userInfoEdit=0L; mMainWidget->userInfoFrame->setFrameStyle(QFrame::NoFrame | QFrame::Plain); QVBoxLayout *l = new QVBoxLayout(mMainWidget->userInfoFrame); l->setContentsMargins( 0, 0, 0, 0 ); userInfoView = new KTextBrowser(mMainWidget->userInfoFrame); userInfoView->setObjectName("userInfoView"); userInfoView->setNotifyClick(true); QObject::connect( userInfoView, SIGNAL(urlClick(QString)), this, SLOT(slotUrlClicked(QString))); QObject::connect( userInfoView, SIGNAL(mailClick(QString,QString)), this, SLOT(slotMailClicked(QString,QString))); showButton(Cancel, false); setButtonText(Ok, i18n("&Close")); setEscapeButton(Ok); l->addWidget(userInfoView); if(m_contact->isOnline()) { // Update the user view to indicate that we're requesting the user's profile userInfoView->setPlainText(i18n("Requesting User Profile, please wait...")); } QTimer::singleShot(0, this, SLOT(slotUpdateProfile())); } }
AIMUserInfoDialog::AIMUserInfoDialog( Kopete::Contact *c, AIMAccount *acc, bool modal, QWidget *parent, const char* name ) : KDialogBase( parent, name, modal, i18n( "User Information on %1" ) .arg( c->property( Kopete::Global::Properties::self()->nickName() ).value().toString() ), Cancel | Ok , Ok, true ) { kdDebug(14200) << k_funcinfo << "for contact '" << c->contactId() << "'" << endl; m_contact = c; mAccount = acc; mMainWidget = new AIMUserInfoWidget(this, "aimuserinfowidget"); setMainWidget(mMainWidget); QObject::connect(this, SIGNAL(okClicked()), this, SLOT(slotSaveClicked())); QObject::connect(this, SIGNAL(user1Clicked()), this, SLOT(slotUpdateClicked())); QObject::connect(this, SIGNAL(cancelClicked()), this, SLOT(slotCloseClicked())); QObject::connect(c, SIGNAL(updatedProfile()), this, SLOT(slotUpdateProfile())); mMainWidget->txtScreenName->setText( c->contactId() ); QString nickName = c->property( Kopete::Global::Properties::self()->nickName() ).value().toString(); if( nickName.isEmpty() ) mMainWidget->txtNickName->setText( c->contactId() ); else mMainWidget->txtNickName->setText( nickName ); if(m_contact == mAccount->myself()) // edit own account profile { mMainWidget->lblWarnLevel->hide(); mMainWidget->txtWarnLevel->hide(); mMainWidget->lblIdleTime->hide(); mMainWidget->txtIdleTime->hide(); mMainWidget->lblOnlineSince->hide(); mMainWidget->txtOnlineSince->hide(); mMainWidget->txtAwayMessage->hide(); mMainWidget->lblAwayMessage->hide(); userInfoView=0L; mMainWidget->userInfoFrame->setFrameStyle(QFrame::NoFrame | QFrame::Plain); QVBoxLayout *l = new QVBoxLayout(mMainWidget->userInfoFrame); userInfoEdit = new KTextEdit(QString::null, QString::null, mMainWidget->userInfoFrame, "userInfoEdit"); userInfoEdit->setTextFormat(PlainText); AIMMyselfContact* aimmc = dynamic_cast<AIMMyselfContact*>( c ); if ( aimmc ) userInfoEdit->setText( aimmc->userProfile() ); else userInfoEdit->setText( QString::null ); setButtonText(Ok, i18n("&Save Profile")); showButton(User1, false); l->addWidget(userInfoEdit); } else { userInfoEdit=0L; mMainWidget->userInfoFrame->setFrameStyle(QFrame::NoFrame | QFrame::Plain); QVBoxLayout *l = new QVBoxLayout(mMainWidget->userInfoFrame); userInfoView = new KTextBrowser(mMainWidget->userInfoFrame, "userInfoView"); userInfoView->setTextFormat(AutoText); userInfoView->setNotifyClick(true); QObject::connect( userInfoView, SIGNAL(urlClick(const QString&)), this, SLOT(slotUrlClicked(const QString&))); QObject::connect( userInfoView, SIGNAL(mailClick(const QString&, const QString&)), this, SLOT(slotMailClicked(const QString&, const QString&))); showButton(Cancel, false); setButtonText(Ok, i18n("&Close")); setEscapeButton(Ok); l->addWidget(userInfoView); if(m_contact->isOnline()) { // Update the user view to indicate that we're requesting the user's profile userInfoView->setText(i18n("Requesting User Profile, please wait...")); } QTimer::singleShot(0, this, SLOT(slotUpdateProfile())); } }