コード例 #1
0
Model::Model(ImageProvider* ip):
        m_showkeyboard(true),        
        m_contactsModel(NULL),
        m_applistModel(NULL),
        m_error(""),
        m_searchString(""),
        m_modelsready(false),
        m_searchresults(new QList<AppEntry>()),
        m_ip(ip),
        m_clearresults(false),
        iCallDialer(NULL)
{
    LS("Model::Model =>>");

    QHash<int, QByteArray> roles;
    roles[0] = "title";
    roles[1] = "uid";
    roles[2] = "iscontact";

    setRoleNames(roles);
    roles.clear();

    QFile fileA( NOTHING );
    if(!fileA.exists())
        m_applistModel = new applistModel(this);
    fileA.close();

    QFile file( ONLYAPPS );
    if(!file.exists())
        m_contactsModel  = new contactsModel(this);
    file.close();

    if(m_applistModel)
        {
        QObject::connect(m_applistModel, SIGNAL(modelReady()), this, SLOT(modelReadyHandle()));
        QObject::connect(m_applistModel, SIGNAL(HandleSearchResults(QString,QList<AppEntry>&,int,bool)), this, SLOT(HandleSearchComplete(QString,QList<AppEntry>&,int,bool)));
        }

    if(m_contactsModel)
        {
        QObject::connect(m_contactsModel, SIGNAL(modelReady()), this, SLOT(modelReadyHandle()));
        QObject::connect(m_contactsModel, SIGNAL(HandleSearchResults(QString,QList<AppEntry>&,int,bool)), this, SLOT(HandleSearchComplete(QString,QList<AppEntry>&,int,bool)));
        }

    if(m_contactsModel == NULL && m_applistModel == NULL)
        modelReadyHandle();

    LS("Model::Model <<");
}
コード例 #2
0
ファイル: ignorelistmodel.cpp プロジェクト: hades/quassel
void IgnoreListModel::clientDisconnected() {
  // clear
  _clonedIgnoreListManager = ClientIgnoreListManager();
  _modelReady = false;
  reset();
  emit modelReady(false);
}
コード例 #3
0
void ResourceModel::onResourceLoaded(Lumix::Resource::State,
									 Lumix::Resource::State new_state)
{
	beginResetModel();
	/*
		endResetModel closes any opened property editor, if this is done in the
	   end of this method
		it can result in a crash, since the editor can access some destroyed
	   node
	*/
	endResetModel();
	beginResetModel();
	for (int i = 0; i < getRoot().m_children.size(); ++i)
	{
		delete getRoot().m_children[i];
	}
	getRoot().m_children.clear();
	this->getRoot().m_getter = [new_state]() -> QVariant
	{
		return new_state == Lumix::Resource::State::LOADING ? "Loading..."
															: "Ready";
	};
	if (new_state == Lumix::Resource::State::READY ||
		new_state == Lumix::Resource::State::FAILURE)
	{
		if (dynamic_cast<Lumix::Model*>(m_resource))
		{
			fillModelInfo();
		}
		else if (dynamic_cast<Lumix::Material*>(m_resource))
		{
			fillMaterialInfo(static_cast<Lumix::Material*>(m_resource),
							 getRoot());
		}
		else if (dynamic_cast<Lumix::Texture*>(m_resource))
		{
			fillTextureInfo(static_cast<Lumix::Texture*>(m_resource),
							getRoot());
		}
		else
		{
			Q_ASSERT(false);
		}
	}
	endResetModel();
	if (new_state == Lumix::Resource::State::READY ||
		new_state == Lumix::Resource::State::FAILURE)
	{
		emit modelReady();
	}
}
コード例 #4
0
ファイル: aliasesmodel.cpp プロジェクト: 02JanDal/quassel
AliasesModel::AliasesModel(QObject *parent)
    : QAbstractItemModel(parent),
    _configChanged(false),
    _modelReady(false)
{
    // we need this signal for future connects to reset the data;
    connect(Client::instance(), SIGNAL(connected()), this, SLOT(clientConnected()));
    connect(Client::instance(), SIGNAL(disconnected()), this, SLOT(clientDisconnected()));

    if (Client::isConnected())
        clientConnected();
    else
        emit modelReady(false);
}
コード例 #5
0
void applistModel::constructappslist()
{
    LS("applistModel::constructappslist() >>");

    int err = m_session.GetAllApps();
    if(KErrNone != err)
        return;

    TApaAppInfo appInfo;
    err = m_session.GetNextApp(appInfo);

    while(err == KErrNone)
        {
        TApaAppCapabilityBuf buf;
        m_session.GetAppCapability(buf, appInfo.iUid);
        if(buf().iAppIsHidden == EFalse && appInfo.iUid.iUid != APPUID)
            {
            QString caption((QChar*)appInfo.iCaption.Ptr(),appInfo.iCaption.Length());
            QString fullName((QChar*)appInfo.iFullName.Ptr(),appInfo.iFullName.Length());
            LS(caption);

            if(!caption.isEmpty())
                {
                AppEntry p;
                p.caption = caption;
                p.fullName = fullName;
                p.uid = appInfo.iUid.iUid;
                p.rank = 1; //does not matter. should be same value for alphabatical sorting
                m_appslist->append(p);
                }
            }

        err = m_session.GetNextApp(appInfo);
        }

    for(int i=0; i < m_appslist->count();i++)
        m_uidlist.append(m_appslist->at(i).uid);

    qSort(m_appslist->begin(), m_appslist->end(), appentrylessthan2);
    emit modelReady();

    LS("applistModel::constructappslist() <<");
}
コード例 #6
0
applistModel::applistModel(QObject *parent) :
    QObject(parent),
    m_appslist(NULL)
{
    LS("applistModel::applistModel() >>");
    int err = m_session.Connect();

    if(KErrNone != err)
        {
        emit modelReady();
        }
    else
        {
        QTimer::singleShot(10, this, SLOT(constructappslist()));
        m_appslist = new  QList<AppEntry>();
        }

    LS("applistModel::applistModel() <<");
}
コード例 #7
0
ファイル: ignorelistmodel.cpp プロジェクト: hades/quassel
void IgnoreListModel::initDone() {
  _modelReady = true;
  reset();
  emit modelReady(true);
}