Пример #1
0
GroupsModel::~GroupsModel()
{
	disconnect(GroupManager::instance(), SIGNAL(groupAboutToBeAdded(Group)),
			this, SLOT(groupAboutToBeAdded(Group)));
	disconnect(GroupManager::instance(), SIGNAL(groupAdded(Group)),
			this, SLOT(groupAdded(Group)));
	disconnect(GroupManager::instance(), SIGNAL(groupAboutToBeRemoved(Group)),
			this, SLOT(groupAboutToBeRemoved(Group)));
	disconnect(GroupManager::instance(), SIGNAL(groupRemoved(Group)),
			this, SLOT(groupRemoved(Group)));
}
Пример #2
0
GroupsModel::GroupsModel(QObject *parent)
	: QAbstractListModel(parent)
{
	connect(GroupManager::instance(), SIGNAL(groupAboutToBeAdded(Group)),
			this, SLOT(groupAboutToBeAdded(Group)));
	connect(GroupManager::instance(), SIGNAL(groupAdded(Group)),
			this, SLOT(groupAdded(Group)));
	connect(GroupManager::instance(), SIGNAL(groupAboutToBeRemoved(Group)),
			this, SLOT(groupAboutToBeRemoved(Group)));
	connect(GroupManager::instance(), SIGNAL(groupRemoved(Group)),
			this, SLOT(groupRemoved(Group)));
}
Пример #3
0
GroupsModel::GroupsModel(GroupManager *groupManager, QObject *parent) :
		QAbstractListModel{parent},
		m_groupManager{groupManager}
{
	connect(m_groupManager, SIGNAL(groupAboutToBeAdded(Group)),
			this, SLOT(groupAboutToBeAdded(Group)), Qt::DirectConnection);
	connect(m_groupManager, SIGNAL(groupAdded(Group)),
			this, SLOT(groupAdded(Group)), Qt::DirectConnection);
	connect(m_groupManager, SIGNAL(groupAboutToBeRemoved(Group)),
			this, SLOT(groupAboutToBeRemoved(Group)), Qt::DirectConnection);
	connect(m_groupManager, SIGNAL(groupRemoved(Group)),
			this, SLOT(groupRemoved(Group)), Qt::DirectConnection);
}
Пример #4
0
/*!
    Creates a QHardwareManager object and attaches it to \a parent. \a interface is the
    name of the accessory interface that this object is monitoring.

    The following code assumes that Qtopia is running on a device that
    has a modem as power source (for more details see QPowerStatus and QPowerSource).
    \code
        QHardwareManager manager( "QPowerSource" );
        QStringList providers = manager.providers();
        
        //Qtopia always has a virtual power source with id DefaultBattery
        providers.contains( "DefaultBattery" ); //always true
        providers.contains( "modem" ); //true
    \endcode

    Another way to achieve the same as the above example would be:

    \code
        QStringList providers = QHardwareManager::providers<QPowerSource>();
        providers.contains( "DefaultBattery" ); //always true
        providers.contains( "modem" ); //true
    \endcode
*/
QHardwareManager::QHardwareManager( const QString& interface, QObject *parent )
    : QAbstractIpcInterfaceGroupManager( HARDWAREINTERFACE_VALUEPATH, interface, parent )
{
    d = new QHardwareManagerPrivate;
    d->interface = interface;
    connect( this, SIGNAL(groupAdded(QString)),
             this, SIGNAL(providerAdded(QString)) );
    connect( this, SIGNAL(groupRemoved(QString)),
             this, SIGNAL(providerRemoved(QString)) );
}
Пример #5
0
bool SSIManager::newGroup( const Oscar::SSI& group )
{
    //trying to find the group by its ID
    QValueList<Oscar::SSI>::iterator it, listEnd = d->SSIList.end();
    if ( findGroup( group.name() ).isValid() )
        return false;

    if ( !group.name().isEmpty() ) //avoid the group with gid 0 and bid 0
    {   // the group is really new
        kdDebug( OSCAR_RAW_DEBUG ) << k_funcinfo << "Adding group '" << group.name() << "' to SSI list" << endl;

        d->SSIList.append( group );
        addID( group );
        emit groupAdded( group );
        return true;
    }
    return false;
}
Пример #6
0
QUuid ContextModel::createGroup( const QUuid &pGroupId, QString pGroupName )
{
	BaseListModel		*Parent = ( mCurrentGroup.isNull() ? mRootItem : mNodeMap.value( mCurrentGroup )->children() );

	if( !Parent )
	{
		return( QUuid() );
	}

	QUuid				 GroupId = pGroupId.isNull() ? QUuid::createUuid() : pGroupId;

	NodeModel			*Group = new NodeModel( GroupId, Parent );

	if( !Group )
	{
		return( QUuid() );
	}

	Group->setName( pGroupName );

	int					 GroupIdx = Parent->rowCount();

	beginInsertRows( createIndex( Parent->row(), 0, Parent ), GroupIdx, GroupIdx );

	Parent->appendChild( Group );

	mNodeMap.insert( GroupId, Group );

	endInsertRows();

	emit layoutChanged();

	emit groupAdded( GroupId );

	return( GroupId );
}
Пример #7
0
void GroupManager::itemAdded(Group item)
{
	emit groupAdded(item);
}
Пример #8
0
void GroupEventListener::init()
{
	for (auto const &group : m_groupManager->items())
		groupAdded(group);
}