summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2020-12-19 22:55:58 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2020-12-19 22:56:21 +0900
commitdf2eb7afd1783a8750b8034890ff7a9e6abb7388 (patch)
tree7d8f360841f6830f0265b94f37a876c7ec0576f9 /win
parent083dbd6407c433a7ff2b4880836d919a84b2cea9 (diff)
downloadtdelibs-df2eb7afd1783a8750b8034890ff7a9e6abb7388.tar.gz
tdelibs-df2eb7afd1783a8750b8034890ff7a9e6abb7388.zip
Fixed some uncrustify's code formatting offending files.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it> (cherry picked from commit 491e1c72c7e2a19b58772fd285284e974d489501)
Diffstat (limited to 'win')
-rw-r--r--win/win32_utils2.cpp114
1 files changed, 73 insertions, 41 deletions
diff --git a/win/win32_utils2.cpp b/win/win32_utils2.cpp
index 2e46d2acb..946d62e5a 100644
--- a/win/win32_utils2.cpp
+++ b/win/win32_utils2.cpp
@@ -26,51 +26,62 @@
#include <shellapi.h>
#include <tchar.h>
-KDEWIN32_EXPORT
-TQString getWin32RegistryValue(HKEY key, const TQString& subKey, const TQString& item, bool *ok)
-{
-#define FAILURE \
- { if (ok) \
- *ok = false; \
- return TQString::null; }
+#define FAILURE \
+ { \
+ if (ok) \
+ { \
+ *ok = false; \
+ } \
+ return TQString::null; \
+ }
+KDEWIN32_EXPORT
+TQString getWin32RegistryValue(HKEY key, const TQString &subKey, const TQString &item, bool *ok)
+{
if (!subKey)
+ {
FAILURE;
+ }
HKEY hKey;
TCHAR *lszValue;
- DWORD dwType=REG_SZ;
+ DWORD dwType = REG_SZ;
DWORD dwSize;
- if (ERROR_SUCCESS!=RegOpenKeyEx(key, subKey.ucs2(), NULL, KEY_READ, &hKey))
+ if (ERROR_SUCCESS != RegOpenKeyEx(key, subKey.ucs2(), NULL, KEY_READ, &hKey))
+ {
FAILURE;
+ }
- if (ERROR_SUCCESS!=RegQueryValueEx(hKey, item.ucs2(), NULL, NULL, NULL, &dwSize))
+ if (ERROR_SUCCESS != RegQueryValueEx(hKey, item.ucs2(), NULL, NULL, NULL, &dwSize))
+ {
FAILURE;
+ }
lszValue = new TCHAR[dwSize];
- if (ERROR_SUCCESS!=RegQueryValueEx(hKey, item.ucs2(), NULL, &dwType, (LPBYTE)lszValue, &dwSize)) {
- delete [] lszValue;
+ if (ERROR_SUCCESS != RegQueryValueEx(hKey, item.ucs2(), NULL, &dwType, (LPBYTE)lszValue, &dwSize))
+ {
+ delete[] lszValue;
FAILURE;
}
RegCloseKey(hKey);
TQString res = TQString::fromUcs2(lszValue);
- delete [] lszValue;
+ delete[] lszValue;
return res;
}
KDEWIN32_EXPORT
-bool showWin32FilePropertyDialog(const TQString& fileName)
+bool showWin32FilePropertyDialog(const TQString &fileName)
{
TQString path_ = TQDir::convertSeparators(TQFileInfo(fileName).absFilePath());
SHELLEXECUTEINFO execInfo;
- memset(&execInfo,0,sizeof(execInfo));
+ memset(&execInfo, 0, sizeof(execInfo));
execInfo.cbSize = sizeof(execInfo);
- execInfo.fMask = SEE_MASK_INVOKEIDLIST | SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_NO_UI;
+ execInfo.fMask = SEE_MASK_INVOKEIDLIST | SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_NO_UI;
const TQString verb("properties");
- execInfo.lpVerb = (TCHAR*)verb.ucs2();
- execInfo.lpFile = (TCHAR*)path_.ucs2();
+ execInfo.lpVerb = (TCHAR *)verb.ucs2();
+ execInfo.lpFile = (TCHAR *)path_.ucs2();
return ShellExecuteEx(&execInfo);
}
@@ -78,77 +89,98 @@ KDEWIN32_EXPORT
TQCString getWin32LocaleName()
{
bool ok;
- TQString localeNumber = getWin32RegistryValue(HKEY_CURRENT_USER, "Control Panel\\International",
- "Locale", &ok);
+ TQString localeNumber = getWin32RegistryValue(HKEY_CURRENT_USER, "Control Panel\\International",
+ "Locale", &ok);
if (!ok)
+ {
return TQCString();
- TQString localeName = getWin32RegistryValue(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Control\\Keyboard Layout\\DosKeybCodes",
- localeNumber, &ok);
+ }
+ TQString localeName = getWin32RegistryValue(HKEY_LOCAL_MACHINE,
+ "SYSTEM\\CurrentControlSet\\Control\\Keyboard Layout\\DosKeybCodes", localeNumber,
+ &ok);
if (!ok)
+ {
return TQCString();
+ }
return localeName.latin1();
}
KDEWIN32_EXPORT
-TQString convertKFileDialogFilterToQFileDialogFilter(const TQString& filter)
+TQString convertKFileDialogFilterToQFileDialogFilter(const TQString &filter)
{
TQString kde_filters = filter;
int pos;
// Strip the escape characters from
// escaped '/' characters.
- TQString copy (kde_filters);
+ TQString copy(kde_filters);
for (pos = 0; (pos = copy.find("\\/", pos)) != -1; ++pos)
+ {
copy.remove(pos, 1);
+ }
//<js>
//we need to convert KDE filter format to Qt format
//Qt format: "some text (*.first *.second)" or "All (*)"
//KDE format: "*.first *.second" or "*"
- TQStringList filters = TQStringList::split("\n",kde_filters);
+ TQStringList filters = TQStringList::split("\n", kde_filters);
TQString current;
TQString converted; //finally - converted filter
- for (TQStringList::ConstIterator it = filters.constBegin(); it!=filters.constEnd();++it) {
+ for (TQStringList::ConstIterator it = filters.constBegin(); it != filters.constEnd(); ++it)
+ {
current = *it;
- TQString new_f;//filter part
- TQString new_name;//filter name part
+ TQString new_f; //filter part
+ TQString new_name; //filter name part
int p = (*it).find('|');
- if (p!=-1) {
- new_f = current.left(p);
- new_name = current.mid(p+1);
+ if (p != -1)
+ {
+ new_f = current.left(p);
+ new_name = current.mid(p + 1);
}
- else {
- new_f = current;
+ else
+ {
+ new_f = current;
new_name = current; //nothing better
}
//remove (.....) from name
- p=new_name.find('(');
+ p = new_name.find('(');
int p2 = new_name.findRev(')');
TQString new_name1, new_name2;
- if (p!=-1)
+ if (p != -1)
+ {
new_name1 = new_name.left(p);
- if (p2!=-1)
- new_name2 = new_name.mid(p2+1);
+ }
+ if (p2 != -1)
+ {
+ new_name2 = new_name.mid(p2 + 1);
+ }
if (!new_name1.isEmpty() || !new_name2.isEmpty())
+ {
new_name = new_name1.stripWhiteSpace() + " " + new_name2.stripWhiteSpace();
- new_name.replace('(',"");
- new_name.replace(')',"");
+ }
+ new_name.replace('(', "");
+ new_name.replace(')', "");
new_name = new_name.stripWhiteSpace();
// make filters unique: remove uppercase extensions (case doesn't matter on win32, BTW)
TQStringList allfiltersUnique;
- TQStringList origList( TQStringList::split(" ", new_f) );
+ TQStringList origList(TQStringList::split(" ", new_f));
for (TQStringList::ConstIterator it = origList.constBegin();
- it!=origList.constEnd(); ++it)
+ it != origList.constEnd(); ++it)
{
if ((*it) == (*it).lower())
+ {
allfiltersUnique += *it;
+ }
}
if (!converted.isEmpty())
+ {
converted += ";;";
+ }
converted += (new_name + " (" + allfiltersUnique.join(" ") + ")");
}
return converted;
}
+