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


C++ defaultConnection函数代码示例

本文整理汇总了C++中defaultConnection函数的典型用法代码示例。如果您正苦于以下问题:C++ defaultConnection函数的具体用法?C++ defaultConnection怎么用?C++ defaultConnection使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: configFile

MirallConfigFile::MirallConfigFile( const QString& appendix, bool useOldConfig )
{

    if (useOldConfig && !appendix.isEmpty()) {
        QString oldConfigFile = configFile();
        _customHandle = appendix;
        QString newConfigFile = configFile();
        QFile::copy(oldConfigFile, newConfigFile);
    } else {
        _customHandle = appendix;
    }

    QSettings::setDefaultFormat(QSettings::IniFormat);
    if (! credentialsPerConfig.contains(_customHandle)) {
        QString con( _customHandle );
        if( _customHandle.isEmpty() ) con = defaultConnection();

        const QString config = configFile();
        qDebug() << "Loading config: " << config;


        QSettings settings(config, QSettings::IniFormat);
        settings.setIniCodec("UTF-8");
        settings.beginGroup( con );

        QString type = settings.value( QLatin1String(authTypeC) ).toString();

        qDebug() << "Getting credentials of type " << type << " for " << _customHandle;

        credentialsPerConfig.insert(_customHandle, SharedCreds(CredentialsFactory::create (type)));
    }
}
开发者ID:cavassin,项目名称:mirall,代码行数:32,代码来源:mirallconfigfile.cpp

示例2: con

QString MirallConfigFile::ownCloudPasswd( const QString& connection ) const
{
    QString con( connection );
    if( connection.isEmpty() ) con = defaultConnection();

    QSettings settings( configFile(), QSettings::IniFormat );
    settings.setIniCodec( "UTF-8" );
    settings.beginGroup( con );

    QByteArray pwdba = settings.value(QLatin1String("passwd")).toByteArray();
    if( !pwdba.isEmpty() ) {
        return QString::fromUtf8( QByteArray::fromBase64(pwdba) );
    }

    // check the password entry, cleartext from before
    // read it and convert to base64, delete the cleartext entry.
    QString p = settings.value(QLatin1String("password")).toString();

    if( ! p.isEmpty() ) {
        // its there, save base64-encoded and delete.
        pwdba = p.toUtf8();
        settings.setValue( QLatin1String("passwd"), QVariant(pwdba.toBase64()) );
        settings.remove( QLatin1String("password") );
        settings.sync();
    }
    return p;
}
开发者ID:NCTU-NBA,项目名称:NCTUBox,代码行数:27,代码来源:mirallconfigfile.cpp

示例3: con

/*
 * returns the configured owncloud url if its already configured, otherwise an empty
 * string.
 * The returned url always has a trailing hash.
 * If webdav is true, the webdav-server url is returned.
 */
QString MirallConfigFile::ownCloudUrl( const QString& connection, bool webdav ) const
{
    QString con( connection );
    if( connection.isEmpty() ) con = defaultConnection();

    QSettings settings( configFile(), QSettings::IniFormat );
    settings.setIniCodec( "UTF-8" );
    settings.beginGroup( con );

    // For the WebDAV connect it is required to know which version the server is running
    // because the url changed :-/
    if( webdav && _oCVersion.isEmpty() ) {
        qDebug() << "######## Config does not yet know the ownCloud server version #########";
        qDebug() << "###################### THIS SHOULD NOT HAPPEN! ########################";
    }

    QString url = settings.value( QLatin1String("url") ).toString();
    if( ! url.isEmpty() ) {
        if( ! url.endsWith(QLatin1Char('/'))) url.append(QLatin1String("/"));
        if( webdav ) url.append( QLatin1String("remote.php/webdav/") );
    }

    qDebug() << "Returning configured owncloud url: " << url;

  return url;
}
开发者ID:ditianxin,项目名称:mirall,代码行数:32,代码来源:mirallconfigfile.cpp

示例4: con

QVariant ConfigFile::retrieveData(const QString& group, const QString& key) const
{
    const QString con(group.isEmpty() ? defaultConnection() : group);
    QSettings settings(configFile(), QSettings::IniFormat);

    settings.beginGroup(con);
    return settings.value(key);
}
开发者ID:chetan19,项目名称:client,代码行数:8,代码来源:configfile.cpp

示例5: connectionExists

bool MirallConfigFile::connectionExists( const QString& conn )
{
    QString con = conn;
    if( conn.isEmpty() ) con = defaultConnection();

    QSettings settings( configFile(), QSettings::IniFormat);
    settings.setIniCodec( "UTF-8" );

    return settings.contains( QString::fromLatin1("%1/url").arg( conn ) );
}
开发者ID:NCTU-NBA,项目名称:NCTUBox,代码行数:10,代码来源:mirallconfigfile.cpp

示例6: connectionExists

bool MirallConfigFile::connectionExists( const QString& conn )
{
    QString con = conn;
    if( conn.isEmpty() ) con = defaultConnection();

    QSettings settings(configFile(), QSettings::IniFormat);
    settings.setIniCodec("UTF-8");

    settings.beginGroup(conn);
    return settings.contains( QLatin1String(urlC) );
}
开发者ID:cavassin,项目名称:mirall,代码行数:11,代码来源:mirallconfigfile.cpp

示例7: con

bool MirallConfigFile::ownCloudSkipUpdateCheck( const QString& connection ) const
{
    QString con( connection );
    if( connection.isEmpty() ) con = defaultConnection();

    QSettings settings(configFile(), QSettings::IniFormat);
    settings.beginGroup( con );

    bool skipIt = settings.value( QLatin1String(skipUpdateCheckC), false ).toBool();

    return skipIt;
}
开发者ID:gbravo25,项目名称:mirall,代码行数:12,代码来源:mirallconfigfile.cpp

示例8: configFile

MirallConfigFile::MirallConfigFile()
{
    QSettings::setDefaultFormat(QSettings::IniFormat);

    const QString config = configFile();


    QSettings settings(config, QSettings::IniFormat);
    settings.beginGroup( defaultConnection() );

    qDebug() << "Loading config: " << config << " (URL is " << settings.value("url").toString() << ")";
}
开发者ID:gbravo25,项目名称:mirall,代码行数:12,代码来源:mirallconfigfile.cpp

示例9: configFile

ConfigFile::ConfigFile()
{
    // QDesktopServices uses the application name to create a config path
    qApp->setApplicationName(Theme::instance()->appNameGUI());

    QSettings::setDefaultFormat(QSettings::IniFormat);

    const QString config = configFile();


    QSettings settings(config, QSettings::IniFormat);
    settings.beginGroup(defaultConnection());
}
开发者ID:msphn,项目名称:client,代码行数:13,代码来源:configfile.cpp

示例10: configFile

// This method is called after the password was successfully stored into the
// QKeyChain in CredentialStore.
void MirallConfigFile::clearPasswordFromConfig( const QString& connection )
{
    const QString file = configFile();
    QString con( defaultConnection() );
    if( !connection.isEmpty() )
        con = connection;

    QSettings settings( file, QSettings::IniFormat);
    settings.setIniCodec( "UTF-8" );
    settings.beginGroup( con );
    settings.remove(QLatin1String("passwd"));
    settings.remove(QLatin1String("password"));
    settings.sync();
}
开发者ID:NCTU-NBA,项目名称:NCTUBox,代码行数:16,代码来源:mirallconfigfile.cpp

示例11: con

void MirallConfigFile::removeConnection( const QString& connection )
{
    QString con( connection );
    if( connection.isEmpty() ) con = defaultConnection();

    qDebug() << "    removing the config file for connection " << con;

    // Currently its just removing the entire config file
    // TODO: Eh? Shouldn't it try to load a file under configFile() and set it to INI?
    QSettings settings;
    settings.setIniCodec( "UTF-8" );
    settings.beginGroup( con );
    settings.remove(QString::null);  // removes all content from the group
    settings.sync();
}
开发者ID:cavassin,项目名称:mirall,代码行数:15,代码来源:mirallconfigfile.cpp

示例12: configFile

ConfigFile::ConfigFile()
{
    // QDesktopServices uses the application name to create a config path
    qApp->setApplicationName( Theme::instance()->appNameGUI() );

    QSettings::setDefaultFormat(QSettings::IniFormat);

    const QString config = configFile();


    QSettings settings(config, QSettings::IniFormat);
    settings.beginGroup( defaultConnection() );

    // qDebug() << Q_FUNC_INFO << "Loading config: " << config << " (URL is " << settings.value("url").toString() << ")";
}
开发者ID:chetan19,项目名称:client,代码行数:15,代码来源:configfile.cpp

示例13: con

void ConfigFile::setRemotePollInterval(chrono::milliseconds interval, const QString &connection)
{
    QString con(connection);
    if (connection.isEmpty())
        con = defaultConnection();

    if (interval < chrono::seconds(5)) {
        qCWarning(lcConfigFile) << "Remote Poll interval of " << interval.count() << " is below five seconds.";
        return;
    }
    QSettings settings(configFile(), QSettings::IniFormat);
    settings.beginGroup(con);
    settings.setValue(QLatin1String(remotePollIntervalC), qlonglong(interval.count()));
    settings.sync();
}
开发者ID:owncloud,项目名称:client,代码行数:15,代码来源:configfile.cpp

示例14: con

quint64 ConfigFile::notificationRefreshInterval(const QString &connection) const
{
    QString con(connection);
    if (connection.isEmpty())
        con = defaultConnection();
    QSettings settings(configFile(), QSettings::IniFormat);
    settings.beginGroup(con);

    quint64 defaultInterval = 5 * 60 * 1000ull; // 5 minutes
    quint64 interval = settings.value(QLatin1String(notificationRefreshIntervalC), defaultInterval).toULongLong();
    if (interval < 60 * 1000ull) {
        qCWarning(lcConfigFile) << "Notification refresh interval smaller than one minute, setting to one minute";
        interval = 60 * 1000ull;
    }
    return interval;
}
开发者ID:msphn,项目名称:client,代码行数:16,代码来源:configfile.cpp

示例15: remotePollInterval

quint64 MirallConfigFile::forceSyncInterval(const QString& connection) const
{
    uint pollInterval = remotePollInterval(connection);

    QString con( connection );
    if( connection.isEmpty() ) con = defaultConnection();
    QSettings settings(configFile(), QSettings::IniFormat);
    settings.beginGroup( con );

    quint64 interval = settings.value( QLatin1String(forceSyncIntervalC), 10 * pollInterval ).toULongLong();
    if( interval < pollInterval) {
        qDebug() << "Force sync interval is less than the remote poll inteval, reverting to" << pollInterval;
        interval = pollInterval;
    }
    return interval;
}
开发者ID:gbravo25,项目名称:mirall,代码行数:16,代码来源:mirallconfigfile.cpp


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