本文整理汇总了C++中KUser::homeDir方法的典型用法代码示例。如果您正苦于以下问题:C++ KUser::homeDir方法的具体用法?C++ KUser::homeDir怎么用?C++ KUser::homeDir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KUser
的用法示例。
在下文中一共展示了KUser::homeDir方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: settings
Settings AddBackupWizard::settings()
{
KUser user;
QString source = user.homeDir();
QString destination = page2->destination();
QString relativeDest = page2->relativeDestination();
QString deviceUDI = page2->deviceUDI();
QStringList excludedDirs = page3->excludedDirs();
QString mountPoint = page2->mountPoint();
Settings settings (source, deviceUDI, relativeDest, excludedDirs);
settings.setMount( mountPoint);
return settings;
}
示例2: filterUri
//.........这里部分代码省略.........
// or for "/tmp/a?b" (#58990)
if( ( url.hasRef() || !url.query().isEmpty() )
&& !url.path().endsWith(QL1S("/")) ) // /tmp/?foo is a namefilter, not a query
{
path = url.path();
ref = url.ref();
//kDebug(7023) << "isLocalFile set path to " << stringDetails( path );
//kDebug(7023) << "isLocalFile set ref to " << stringDetails( ref );
query = url.query();
if (path.isEmpty() && url.hasHost())
path = '/';
}
else
{
path = cmd;
//kDebug(7023) << "(2) path=cmd=" << path;
}
}
}
if( path[0] == '~' )
{
int slashPos = path.indexOf('/');
if( slashPos == -1 )
slashPos = path.length();
if( slashPos == 1 ) // ~/
{
path.replace ( 0, 1, QDir::homePath() );
}
else // ~username/
{
const QString userName (path.mid( 1, slashPos-1 ));
KUser user (userName);
if( user.isValid() && !user.homeDir().isEmpty())
{
path.replace (0, slashPos, user.homeDir());
}
else
{
if (user.isValid()) {
setErrorMsg(data, i18n("<qt><b>%1</b> does not have a home folder.</qt>", userName));
} else {
setErrorMsg(data, i18n("<qt>There is no user called <b>%1</b>.</qt>", userName));
}
setUriType( data, KUriFilterData::Error );
// Always return true for error conditions so
// that other filters will not be invoked !!
return true;
}
}
expanded = true;
}
else if ( path[0] == '$' ) {
// Environment variable expansion.
if ( sEnvVarExp.indexIn( path ) == 0 )
{
QByteArray exp = qgetenv( path.mid( 1, sEnvVarExp.matchedLength() - 1 ).toLocal8Bit().data() );
if(! exp.isNull())
{
path.replace( 0, sEnvVarExp.matchedLength(), QString::fromLocal8Bit(exp.constData()) );
expanded = true;
}
}
}
if ( expanded || cmd.startsWith( '/' ) )