本文整理汇总了C++中kio::UDSEntry类的典型用法代码示例。如果您正苦于以下问题:C++ UDSEntry类的具体用法?C++ UDSEntry怎么用?C++ UDSEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UDSEntry类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: validateOpenUrl
void OpenProjectDialog::validateOpenUrl( const QUrl& url_ )
{
bool isDir = false;
QString extension;
bool isValid = false;
const QUrl url = url_.adjusted(QUrl::StripTrailingSlash);
if( url.isLocalFile() )
{
QFileInfo info( url.toLocalFile() );
isValid = info.exists();
if ( isValid ) {
isDir = info.isDir();
extension = info.suffix();
}
} else if ( url.isValid() )
{
KIO::StatJob* statJob = KIO::stat( url, KIO::HideProgressInfo );
KJobWidgets::setWindow(statJob, Core::self()->uiControllerInternal()->defaultMainWindow() );
isValid = statJob->exec(); // TODO: do this asynchronously so that the user isn't blocked while typing every letter of the hostname in sftp://hostname
if ( isValid ) {
KIO::UDSEntry entry = statJob->statResult();
isDir = entry.isDir();
extension = QFileInfo( entry.stringValue( KIO::UDSEntry::UDS_NAME ) ).suffix();
}
}
if ( isValid ) {
// reset header
openPage->setHeader(i18n("Open \"%1\" as project", url.fileName()));
} else {
// report error
KColorScheme scheme(palette().currentColorGroup());
const QString errorMsg = i18n("Selected URL is invalid");
openPage->setHeader(QStringLiteral("<font color='%1'>%2</font>")
.arg(scheme.foreground(KColorScheme::NegativeText).color().name(), errorMsg)
);
setAppropriate( projectInfoPage, false );
setAppropriate( openPage, true );
setValid( openPage, false );
return;
}
if( isDir || extension != ShellExtension::getInstance()->projectFileExtension() )
{
setAppropriate( projectInfoPage, true );
m_url = url;
if( !isDir ) {
m_url = m_url.adjusted(QUrl::StripTrailingSlash | QUrl::RemoveFilename);
}
ProjectInfoPage* page = qobject_cast<ProjectInfoPage*>( projectInfoPage->widget() );
if( page )
{
page->setProjectName( m_url.fileName() );
OpenProjectPage* page2 = qobject_cast<OpenProjectPage*>( openPage->widget() );
if( page2 )
{
// Default manager
page->setProjectManager( QStringLiteral("Generic Project Manager") );
// clear the filelist
m_fileList.clear();
if( isDir ) {
// If a dir was selected fetch all files in it
KIO::ListJob* job = KIO::listDir( m_url );
connect( job, &KIO::ListJob::entries,
this, &OpenProjectDialog::storeFileList);
KJobWidgets::setWindow(job, Core::self()->uiController()->activeMainWindow());
job->exec();
} else {
// Else we'lll just take the given file
m_fileList << url.fileName();
}
// Now find a manager for the file(s) in our filelist.
bool managerFound = false;
foreach( const QString& manager, page2->projectFilters().keys() )
{
foreach( const QString& filterexp, page2->projectFilters().value(manager) )
{
if( !m_fileList.filter( QRegExp( filterexp, Qt::CaseSensitive, QRegExp::Wildcard ) ).isEmpty() )
{
managerFound = true;
break;
}
}
if( managerFound )
{
page->setProjectManager( manager );
break;
}
}
}
}
m_url.setPath( m_url.path() + '/' + m_url.fileName() + '.' + ShellExtension::getInstance()->projectFileExtension() );
} else
开发者ID:mali,项目名称:kdevplatform,代码行数:96,代码来源:openprojectdialog.cpp
注:本文中的kio::UDSEntry类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论