void Kopete::ChatSession::slotUpdateDisplayName()
{
	if( d->customDisplayName )
		return;

	Kopete::Contact *c = d->mContactList.first();

	//If there is no member yet, don't try to update the display name
	if ( !c )
		return;

	d->displayName=QString::null;
	do
	{
		if(! d->displayName.isNull() )
			d->displayName.append( QString::fromLatin1( ", " ) ) ;

		if ( c->metaContact() )
			d->displayName.append( c->metaContact()->displayName() );
		else
		{
			QString nick=c->property(Kopete::Global::Properties::self()->nickName()).value().toString();
			d->displayName.append( nick.isEmpty() ? c->contactId() : nick );
		}
		c=d->mContactList.next();
	} while (c);

	//If we have only 1 contact, add the status of him
	if ( d->mContactList.count() == 1 )
	{
		d->displayName.append( QString::fromLatin1( " (%1)" ).arg( d->mContactList.first()->onlineStatus().description() ) );
	}

	emit displayNameChanged();
}
void Kopete::ChatSession::slotUpdateDisplayName()
{
	if( d->customDisplayName )
		return;


	//If there is no member yet, don't try to update the display name
	if ( d->contacts.isEmpty() )
		return;

	d->displayName.clear();
	for(int i = 0; i != d->contacts.size(); i++ )
	{
		Kopete::Contact * c = d->contacts[i];
		if(! d->displayName.isNull() )
			d->displayName.append( QString::fromLatin1( ", " ) ) ;

		if ( c->metaContact() )
			d->displayName.append( c->metaContact()->displayName() );
		else
		{
			d->displayName.append( c->nickName() );
		}
	}

	//If we have only 1 contact, add the status of him
	if ( d->contacts.count() == 1 )
	{
		d->displayName.append( QString::fromLatin1( " (%1)" ).arg( d->contacts.first()->onlineStatus().description() ) );
	}

	emit displayNameChanged();
}
void QInstallerPackage::setDisplayName(const QString &displayName)
{
    if(m_displayName == displayName)
        return;
    m_displayName = displayName ;
    emit displayNameChanged();
}
Example #4
0
void ShotgunField::setDisplayName(const QString n)
{
    if (m_displayName != n) {
        m_displayName = n;
        emit displayNameChanged(n);
    }
}
void AccountInterfacePrivate::setAccount(Accounts::Account *acc)
{
    if (!acc) {
        qWarning() << "AccountInterface: setAccount() called with null account! Aborting operation.";
        return;
    }

    if (account) {
        qWarning() << "AccountInterface: setAccount() called but account already set! Aborting operation.";
        return;
    }

    account = acc;

    // connect up our signals.
    connect(account, SIGNAL(enabledChanged(QString,bool)), this, SLOT(enabledHandler(QString,bool)));
    connect(account, SIGNAL(displayNameChanged(QString)), this, SLOT(displayNameChangedHandler()));
    connect(account, SIGNAL(synced()), this, SLOT(handleSynced()));
    connect(account, SIGNAL(removed()), this, SLOT(invalidate()));
    connect(account, SIGNAL(destroyed()), this, SLOT(invalidate()));

    // first time read from db.  we should be in Initializing state to begin with.
    // QueuedConnection to ensure that clients have a chance to connect to state changed signals.
    QMetaObject::invokeMethod(this, "asyncQueryInfo", Qt::QueuedConnection);
}
Example #6
0
void DesignDocument::updateFileName(const QString & /*oldFileName*/, const QString &newFileName)
{
    if (m_documentModel)
        m_documentModel->setFileUrl(QUrl::fromLocalFile(newFileName));

    if (m_inFileComponentModel)
        m_inFileComponentModel->setFileUrl(QUrl::fromLocalFile(newFileName));

    viewManager().setItemLibraryViewResourcePath(QFileInfo(newFileName).absolutePath());

    emit displayNameChanged(displayName());
}
Example #7
0
void DesignDocumentController::setFileName(const QString &fileName)
{
    d->fileName = fileName;

    if (QFileInfo(fileName).exists()) {
        d->searchPath = QUrl::fromLocalFile(fileName);
    } else {
        d->searchPath = QUrl(fileName);
    }

    if (d->model)
        d->model->setFileUrl(d->searchPath);

    if (d->itemLibraryView)
        d->itemLibraryView->widget()->setResourcePath(QFileInfo(fileName).absolutePath());
    emit displayNameChanged(displayName());
}
Accounts::Account* AccountsModelPrivate::accountById(int id)
{
    if (m_accHash.contains(id)) {
        return m_accHash.value(id);
    }

    Accounts::Account* account = m_manager->account(id);
    if (!account) {
        qDebug() << "\t Failed to get the account from manager";
        return 0;
    }

    connect(account, SIGNAL(displayNameChanged(QString)), q, SLOT(accountUpdated()));

    m_accHash[id] = account;
    return account;
}
void QDeclarativeCamera::setupDevice(const QString &deviceName)
{
    QMediaService *service = m_camera->service();
    if (!service)
        return;

    QVideoDeviceSelectorControl *deviceControl = qobject_cast<QVideoDeviceSelectorControl*>(service->requestControl(QVideoDeviceSelectorControl_iid));
    if (!deviceControl)
        return;

    int deviceIndex = -1;

    if (deviceName.isEmpty()) {
        deviceIndex = deviceControl->defaultDevice();
    } else {
        for (int i = 0; i < deviceControl->deviceCount(); ++i) {
            if (deviceControl->deviceName(i) == deviceName) {
                deviceIndex = i;
                break;
            }
        }
    }

    if (deviceIndex == -1)
        return;

    State previousState = cameraState();
    setCameraState(UnloadedState);

    deviceControl->setSelectedDevice(deviceIndex);

    QCameraInfo oldCameraInfo = m_currentCameraInfo;
    m_currentCameraInfo = QCameraInfo(*m_camera);

    emit deviceIdChanged();
    if (oldCameraInfo.description() != m_currentCameraInfo.description())
        emit displayNameChanged();
    if (oldCameraInfo.position() != m_currentCameraInfo.position())
        emit positionChanged();
    if (oldCameraInfo.orientation() != m_currentCameraInfo.orientation())
        emit orientationChanged();

    setCameraState(previousState);
}
void Kopete::ChatSession::addContact( const Kopete::Contact *c, bool suppress )
{
	//kDebug( 14010 ) ;
	if ( d->contacts.contains( (Kopete::Contact*)c ) )
	{
		kDebug( 14010 ) << "Contact already exists";
//		emit contactAdded( c, suppress );
	}
	else
	{
		if ( d->contacts.count() == 1 && d->isEmpty )
		{
			kDebug( 14010 ) << " F****R ZONE ";
			/* We have only 1 contact before, so the status of the
			   message manager was given from that contact status */
			Kopete::Contact *old = d->contacts.first();
			d->contacts.removeAll( old );
			d->contacts.append( (Kopete::Contact*)c );

			disconnect( old, SIGNAL(onlineStatusChanged(Kopete::Contact*,Kopete::OnlineStatus,Kopete::OnlineStatus)),
				this, SLOT(slotOnlineStatusChanged(Kopete::Contact*,Kopete::OnlineStatus,Kopete::OnlineStatus)) );
			disconnect( old, SIGNAL(statusMessageChanged(Kopete::Contact*)), this, SIGNAL(statusMessageChanged(Kopete::Contact*)) );

			if ( old->metaContact() )
			{
				disconnect( old->metaContact(), SIGNAL(displayNameChanged(QString,QString)), this, SLOT(slotUpdateDisplayName()) );
				disconnect( old->metaContact(), SIGNAL(photoChanged()), this, SIGNAL(photoChanged()) );
			}
			else
				disconnect( old, SIGNAL(propertyChanged(Kopete::PropertyContainer*,QString,QVariant,QVariant)), this, SLOT(slotUpdateDisplayName()) );

			disconnect( old, SIGNAL(propertyChanged(Kopete::PropertyContainer*,QString,QVariant,QVariant)), this, SLOT(slotContactPropertyChanged(Kopete::PropertyContainer*,QString,QVariant,QVariant)) );

			emit contactAdded( c, suppress );
			emit contactRemoved( old, QString() );
		}
		else
		{
void Kopete::ChatSession::setDisplayName( const QString &newName )
{
	d->displayName = newName;
	d->customDisplayName = true;
	emit displayNameChanged();
}