当前位置: 首页>>代码示例>>C++>>正文


C++ Ptr::isPropertySet方法代码示例

本文整理汇总了C++中profile::Ptr::isPropertySet方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::isPropertySet方法的具体用法?C++ Ptr::isPropertySet怎么用?C++ Ptr::isPropertySet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在profile::Ptr的用法示例。


在下文中一共展示了Ptr::isPropertySet方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: config

bool KDE4ProfileWriter::writeProfile(const QString& path , const Profile::Ptr profile)
{
    KConfig config(path, KConfig::NoGlobals);

    KConfigGroup general = config.group(GENERAL_GROUP);

    // Parent profile if set, when loading the profile in future, the parent
    // must be loaded as well if it exists.
    if (profile->parent())
        general.writeEntry("Parent", profile->parent()->path());

    if (profile->isPropertySet(Profile::Command)
            || profile->isPropertySet(Profile::Arguments))
        general.writeEntry("Command",
                           ShellCommand(profile->command(), profile->arguments()).fullCommand());

    // Write remaining properties
    writeProperties(config, profile, Profile::DefaultPropertyNames);

    return true;
}
开发者ID:sandsmark,项目名称:konsole,代码行数:21,代码来源:ProfileWriter.cpp

示例2: fileInfo

QString KDE4ProfileWriter::getPath(const Profile::Ptr profile)
{
    // both location have trailing slash
    static const QString localDataLocation = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("/konsole/");
    static const QString systemDataLocation = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation).last() + QStringLiteral("konsole/");

    const QString candidateLocalPath = localDataLocation + profile->untranslatedName() + ".profile";
    QString newPath;

    // when the path property is not set, it means the profile has just
    // been created in memory and has never been saved into disk before.
    //
    // use "name.profile" as filename and save it under $KDEHOME
    if (!profile->isPropertySet(Profile::Path)) {
        return candidateLocalPath;
    }

    // for a system wide profile, save the modified version as
    // a local profile under $KDEHOME
    if (profile->path().startsWith(systemDataLocation)) {
        return candidateLocalPath;
    }

    // for a local profile, use its existing path
    if (profile->path().startsWith(localDataLocation)) {
        newPath = profile->path();
    } else {
        // for the ad-hoc profiles in non-standard places
        //
        //  * if its path is writable for user, use its existing path
        //  * if its path is not writable for user, save it under $KDEHOME
        //
        QFileInfo fileInfo(profile->path());
        if (fileInfo.isWritable()) {
            newPath = profile->path();
        } else {
            newPath = candidateLocalPath;
        }
    }

    return newPath;
}
开发者ID:sandsmark,项目名称:konsole,代码行数:42,代码来源:ProfileWriter.cpp

示例3: while

void KDE4ProfileWriter::writeProperties(KConfig& config,
                                        const Profile::Ptr profile,
                                        const Profile::PropertyInfo* properties)
{
    const char* groupName = 0;
    KConfigGroup group;

    while (properties->name != 0) {
        if (properties->group != 0) {
            if (groupName == 0 || qstrcmp(groupName, properties->group) != 0) {
                group = config.group(properties->group);
                groupName = properties->group;
            }

            if (profile->isPropertySet(properties->property))
                group.writeEntry(QString(properties->name),
                                 profile->property<QVariant>(properties->property));
        }

        properties++;
    }
}
开发者ID:sandsmark,项目名称:konsole,代码行数:22,代码来源:ProfileWriter.cpp


注:本文中的profile::Ptr::isPropertySet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。