本文整理汇总了C++中KFileItem::mostLocalURL方法的典型用法代码示例。如果您正苦于以下问题:C++ KFileItem::mostLocalURL方法的具体用法?C++ KFileItem::mostLocalURL怎么用?C++ KFileItem::mostLocalURL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KFileItem
的用法示例。
在下文中一共展示了KFileItem::mostLocalURL方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: autostart
bool MediaNotifier::autostart(const KFileItem &medium)
{
QString mimetype = medium.mimetype();
bool is_cdrom = mimetype.startsWith("cd") || mimetype.startsWith("dvd");
bool is_mounted = mimetype.endsWith("_mounted");
// We autorun only on CD/DVD or removable disks (USB, Firewire)
if(!(is_cdrom || is_mounted) && mimetype != "media/removable_mounted")
{
return false;
}
// Here starts the 'Autostart Of Applications After Mount' implementation
// The desktop environment MAY ignore Autostart files altogether
// based on policy set by the user, system administrator or vendor.
MediaManagerSettings::self()->readConfig();
if(!MediaManagerSettings::self()->autostartEnabled())
{
return false;
}
// From now we're sure the medium is already mounted.
// We can use the local path for stating, no need to use KIO here.
bool local;
QString path = medium.mostLocalURL(local).path(); // local is always true here...
// When a new medium is mounted the root directory of the medium should
// be checked for the following Autostart files in order of precedence:
// .autorun, autorun, autorun.sh
QStringList autorun_list;
autorun_list << ".autorun"
<< "autorun"
<< "autorun.sh";
QStringList::iterator it = autorun_list.begin();
QStringList::iterator end = autorun_list.end();
for(; it != end; ++it)
{
if(QFile::exists(path + "/" + *it))
{
return execAutorun(medium, path, *it);
}
}
// When a new medium is mounted the root directory of the medium should
// be checked for the following Autoopen files in order of precedence:
// .autoopen, autoopen
QStringList autoopen_list;
autoopen_list << ".autoopen"
<< "autoopen";
it = autoopen_list.begin();
end = autoopen_list.end();
for(; it != end; ++it)
{
if(QFile::exists(path + "/" + *it))
{
return execAutoopen(medium, path, *it);
}
}
return false;
}