LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1051|回复: 4

请帮忙看下这段代码

[复制链接]
发表于 2006-9-28 08:59:01 | 显示全部楼层 |阅读模式
KPropertiesDialog* KonqPopupMenu::showPropertiesDialog()
{
    // It may be that the kfileitem was created by hand
    // (see KonqKfmIconView::slotMouseButtonPressed)
    // In that case, we can get more precise info in the properties
    // (like permissions) if we stat the URL.
    if ( m_lstItems.count() == 1 )
    {
        KFileItem * item = m_lstItems.first();
        if (item->entry().count() == 0) // this item wasn't listed by a slave
        {
            // KPropertiesDialog will use stat to get more info on the file
            return new KPropertiesDialog( item->url(), d->m_parentWidget );
        }
    }
    return new KPropertiesDialog( m_lstItems, d->m_parentWidget );
这段代码是fc5kdebase里的,功能就右键菜单的“属性”,现在我想改下,就是把我指定的桌面.desktop文件的“属性”功能改成其他的,
KPropertiesDialog* KonqPopupMenu::showPropertiesDialog()

        if (        )
   {
     system ("/usr/bin/sysinfo");
   }
   else eturn new KPropertiesDialog( m_lstItems, d->m_parentWidget );

我想在if中判断是否是我指定的.desktop文件,但是不知道怎么判断,请大家帮帮我,谢谢
发表于 2006-9-30 10:11:40 | 显示全部楼层
if(item->url().path() == "/root/Desktop/a.desktop")
{}
回复 支持 反对

使用道具 举报

发表于 2006-9-30 17:02:52 | 显示全部楼层
字符串比较应该用 strcmp, 不要直接比较指针

  1. if (strcmp(item->url().path(), "/root/Desktop/a.desktop") == 0) {
  2. }
复制代码
回复 支持 反对

使用道具 举报

发表于 2006-10-3 19:00:57 | 显示全部楼层
QString是可以直接比较的,它是QT库的一个类。:)
回复 支持 反对

使用道具 举报

发表于 2006-10-3 20:49:38 | 显示全部楼层
不好意思, 只看了你那一句代码, 没注意到是 C++
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表