本文整理汇总了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)));
}
}
示例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;
}
示例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;
}
示例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);
}
示例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 ) );
}
示例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) );
}
示例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;
}
示例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() << ")";
}
示例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());
}
示例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();
}
示例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();
}
示例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() << ")";
}
示例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();
}
示例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;
}
示例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;
}