Ejemplo n.º 1
0
std::string getPerrmissibleFileLocation(uid_t uid, int installationType)
{
    TizenPlatformConfig tpc(uid);
    if ((installationType == SM_APP_INSTALL_GLOBAL)
            || (installationType == SM_APP_INSTALL_PRELOADED))
        return tpc.ctxMakePath(TZ_SYS_VAR, Config::SERVICE_NAME,
            Config::APPS_LABELS_FILE);
    else
        return tpc.ctxMakePath(TZ_SYS_VAR, Config::SERVICE_NAME,
            tpc.ctxGetEnv(TZ_USER_NAME), Config::APPS_LABELS_FILE);
}
Ejemplo n.º 2
0
void FuzzySaver::save(const QMap<QString, RugItem *> &rugs)
{
	if(QFile::exists(m_dirPath))
		QFile::remove(m_dirPath);
	QFile f(m_dirPath);
	f.open(QIODevice::WriteOnly);

	QXmlStreamWriter stream(&f);
	stream.setAutoFormatting(true);
	stream.writeStartDocument();
	stream.writeStartElement("fuzzysession");
	ThreadPatternCollection * tpc(ThreadPatternCollection::getInstance());
	QString dpath(ThreadPattern::DefaultPattern()->path());
	// First save patterns
	foreach(const QString& k, tpc->getCollection().keys())
	{
		QString path(tpc->value(k)->path());
		if(dpath != path)
			stream.writeTextElement("patternpath", path);
	}

	// Now rugs!
	foreach(const QString& k, rugs.keys())
	{
		RugItem * rug(rugs.value(k));
		if(rug->getThreadPattern()->path() != ThreadPattern::DefaultPattern()->path())
		{
			stream.writeStartElement("rug");

			stream.writeAttribute("name", rug->getRugName());
			stream.writeAttribute("xpos", QString::number(rug->x(), 'f'));
			stream.writeAttribute("ypos", QString::number(rug->y(), 'f'));
			stream.writeAttribute("width", QString::number(rug->getRugSize().width(), 'f'));
			stream.writeAttribute("height", QString::number(rug->getRugSize().height(), 'f'));
			stream.writeAttribute("threadheight", QString::number(rug->getThreadHeight(), 'f'));
			stream.writeAttribute("patternsize", QString::number(rug->getPatternSize(), 'f'));
			stream.writeAttribute("wphundred", QString::number(rug->getWP100(), 'f'));

			stream.writeTextElement("pattern", rug->getThreadPattern()->getName());

			stream.writeEndElement(); // rug
		}
	}

	stream.writeEndElement(); // fuzzysession
	stream.writeEndDocument();
}
Ejemplo n.º 3
0
void TestTools::testProfiles()
{
    TemporaryProfile tpp("parent", m_settings);
    Profile parentProfile = tpp.p;
    TemporaryProfile tpc("child", m_settings);
    Profile childProfile = tpc.p;
    parentProfile.removeBaseProfile();
    parentProfile.remove("testKey");
    QCOMPARE(parentProfile.value("testKey", "none").toString(), QLatin1String("none"));
    parentProfile.setValue("testKey", "testValue");
    QCOMPARE(parentProfile.value("testKey").toString(), QLatin1String("testValue"));

    childProfile.remove("testKey");
    childProfile.removeBaseProfile();
    QCOMPARE(childProfile.value("testKey", "none").toString(), QLatin1String("none"));
    childProfile.setBaseProfile("parent");
    QCOMPARE(childProfile.value("testKey").toString(), QLatin1String("testValue"));

    // Change base profile and check if the inherited value also changes.
    TemporaryProfile tpf("foo", m_settings);
    Profile fooProfile = tpf.p;
    fooProfile.setValue("testKey", "gnampf");
    childProfile.setBaseProfile("foo");
    QCOMPARE(childProfile.value("testKey", "none").toString(), QLatin1String("gnampf"));

    ErrorInfo errorInfo;
    childProfile.setBaseProfile("SmurfAlongWithMe");
    childProfile.value("blubb", QString(), &errorInfo);
    QVERIFY(errorInfo.hasError());

    errorInfo.clear();
    childProfile.setBaseProfile("parent");
    parentProfile.setBaseProfile("child");
    QVERIFY(!childProfile.value("blubb", QString(), &errorInfo).isValid());
    QVERIFY(errorInfo.hasError());

    QVERIFY(!childProfile.allKeys(Profile::KeySelectionNonRecursive).isEmpty());

    errorInfo.clear();
    QVERIFY(childProfile.allKeys(Profile::KeySelectionRecursive, &errorInfo).isEmpty());
    QVERIFY(errorInfo.hasError());
}