44 #include <private/qsystemlibrary_p.h> 53 #if !defined(Q_OS_WINCE) 54 # include <intshcut.h> 60 #define CSIDL_MYMUSIC 13 61 #define CSIDL_MYVIDEO 14 64 #ifndef QT_NO_DESKTOPSERVICES 76 return (returnValue > 32);
81 #if defined(Q_OS_WINCE) 84 wchar_t buffer[MAX_PATH];
85 if (ExpandEnvironmentStrings((
wchar_t*)command.
utf16(), buffer, MAX_PATH))
97 DWORD bufferSize =
sizeof(wchar_t) * MAX_PATH;
98 long returnValue = -1;
103 wchar_t keyValue[MAX_PATH] = {0};
107 res = RegOpenKeyEx(HKEY_CURRENT_USER,
108 L
"Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\mailto\\UserChoice",
109 0, KEY_READ, &handle);
110 if (res == ERROR_SUCCESS) {
111 returnValue = RegQueryValueEx(handle, L
"Progid", 0, 0, reinterpret_cast<unsigned char*>(keyValue), &bufferSize);
117 res = RegOpenKeyExW(HKEY_CLASSES_ROOT, (
const wchar_t*)keyName.
utf16(), 0, KEY_READ, &handle);
118 if (res != ERROR_SUCCESS)
121 bufferSize =
sizeof(wchar_t) * MAX_PATH;
122 returnValue = RegQueryValueEx(handle, L
"", 0, 0, reinterpret_cast<unsigned char*>(keyValue), &bufferSize);
145 PROCESS_INFORMATION pi;
146 ZeroMemory(&pi,
sizeof(pi));
148 ZeroMemory(&si,
sizeof(si));
151 returnValue = CreateProcess(NULL, (
wchar_t*)command.
utf16(), NULL, NULL,
FALSE, 0, NULL, NULL, &si, &pi);
156 CloseHandle(pi.hProcess);
157 CloseHandle(pi.hThread);
168 0, 0, SW_SHOWNORMAL);
169 return (returnValue > 32);
181 typedef BOOL (WINAPI*GetSpecialFolderPath)(HWND, LPWSTR, int, BOOL);
182 static GetSpecialFolderPath SHGetSpecialFolderPath =
183 (GetSpecialFolderPath)library.
resolve(
"SHGetSpecialFolderPathW");
184 if (!SHGetSpecialFolderPath)
187 wchar_t path[MAX_PATH];
191 #if defined Q_WS_WINCE 194 if (SHGetSpecialFolderPath(0, path, CSIDL_LOCAL_APPDATA,
FALSE))
204 if (SHGetSpecialFolderPath(0, path, CSIDL_DESKTOPDIRECTORY,
FALSE))
209 if (SHGetSpecialFolderPath(0, path, CSIDL_PERSONAL,
FALSE))
214 if (SHGetSpecialFolderPath(0, path, CSIDL_FONTS,
FALSE))
219 if (SHGetSpecialFolderPath(0, path, CSIDL_PROGRAMS,
FALSE))
234 if (SHGetSpecialFolderPath(0, path, CSIDL_MYPICTURES,
FALSE))
264 #endif // QT_NO_DESKTOPSERVICES static QString fromWCharArray(const wchar_t *, int size=-1)
Returns a copy of the string, where the encoding of string depends on the size of wchar...
#define ShellExecute(a, b, c, d, e, f)
static QString keyName(const QString &rKey)
bool isValid() const
Returns true if the URL is valid; otherwise returns false.
QIntegerForSizeof< void * >::Unsigned quintptr
#define QT_END_NAMESPACE
This macro expands to.
QString toString(FormattingOptions options=None) const
Returns the human-displayable string representation of the URL.
static QString storageLocation(StandardLocation type)
Returns the default system directory where files of type belong, or an empty string if the location c...
static QString displayName(StandardLocation type)
Returns a localized display name for the given location type or an empty QString if no relevant locat...
QString & replace(int i, int len, QChar after)
StandardLocation
This enum describes the different locations that can be queried by QDesktopServices::storageLocation ...
static bool openDocument(const QUrl &file)
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QUrl class provides a convenient interface for working with URLs.
The QString class provides a Unicode character string.
The QChar class provides a 16-bit Unicode character.
static QString fromRawData(const QChar *, int size)
Constructs a QString that uses the first size Unicode characters in the array unicode.
static bool launchWebBrowser(const QUrl &url)
#define QT_BEGIN_NAMESPACE
This macro expands to.
static bool isEmpty(const char *str)
QString trimmed() const Q_REQUIRED_RESULT
Returns a string that has whitespace removed from the start and the end.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
static QString fromUtf8(const char *, int size=-1)
Returns a QString initialized with the first size bytes of the UTF-8 string str.
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
#define FALSE
Synonym for false.
QString toLocalFile() const
Returns the path of this URL formatted as a local file path.
static QString tempPath()
Returns the absolute path of the system's temporary directory.
QByteArray toEncoded(FormattingOptions options=None) const
Returns the encoded representation of the URL if it's valid; otherwise an empty QByteArray is returne...
const char * constData() const
Returns a pointer to the data stored in the byte array.
QString scheme() const
Returns the scheme of the URL.
void * resolve(const char *symbol)
int lastIndexOf(QChar c, int from=-1, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
static QString organizationName()
static QString applicationName()
static QString expandEnvStrings(const QString &command)
QString & insert(int i, QChar c)
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
static QString fromUtf16(const ushort *, int size=-1)
Returns a QString initialized with the first size characters of the Unicode string unicode (ISO-10646...
const ushort * utf16() const
Returns the QString as a '\0\'-terminated array of unsigned shorts.
static QString homePath()
Returns the absolute path of the user's home directory.