comparison kdiff3/src-QT4/kreplacements/ShellContextMenu.cpp @ 77:1184fc843210

KDiff3-0.9.92
author joachim99
date Mon, 16 Apr 2007 21:26:08 +0000
parents 08ea9b86c12c
children 0180c7f92563
comparison
equal deleted inserted replaced
76:257ccb866dc3 77:1184fc843210
1 /***************************************************************************
2 ShellContextMenu.cpp - description
3 -------------------
4 begin : Sat Mar 4 2006
5 copyright : (C) 2005-2007 by Joachim Eibl
6 email : joachim dot eibl at gmx dot de
7 ***************************************************************************/
8
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
1 // ShellContextMenu.cpp: Implementierung der Klasse CShellContextMenu. 17 // ShellContextMenu.cpp: Implementierung der Klasse CShellContextMenu.
2 // 18 //
3 ////////////////////////////////////////////////////////////////////// 19 //////////////////////////////////////////////////////////////////////
4 #ifdef _WIN32 20 #ifdef _WIN32
5 #include <windows.h> 21 #include <windows.h>
27 43
28 44
29 void showShellContextMenu( const QString& itemPath, QPoint pt, QWidget* pParentWidget, QMenu* pMenu ) 45 void showShellContextMenu( const QString& itemPath, QPoint pt, QWidget* pParentWidget, QMenu* pMenu )
30 { 46 {
31 CShellContextMenu scm; 47 CShellContextMenu scm;
32 scm.SetObjects(QDir::convertSeparators(itemPath)); 48 scm.SetObjects(QDir::toNativeSeparators(QDir::cleanPath(itemPath)));
33 int id = scm.ShowContextMenu (pParentWidget, pt, pMenu); 49 int id = scm.ShowContextMenu (pParentWidget, pt, pMenu);
34 if (id>=1) 50 if (id>=1)
35 pMenu->actions().value(id-1)->trigger(); 51 pMenu->actions().value(id-1)->trigger();
36 } 52 }
37 53
64 // and returns that interface 80 // and returns that interface
65 BOOL CShellContextMenu::GetContextMenu (void ** ppContextMenu, int & iMenuType) 81 BOOL CShellContextMenu::GetContextMenu (void ** ppContextMenu, int & iMenuType)
66 { 82 {
67 *ppContextMenu = NULL; 83 *ppContextMenu = NULL;
68 LPCONTEXTMENU icm1 = NULL; 84 LPCONTEXTMENU icm1 = NULL;
85
86 if ( m_psfFolder==0 )
87 return FALSE;
69 88
70 // first we retrieve the normal IContextMenu interface (every object should have it) 89 // first we retrieve the normal IContextMenu interface (every object should have it)
71 m_psfFolder->GetUIObjectOf (NULL, nItems, (LPCITEMIDLIST *) m_pidlArray, IID_IContextMenu, NULL, (void**) &icm1); 90 m_psfFolder->GetUIObjectOf (NULL, nItems, (LPCITEMIDLIST *) m_pidlArray, IID_IContextMenu, NULL, (void**) &icm1);
72 91
73 if (icm1) 92 if (icm1)