mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-17 13:01:42 +00:00
parent
91221fd4ce
commit
1e474e9ebd
2 changed files with 31 additions and 0 deletions
|
@ -99,6 +99,8 @@ wchar_t* qToWide(const QString &str)
|
||||||
|
|
||||||
bool createLink(const QString &link, const QString &name, const QString &executable, const QString &arguments, const QString &icon, const QString &workingDir)
|
bool createLink(const QString &link, const QString &name, const QString &executable, const QString &arguments, const QString &icon, const QString &workingDir)
|
||||||
{
|
{
|
||||||
|
CCOMHelper comHelper;
|
||||||
|
|
||||||
IShellLinkW* psl;
|
IShellLinkW* psl;
|
||||||
|
|
||||||
// Get a pointer to the IShellLink interface. It is assumed that CoInitialize
|
// Get a pointer to the IShellLink interface. It is assumed that CoInitialize
|
||||||
|
@ -135,6 +137,8 @@ bool createLink(const QString &link, const QString &name, const QString &executa
|
||||||
|
|
||||||
bool resolveLink(const QWidget &window, const QString &linkFile, QString &path)
|
bool resolveLink(const QWidget &window, const QString &linkFile, QString &path)
|
||||||
{
|
{
|
||||||
|
CCOMHelper comHelper;
|
||||||
|
|
||||||
IShellLinkW* psl;
|
IShellLinkW* psl;
|
||||||
WIN32_FIND_DATAW wfd;
|
WIN32_FIND_DATAW wfd;
|
||||||
|
|
||||||
|
@ -239,3 +243,21 @@ bool resolveLink(const QWidget &window, const QString &pathLink, QString &pathOb
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
CCOMHelper::CCOMHelper()
|
||||||
|
{
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
// to fix the bug with QFileDialog::getExistingDirectory hanging under Windows
|
||||||
|
m_mustUninit = SUCCEEDED(CoInitialize(NULL));
|
||||||
|
#else
|
||||||
|
m_mustUninit = false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
CCOMHelper::~CCOMHelper()
|
||||||
|
{
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
// only call CoUninitialize if CoInitialize succeeded
|
||||||
|
if (m_mustUninit) CoUninitialize();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
|
@ -51,4 +51,13 @@ wchar_t* qToWide(const QString &str);
|
||||||
bool createLink(const QString &link, const QString &name, const QString &executable, const QString &arguments, const QString &icon, const QString &workingDir);
|
bool createLink(const QString &link, const QString &name, const QString &executable, const QString &arguments, const QString &icon, const QString &workingDir);
|
||||||
bool resolveLink(const QWidget &window, const QString &pathLink, QString &pathObj);
|
bool resolveLink(const QWidget &window, const QString &pathLink, QString &pathObj);
|
||||||
|
|
||||||
|
class CCOMHelper
|
||||||
|
{
|
||||||
|
bool m_mustUninit;
|
||||||
|
|
||||||
|
public:
|
||||||
|
CCOMHelper();
|
||||||
|
~CCOMHelper();
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue