本文整理汇总了C++中KFileItem::run方法的典型用法代码示例。如果您正苦于以下问题:C++ KFileItem::run方法的具体用法?C++ KFileItem::run怎么用?C++ KFileItem::run使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KFileItem
的用法示例。
在下文中一共展示了KFileItem::run方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateURL
void DolphinView::updateURL()
{
KFileView* fileView = (m_iconsView != 0) ? static_cast<KFileView*>(m_iconsView) :
static_cast<KFileView*>(m_detailsView);
KFileItem* fileItem = fileView->currentFileItem();
if (fileItem == 0) {
return;
}
if (fileItem->isDir()) {
// Prefer the local path over the URL. This assures that the
// volume space information is correct. Assuming that the URL is media:/sda1,
// and the local path is /windows/C: For the URL the space info is related
// to the root partition (and hence wrong) and for the local path the space
// info is related to the windows partition (-> correct).
const QString localPath(fileItem->localPath());
if (localPath.isEmpty()) {
setURL(fileItem->url());
}
else {
setURL(KURL(localPath));
}
}
else if (fileItem->isFile()) {
// allow to browse through ZIP and tar files
KMimeType::Ptr mime = fileItem->mimeTypePtr();
if (mime->is("application/x-zip")) {
KURL url = fileItem->url();
url.setProtocol("zip");
setURL(url);
}
else if (mime->is("application/x-tar") ||
mime->is("application/x-tarz") ||
mime->is("application/x-tbz") ||
mime->is("application/x-tgz") ||
mime->is("application/x-tzo")) {
KURL url = fileItem->url();
url.setProtocol("tar");
setURL(url);
}
else {
fileItem->run();
}
}
else {
fileItem->run();
}
}
示例2: mouseDoubleClickEvent
void IconView::mouseDoubleClickEvent( QMouseEvent* event )
{
if ( event->button() == Qt::LeftButton ) {
const QModelIndex index = indexAt( event->pos() );
if ( !index.isValid() )
return;
const KFileItem item = m_model->itemForIndex( m_proxyModel->mapToSource( index ) );
item.run();
m_selectionModel->clearSelection();
}
}
示例3: slotItemTriggered
void DolphinViewContainer::slotItemTriggered(const KFileItem& item)
{
KUrl url = item.targetUrl();
if (item.isDir()) {
m_view->setUrl(url);
return;
}
const GeneralSettings* settings = DolphinSettings::instance().generalSettings();
const bool browseThroughArchives = settings->browseThroughArchives();
if (browseThroughArchives && item.isFile() && url.isLocalFile()) {
// Generic mechanism for redirecting to tar:/<path>/ when clicking on a tar file,
// zip:/<path>/ when clicking on a zip file, etc.
// The .protocol file specifies the mimetype that the kioslave handles.
// Note that we don't use mimetype inheritance since we don't want to
// open OpenDocument files as zip folders...
const QString protocol = KProtocolManager::protocolForArchiveMimetype(item.mimetype());
if (!protocol.isEmpty()) {
url.setProtocol(protocol);
m_view->setUrl(url);
return;
}
}
if (item.mimetype() == "application/x-desktop") {
// redirect to the url in Type=Link desktop files
KDesktopFile desktopFile(url.toLocalFile());
if (desktopFile.hasLinkType()) {
url = desktopFile.readUrl();
m_view->setUrl(url);
return;
}
}
item.run();
}
示例4: slotOpen
void MenuMedia::slotOpen(KFileItem &fileItem)
{
fileItem.run();
}
示例5: Value
KJS::Value KJSEmbed::Bindings::KFileItemImp::call( KJS::ExecState * exec, KJS::Object & self, const KJS::List & args )
{
kdDebug() << "KFileItemImp::call() " << mid << endl;
JSOpaqueProxy *op = JSProxy::toOpaqueProxy( self.imp() );
if ( !op ) {
kdWarning() << "KFileItemImp::call() failed, not a JSOpaqueProxy" << endl;
return KJS::Value();
}
if ( op->typeName() != "KFileItem" ) {
kdWarning() << "KFileItemImp::call() failed, type is " << op->typeName() << endl;
return KJS::Value();
}
KFileItem *obj = op->toNative<KFileItem >();
KJS::Value retValue = KJS::Value();
switch ( mid ) {
case Methodrefresh:
obj->refresh();
break;
case MethodrefreshMimeType:
obj->refreshMimeType();
break;
case Methodurl:
{
QString url = obj->url().url();
retValue = KJS::String(url);
break;
}
case MethodsetUrl:
{
QString url = extractQString(exec, args, 0);
obj->setURL(url);
break;
}
case MethodsetName:
case MethodpermissionsString:
case Methoduser:
case Methodgroup:
case MethodisLink:
case MethodisDir:
case MethodisFile:
case MethodisReadable:
case MethodlinkDest:
case MethodtimeString:
case MethodisLocalFile:
case Methodtext:
{
retValue = convertToValue(exec, obj->text() );
break;
}
case Methodname:
case MethodmimeType:
case MethodisMimeTypeKnown:
case MethodmimeComment:
case MethodiconName:
{
retValue = convertToValue( exec, obj->iconName() );
break;
}
case Methodpixmap:
{
int size = extractInt(exec, args, 0);
int state = extractInt(exec, args, 1);
retValue = convertToValue(exec, obj->pixmap(size, state));
break;
}
case Methodoverlays:
{
retValue = convertToValue(exec, obj->overlays());
break;
}
case MethodgetStatusBarInfo:
{
retValue = KJS::String( obj->getStatusBarInfo() );
break;
}
case MethodgetToolTipText:
{
int maxcount = extractInt(exec, args, 0);
retValue = KJS::String(obj->getToolTipText(maxcount));
break;
}
case Methodrun:
obj->run();
break;
default:
kdWarning() << "KFileItemImp has no method " << mid << endl;
break;
}
op->setValue((void*) obj, "KFileItem");
return retValue;
}