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


C++ KUser::homeDir方法代码示例

本文整理汇总了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;
}
开发者ID:ayoy,项目名称:kaveau,代码行数:15,代码来源:addbackupwizard.cpp

示例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( '/' ) )
开发者ID:KDE,项目名称:kde-runtime,代码行数:67,代码来源:kshorturifilter.cpp


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