summaryrefslogtreecommitdiffstats
path: root/src/qt3support
diff options
context:
space:
mode:
Diffstat (limited to 'src/qt3support')
-rw-r--r--src/qt3support/canvas/q3canvas.cpp2
-rw-r--r--src/qt3support/dialogs/q3filedialog.cpp220
-rw-r--r--src/qt3support/dialogs/q3filedialog_mac.cpp2
-rw-r--r--src/qt3support/dialogs/q3filedialog_win.cpp432
-rw-r--r--src/qt3support/dialogs/q3tabdialog.cpp13
-rw-r--r--src/qt3support/dialogs/q3tabdialog.h1
-rw-r--r--src/qt3support/itemviews/q3iconview.cpp6
-rw-r--r--src/qt3support/itemviews/q3table.cpp2
-rw-r--r--src/qt3support/network/q3dns.cpp84
-rw-r--r--src/qt3support/network/q3ftp.cpp22
-rw-r--r--src/qt3support/network/q3http.cpp12
-rw-r--r--src/qt3support/network/q3socketdevice_win.cpp7
-rw-r--r--src/qt3support/network/q3url.cpp61
-rw-r--r--src/qt3support/network/q3urloperator.cpp2
-rw-r--r--src/qt3support/other/q3dragobject.cpp18
-rw-r--r--src/qt3support/other/q3process.cpp2
-rw-r--r--src/qt3support/other/q3process_unix.cpp2
-rw-r--r--src/qt3support/other/q3process_win.cpp158
-rw-r--r--src/qt3support/painting/q3paintengine_svg.cpp48
-rw-r--r--src/qt3support/sql/q3datatable.cpp2
-rw-r--r--src/qt3support/sql/q3sqlcursor.cpp2
-rw-r--r--src/qt3support/text/q3richtext.cpp28
-rw-r--r--src/qt3support/text/q3textedit.cpp4
-rw-r--r--src/qt3support/tools/q3cstring.cpp32
-rw-r--r--src/qt3support/widgets/q3action.cpp2
-rw-r--r--src/qt3support/widgets/q3datetimeedit.cpp75
-rw-r--r--src/qt3support/widgets/q3dockarea.cpp29
-rw-r--r--src/qt3support/widgets/q3mainwindow.cpp18
-rw-r--r--src/qt3support/widgets/q3scrollview.cpp4
-rw-r--r--src/qt3support/widgets/q3titlebar.cpp33
30 files changed, 421 insertions, 902 deletions
diff --git a/src/qt3support/canvas/q3canvas.cpp b/src/qt3support/canvas/q3canvas.cpp
index 034aff5..948935c 100644
--- a/src/qt3support/canvas/q3canvas.cpp
+++ b/src/qt3support/canvas/q3canvas.cpp
@@ -4828,7 +4828,7 @@ void Q3CanvasText::draw(QPainter& painter)
}
/*!
- \reimp
+ \internal
*/
void Q3CanvasText::changeChunks()
{
diff --git a/src/qt3support/dialogs/q3filedialog.cpp b/src/qt3support/dialogs/q3filedialog.cpp
index 3127790..a285fd8 100644
--- a/src/qt3support/dialogs/q3filedialog.cpp
+++ b/src/qt3support/dialogs/q3filedialog.cpp
@@ -507,45 +507,7 @@ static void updateLastSize(Q3FileDialog *that)
lastHeight = that->height() - extHeight;
}
-// Don't remove the lines below!
-//
-// resolving the W methods manually is needed, because Windows 95 doesn't include
-// these methods in Shell32.lib (not even stubs!), so you'd get an unresolved symbol
-// when Qt calls getEsistingDirectory(), etc.
#if defined(Q_WS_WIN)
-
-typedef UINT (WINAPI *PtrExtractIconEx)(LPCTSTR,int,HICON*,HICON*,UINT);
-static PtrExtractIconEx ptrExtractIconEx = 0;
-
-static void resolveLibs()
-{
-#ifndef Q_OS_WINCE
- static bool triedResolve = false;
-
- if (!triedResolve) {
-#ifndef QT_NO_THREAD
- // protect initialization
- QMutexLocker locker(QMutexPool::globalInstanceGet(&triedResolve));
- // check triedResolve again, since another thread may have already
- // done the initialization
- if (triedResolve) {
- // another thread did initialize the security function pointers,
- // so we shouldn't do it again.
- return;
- }
-#endif
- triedResolve = true;
- if (qt_winUnicode()) {
- QLibrary lib(QLatin1String("shell32"));
- ptrExtractIconEx = (PtrExtractIconEx) lib.resolve("ExtractIconExW");
- }
- }
-#endif
-}
-#ifdef Q_OS_WINCE
-#define PtrExtractIconEx ExtractIconEx
-#endif
-
class QWindowsIconProvider : public Q3FileIconProvider
{
public:
@@ -2566,11 +2528,7 @@ void Q3FileDialog::init()
d->modeButtons->insert(d->previewInfo);
d->previewContents = new QToolButton(this, "preview info view");
-#if defined(Q_WS_WIN) && !defined(Q_OS_WINCE)
- if ((qWinVersion() & Qt::WV_NT_based) > Qt::WV_NT)
-#else
if (!qstrcmp(style()->className(), "QWindowsStyle"))
-#endif
{
d->goBack->setAutoRaise(true);
d->cdToParent->setAutoRaise(true);
@@ -3879,7 +3837,7 @@ void Q3FileDialog::detailViewSelectionChanged()
d->moreFiles->setSelected(f->i, i->isSelected());
}
if (i->isSelected() && !((Q3FileDialogPrivate::File *)i)->info.isDir())
- str += QString(QLatin1String("\"%1\" ")).arg(i->text(0));
+ str += QString::fromLatin1("\"%1\" ").arg(i->text(0));
i = i->nextSibling();
}
d->moreFiles->blockSignals(false);
@@ -3931,7 +3889,7 @@ void Q3FileDialog::listBoxSelectionChanged()
}
if (d->moreFiles->isSelected(i)
&& !((Q3FileDialogPrivate::File*)(mcitem)->i)->info.isDir()) {
- str += QString(QLatin1String("\"%1\" ")).arg(i->text());
+ str += QString::fromLatin1("\"%1\" ").arg(i->text());
if (j == 0)
j = i;
}
@@ -4611,11 +4569,11 @@ void Q3FileDialog::setPreviewMode(PreviewMode m)
}
Q3FileDialog::PreviewMode Q3FileDialog::previewMode() const
{
- if (d->infoPreview && d->infoPreviewWidget->isVisible())
+ if (d->infoPreview && d->infoPreviewWidget->isVisibleTo(const_cast<Q3FileDialog *>(this)))
return Info;
- else if (d->contentsPreview && d->contentsPreviewWidget->isVisible())
+ else if (d->contentsPreview
+ && d->contentsPreviewWidget->isVisibleTo(const_cast<Q3FileDialog *>(this)))
return Contents;
-
return NoPreview;
}
@@ -4878,33 +4836,20 @@ Q3FileIconProvider * Q3FileDialog::iconProvider()
static QString getWindowsRegString(HKEY key, const QString &subKey)
{
QString s;
- QT_WA({
- char buf[1024];
- DWORD bsz = sizeof(buf);
- int r = RegQueryValueEx(key, (TCHAR*)subKey.ucs2(), 0, 0, (LPBYTE)buf, &bsz);
- if (r == ERROR_SUCCESS) {
- s = QString::fromUcs2((unsigned short *)buf);
- } else if (r == ERROR_MORE_DATA) {
- char *ptr = new char[bsz+1];
- r = RegQueryValueEx(key, (TCHAR*)subKey.ucs2(), 0, 0, (LPBYTE)ptr, &bsz);
- if (r == ERROR_SUCCESS)
- s = QLatin1String(ptr);
- delete [] ptr;
- }
- } , {
- char buf[512];
- DWORD bsz = sizeof(buf);
- int r = RegQueryValueExA(key, subKey.local8Bit(), 0, 0, (LPBYTE)buf, &bsz);
- if (r == ERROR_SUCCESS) {
- s = QLatin1String(buf);
- } else if (r == ERROR_MORE_DATA) {
- char *ptr = new char[bsz+1];
- r = RegQueryValueExA(key, subKey.local8Bit(), 0, 0, (LPBYTE)ptr, &bsz);
- if (r == ERROR_SUCCESS)
- s = QLatin1String(ptr);
- delete [] ptr;
- }
- });
+
+ wchar_t buf[1024];
+ DWORD bsz = sizeof(buf) / sizeof(wchar_t);
+ int r = RegQueryValueEx(key, (wchar_t*)subKey.utf16(), 0, 0, (LPBYTE)buf, &bsz);
+ if (r == ERROR_SUCCESS) {
+ s = QString::fromWCharArray(buf);
+ } else if (r == ERROR_MORE_DATA) {
+ char *ptr = new char[bsz+1];
+ r = RegQueryValueEx(key, (wchar_t*)subKey.utf16(), 0, 0, (LPBYTE)ptr, &bsz);
+ if (r == ERROR_SUCCESS)
+ s = QLatin1String(ptr);
+ delete [] ptr;
+ }
+
return s;
}
@@ -4925,22 +4870,13 @@ QWindowsIconProvider::QWindowsIconProvider(QObject *parent, const char *name)
HKEY k;
HICON si;
- int r;
QString s;
UINT res = 0;
// ---------- get default folder pixmap
const wchar_t iconFolder[] = L"folder\\DefaultIcon"; // workaround for Borland
- QT_WA({
- r = RegOpenKeyEx(HKEY_CLASSES_ROOT,
- iconFolder,
- 0, KEY_READ, &k);
- } , {
- r = RegOpenKeyExA(HKEY_CLASSES_ROOT,
- "folder\\DefaultIcon",
- 0, KEY_READ, &k);
- });
- resolveLibs();
+ int r = RegOpenKeyEx(HKEY_CLASSES_ROOT, iconFolder, 0, KEY_READ, &k);
+
if (r == ERROR_SUCCESS) {
s = getWindowsRegString(k, QString());
RegCloseKey(k);
@@ -4948,21 +4884,7 @@ QWindowsIconProvider::QWindowsIconProvider(QObject *parent, const char *name)
QStringList lst = QStringList::split(QLatin1String(","), s);
if (lst.count() >= 2) { // don't just assume that lst has two entries
-#ifndef Q_OS_WINCE
- QT_WA({
- res = ptrExtractIconEx((TCHAR*)lst[0].simplifyWhiteSpace().ucs2(),
- lst[1].simplifyWhiteSpace().toInt(),
- 0, &si, 1);
- } , {
- res = ExtractIconExA(lst[0].simplifyWhiteSpace().local8Bit(),
- lst[1].simplifyWhiteSpace().toInt(),
- 0, &si, 1);
- });
-#else
- res = (UINT)ExtractIconEx((TCHAR*)lst[0].simplifyWhiteSpace().ucs2(),
- lst[1].simplifyWhiteSpace().toInt(),
- 0, &si, 1);
-#endif
+ res = ExtractIconEx((wchar_t*)lst[0].simplifyWhiteSpace().utf16(), lst[1].simplifyWhiteSpace().toInt(), 0, &si, 1);
}
if (res) {
@@ -4978,18 +4900,7 @@ QWindowsIconProvider::QWindowsIconProvider(QObject *parent, const char *name)
}
//------------------------------- get default file pixmap
-#ifndef Q_OS_WINCE
- QT_WA({
- res = ptrExtractIconEx(L"shell32.dll",
- 0, 0, &si, 1);
- } , {
- res = ExtractIconExA("shell32.dll",
- 0, 0, &si, 1);
- });
-#else
- res = (UINT)ExtractIconEx(L"shell32.dll",
- 0, 0, &si, 1);
-#endif
+ res = ExtractIconEx(L"shell32.dll", 0, 0, &si, 1);
if (res) {
defaultFile = fromHICON(si);
@@ -5002,16 +4913,9 @@ QWindowsIconProvider::QWindowsIconProvider(QObject *parent, const char *name)
//------------------------------- get default exe pixmap
#ifndef Q_OS_WINCE
- QT_WA({
- res = ptrExtractIconEx(L"shell32.dll",
- 2, 0, &si, 1);
- } , {
- res = ExtractIconExA("shell32.dll",
- 2, 0, &si, 1);
- });
+ res = ExtractIconEx(L"shell32.dll", 2, 0, &si, 1);
#else
- res = (UINT)ExtractIconEx(L"ceshell.dll",
- 10, 0, &si, 1);
+ res = ExtractIconEx(L"ceshell.dll", 10, 0, &si, 1);
#endif
if (res) {
@@ -5050,14 +4954,7 @@ const QPixmap * QWindowsIconProvider::pixmap(const QFileInfo &fi)
return &(*it);
HKEY k, k2;
- int r;
- QT_WA({
- r = RegOpenKeyEx(HKEY_CLASSES_ROOT, (TCHAR*)ext.ucs2(),
- 0, KEY_READ, &k);
- } , {
- r = RegOpenKeyExA(HKEY_CLASSES_ROOT, ext.local8Bit(),
- 0, KEY_READ, &k);
- });
+ int r = RegOpenKeyEx(HKEY_CLASSES_ROOT, (wchar_t*)ext.utf16(), 0, KEY_READ, &k);
QString s;
if (r == ERROR_SUCCESS) {
s = getWindowsRegString(k, QString());
@@ -5068,13 +4965,8 @@ const QPixmap * QWindowsIconProvider::pixmap(const QFileInfo &fi)
}
RegCloseKey(k);
- QT_WA({
- r = RegOpenKeyEx(HKEY_CLASSES_ROOT, (TCHAR*)QString(s + QLatin1String("\\DefaultIcon")).ucs2(),
- 0, KEY_READ, &k2);
- } , {
- r = RegOpenKeyExA(HKEY_CLASSES_ROOT, QString(s + QLatin1String("\\DefaultIcon")).local8Bit() ,
- 0, KEY_READ, &k2);
- });
+ r = RegOpenKeyEx(HKEY_CLASSES_ROOT, (wchar_t*)QString(s + QLatin1String("\\DefaultIcon")).utf16(),
+ 0, KEY_READ, &k2);
if (r == ERROR_SUCCESS) {
s = getWindowsRegString(k2, QString());
} else {
@@ -5104,19 +4996,7 @@ const QPixmap * QWindowsIconProvider::pixmap(const QFileInfo &fi)
if (filepath[0] == QLatin1Char('"') && filepath[(int)filepath.length()-1] == QLatin1Char('"'))
filepath = filepath.mid(1, filepath.length()-2);
- resolveLibs();
-#ifndef Q_OS_WINCE
- QT_WA({
- res = ptrExtractIconEx((TCHAR*)filepath.ucs2(), lst[1].stripWhiteSpace().toInt(),
- 0, &si, 1);
- } , {
- res = ExtractIconExA(filepath.local8Bit(), lst[1].stripWhiteSpace().toInt(),
- 0, &si, 1);
- });
-#else
- res = (UINT)ExtractIconEx((TCHAR*)filepath.ucs2(), lst[1].stripWhiteSpace().toInt(),
- 0, &si, 1);
-#endif
+ res = ExtractIconEx((wchar_t*)filepath.utf16(), lst[1].stripWhiteSpace().toInt(), 0, &si, 1);
}
}
if (res) {
@@ -5133,32 +5013,9 @@ const QPixmap * QWindowsIconProvider::pixmap(const QFileInfo &fi)
HICON si;
UINT res = 0;
if (!fi.absFilePath().isEmpty()) {
-#ifndef Q_OS_WINCE
- QT_WA({
- res = ptrExtractIconEx((TCHAR*)fi.absFilePath().ucs2(), -1,
- 0, 0, 1);
- } , {
- res = ExtractIconExA(fi.absFilePath().local8Bit(), -1,
- 0, 0, 1);
- });
-
- if (res) {
- QT_WA({
- res = ptrExtractIconEx((TCHAR*)fi.absFilePath().ucs2(), res - 1,
- 0, &si, 1);
- } , {
- res = ExtractIconExA(fi.absFilePath().local8Bit(), res - 1,
- 0, &si, 1);
- });
- }
-#else
- res = (UINT)ExtractIconEx((TCHAR*)fi.absFilePath().ucs2(), -1,
- 0, 0, 1);
- if (res)
- res = (UINT)ExtractIconEx((TCHAR*)fi.absFilePath().ucs2(), res - 1,
- 0, &si, 1);
-#endif
-
+ res = ExtractIconEx((wchar_t*)fi.absFilePath().utf16(), -1, 0, 0, 1);
+ if (res)
+ res = ExtractIconEx((wchar_t*)fi.absFilePath().utf16(), res - 1, 0, &si, 1);
}
if (res) {
@@ -5757,16 +5614,11 @@ void Q3FileDialog::insertEntry(const Q3ValueList<QUrlInfo> &lst, Q3NetworkOperat
if (!bShowHiddenFiles && inf.name() != QLatin1String("..")) {
if (d->url.isLocalFile()) {
QString file = d->url.path();
- if (!file.endsWith(QLatin1String("/")))
- file.append(QLatin1String("/"));
+ if (!file.endsWith(QLatin1Char('/')))
+ file.append(QLatin1Char('/'));
file += inf.name();
- QT_WA({
- if (GetFileAttributesW((TCHAR*)file.ucs2()) & FILE_ATTRIBUTE_HIDDEN)
- continue;
- } , {
- if (GetFileAttributesA(file.local8Bit()) & FILE_ATTRIBUTE_HIDDEN)
- continue;
- });
+ if (GetFileAttributes((wchar_t*)file.utf16()) & FILE_ATTRIBUTE_HIDDEN)
+ continue;
} else {
if (inf.name() != QLatin1String("..") && inf.name()[0] == QLatin1Char('.'))
continue;
diff --git a/src/qt3support/dialogs/q3filedialog_mac.cpp b/src/qt3support/dialogs/q3filedialog_mac.cpp
index 6c87eb0..d6411c7 100644
--- a/src/qt3support/dialogs/q3filedialog_mac.cpp
+++ b/src/qt3support/dialogs/q3filedialog_mac.cpp
@@ -554,7 +554,7 @@ QString Q3FileDialog::macGetSaveFileName(const QString &start, const QString &fi
retstr = QString::fromUtf8((const char *)str_buffer);
//now filename
CFStringGetCString(ret.saveFileName, (char *)str_buffer, 1024, kCFStringEncodingUTF8);
- retstr += QLatin1String("/") + QString::fromUtf8((const char *)str_buffer);
+ retstr += QLatin1Char('/') + QString::fromUtf8((const char *)str_buffer);
}
NavDisposeReply(&ret);
if(selectedFilter)
diff --git a/src/qt3support/dialogs/q3filedialog_win.cpp b/src/qt3support/dialogs/q3filedialog_win.cpp
index cecec18..487097a 100644
--- a/src/qt3support/dialogs/q3filedialog_win.cpp
+++ b/src/qt3support/dialogs/q3filedialog_win.cpp
@@ -64,49 +64,6 @@
QT_BEGIN_NAMESPACE
-// Don't remove the lines below!
-//
-// resolving the W methods manually is needed, because Windows 95 doesn't include
-// these methods in Shell32.lib (not even stubs!), so you'd get an unresolved symbol
-// when Qt calls getEsistingDirectory(), etc.
-typedef LPITEMIDLIST (WINAPI *PtrSHBrowseForFolder)(BROWSEINFO*);
-static PtrSHBrowseForFolder ptrSHBrowseForFolder = 0;
-typedef BOOL (WINAPI *PtrSHGetPathFromIDList)(LPITEMIDLIST,LPWSTR);
-static PtrSHGetPathFromIDList ptrSHGetPathFromIDList = 0;
-
-static void resolveLibs()
-{
-#ifndef Q_OS_WINCE
- static bool triedResolve = false;
-
- if (!triedResolve) {
-#ifndef QT_NO_THREAD
- // protect initialization
- QMutexLocker locker(QMutexPool::globalInstanceGet(&triedResolve));
- // check triedResolve again, since another thread may have already
- // done the initialization
- if (triedResolve) {
- // another thread did initialize the security function pointers,
- // so we shouldn't do it again.
- return;
- }
-#endif
-
- triedResolve = true;
- if (qt_winUnicode()) {
- QLibrary lib(QLatin1String("shell32"));
- ptrSHBrowseForFolder = (PtrSHBrowseForFolder) lib.resolve("SHBrowseForFolderW");
- ptrSHGetPathFromIDList = (PtrSHGetPathFromIDList) lib.resolve("SHGetPathFromIDListW");
- }
- }
-#endif
-}
-#ifdef Q_OS_WINCE
-#define PtrSHBrowseForFolder SHBrowseForFolder ;
-#define PtrSHGetPathFromIDList SHGetPathFromIDList;
-#endif
-
-
extern const char qt3_file_dialog_filter_reg_exp[]; // defined in qfiledialog.cpp
const int maxNameLen = 1023;
@@ -168,80 +125,8 @@ static QString selFilter(const QString& filter, DWORD idx)
return filterLst[(int)idx - 1];
}
-#ifndef Q_OS_WINCE
-// Static vars for OFNA funcs:
-static QByteArray aInitDir;
-static QByteArray aInitSel;
-static QByteArray aTitle;
-static QByteArray aFilter;
-// Use ANSI strings and API
-
-// If you change this, then make sure you change makeOFN (below) too
-static
-OPENFILENAMEA* makeOFNA(QWidget* parent,
- const QString& initialSelection,
- const QString& initialDirectory,
- const QString& title,
- const QString& filters,
- Q3FileDialog::Mode mode)
-{
- if (parent)
- parent = parent->window();
- else
- parent = qApp->activeWindow();
-
- aTitle = title.local8Bit();
- aInitDir = QDir::toNativeSeparators(initialDirectory).local8Bit();
- if (initialSelection.isEmpty())
- aInitSel = "";
- else
- aInitSel = QDir::toNativeSeparators(initialSelection).local8Bit();
- int maxLen = mode == Q3FileDialog::ExistingFiles ? maxMultiLen : maxNameLen;
- aInitSel.resize(maxLen + 1); // make room for return value
- aFilter = filters.local8Bit();
-
- OPENFILENAMEA* ofn = new OPENFILENAMEA;
- memset(ofn, 0, sizeof(OPENFILENAMEA));
-
-#if defined(Q_CC_BOR) && (WINVER >= 0x0500) && (_WIN32_WINNT >= 0x0500)
- // according to the MSDN, this should also be necessary for MSVC, but
- // OPENFILENAME_SIZE_VERSION_400A is in not Microsoft header, as it seems
- if (QApplication::winVersion()==Qt::WV_NT || QApplication::winVersion()&Qt::WV_DOS_based) {
- ofn->lStructSize= OPENFILENAME_SIZE_VERSION_400A;
- } else {
- ofn->lStructSize= sizeof(OPENFILENAMEA);
- }
-#else
- ofn->lStructSize = sizeof(OPENFILENAMEA);
-#endif
- ofn->hwndOwner = parent ? parent->winId() : 0;
- ofn->lpstrFilter = aFilter;
- ofn->lpstrFile = aInitSel.data();
- ofn->nMaxFile = maxLen;
- ofn->lpstrInitialDir = aInitDir.data();
- ofn->lpstrTitle = aTitle.data();
- ofn->Flags = (OFN_NOCHANGEDIR | OFN_HIDEREADONLY);
-
- if (mode == Q3FileDialog::ExistingFile ||
- mode == Q3FileDialog::ExistingFiles)
- ofn->Flags |= (OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST);
- if (mode == Q3FileDialog::ExistingFiles)
- ofn->Flags |= (OFN_ALLOWMULTISELECT | OFN_EXPLORER);
-
- return ofn;
-}
-
-static void cleanUpOFNA(OPENFILENAMEA** ofn)
-{
- delete *ofn;
- *ofn = 0;
-}
-#endif
-
static QString tFilters, tTitle, tInitDir;
-#ifdef UNICODE
-// If you change this, then make sure you change makeOFNA (above) too
static
OPENFILENAME* makeOFN(QWidget* parent,
const QString& initialSelection,
@@ -261,33 +146,23 @@ OPENFILENAME* makeOFN(QWidget* parent,
QString initSel = QDir::toNativeSeparators(initialSelection);
int maxLen = mode == Q3FileDialog::ExistingFiles ? maxMultiLen : maxNameLen;
- TCHAR *tInitSel = new TCHAR[maxLen+1];
+ wchar_t *tInitSel = new wchar_t[maxLen+1];
if (initSel.length() > 0 && initSel.length() <= maxLen)
- memcpy(tInitSel, initSel.ucs2(), (initSel.length()+1)*sizeof(QChar));
+ memcpy(tInitSel, initSel.utf16(), (initSel.length() + 1) * sizeof(wchar_t));
else
tInitSel[0] = 0;
OPENFILENAME* ofn = new OPENFILENAME;
memset(ofn, 0, sizeof(OPENFILENAME));
-#if defined(Q_CC_BOR) && (WINVER >= 0x0500) && (_WIN32_WINNT >= 0x0500)
- // according to the MSDN, this should also be necessary for MSVC, but
- // OPENFILENAME_SIZE_VERSION_400 is in not Microsoft header, as it seems
- if (QApplication::winVersion()==Qt::WV_NT || QApplication::winVersion()&Qt::WV_DOS_based) {
- ofn->lStructSize= OPENFILENAME_SIZE_VERSION_400;
- } else {
- ofn->lStructSize = sizeof(OPENFILENAME);
- }
-#else
- ofn->lStructSize = sizeof(OPENFILENAME);
-#endif
- ofn->hwndOwner = parent ? parent->winId() : 0;
- ofn->lpstrFilter = (TCHAR *)tFilters.ucs2();
- ofn->lpstrFile = tInitSel;
+ ofn->lStructSize = sizeof(OPENFILENAME);
+ ofn->hwndOwner = parent ? parent->winId() : 0;
+ ofn->lpstrFilter = (wchar_t*)tFilters.utf16();
+ ofn->lpstrFile = tInitSel;
ofn->nMaxFile = maxLen;
- ofn->lpstrInitialDir = (TCHAR *)tInitDir.ucs2();
- ofn->lpstrTitle = (TCHAR *)tTitle.ucs2();
- ofn->Flags = (OFN_NOCHANGEDIR | OFN_HIDEREADONLY);
+ ofn->lpstrInitialDir = (wchar_t*)tInitDir.utf16();
+ ofn->lpstrTitle = (wchar_t*)tTitle.utf16();
+ ofn->Flags = (OFN_NOCHANGEDIR | OFN_HIDEREADONLY);
if (mode == Q3FileDialog::ExistingFile ||
mode == Q3FileDialog::ExistingFiles)
@@ -298,7 +173,6 @@ OPENFILENAME* makeOFN(QWidget* parent,
return ofn;
}
-
static void cleanUpOFN(OPENFILENAME** ofn)
{
delete (*ofn)->lpstrFile;
@@ -306,8 +180,6 @@ static void cleanUpOFN(OPENFILENAME** ofn)
*ofn = 0;
}
-#endif // UNICODE
-
QString Q3FileDialog::winGetOpenFileName(const QString &initialSelection,
const QString &filter,
QString* initialDirectory,
@@ -349,31 +221,18 @@ QString Q3FileDialog::winGetOpenFileName(const QString &initialSelection,
QApplication::sendEvent(parent, &e);
QApplicationPrivate::enterModal(parent);
}
- QT_WA({
- // Use Unicode strings and API
- OPENFILENAME* ofn = makeOFN(parent, isel,
- *initialDirectory, title,
- winFilter(filter), ExistingFile);
- if (idx)
- ofn->nFilterIndex = idx + 1;
- if (GetOpenFileName(ofn)) {
- result = QString::fromUcs2((ushort*)ofn->lpstrFile);
- selFilIdx = ofn->nFilterIndex;
- }
- cleanUpOFN(&ofn);
- } , {
- // Use ANSI strings and API
- OPENFILENAMEA* ofn = makeOFNA(parent, isel,
- *initialDirectory, title,
- winFilter(filter), ExistingFile);
- if (idx)
- ofn->nFilterIndex = idx + 1;
- if (GetOpenFileNameA(ofn)) {
- result = QString::fromLocal8Bit(ofn->lpstrFile);
- selFilIdx = ofn->nFilterIndex;
- }
- cleanUpOFNA(&ofn);
- });
+
+ OPENFILENAME* ofn = makeOFN(parent, isel,
+ *initialDirectory, title,
+ winFilter(filter), ExistingFile);
+ if (idx)
+ ofn->nFilterIndex = idx + 1;
+ if (GetOpenFileName(ofn)) {
+ result = QString::fromWCharArray(ofn->lpstrFile);
+ selFilIdx = ofn->nFilterIndex;
+ }
+ cleanUpOFN(&ofn);
+
if (parent) {
QApplicationPrivate::leaveModal(parent);
QEvent e(QEvent::WindowUnblocked);
@@ -433,31 +292,18 @@ QString Q3FileDialog::winGetSaveFileName(const QString &initialSelection,
QApplication::sendEvent(parent, &e);
QApplicationPrivate::enterModal(parent);
}
- QT_WA({
- // Use Unicode strings and API
- OPENFILENAME* ofn = makeOFN(parent, isel,
- *initialDirectory, title,
- winFilter(filter), AnyFile);
- if (idx)
- ofn->nFilterIndex = idx + 1;
- if (GetSaveFileName(ofn)) {
- result = QString::fromUcs2((ushort*)ofn->lpstrFile);
- selFilIdx = ofn->nFilterIndex;
- }
- cleanUpOFN(&ofn);
- } , {
- // Use ANSI strings and API
- OPENFILENAMEA* ofn = makeOFNA(parent, isel,
- *initialDirectory, title,
- winFilter(filter), AnyFile);
- if (idx)
- ofn->nFilterIndex = idx + 1;
- if (GetSaveFileNameA(ofn)) {
- result = QString::fromLocal8Bit(ofn->lpstrFile);
- selFilIdx = ofn->nFilterIndex;
- }
- cleanUpOFNA(&ofn);
- });
+
+ OPENFILENAME* ofn = makeOFN(parent, isel,
+ *initialDirectory, title,
+ winFilter(filter), AnyFile);
+ if (idx)
+ ofn->nFilterIndex = idx + 1;
+ if (GetSaveFileName(ofn)) {
+ result = QString::fromWCharArray(ofn->lpstrFile);
+ selFilIdx = ofn->nFilterIndex;
+ }
+ cleanUpOFN(&ofn);
+
if (parent) {
QApplicationPrivate::leaveModal(parent);
QEvent e(QEvent::WindowUnblocked);
@@ -519,69 +365,38 @@ QStringList Q3FileDialog::winGetOpenFileNames(const QString &filter,
QApplication::sendEvent(parent, &e);
QApplicationPrivate::enterModal(parent);
}
- QT_WA({
- OPENFILENAME* ofn = makeOFN(parent, isel,
- *initialDirectory, title,
- winFilter(filter), ExistingFiles);
- if (idx)
- ofn->nFilterIndex = idx + 1;
- if (GetOpenFileName(ofn)) {
- QString fileOrDir = QString::fromUcs2((ushort*)ofn->lpstrFile);
- selFilIdx = ofn->nFilterIndex;
- int offset = fileOrDir.length() + 1;
- if (ofn->lpstrFile[offset] == 0) {
- // Only one file selected; has full path
- fi.setFile(fileOrDir);
- QString res = fi.absFilePath();
- if (!res.isEmpty())
- result.append(res);
- }
- else {
- // Several files selected; first string is path
- dir.setPath(fileOrDir);
- QString f;
- while(!(f = QString::fromUcs2((ushort*)ofn->lpstrFile+offset)).isEmpty()) {
- fi.setFile(dir, f);
- QString res = fi.absFilePath();
- if (!res.isEmpty())
- result.append(res);
- offset += f.length() + 1;
- }
- }
+
+ OPENFILENAME* ofn = makeOFN(parent, isel,
+ *initialDirectory, title,
+ winFilter(filter), ExistingFiles);
+ if (idx)
+ ofn->nFilterIndex = idx + 1;
+ if (GetOpenFileName(ofn)) {
+ QString fileOrDir = QString::fromWCharArray(ofn->lpstrFile);
+ selFilIdx = ofn->nFilterIndex;
+ int offset = fileOrDir.length() + 1;
+ if (ofn->lpstrFile[offset] == 0) {
+ // Only one file selected; has full path
+ fi.setFile(fileOrDir);
+ QString res = fi.absFilePath();
+ if (!res.isEmpty())
+ result.append(res);
}
- cleanUpOFN(&ofn);
- } , {
- OPENFILENAMEA* ofn = makeOFNA(parent, isel,
- *initialDirectory, title,
- winFilter(filter), ExistingFiles);
- if (idx)
- ofn->nFilterIndex = idx + 1;
- if (GetOpenFileNameA(ofn)) {
- QByteArray fileOrDir(ofn->lpstrFile);
- selFilIdx = ofn->nFilterIndex;
- int offset = fileOrDir.length() + 1;
- if (ofn->lpstrFile[offset] == '\0') {
- // Only one file selected; has full path
- fi.setFile(QString::fromLocal8Bit(fileOrDir));
+ else {
+ // Several files selected; first string is path
+ dir.setPath(fileOrDir);
+ QString f;
+ while (!(f = QString::fromWCharArray(ofn->lpstrFile + offset)).isEmpty()) {
+ fi.setFile(dir, f);
QString res = fi.absFilePath();
if (!res.isEmpty())
result.append(res);
+ offset += f.length() + 1;
}
- else {
- // Several files selected; first string is path
- dir.setPath(QString::fromLocal8Bit(fileOrDir));
- QByteArray f;
- while(!(f = QByteArray(ofn->lpstrFile + offset)).isEmpty()) {
- fi.setFile(dir, QString::fromLocal8Bit(f));
- QString res = fi.absFilePath();
- if (!res.isEmpty())
- result.append(res);
- offset += f.length() + 1;
- }
- }
- cleanUpOFNA(&ofn);
}
- });
+ }
+ cleanUpOFN(&ofn);
+
if (parent) {
QApplicationPrivate::leaveModal(parent);
QEvent e(QEvent::WindowUnblocked);
@@ -607,34 +422,17 @@ static int __stdcall winGetExistDirCallbackProc(HWND hwnd,
if (uMsg == BFFM_INITIALIZED && lpData != 0) {
QString *initDir = (QString *)(lpData);
if (!initDir->isEmpty()) {
- // ### Lars asks: is this correct for the A version????
- QT_WA({
- SendMessage(hwnd, BFFM_SETSELECTION, TRUE, Q_ULONG(initDir->ucs2()));
- } , {
- SendMessageA(hwnd, BFFM_SETSELECTION, TRUE, Q_ULONG(initDir->ucs2()));
- });
+ SendMessage(hwnd, BFFM_SETSELECTION, TRUE, Q_ULONG(initDir->utf16()));
}
} else if (uMsg == BFFM_SELCHANGED) {
- QT_WA({
- resolveLibs();
- TCHAR path[MAX_PATH];
- ptrSHGetPathFromIDList(LPITEMIDLIST(lParam), path);
- QString tmpStr = QString::fromUcs2((ushort*)path);
- if (!tmpStr.isEmpty())
- SendMessage(hwnd, BFFM_ENABLEOK, 1, 1);
- else
- SendMessage(hwnd, BFFM_ENABLEOK, 0, 0);
- SendMessage(hwnd, BFFM_SETSTATUSTEXT, 1, Q_ULONG(path));
- } , {
- char path[MAX_PATH];
- SHGetPathFromIDListA(LPITEMIDLIST(lParam), path);
- QString tmpStr = QString::fromLocal8Bit(path);
- if (!tmpStr.isEmpty())
- SendMessageA(hwnd, BFFM_ENABLEOK, 1, 1);
- else
- SendMessageA(hwnd, BFFM_ENABLEOK, 0, 0);
- SendMessageA(hwnd, BFFM_SETSTATUSTEXT, 1, Q_ULONG(path));
- });
+ wchar_t path[MAX_PATH];
+ SHGetPathFromIDList(LPITEMIDLIST(lParam), path);
+ QString tmpStr = QString::fromWCharArray(path);
+ if (!tmpStr.isEmpty())
+ SendMessage(hwnd, BFFM_ENABLEOK, 1, 1);
+ else
+ SendMessage(hwnd, BFFM_ENABLEOK, 0, 0);
+ SendMessage(hwnd, BFFM_SETSTATUSTEXT, 1, Q_ULONG(path));
}
#endif
return 0;
@@ -666,78 +464,44 @@ QString Q3FileDialog::winGetExistingDirectory(const QString& initialDirectory,
QApplication::sendEvent(parent, &e);
QApplicationPrivate::enterModal(parent);
}
- QT_WA({
- resolveLibs();
- QString initDir = QDir::toNativeSeparators(initialDirectory);
- TCHAR path[MAX_PATH];
- TCHAR initPath[MAX_PATH];
- initPath[0] = 0;
- path[0] = 0;
- tTitle = title;
- BROWSEINFO bi;
- bi.hwndOwner = (parent ? parent->winId() : 0);
- bi.pidlRoot = NULL;
- bi.lpszTitle = (TCHAR*)tTitle.ucs2();
- bi.pszDisplayName = initPath;
- bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT | BIF_NEWDIALOGSTYLE;
- bi.lpfn = winGetExistDirCallbackProc;
- bi.lParam = Q_ULONG(&initDir);
- LPITEMIDLIST pItemIDList = ptrSHBrowseForFolder(&bi);
- if (pItemIDList) {
- ptrSHGetPathFromIDList(pItemIDList, path);
- IMalloc *pMalloc;
- if (SHGetMalloc(&pMalloc) != NOERROR)
- result.clear();
- else {
- pMalloc->Free(pItemIDList);
- pMalloc->Release();
- result = QString::fromUcs2((ushort*)path);
- }
- } else
- result.clear();
- tTitle.clear();
- } , {
- QString initDir = QDir::toNativeSeparators(initialDirectory);
- char path[MAX_PATH];
- char initPath[MAX_PATH];
- QByteArray ctitle = title.toLocal8Bit();
- initPath[0]=0;
- path[0]=0;
- BROWSEINFOA bi;
- bi.hwndOwner = (parent ? parent->winId() : 0);
- bi.pidlRoot = NULL;
- bi.lpszTitle = ctitle;
- bi.pszDisplayName = initPath;
- bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT | BIF_NEWDIALOGSTYLE;
- bi.lpfn = winGetExistDirCallbackProc;
- bi.lParam = Q_ULONG(&initDir);
- LPITEMIDLIST pItemIDList = SHBrowseForFolderA(&bi);
- if (pItemIDList) {
- SHGetPathFromIDListA(pItemIDList, path);
- IMalloc *pMalloc;
- if (SHGetMalloc(&pMalloc) != NOERROR)
- result.clear();
- else {
- pMalloc->Free(pItemIDList);
- pMalloc->Release();
- result = QString::fromLocal8Bit(path);
- }
- } else
+
+ QString initDir = QDir::toNativeSeparators(initialDirectory);
+ wchar_t path[MAX_PATH];
+ wchar_t initPath[MAX_PATH];
+ initPath[0] = 0;
+ path[0] = 0;
+ tTitle = title;
+ BROWSEINFO bi;
+ bi.hwndOwner = (parent ? parent->winId() : 0);
+ bi.pidlRoot = NULL;
+ bi.lpszTitle = (wchar_t*)tTitle.utf16();
+ bi.pszDisplayName = initPath;
+ bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT | BIF_NEWDIALOGSTYLE;
+ bi.lpfn = winGetExistDirCallbackProc;
+ bi.lParam = Q_ULONG(&initDir);
+ LPITEMIDLIST pItemIDList = SHBrowseForFolder(&bi);
+ if (pItemIDList) {
+ SHGetPathFromIDList(pItemIDList, path);
+ IMalloc *pMalloc;
+ if (SHGetMalloc(&pMalloc) != NOERROR)
result.clear();
- });
+ else {
+ pMalloc->Free(pItemIDList);
+ pMalloc->Release();
+ result = QString::fromWCharArray(path);
+ }
+ } else
+ result.clear();
+ tTitle.clear();
+
if (parent) {
QApplicationPrivate::leaveModal(parent);
QEvent e(QEvent::WindowUnblocked);
QApplication::sendEvent(parent, &e);
}
- // Due to a bug on Windows Me, we need to reset the current
- // directory
- if ((qWinVersion() == Qt::WV_98 || qWinVersion() == Qt::WV_Me) && QDir::currentDirPath() != currentDir)
- QDir::setCurrent(currentDir);
-
if (!result.isEmpty())
- result.replace(QLatin1String("\\"), QLatin1String("/"));
+ result.replace(QLatin1Char('\\'), QLatin1Char('/'));
return result;
#else
return QString();
diff --git a/src/qt3support/dialogs/q3tabdialog.cpp b/src/qt3support/dialogs/q3tabdialog.cpp
index c0391aa..a65affc 100644
--- a/src/qt3support/dialogs/q3tabdialog.cpp
+++ b/src/qt3support/dialogs/q3tabdialog.cpp
@@ -49,6 +49,7 @@
#include "qapplication.h"
#include "q3widgetstack.h"
#include "qlayout.h"
+#include "qevent.h"
QT_BEGIN_NAMESPACE
@@ -961,6 +962,16 @@ void Q3TabDialog::paintEvent(QPaintEvent *)
}
+/*!\reimp
+*/
+void Q3TabDialog::showEvent(QShowEvent *e)
+{
+ if (!e->spontaneous())
+ show();
+ QDialog::showEvent(e);
+}
+
+
/*!
Adds an OK button to the dialog and sets the button's text to \a text.
@@ -1027,7 +1038,7 @@ QString Q3TabDialog::tabLabel(QWidget * w)
}
-/*! \reimp
+/*! \internal
*/
void Q3TabDialog::styleChange(QStyle& s)
{
diff --git a/src/qt3support/dialogs/q3tabdialog.h b/src/qt3support/dialogs/q3tabdialog.h
index 951ffb3..b088733 100644
--- a/src/qt3support/dialogs/q3tabdialog.h
+++ b/src/qt3support/dialogs/q3tabdialog.h
@@ -111,6 +111,7 @@ public:
protected:
void paintEvent(QPaintEvent *);
void resizeEvent(QResizeEvent *);
+ void showEvent(QShowEvent *);
void styleChange(QStyle&);
void setTabBar(QTabBar*);
QTabBar* tabBar() const;
diff --git a/src/qt3support/itemviews/q3iconview.cpp b/src/qt3support/itemviews/q3iconview.cpp
index bc5b2ac..68cbac5 100644
--- a/src/qt3support/itemviews/q3iconview.cpp
+++ b/src/qt3support/itemviews/q3iconview.cpp
@@ -614,7 +614,7 @@ QByteArray Q3IconDrag::encodedData(const char* mime) const
(*it).item.textRect().x()).arg((*it).item.textRect().y()).
arg((*it).item.textRect().width()).arg(
(*it).item.textRect().height());
- k += QString(QLatin1String((*it).data.data())) + QLatin1String("$@@$");
+ k += QString::fromLatin1((*it).data.data()) + QLatin1String("$@@$");
s += k;
}
@@ -1820,8 +1820,8 @@ void Q3IconViewItem::calcRect(const QString &text_)
tw = r.width();
th = r.height();
- if (tw < view->d->fm->width(QLatin1String("X")))
- tw = view->d->fm->width(QLatin1String("X"));
+ if (tw < view->d->fm->width(QLatin1Char('X')))
+ tw = view->d->fm->width(QLatin1Char('X'));
itemTextRect.setWidth(tw);
itemTextRect.setHeight(th);
diff --git a/src/qt3support/itemviews/q3table.cpp b/src/qt3support/itemviews/q3table.cpp
index 11c70b4..6c3e90c 100644
--- a/src/qt3support/itemviews/q3table.cpp
+++ b/src/qt3support/itemviews/q3table.cpp
@@ -6411,7 +6411,7 @@ void Q3Table::startDrag()
#endif
-/*! \reimp */
+/*! \internal */
void Q3Table::windowActivationChange(bool oldActive)
{
if (oldActive && autoScrollTimer)
diff --git a/src/qt3support/network/q3dns.cpp b/src/qt3support/network/q3dns.cpp
index dc9d30d..6d514c1 100644
--- a/src/qt3support/network/q3dns.cpp
+++ b/src/qt3support/network/q3dns.cpp
@@ -1738,7 +1738,7 @@ void Q3Dns::setLabel( const QString & label )
const char * dom;
while( (dom=it.current()) != 0 ) {
++it;
- n.append( l.lower() + QLatin1String(".") + QLatin1String(dom) );
+ n.append( l.lower() + QLatin1Char('.') + QLatin1String(dom) );
}
}
n.append( l.lower() );
@@ -1902,8 +1902,8 @@ QString Q3Dns::toInAddrArpaDomain( const QHostAddress &address )
s = QLatin1String("ip6.arpa");
uint b = 0;
while( b < 16 ) {
- s = QString::number( i.c[b]%16, 16 ) + QLatin1String(".") +
- QString::number( i.c[b]/16, 16 ) + QLatin1String(".") + s;
+ s = QString::number( i.c[b]%16, 16 ) + QLatin1Char('.') +
+ QString::number( i.c[b]/16, 16 ) + QLatin1Char('.') + s;
b++;
}
}
@@ -2242,53 +2242,31 @@ typedef struct {
typedef DWORD (WINAPI *GNP)( PFIXED_INFO, PULONG );
// ### FIXME: this code is duplicated in qfiledialog.cpp
-static QString getWindowsRegString( HKEY key, const QString &subKey )
+static QString getWindowsRegString(HKEY key, const QString &subKey)
{
QString s;
- QT_WA( {
- char buf[1024];
- DWORD bsz = sizeof(buf);
- int r = RegQueryValueEx( key, (TCHAR*)subKey.ucs2(), 0, 0, (LPBYTE)buf, &bsz );
- if ( r == ERROR_SUCCESS ) {
- s = QString::fromUcs2( (unsigned short *)buf );
- } else if ( r == ERROR_MORE_DATA ) {
- char *ptr = new char[bsz+1];
- r = RegQueryValueEx( key, (TCHAR*)subKey.ucs2(), 0, 0, (LPBYTE)ptr, &bsz );
- if ( r == ERROR_SUCCESS )
- s = QLatin1String(ptr);
- delete [] ptr;
- }
- } , {
- char buf[512];
- DWORD bsz = sizeof(buf);
- int r = RegQueryValueExA( key, subKey.local8Bit(), 0, 0, (LPBYTE)buf, &bsz );
- if ( r == ERROR_SUCCESS ) {
- s = QLatin1String(buf);
- } else if ( r == ERROR_MORE_DATA ) {
- char *ptr = new char[bsz+1];
- r = RegQueryValueExA( key, subKey.local8Bit(), 0, 0, (LPBYTE)ptr, &bsz );
- if ( r == ERROR_SUCCESS )
- s = QLatin1String(ptr);
- delete [] ptr;
- }
- } );
+
+ wchar_t buf[1024];
+ DWORD bsz = sizeof(buf) / sizeof(wchar_t);
+ int r = RegQueryValueEx(key, (wchar_t*)subKey.utf16(), 0, 0, (LPBYTE)buf, &bsz);
+ if (r == ERROR_SUCCESS) {
+ s = QString::fromWCharArray(buf);
+ } else if (r == ERROR_MORE_DATA) {
+ char *ptr = new char[bsz+1];
+ r = RegQueryValueEx(key, (wchar_t*)subKey.utf16(), 0, 0, (LPBYTE)ptr, &bsz);
+ if (r == ERROR_SUCCESS)
+ s = QLatin1String(ptr);
+ delete [] ptr;
+ }
+
return s;
}
static bool getDnsParamsFromRegistry( const QString &path,
- QString *domainName, QString *nameServer, QString *searchList )
+ QString *domainName, QString *nameServer, QString *searchList )
{
HKEY k;
- int r;
- QT_WA( {
- r = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
- (TCHAR*)path.ucs2(),
- 0, KEY_READ, &k );
- } , {
- r = RegOpenKeyExA( HKEY_LOCAL_MACHINE,
- path.latin1(),
- 0, KEY_READ, &k );
- } );
+ int r = RegOpenKeyEx( HKEY_LOCAL_MACHINE, (wchar_t*)path.utf16(), 0, KEY_READ, &k );
if ( r == ERROR_SUCCESS ) {
*domainName = getWindowsRegString( k, QLatin1String("DhcpDomain") );
@@ -2321,14 +2299,10 @@ void Q3Dns::doResInit()
bool gotNetworkParams = false;
// try the API call GetNetworkParams() first and use registry lookup only
// as a fallback
-#ifdef Q_OS_WINCE
- HINSTANCE hinstLib = LoadLibraryW( L"iphlpapi" );
-#else
- HINSTANCE hinstLib = LoadLibraryA( "iphlpapi" );
-#endif
+ HINSTANCE hinstLib = LoadLibrary( L"iphlpapi" );
if ( hinstLib != 0 ) {
#ifdef Q_OS_WINCE
- GNP getNetworkParams = (GNP) GetProcAddressW( hinstLib, L"GetNetworkParams" );
+ GNP getNetworkParams = (GNP) GetProcAddress( hinstLib, L"GetNetworkParams" );
#else
GNP getNetworkParams = (GNP) GetProcAddress( hinstLib, "GetNetworkParams" );
#endif
@@ -2347,7 +2321,7 @@ void Q3Dns::doResInit()
nameServer += QLatin1String(dnsServer->IpAddress.String);
dnsServer = dnsServer->Next;
if ( dnsServer != 0 )
- nameServer += QLatin1String(" ");
+ nameServer += QLatin1Char(' ');
}
searchList = QLatin1String("");
separator = ' ';
@@ -2360,15 +2334,9 @@ void Q3Dns::doResInit()
}
if ( !gotNetworkParams ) {
if ( getDnsParamsFromRegistry(
- QString( QLatin1String("System\\CurrentControlSet\\Services\\Tcpip\\Parameters") ),
+ QLatin1String("System\\CurrentControlSet\\Services\\Tcpip\\Parameters"),
&domainName, &nameServer, &searchList )) {
- // for NT
separator = ' ';
- } else if ( getDnsParamsFromRegistry(
- QString( QLatin1String("System\\CurrentControlSet\\Services\\VxD\\MSTCP") ),
- &domainName, &nameServer, &searchList )) {
- // for Windows 98
- separator = ',';
} else {
// Could not access the TCP/IP parameters
domainName = QLatin1String("");
@@ -2395,7 +2363,7 @@ void Q3Dns::doResInit()
} while( first < (int)nameServer.length() );
}
- searchList = searchList + QLatin1String(" ") + domainName;
+ searchList += QLatin1Char(' ') + domainName;
searchList = searchList.simplifyWhiteSpace().lower();
first = 0;
do {
@@ -2488,7 +2456,7 @@ void Q3Dns::doResInit()
while ( !stream.atEnd() ) {
line = stream.readLine();
QStringList list = QStringList::split( QLatin1String(" "), line );
- if( line.startsWith( QLatin1String("#") ) || list.size() < 2 )
+ if( line.startsWith( QLatin1Char('#') ) || list.size() < 2 )
continue;
const QString type = list[0].lower();
diff --git a/src/qt3support/network/q3ftp.cpp b/src/qt3support/network/q3ftp.cpp
index b011e2b..e27c7bd 100644
--- a/src/qt3support/network/q3ftp.cpp
+++ b/src/qt3support/network/q3ftp.cpp
@@ -485,7 +485,7 @@ bool Q3FtpDTP::parseDir( const QString &buffer, const QString &userName, QUrlInf
dateStr += lst[ 6 ];
dateStr += QLatin1Char(' ');
- if ( lst[ 7 ].contains( QLatin1String(":") ) ) {
+ if ( lst[ 7 ].contains( QLatin1Char(':') ) ) {
time = QTime( lst[ 7 ].left( 2 ).toInt(), lst[ 7 ].right( 2 ).toInt() );
dateStr += QString::number( QDate::currentDate().year() );
} else {
@@ -495,7 +495,7 @@ bool Q3FtpDTP::parseDir( const QString &buffer, const QString &userName, QUrlInf
QDate date = QDate::fromString( dateStr );
info->setLastModified( QDateTime( date, time ) );
- if ( lst[ 7 ].contains( QLatin1String(":") ) ) {
+ if ( lst[ 7 ].contains( QLatin1Char(':') ) ) {
const int futureTolerance = 600;
if( info->lastModified().secsTo( QDateTime::currentDateTime() ) < -futureTolerance ) {
QDateTime dt = info->lastModified();
@@ -512,7 +512,7 @@ bool Q3FtpDTP::parseDir( const QString &buffer, const QString &userName, QUrlInf
else {
QString n;
for ( uint i = 8; i < (uint) lst.count(); ++i )
- n += lst[ i ] + QLatin1String(" ");
+ n += lst[ i ] + QLatin1Char(' ');
n = n.stripWhiteSpace();
info->setName( n );
}
@@ -897,7 +897,7 @@ bool Q3FtpPI::processReply()
// ### error handling
} else {
QStringList lst = addrPortPattern.capturedTexts();
- QString host = lst[1] + QLatin1String(".") + lst[2] + QLatin1String(".") + lst[3] + QLatin1String(".") + lst[4];
+ QString host = lst[1] + QLatin1Char('.') + lst[2] + QLatin1Char('.') + lst[3] + QLatin1Char('.') + lst[4];
Q_UINT16 port = ( lst[5].toUInt() << 8 ) + lst[6].toUInt();
waitForDtpToConnect = true;
dtp.connectToHost( host, port );
@@ -1435,8 +1435,8 @@ int Q3Ftp::connectToHost( const QString &host, Q_UINT16 port )
int Q3Ftp::login( const QString &user, const QString &password )
{
QStringList cmds;
- cmds << ( QString(QLatin1String("USER ")) + ( user.isNull() ? QString(QLatin1String("anonymous")) : user ) + QLatin1String("\r\n") );
- cmds << ( QString(QLatin1String("PASS ")) + ( password.isNull() ? QString(QLatin1String("anonymous@")) : password ) + QLatin1String("\r\n") );
+ cmds << ( QString::fromLatin1("USER ") + ( user.isNull() ? QString::fromLatin1("anonymous") : user ) + QLatin1String("\r\n") );
+ cmds << ( QString::fromLatin1("PASS ") + ( password.isNull() ? QString::fromLatin1("anonymous@") : password ) + QLatin1String("\r\n") );
return addCommand( new Q3FtpCommand( Login, cmds ) );
}
@@ -2095,7 +2095,7 @@ void Q3Ftp::operationListChildren( Q3NetworkOperation *op )
{
op->setState( StInProgress );
- cd( ( url()->path().isEmpty() ? QString( QLatin1String("/") ) : url()->path() ) );
+ cd( ( url()->path().isEmpty() ? QString::fromLatin1("/") : url()->path() ) );
list();
emit start( op );
}
@@ -2115,7 +2115,7 @@ void Q3Ftp::operationRemove( Q3NetworkOperation *op )
{
op->setState( StInProgress );
- cd( ( url()->path().isEmpty() ? QString( QLatin1String("/") ) : url()->path() ) );
+ cd( ( url()->path().isEmpty() ? QString::fromLatin1("/") : url()->path() ) );
remove( Q3Url( op->arg( 0 ) ).path() );
}
@@ -2125,7 +2125,7 @@ void Q3Ftp::operationRename( Q3NetworkOperation *op )
{
op->setState( StInProgress );
- cd( ( url()->path().isEmpty() ? QString( QLatin1String("/") ) : url()->path() ) );
+ cd( ( url()->path().isEmpty() ? QString::fromLatin1("/") : url()->path() ) );
rename( op->arg( 0 ), op->arg( 1 ));
}
@@ -2179,8 +2179,8 @@ bool Q3Ftp::checkConnection( Q3NetworkOperation *op )
connectToHost( url()->host(), url()->port() != -1 ? url()->port() : 21 );
break;
}
- QString user = url()->user().isEmpty() ? QString( QLatin1String("anonymous") ) : url()->user();
- QString pass = url()->password().isEmpty() ? QString( QLatin1String("anonymous@") ) : url()->password();
+ QString user = url()->user().isEmpty() ? QString::fromLatin1("anonymous") : url()->user();
+ QString pass = url()->password().isEmpty() ? QString::fromLatin1("anonymous@") : url()->password();
login( user, pass );
}
diff --git a/src/qt3support/network/q3http.cpp b/src/qt3support/network/q3http.cpp
index e44dfe8..9b5c33f 100644
--- a/src/qt3support/network/q3http.cpp
+++ b/src/qt3support/network/q3http.cpp
@@ -468,7 +468,7 @@ bool Q3HttpHeader::parse( const QString& str )
if ( !(*it).isEmpty() ) {
if ( (*it)[0].isSpace() ) {
if ( !lines.isEmpty() ) {
- lines.last() += QLatin1String(" ");
+ lines.last() += QLatin1Char(' ');
lines.last() += (*it).stripWhiteSpace();
}
} else {
@@ -562,7 +562,7 @@ void Q3HttpHeader::removeValue( const QString& key )
*/
bool Q3HttpHeader::parseLine( const QString& line, int )
{
- int i = line.find( QLatin1String(":") );
+ int i = line.find( QLatin1Char(':') );
if ( i == -1 )
return false;
@@ -647,7 +647,7 @@ QString Q3HttpHeader::contentType() const
if ( type.isEmpty() )
return QString();
- int pos = type.find( QLatin1String(";") );
+ int pos = type.find( QLatin1Char(';') );
if ( pos == -1 )
return type;
@@ -785,7 +785,7 @@ int Q3HttpResponseHeader::minorVersion() const
return minVer;
}
-/*! \reimp
+/*! \internal
*/
bool Q3HttpResponseHeader::parseLine( const QString& line, int number )
{
@@ -952,7 +952,7 @@ int Q3HttpRequestHeader::minorVersion() const
return minVer;
}
-/*! \reimp
+/*! \internal
*/
bool Q3HttpRequestHeader::parseLine( const QString& line, int number )
{
@@ -2210,7 +2210,7 @@ void Q3Http::clientReply( const Q3HttpResponseHeader &rep )
if ( rep.statusCode() >= 400 && rep.statusCode() < 600 ) {
op->setState( StFailed );
op->setProtocolDetail(
- QString(QLatin1String("%1 %2")).arg(rep.statusCode()).arg(rep.reasonPhrase())
+ QString::fromLatin1("%1 %2").arg(rep.statusCode()).arg(rep.reasonPhrase())
);
switch ( rep.statusCode() ) {
case 401:
diff --git a/src/qt3support/network/q3socketdevice_win.cpp b/src/qt3support/network/q3socketdevice_win.cpp
index 926d699..a0f0c0f 100644
--- a/src/qt3support/network/q3socketdevice_win.cpp
+++ b/src/qt3support/network/q3socketdevice_win.cpp
@@ -47,20 +47,15 @@
#include <string.h>
+# include <qt_windows.h>
#if defined (QT_NO_IPV6)
-# include <windows.h>
# include <winsock.h>
#else
# if defined (Q_CC_BOR) || defined (Q_CC_GNU)
# include <winsock2.h>
-# elif defined (Q_CC_INTEL)
-# include <winsock.h>
# else
-# include <windows.h>
-# if defined(Q_OS_WINCE)
# include <winsock.h>
# endif
-# endif
// Use our own defines and structs which we know are correct
# define QT_SS_MAXSIZE 128
# define QT_SS_ALIGNSIZE (sizeof(__int64))
diff --git a/src/qt3support/network/q3url.cpp b/src/qt3support/network/q3url.cpp
index 3d77cea..3523ace 100644
--- a/src/qt3support/network/q3url.cpp
+++ b/src/qt3support/network/q3url.cpp
@@ -211,8 +211,8 @@ Q3Url::Q3Url( const Q3Url& url )
bool Q3Url::isRelativeUrl( const QString &url )
{
- int colon = url.find( QLatin1String(":") );
- int slash = url.find( QLatin1String("/") );
+ int colon = url.find( QLatin1Char(':') );
+ int slash = url.find( QLatin1Char('/') );
return ( slash != 0 && ( colon == -1 || ( slash != -1 && colon > slash ) ) );
}
@@ -280,8 +280,8 @@ Q3Url::Q3Url( const Q3Url& url, const QString& relUrl, bool checkSlash )
if ( !d->host.isEmpty() && !d->user.isEmpty() && !d->pass.isEmpty() )
p = QLatin1String("/");
}
- if ( !p.isEmpty() && p.right(1)!=QLatin1String("/") )
- p += QLatin1String("/");
+ if ( !p.isEmpty() && !p.endsWith(QLatin1Char('/')) )
+ p += QLatin1Char('/');
p += rel;
d->path = p;
d->cleanPathDirty = true;
@@ -678,7 +678,7 @@ bool Q3Url::parse( const QString& url )
++cs;
while ( url_[ cs ] == QLatin1Char('/') )
++cs;
- int slash = url_.find( QLatin1String("/"), cs );
+ int slash = url_.find( QLatin1Char('/'), cs );
if ( slash == -1 )
slash = url_.length() - 1;
QString tmp = url_.mid( cs, slash - cs + 1 );
@@ -686,7 +686,7 @@ bool Q3Url::parse( const QString& url )
if ( !tmp.isEmpty() ) { // if this part exists
// look for the @ in this part
- int at = tmp.find( QLatin1String("@") );
+ int at = tmp.find( QLatin1Char('@') );
if ( at != -1 )
at += cs;
// we have no @, which means host[:port], so directly
@@ -793,7 +793,7 @@ bool Q3Url::parse( const QString& url )
// hack for windows
if ( d->path.length() == 2 && d->path[ 1 ] == QLatin1Char(':') )
- d->path += QLatin1String("/");
+ d->path += QLatin1Char('/');
// #### do some corrections, should be done nicer too
if ( !d->pass.isEmpty() ) {
@@ -808,7 +808,7 @@ bool Q3Url::parse( const QString& url )
if ( d->path[ 0 ] == QLatin1Char('@') || d->path[ 0 ] == QLatin1Char(':') )
d->path.remove( (uint)0, 1 );
if ( d->path[ 0 ] != QLatin1Char('/') && !relPath && d->path[ 1 ] != QLatin1Char(':') )
- d->path.prepend( QLatin1String("/") );
+ d->path.prepend( QLatin1Char('/') );
}
if ( !d->refEncoded.isEmpty() && d->refEncoded[ 0 ] == QLatin1Char('#') )
d->refEncoded.remove( (uint)0, 1 );
@@ -820,9 +820,9 @@ bool Q3Url::parse( const QString& url )
#if defined(Q_OS_WIN32)
// hack for windows file://machine/path syntax
if ( d->protocol == QLatin1String("file") ) {
- if ( url.left( 7 ) == QLatin1String("file://") &&
+ if ( url.startsWith(QLatin1String("file://")) &&
d->path.length() > 1 && d->path[ 1 ] != QLatin1Char(':') )
- d->path.prepend( QLatin1String("/") );
+ d->path.prepend( QLatin1Char('/') );
}
#endif
@@ -942,7 +942,7 @@ void Q3Url::setFileName( const QString& name )
p += fn;
if ( !d->queryEncoded.isEmpty() )
- p += QLatin1String("?") + d->queryEncoded;
+ p += QLatin1Char('?') + d->queryEncoded;
setEncodedPathAndQuery( p );
}
@@ -961,7 +961,7 @@ QString Q3Url::encodedPathAndQuery()
encode( p );
if ( !d->queryEncoded.isEmpty() ) {
- p += QLatin1String("?");
+ p += QLatin1Char('?');
p += d->queryEncoded;
}
@@ -1011,7 +1011,7 @@ QString Q3Url::path( bool correct ) const
} else if ( isLocalFile() ) {
#if defined(Q_OS_WIN32)
// hack for stuff like \\machine\path and //machine/path on windows
- if ( ( d->path.left( 1 ) == QLatin1String("/") || d->path.left( 1 ) == QLatin1String("\\") ) &&
+ if ( ( d->path.startsWith(QLatin1Char('/')) || d->path.startsWith(QLatin1Char('\\')) ) &&
d->path.length() > 1 ) {
d->cleanPath = d->path;
bool share = (d->cleanPath[0] == QLatin1Char('\\') && d->cleanPath[1] == QLatin1Char('\\')) ||
@@ -1021,7 +1021,7 @@ QString Q3Url::path( bool correct ) const
if ( share ) {
check = false;
while (d->cleanPath.at(0) != QLatin1Char('/') || d->cleanPath.at(1) != QLatin1Char('/'))
- d->cleanPath.prepend(QLatin1String("/"));
+ d->cleanPath.prepend(QLatin1Char('/'));
}
}
#endif
@@ -1036,7 +1036,7 @@ QString Q3Url::path( bool correct ) const
dir = QDir::cleanDirPath( canPath );
else
dir = QDir::cleanDirPath( QDir( d->path ).absPath() );
- dir += QLatin1String("/");
+ dir += QLatin1Char('/');
if ( dir == QLatin1String("//") )
d->cleanPath = QLatin1String("/");
else
@@ -1046,14 +1046,13 @@ QString Q3Url::path( bool correct ) const
QDir::cleanDirPath( (qt_resolve_symlinks ?
fi.dir().canonicalPath() :
fi.dir().absPath()) );
- d->cleanPath = p + QLatin1String("/") + fi.fileName();
+ d->cleanPath = p + QLatin1Char('/') + fi.fileName();
}
}
} else {
- if ( d->path != QLatin1String("/") && d->path[ (int)d->path.length() - 1 ] == QLatin1Char('/') )
- d->cleanPath = QDir::cleanDirPath( d->path ) + QLatin1String("/");
- else
d->cleanPath = QDir::cleanDirPath( d->path );
+ if ( d->path.length() > 1 && d->path.endsWith(QLatin1Char('/')) )
+ d->cleanPath += QLatin1Char('/');
}
if ( check )
@@ -1084,9 +1083,9 @@ bool Q3Url::isLocalFile() const
QString Q3Url::fileName() const
{
- if ( d->path.isEmpty() || d->path.endsWith( QLatin1String("/") )
+ if ( d->path.isEmpty() || d->path.endsWith( QLatin1Char('/') )
#ifdef Q_WS_WIN
- || d->path.endsWith( QLatin1String("\\") )
+ || d->path.endsWith( QLatin1Char('\\') )
#endif
)
return QString();
@@ -1110,12 +1109,12 @@ void Q3Url::addPath( const QString& pa )
if ( path().isEmpty() ) {
if ( p[ 0 ] != QLatin1Char( '/' ) )
- d->path = QLatin1String("/") + p;
+ d->path = QLatin1Char('/') + p;
else
d->path = p;
} else {
if ( p[ 0 ] != QLatin1Char( '/' ) && d->path[ (int)d->path.length() - 1 ] != QLatin1Char('/') )
- d->path += QLatin1String("/") + p;
+ d->path += QLatin1Char('/') + p;
else
d->path += p;
}
@@ -1250,11 +1249,11 @@ QString Q3Url::toString( bool encodedPath, bool forcePrependProtocol ) const
if ( isLocalFile() ) {
if ( forcePrependProtocol )
- res = d->protocol + QLatin1String(":") + p;
+ res = d->protocol + QLatin1Char(':') + p;
else
res = p;
} else if ( d->protocol == QLatin1String("mailto") ) {
- res = d->protocol + QLatin1String(":") + p;
+ res = d->protocol + QLatin1Char(':') + p;
} else {
res = d->protocol + QLatin1String("://");
if ( !d->user.isEmpty() || !d->pass.isEmpty() ) {
@@ -1267,24 +1266,24 @@ QString Q3Url::toString( bool encodedPath, bool forcePrependProtocol ) const
if ( !d->pass.isEmpty() ) {
tmp = d->pass;
encode( tmp );
- res += QLatin1String(":") + tmp;
+ res += QLatin1Char(':') + tmp;
}
- res += QLatin1String("@");
+ res += QLatin1Char('@');
}
res += d->host;
if ( d->port != -1 )
- res += QLatin1String(":") + QString( QLatin1String("%1") ).arg( d->port );
+ res += QLatin1Char(':') + QString::number( d->port );
if ( !p.isEmpty() ) {
if ( !d->host.isEmpty() && p[0]!= QLatin1Char( '/' ) )
- res += QLatin1String("/");
+ res += QLatin1Char('/');
res += p;
}
}
if ( !d->refEncoded.isEmpty() )
- res += QLatin1String("#") + d->refEncoded;
+ res += QLatin1Char('#') + d->refEncoded;
if ( !d->queryEncoded.isEmpty() )
- res += QLatin1String("?") + d->queryEncoded;
+ res += QLatin1Char('?') + d->queryEncoded;
return res;
}
diff --git a/src/qt3support/network/q3urloperator.cpp b/src/qt3support/network/q3urloperator.cpp
index 0f44dbe..98a603f 100644
--- a/src/qt3support/network/q3urloperator.cpp
+++ b/src/qt3support/network/q3urloperator.cpp
@@ -579,7 +579,7 @@ Q3PtrList<Q3NetworkOperation> Q3UrlOperator::copy( const QString &from, const QS
if (frm == to + file)
return ops;
- file.prepend( QLatin1String("/") );
+ file.prepend( QLatin1Char('/') );
// uFrom and uTo are deleted when the Q3NetworkProtocol deletes itself via
// autodelete
diff --git a/src/qt3support/other/q3dragobject.cpp b/src/qt3support/other/q3dragobject.cpp
index ea799f3..93a6079 100644
--- a/src/qt3support/other/q3dragobject.cpp
+++ b/src/qt3support/other/q3dragobject.cpp
@@ -93,7 +93,7 @@ public:
Q3TextDragPrivate() { setSubType(QLatin1String("plain")); }
void setSubType(const QString & st) {
subtype = st;
- fmt = QString(QLatin1String("text/")).toLatin1() + subtype.toLatin1();
+ fmt = "text/" + subtype.toLatin1();
}
QString txt;
@@ -191,8 +191,7 @@ Q3DragObject::~Q3DragObject()
Set the pixmap, \a pm, to display while dragging the object. The
platform-specific implementation will use this where it can - so
provide a small masked pixmap, and do not assume that the user
- will actually see it. For example, cursors on Windows 95 are of
- limited size.
+ will actually see it.
The \a hotspot is the point on (or off) the pixmap that should be
under the cursor as it is dragged. It is relative to the top-left
@@ -208,11 +207,6 @@ void Q3DragObject::setPixmap(QPixmap pm, const QPoint& hotspot)
Q_D(Q3DragObject);
d->pixmap = pm;
d->hot = hotspot;
-#if 0
- QDragManager *manager = QDragManager::self();
- if (manager && manager->object == d->data)
- manager->updatePixmap();
-#endif
}
/*!
@@ -558,10 +552,6 @@ QTextCodec* qt_findcharset(const QByteArray& mimetype)
i = cs.indexOf(';');
if (i >= 0)
cs = cs.left(i);
- // win98 often has charset=utf16, and we need to get the correct codec for
- // it to be able to get Unicode text drops.
- if (cs == "utf16")
- cs = "ISO-10646-UCS-2";
// May return 0 if unknown charset
return QTextCodec::codecForName(cs);
}
@@ -1302,7 +1292,7 @@ QByteArray Q3UriDrag::localFileToUri(const QString& filename)
r.prepend(QString::fromLatin1(hostname));
}
#endif
- return unicodeUriToUri(QString(QLatin1String("file://") + r));
+ return unicodeUriToUri(QLatin1String("file://") + r);
}
/*!
@@ -1357,7 +1347,7 @@ QString Q3UriDrag::uriToLocalFile(const char* uri)
return file;
if (0==qstrnicmp(uri,"file:/",6)) // It is a local file uri
uri += 6;
- else if (QString(QLatin1String(uri)).indexOf(QLatin1String(":/")) != -1) // It is a different scheme uri
+ else if (QString::fromLatin1(uri).indexOf(QLatin1String(":/")) != -1) // It is a different scheme uri
return file;
bool local = uri[0] != '/' || (uri[0] != '\0' && uri[1] == '/');
diff --git a/src/qt3support/other/q3process.cpp b/src/qt3support/other/q3process.cpp
index df23d2d..4390137 100644
--- a/src/qt3support/other/q3process.cpp
+++ b/src/qt3support/other/q3process.cpp
@@ -483,7 +483,7 @@ QString Q3Process::readLineStdout()
return QString();
if ( !buf->scanNewline( &a ) )
- return QString( QLatin1String(buf->readAll()) );
+ return QLatin1String(buf->readAll());
}
uint size = a.size();
diff --git a/src/qt3support/other/q3process_unix.cpp b/src/qt3support/other/q3process_unix.cpp
index f54a345..eb3889b 100644
--- a/src/qt3support/other/q3process_unix.cpp
+++ b/src/qt3support/other/q3process_unix.cpp
@@ -828,7 +828,7 @@ bool Q3Process::start( QStringList *env )
#ifndef QT_NO_DIR
QFileInfo fileInfo( dir, command );
#else
- QFileInfo fileInfo( dir + "/" + command );
+ QFileInfo fileInfo( dir + QLatin1Char('/') + command );
#endif
if ( fileInfo.isExecutable() ) {
#if defined(Q_OS_MACX)
diff --git a/src/qt3support/other/q3process_win.cpp b/src/qt3support/other/q3process_win.cpp
index 327782a..0952663 100644
--- a/src/qt3support/other/q3process_win.cpp
+++ b/src/qt3support/other/q3process_win.cpp
@@ -285,7 +285,7 @@ bool Q3Process::start( QStringList *env )
for ( ; it != _arguments.end(); ++it ) {
QString tmp = *it;
// escape a single " because the arguments will be parsed
- tmp.replace( QLatin1String("\""), QLatin1String("\\\"") );
+ tmp.replace( QLatin1Char('\"'), QLatin1String("\\\"") );
if ( tmp.isEmpty() || tmp.contains( QLatin1Char(' ') ) || tmp.contains( QLatin1Char('\t') ) ) {
// The argument must not end with a \ since this would be interpreted
// as escaping the quote -- rather put the \ behind the quote: e.g.
@@ -294,9 +294,9 @@ bool Q3Process::start( QStringList *env )
int i = tmp.length();
while ( i>0 && tmp.at( i-1 ) == QLatin1Char('\\') ) {
--i;
- endQuote += QLatin1String("\\");
+ endQuote += QLatin1Char('\\');
}
- args += QString( QLatin1String(" \"") ) + tmp.left( i ) + endQuote;
+ args += QLatin1String(" \"") + tmp.left( i ) + endQuote;
} else {
args += QLatin1Char(' ') + tmp;
}
@@ -308,108 +308,60 @@ bool Q3Process::start( QStringList *env )
// CreateProcess()
bool success;
d->newPid();
-#ifdef UNICODE
- if (!(QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based)) {
- STARTUPINFOW startupInfo = {
- sizeof( STARTUPINFO ), 0, 0, 0,
- (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT,
- 0, 0, 0,
- STARTF_USESTDHANDLES,
- 0, 0, 0,
- d->pipeStdin[0], d->pipeStdout[1], d->pipeStderr[1]
- };
- TCHAR *applicationName;
- if ( appName.isNull() )
- applicationName = 0;
- else
- applicationName = _wcsdup( (TCHAR*)appName.ucs2() );
- TCHAR *commandLine = _wcsdup( (TCHAR*)args.ucs2() );
- QByteArray envlist;
- if ( env != 0 ) {
- int pos = 0;
- // add PATH if necessary (for DLL loading)
- QByteArray path = qgetenv( "PATH" );
- if ( env->grep( QRegExp(QLatin1String("^PATH="),FALSE) ).empty() && !path.isNull() ) {
- QString tmp = QString( QLatin1String("PATH=%1") ).arg(QString::fromLatin1(path.constData()));
- uint tmpSize = sizeof(TCHAR) * (tmp.length()+1);
- envlist.resize( envlist.size() + tmpSize );
- memcpy( envlist.data()+pos, tmp.ucs2(), tmpSize );
- pos += tmpSize;
- }
- // add the user environment
- for ( QStringList::Iterator it = env->begin(); it != env->end(); it++ ) {
- QString tmp = *it;
- uint tmpSize = sizeof(TCHAR) * (tmp.length()+1);
- envlist.resize( envlist.size() + tmpSize );
- memcpy( envlist.data()+pos, tmp.ucs2(), tmpSize );
- pos += tmpSize;
- }
- // add the 2 terminating 0 (actually 4, just to be on the safe side)
- envlist.resize( envlist.size()+4 );
- envlist[pos++] = 0;
- envlist[pos++] = 0;
- envlist[pos++] = 0;
- envlist[pos++] = 0;
- }
- success = CreateProcessW( applicationName, commandLine,
- 0, 0, TRUE, ( comms==0 ? CREATE_NEW_CONSOLE : CREATE_NO_WINDOW )
+
+ STARTUPINFOW startupInfo = {
+ sizeof( STARTUPINFO ), 0, 0, 0,
+ (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT,
+ 0, 0, 0,
+ STARTF_USESTDHANDLES,
+ 0, 0, 0,
+ d->pipeStdin[0], d->pipeStdout[1], d->pipeStderr[1]
+ };
+ wchar_t *applicationName;
+ if ( appName.isNull() )
+ applicationName = 0;
+ else
+ applicationName = _wcsdup( (wchar_t*)appName.utf16() );
+ wchar_t *commandLine = _wcsdup( (wchar_t*)args.utf16() );
+ QByteArray envlist;
+ if ( env != 0 ) {
+ int pos = 0;
+ // add PATH if necessary (for DLL loading)
+ QByteArray path = qgetenv( "PATH" );
+ if ( env->grep( QRegExp(QLatin1String("^PATH="),FALSE) ).empty() && !path.isNull() ) {
+ QString tmp = QString::fromLatin1("PATH=%1").arg(QLatin1String(path.constData()));
+ uint tmpSize = sizeof(wchar_t) * (tmp.length() + 1);
+ envlist.resize( envlist.size() + tmpSize );
+ memcpy( envlist.data() + pos, tmp.utf16(), tmpSize );
+ pos += tmpSize;
+ }
+ // add the user environment
+ for ( QStringList::Iterator it = env->begin(); it != env->end(); it++ ) {
+ QString tmp = *it;
+ uint tmpSize = sizeof(wchar_t) * (tmp.length() + 1);
+ envlist.resize( envlist.size() + tmpSize );
+ memcpy( envlist.data() + pos, tmp.utf16(), tmpSize );
+ pos += tmpSize;
+ }
+ // add the 2 terminating 0 (actually 4, just to be on the safe side)
+ envlist.resize( envlist.size()+4 );
+ envlist[pos++] = 0;
+ envlist[pos++] = 0;
+ envlist[pos++] = 0;
+ envlist[pos++] = 0;
+ }
+ success = CreateProcess( applicationName, commandLine,
+ 0, 0, TRUE, ( comms == 0 ? CREATE_NEW_CONSOLE : CREATE_NO_WINDOW )
#ifndef Q_OS_WINCE
- | CREATE_UNICODE_ENVIRONMENT
+ | CREATE_UNICODE_ENVIRONMENT
#endif
- , env==0 ? 0 : envlist.data(),
- (TCHAR*)QDir::toNativeSeparators(workingDir.absPath()).ucs2(),
- &startupInfo, d->pid );
- free( applicationName );
- free( commandLine );
- } else
-#endif // UNICODE
- {
-#ifndef Q_OS_WINCE
- STARTUPINFOA startupInfo = { sizeof( STARTUPINFOA ), 0, 0, 0,
- (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT,
- 0, 0, 0,
- STARTF_USESTDHANDLES,
- 0, 0, 0,
- d->pipeStdin[0], d->pipeStdout[1], d->pipeStderr[1]
- };
- QByteArray envlist;
- if ( env != 0 ) {
- int pos = 0;
- // add PATH if necessary (for DLL loading)
- QByteArray path = qgetenv( "PATH" );
- if ( env->grep( QRegExp(QLatin1String("^PATH="),FALSE) ).empty() && !path.isNull() ) {
- Q3CString tmp = QString( QLatin1String("PATH=%1") ).arg(QString::fromLatin1(path.constData())).local8Bit();
- uint tmpSize = tmp.length() + 1;
- envlist.resize( envlist.size() + tmpSize );
- memcpy( envlist.data()+pos, tmp.data(), tmpSize );
- pos += tmpSize;
- }
- // add the user environment
- for ( QStringList::Iterator it = env->begin(); it != env->end(); it++ ) {
- Q3CString tmp = (*it).local8Bit();
- uint tmpSize = tmp.length() + 1;
- envlist.resize( envlist.size() + tmpSize );
- memcpy( envlist.data()+pos, tmp.data(), tmpSize );
- pos += tmpSize;
- }
- // add the terminating 0 (actually 2, just to be on the safe side)
- envlist.resize( envlist.size()+2 );
- envlist[pos++] = 0;
- envlist[pos++] = 0;
- }
- char *applicationName;
- if ( appName.isNull() )
- applicationName = 0;
- else
- applicationName = const_cast<char *>(appName.toLocal8Bit().data());
- success = CreateProcessA( applicationName,
- const_cast<char *>(args.toLocal8Bit().data()),
- 0, 0, TRUE, comms==0 ? CREATE_NEW_CONSOLE : DETACHED_PROCESS,
- env==0 ? 0 : envlist.data(),
- (const char*)QDir::toNativeSeparators(workingDir.absPath()).local8Bit(),
- &startupInfo, d->pid );
-#endif // Q_OS_WINCE
- }
+ , env == 0 ? 0 : envlist.data(),
+ (wchar_t*)QDir::toNativeSeparators(workingDir.absPath()).utf16(),
+ &startupInfo, d->pid );
+
+ free( applicationName );
+ free( commandLine );
+
if ( !success ) {
d->deletePid();
return false;
diff --git a/src/qt3support/painting/q3paintengine_svg.cpp b/src/qt3support/painting/q3paintengine_svg.cpp
index b5bea9d..007729c 100644
--- a/src/qt3support/painting/q3paintengine_svg.cpp
+++ b/src/qt3support/painting/q3paintengine_svg.cpp
@@ -263,7 +263,7 @@ void Q3SVGPaintEngine::updateClipPath(const QPainterPath &path, Qt::ClipOperatio
QDomElement e;
d->currentClip++;
e = d->doc.createElement(QLatin1String("clipPath"));
- e.setAttribute(QLatin1String("id"), QString(QLatin1String("clip%1")).arg(d->currentClip));
+ e.setAttribute(QLatin1String("id"), QString::fromLatin1("clip%1").arg(d->currentClip));
QDomElement path_element = d->doc.createElement(QLatin1String("path"));
path_element.setAttribute(QLatin1String("d"), qt_svg_compose_path(path));
@@ -509,14 +509,14 @@ bool Q3SVGPaintEngine::save(const QString &fileName)
int icount = 0;
ImageList::Iterator iit = d->images.begin();
for (; iit != d->images.end(); ++iit) {
- QString href = QString(QLatin1String("%1_%2.png")).arg(svgName).arg(icount);
+ QString href = QString::fromLatin1("%1_%2.png").arg(svgName).arg(icount);
(*iit).image.save(href, "PNG");
(*iit).element.setAttribute(QLatin1String("xlink:href"), href);
icount++;
}
PixmapList::Iterator pit = d->pixmaps.begin();
for (; pit != d->pixmaps.end(); ++pit) {
- QString href = QString(QLatin1String("%1_%2.png")).arg(svgName).arg(icount);
+ QString href = QString::fromLatin1("%1_%2.png").arg(svgName).arg(icount);
(*pit).pixmap.save(href, "PNG");
(*pit).element.setAttribute(QLatin1String("xlink:href"), href);
icount++;
@@ -592,7 +592,7 @@ void Q3SVGPaintEnginePrivate::appendChild(QDomElement &e, QPicturePrivate::Paint
if (c == QPicturePrivate::PdcSetClipRegion || c == QPicturePrivate::PdcSetClipPath) {
QDomElement ne;
ne = doc.createElement(QLatin1String("g"));
- ne.setAttribute(QLatin1String("style"), QString(QLatin1String("clip-path:url(#clip%1)")).arg(currentClip));
+ ne.setAttribute(QLatin1String("style"), QString::fromLatin1("clip-path:url(#clip%1)").arg(currentClip));
if (dirtyTransform) {
applyTransform(&ne);
dirtyTransform = false;
@@ -621,12 +621,12 @@ void Q3SVGPaintEnginePrivate::applyStyle(QDomElement *e, QPicturePrivate::PaintC
if (c == QPicturePrivate::PdcDrawText2 || c == QPicturePrivate::PdcDrawText2Formatted) {
// QPainter has a reversed understanding of pen/stroke vs.
// brush/fill for text
- s += QString(QLatin1String("fill:rgb(%1,%2,%3);")).arg(pcol.red()).arg(pcol.green()).arg(pcol.blue());
- s += QString(QLatin1String("stroke-width:0;"));
+ s += QString::fromLatin1("fill:rgb(%1,%2,%3);").arg(pcol.red()).arg(pcol.green()).arg(pcol.blue());
+ s += QLatin1String("stroke-width:0;");
QFont f = cfont;
QFontInfo fi(f);
- s += QString(QLatin1String("font-size:%1;")).arg(fi.pointSize());
- s += QString(QLatin1String("font-style:%1;")).arg(f.italic() ? QLatin1String("italic") : QLatin1String("normal"));
+ s += QString::fromLatin1("font-size:%1;").arg(fi.pointSize());
+ s += QString::fromLatin1("font-style:%1;").arg(f.italic() ? QLatin1String("italic") : QLatin1String("normal"));
// not a very scientific distribution
QString fw;
if (f.weight() <= QFont::Light)
@@ -641,32 +641,32 @@ void Q3SVGPaintEnginePrivate::applyStyle(QDomElement *e, QPicturePrivate::PaintC
fw = QLatin1String("800");
else
fw = QLatin1String("900");
- s += QString(QLatin1String("font-weight:%1;")).arg(fw);
- s += QString(QLatin1String("font-family:%1;")).arg(f.family());
+ s += QString::fromLatin1("font-weight:%1;").arg(fw);
+ s += QString::fromLatin1("font-family:%1;").arg(f.family());
} else {
- s += QString(QLatin1String("stroke:rgb(%1,%2,%3);")).arg(pcol.red()).arg(pcol.green()).arg(pcol.blue());
+ s += QString::fromLatin1("stroke:rgb(%1,%2,%3);").arg(pcol.red()).arg(pcol.green()).arg(pcol.blue());
if (pcol.alpha() != 255)
- s += QString(QLatin1String("stroke-opacity:%1;")).arg(pcol.alpha()/255.0);
+ s += QString::fromLatin1("stroke-opacity:%1;").arg(pcol.alpha()/255.0);
if (bcol.alpha() != 255)
- s += QString(QLatin1String("fill-opacity:%1;")).arg(bcol.alpha()/255.0);
+ s += QString::fromLatin1("fill-opacity:%1;").arg(bcol.alpha()/255.0);
double pw = cpen.width();
if (pw == 0 && cpen.style() != Qt::NoPen)
pw = 0.9;
if (c == QPicturePrivate::PdcDrawLine)
pw /= (qAbs(worldMatrix.m11()) + qAbs(worldMatrix.m22())) / 2.0;
- s += QString(QLatin1String("stroke-width:%1;")).arg(pw);
+ s += QString::fromLatin1("stroke-width:%1;").arg(pw);
if (cpen.style() == Qt::DashLine)
- s+= QString(QLatin1String("stroke-dasharray:18,6;"));
+ s+= QLatin1String("stroke-dasharray:18,6;");
else if (cpen.style() == Qt::DotLine)
- s+= QString(QLatin1String("stroke-dasharray:3;"));
+ s+= QLatin1String("stroke-dasharray:3;");
else if (cpen.style() == Qt::DashDotLine)
- s+= QString(QLatin1String("stroke-dasharray:9,6,3,6;"));
+ s+= QLatin1String("stroke-dasharray:9,6,3,6;");
else if (cpen.style() == Qt::DashDotDotLine)
- s+= QString(QLatin1String("stroke-dasharray:9,3,3;"));
+ s+= QLatin1String("stroke-dasharray:9,3,3;");
if (cbrush.style() == Qt::NoBrush || c == QPicturePrivate::PdcDrawPolyline || c == QPicturePrivate::PdcDrawCubicBezier)
s += QLatin1String("fill:none;"); // Qt polylines use no brush, neither do Beziers
else
- s += QString(QLatin1String("fill:rgb(%1,%2,%3);")).arg(bcol.red()).arg(bcol.green()).arg(bcol.blue());
+ s += QString::fromLatin1("fill:rgb(%1,%2,%3);").arg(bcol.red()).arg(bcol.green()).arg(bcol.blue());
}
e->setAttribute(QLatin1String("style"), s);
}
@@ -679,13 +679,13 @@ void Q3SVGPaintEnginePrivate::applyTransform(QDomElement *e) const
bool rot = (m.m11() != 1.0 || m.m12() != 0.0 ||
m.m21() != 0.0 || m.m22() != 1.0);
if (!rot && (m.dx() != 0.0 || m.dy() != 0.0)) {
- s = QString(QLatin1String("translate(%1,%2)")).arg(m.dx()).arg(m.dy());
+ s = QString::fromLatin1("translate(%1,%2)").arg(m.dx()).arg(m.dy());
} else if (rot) {
if (m.m12() == 0.0 && m.m21() == 0.0 &&
m.dx() == 0.0 && m.dy() == 0.0)
- s = QString(QLatin1String("scale(%1,%2)")).arg(m.m11()).arg(m.m22());
+ s = QString::fromLatin1("scale(%1,%2)").arg(m.m11()).arg(m.m22());
else
- s = QString(QLatin1String("matrix(%1,%2,%3,%4,%5,%6)"))
+ s = QString::fromLatin1("matrix(%1,%2,%3,%4,%5,%6)")
.arg(m.m11()).arg(m.m12())
.arg(m.m21()).arg(m.m22())
.arg(m.dx()).arg(m.dy());
@@ -730,9 +730,9 @@ bool Q3SVGPaintEngine::play(QPainter *pt)
d->brect.setX(x);
d->brect.setY(y);
QString wstr = attr.contains(QLatin1String("width"))
- ? attr.namedItem(QLatin1String("width")).nodeValue() : QString(QLatin1String("100%"));
+ ? attr.namedItem(QLatin1String("width")).nodeValue() : QString::fromLatin1("100%");
QString hstr = attr.contains(QLatin1String("height"))
- ? attr.namedItem(QLatin1String("height")).nodeValue() : QString(QLatin1String("100%"));
+ ? attr.namedItem(QLatin1String("height")).nodeValue() : QString::fromLatin1("100%");
double width = d->parseLen(wstr, 0, true);
double height = d->parseLen(hstr, 0, false);
// SVG doesn't respect x and y. But we want a proper bounding rect.
diff --git a/src/qt3support/sql/q3datatable.cpp b/src/qt3support/sql/q3datatable.cpp
index 638aff8..d8d3c2b 100644
--- a/src/qt3support/sql/q3datatable.cpp
+++ b/src/qt3support/sql/q3datatable.cpp
@@ -1726,8 +1726,6 @@ void Q3DataTable::repaintCell( int row, int col )
the content coordinate system. If \a selected is true the cell has
been selected and would normally be rendered differently than an
unselected cell.
-
- \sa QSql::isNull()
*/
void Q3DataTable::paintCell( QPainter * p, int row, int col, const QRect & cr,
diff --git a/src/qt3support/sql/q3sqlcursor.cpp b/src/qt3support/sql/q3sqlcursor.cpp
index 6b0c69f..aa6aae2 100644
--- a/src/qt3support/sql/q3sqlcursor.cpp
+++ b/src/qt3support/sql/q3sqlcursor.cpp
@@ -879,7 +879,7 @@ QString Q3SqlCursor::toString(const QString& prefix, QSqlField* field, const QSt
{
QString f;
if (field && driver()) {
- f = (prefix.length() > 0 ? prefix + QLatin1Char('.') : QString()) + field->name();
+ f = (prefix.length() > 0 ? prefix + QLatin1Char('.') : QString()) + driver()->escapeIdentifier(field->name(), QSqlDriver::FieldName);
f += QLatin1Char(' ') + fieldSep + QLatin1Char(' ');
if (field->isNull()) {
f += QLatin1String("NULL");
diff --git a/src/qt3support/text/q3richtext.cpp b/src/qt3support/text/q3richtext.cpp
index 219c319..6af23ae 100644
--- a/src/qt3support/text/q3richtext.cpp
+++ b/src/qt3support/text/q3richtext.cpp
@@ -1678,7 +1678,7 @@ void Q3TextDocument::setRichTextInternal(const QString &text, Q3TextCursor* curs
if (curtag.style->displayMode() == Q3StyleSheetItem::DisplayListItem) {
// we are in a li and a new block comes along
- if (nstyle->name() == QString(QLatin1String("ul")) || nstyle->name() == QLatin1String("ol"))
+ if (nstyle->name() == QLatin1String("ul") || nstyle->name() == QLatin1String("ol"))
hasNewPar = false; // we want an empty li (like most browsers)
if (!hasNewPar) {
/* do not add new blocks inside
@@ -1857,7 +1857,7 @@ void Q3TextDocument::setRichTextInternal(const QString &text, Q3TextCursor* curs
curtag.format = curtag.format.makeTextFormat(nstyle, attr, scaleFontsFactor);
if (nstyle->isAnchor()) {
if (!anchorName.isEmpty())
- anchorName += QLatin1String("#") + attr[QLatin1String("name")];
+ anchorName += QLatin1Char('#') + attr[QLatin1String("name")];
else
anchorName = attr[QLatin1String("name")];
curtag.anchorHref = attr[QLatin1String("href")];
@@ -2436,7 +2436,7 @@ QString Q3TextDocument::richText() const
list_type = QLatin1String(" type=") + list_style_to_string(p->listStyle());
for (int i = pastListDepth; i < listDepth; i++) {
s += list_is_ordered(p->listStyle()) ? QLatin1String("<ol") : QLatin1String("<ul");
- s += list_type + QLatin1String(">");
+ s += list_type + QLatin1Char('>');
}
} else {
s += QLatin1Char('\n');
@@ -2463,7 +2463,7 @@ QString Q3TextDocument::richText() const
s += margin_to_string(item_li, p->utm, p->ubm, p->ulm, p->urm, p->uflm);
s += list_value_to_string(p->listValue());
s += direction_to_string(p->direction());
- s += QLatin1String(">");
+ s += QLatin1Char('>');
s += ps;
s += QLatin1String("</li>");
} else if (p->listDepth()) {
@@ -2471,7 +2471,7 @@ QString Q3TextDocument::richText() const
s += align_to_string(p->alignment());
s += margin_to_string(item_div, p->utm, p->ubm, p->ulm, p->urm, p->uflm);
s += direction_to_string(p->direction());
- s += QLatin1String(">");
+ s += QLatin1Char('>');
s += ps;
s += QLatin1String("</div>");
} else {
@@ -2480,7 +2480,7 @@ QString Q3TextDocument::richText() const
s += align_to_string(p->alignment());
s += margin_to_string(item_p, p->utm, p->ubm, p->ulm, p->urm, p->uflm);
s += direction_to_string(p->direction());
- s += QLatin1String(">");
+ s += QLatin1Char('>');
s += ps;
s += QLatin1String("</p>");
}
@@ -6667,7 +6667,7 @@ Q3TextImage::Q3TextImage(Q3TextDocument *p, const QMap<QString, QString> &attr,
imageName = attr[QLatin1String("source")];
if (!imageName.isEmpty()) {
- imgId = QString(QLatin1String("%1,%2,%3,%4")).arg(imageName).arg(width).arg(height).arg((ulong)&factory);
+ imgId = QString::fromLatin1("%1,%2,%3,%4").arg(imageName).arg(width).arg(height).arg((ulong)&factory);
if (!pixmap_map)
pixmap_map = new QMap<QString, QPixmapInt>;
if (pixmap_map->contains(imgId)) {
@@ -6761,13 +6761,13 @@ QString Q3TextImage::richText() const
s += QLatin1String("<img ");
QMap<QString, QString>::ConstIterator it = attributes.begin();
for (; it != attributes.end(); ++it) {
- s += it.key() + QLatin1String("=");
+ s += it.key() + QLatin1Char('=');
if ((*it).contains(QLatin1Char(' ')))
- s += QLatin1String("\"") + *it + QLatin1String("\" ");
+ s += QLatin1Char('\"') + *it + QLatin1String("\" ");
else
- s += *it + QLatin1String(" ");
+ s += *it + QLatin1Char(' ');
}
- s += QLatin1String(">");
+ s += QLatin1Char('>');
return s;
}
@@ -7722,7 +7722,7 @@ QString Q3TextTable::richText() const
s = QLatin1String("<table ");
QMap<QString, QString>::ConstIterator it = attributes.begin();
for (; it != attributes.end(); ++it)
- s += it.key() + QLatin1String("=") + *it + QLatin1String(" ");
+ s += it.key() + QLatin1Char('=') + *it + QLatin1Char(' ');
s += QLatin1String(">\n");
int lastRow = -1;
@@ -7739,8 +7739,8 @@ QString Q3TextTable::richText() const
s += QLatin1String("<td");
it = cell->attributes.constBegin();
for (; it != cell->attributes.constEnd(); ++it)
- s += QLatin1String(" ") + it.key() + QLatin1String("=") + *it;
- s += QLatin1String(">");
+ s += QLatin1Char(' ') + it.key() + QLatin1Char('=') + *it;
+ s += QLatin1Char('>');
s += cell->richText()->richText();
s += QLatin1String("</td>");
}
diff --git a/src/qt3support/text/q3textedit.cpp b/src/qt3support/text/q3textedit.cpp
index b3e0f31..2d56ea7 100644
--- a/src/qt3support/text/q3textedit.cpp
+++ b/src/qt3support/text/q3textedit.cpp
@@ -77,7 +77,7 @@
#include <qkeysequence.h>
#define ACCEL_KEY(k) QLatin1Char('\t') + QString(QKeySequence(Qt::CTRL | Qt::Key_ ## k))
#else
-#define ACCEL_KEY(k) QLatin1Char('\t' )+ QString(QLatin1String("Ctrl+" #k))
+#define ACCEL_KEY(k) QLatin1Char('\t' )+ QString::fromLatin1("Ctrl+" #k)
#endif
#ifdef QT_TEXTEDIT_OPTIMIZATION
@@ -6625,7 +6625,7 @@ void Q3TextEdit::optimSetTextFormat(Q3TextDocument * td, Q3TextCursor * cur,
}
if (tag) {
QString col = tag->tag.simplified();
- if (col.left(10) == QLatin1String("font color")) {
+ if (col.startsWith(QLatin1String("font color"))) {
int i = col.indexOf(QLatin1Char('='), 10);
col = col.mid(i + 1).simplified();
if (col[0] == QLatin1Char('\"'))
diff --git a/src/qt3support/tools/q3cstring.cpp b/src/qt3support/tools/q3cstring.cpp
index 39f1c43..b33b9b6 100644
--- a/src/qt3support/tools/q3cstring.cpp
+++ b/src/qt3support/tools/q3cstring.cpp
@@ -77,11 +77,23 @@ QT_BEGIN_NAMESPACE
and '\0' (NUL byte) terminated; otherwise the results are
undefined.
- A Q3CString that has not been assigned to anything is \e null, i.e.
- both the length and the data pointer is 0. A Q3CString that
- references the empty string ("", a single '\0' char) is \e empty.
- Both null and empty Q3CStrings are legal parameters to the methods.
- Assigning \c{const char *} 0 to Q3CString produces a null Q3CString.
+ A default constructed Q3CString is \e null, i.e. both the length
+ and the data pointer are 0 and isNull() returns true.
+
+ \note However, if you ask for the data pointer of a null Q3CString
+ by calling data(), then because the internal representation of the
+ null Q3CString is shared, it will be detached and replaced with a
+ non-shared, empty representation, a non-null data pointer will be
+ returned, and subsequent calls to isNull() will return false. But
+ if you ask for the data pointer of a null Q3CString by calling
+ constData(), the shared internal representation is not detached, a
+ null data pointer is returned, and subsequent calls to isNull()
+ will continue to return true.
+
+ A Q3CString that references the empty string ("", a single '\0'
+ char) is \e empty, i.e. isEmpty() returns true. Both null and
+ empty Q3CStrings are legal parameters to the methods. Assigning
+ \c{const char *} 0 to Q3CString produces a null Q3CString.
The length() function returns the length of the string; resize()
resizes the string and truncate() truncates the string. A string
@@ -321,6 +333,16 @@ QT_BEGIN_NAMESPACE
Returns true if the string is null, i.e. if data() == 0; otherwise
returns false. A null string is also an empty string.
+ \note If you ask for the data pointer of a null Q3CString by
+ calling data(), then because the internal representation of the
+ null Q3CString is shared, it will be detached and replaced with a
+ non-shared, empty representation, a non-null data pointer will be
+ returned, and subsequent calls to isNull() will return false. But
+ if you ask for the data pointer of a null Q3CString by calling
+ constData(), the shared internal representation is not detached, a
+ null data pointer is returned, and subsequent calls to isNull()
+ will continue to return true.
+
Example:
\snippet doc/src/snippets/code/src.qt3support.tools.q3cstring.cpp 1
diff --git a/src/qt3support/widgets/q3action.cpp b/src/qt3support/widgets/q3action.cpp
index 49b21c7..074e54e 100644
--- a/src/qt3support/widgets/q3action.cpp
+++ b/src/qt3support/widgets/q3action.cpp
@@ -415,7 +415,7 @@ static QString qt_stripMenuText(QString s)
s.remove(QLatin1String("..."));
s.remove(QLatin1Char('&'));
return s.trimmed();
-};
+}
/*!
Constructs an action called \a name with parent \a parent.
diff --git a/src/qt3support/widgets/q3datetimeedit.cpp b/src/qt3support/widgets/q3datetimeedit.cpp
index b6e303c..71a8ffd 100644
--- a/src/qt3support/widgets/q3datetimeedit.cpp
+++ b/src/qt3support/widgets/q3datetimeedit.cpp
@@ -114,39 +114,21 @@ static void readLocaleSettings()
lTimeSep = new QString();
#if defined(Q_WS_WIN)
- QT_WA({
- TCHAR data[10];
- GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDATE, data, 10);
- *lDateSep = QString::fromUtf16((ushort*)data);
- GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIME, data, 10);
- *lTimeSep = QString::fromUtf16((ushort*)data);
- GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ITIME, data, 10);
- lAMPM = QString::fromUtf16((ushort*)data).toInt()==0;
- GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S1159, data, 10);
- QString am = QString::fromUtf16((ushort*)data);
- if (!am.isEmpty())
- lAM = new QString(am);
- GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S2359, data, 10);
- QString pm = QString::fromUtf16((ushort*)data);
- if (!pm.isEmpty() )
- lPM = new QString(pm);
- } , {
- char data[10];
- GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SDATE, (char*)&data, 10);
- *lDateSep = QString::fromLocal8Bit(data);
- GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_STIME, (char*)&data, 10);
- *lTimeSep = QString::fromLocal8Bit(data);
- GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_ITIME, (char*)&data, 10);
- lAMPM = QString::fromLocal8Bit(data).toInt()==0;
- GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_S1159, (char*)&data, 10);
- QString am = QString::fromLocal8Bit(data);
- if (!am.isEmpty())
- lAM = new QString(am);
- GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_S2359, (char*)&data, 10);
- QString pm = QString::fromLocal8Bit(data);
- if (!pm.isEmpty())
- lPM = new QString(pm);
- });
+ wchar_t data[10];
+ GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDATE, data, 10);
+ *lDateSep = QString::fromWCharArray(data);
+ GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIME, data, 10);
+ *lTimeSep = QString::fromWCharArray(data);
+ GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ITIME, data, 10);
+ lAMPM = QString::fromWCharArray(data).toInt() == 0;
+ GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S1159, data, 10);
+ QString am = QString::fromWCharArray(data);
+ if (!am.isEmpty())
+ lAM = new QString(am);
+ GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S2359, data, 10);
+ QString pm = QString::fromWCharArray(data);
+ if (!pm.isEmpty() )
+ lPM = new QString(pm);
#else
*lDateSep = QLatin1Char('-');
*lTimeSep = QLatin1Char(':');
@@ -1262,7 +1244,7 @@ Q3DateEdit::Order Q3DateEdit::order() const
}
-/*! \reimp
+/*! \internal
*/
void Q3DateEdit::stepUp()
@@ -1294,7 +1276,7 @@ void Q3DateEdit::stepUp()
-/*! \reimp
+/*! \internal
*/
@@ -1458,7 +1440,7 @@ bool Q3DateEdit::outOfRange(int y, int m, int d) const
return false; /* assume ok */
}
-/*! \reimp
+/*! \internal
*/
@@ -1552,7 +1534,7 @@ void Q3DateEdit::addNumber(int sec, int num)
}
-/*! \reimp
+/*! \internal
*/
@@ -1699,7 +1681,7 @@ void Q3DateEdit::removeFirstNumber(int sec)
d->ed->repaint(d->ed->rect());
}
-/*! \reimp
+/*! \internal
*/
@@ -2077,7 +2059,7 @@ void Q3TimeEdit::timerEvent(QTimerEvent *)
}
-/*! \reimp
+/*! \internal
*/
@@ -2123,7 +2105,7 @@ void Q3TimeEdit::stepUp()
}
-/*! \reimp
+/*! \internal
*/
@@ -2191,7 +2173,7 @@ QString Q3TimeEdit::sectionFormattedText(int sec)
}
-/*! \reimp
+/*! \internal
*/
@@ -2326,7 +2308,7 @@ bool Q3TimeEdit::outOfRange(int h, int m, int s) const
return true;
}
-/*! \reimp
+/*! \internal
*/
@@ -2495,7 +2477,7 @@ void Q3TimeEdit::removeFirstNumber(int sec)
d->ed->repaint(d->ed->rect());
}
-/*! \reimp
+/*! \internal
*/
void Q3TimeEdit::removeLastNumber(int sec)
@@ -2666,13 +2648,12 @@ Q3DateTimeEdit::~Q3DateTimeEdit()
}
-/*!
+/*! \fn void Q3DateTimeEdit::resizeEvent(QResizeEvent *event)
\reimp
- Intercepts and handles resize events which have special meaning
- for the Q3DateTimeEdit.
+ Intercepts and handles the resize \a event, which hase a
+ special meaning for the Q3DateTimeEdit.
*/
-
void Q3DateTimeEdit::resizeEvent(QResizeEvent *)
{
int dw = de->sizeHint().width();
diff --git a/src/qt3support/widgets/q3dockarea.cpp b/src/qt3support/widgets/q3dockarea.cpp
index a00bc81..d76835a 100644
--- a/src/qt3support/widgets/q3dockarea.cpp
+++ b/src/qt3support/widgets/q3dockarea.cpp
@@ -473,24 +473,25 @@ int Q3DockAreaLayout::widthForHeight(int h) const
contain Q3ToolBars since Q3ToolBar is a Q3DockWindow subclass.
QMainWindow contains four Q3DockAreas which you can use for your
- Q3ToolBars and Q3DockWindows, so in most situations you do not need
- to use the Q3DockArea class directly. Although QMainWindow contains
- support for its own dock areas it isn't convenient for adding new
- Q3DockAreas. If you need to create your own dock areas we suggest
- that you create a subclass of QWidget and add your Q3DockAreas to
- your subclass.
+ Q3ToolBars and Q3DockWindows, so in most situations you do not
+ need to use the Q3DockArea class directly. Although QMainWindow
+ contains support for its own dock areas, you can't add new ones.
+ You also can't add a Q3DockArea to your own subclass of QWidget.
+ It won't be shown.
\img qmainwindow-qdockareas.png QMainWindow's Q3DockAreas
\target lines
- \e Lines. Q3DockArea uses the concept of lines. A line is a
- horizontal region which may contain dock windows side-by-side. A
- dock area may have room for more than one line. When dock windows
- are docked into a dock area they are usually added at the right
- hand side of the top-most line that has room (unless manually
- placed by the user). When users move dock windows they may leave
- empty lines or gaps in non-empty lines. Qt::Dock windows can be lined
- up to minimize wasted space using the lineUp() function.
+ \section1 Lines.
+
+ Q3DockArea uses the concept of lines. A line is a horizontal
+ region which may contain dock windows side-by-side. A dock area
+ may have room for more than one line. When dock windows are docked
+ into a dock area they are usually added at the right hand side of
+ the top-most line that has room (unless manually placed by the
+ user). When users move dock windows they may leave empty lines or
+ gaps in non-empty lines. Qt::Dock windows can be lined up to
+ minimize wasted space using the lineUp() function.
The Q3DockArea class maintains a position list of all its child
dock windows. Qt::Dock windows are added to a dock area from position
diff --git a/src/qt3support/widgets/q3mainwindow.cpp b/src/qt3support/widgets/q3mainwindow.cpp
index 6af473a..beed5ec 100644
--- a/src/qt3support/widgets/q3mainwindow.cpp
+++ b/src/qt3support/widgets/q3mainwindow.cpp
@@ -2261,7 +2261,7 @@ static void saveDockArea(QTextStream &ts, Q3DockArea *a)
for (int i = 0; i < l.size(); ++i) {
Q3DockWindow *dw = l.at(i);
ts << QString(dw->windowTitle());
- ts << ",";
+ ts << ',';
}
ts << endl;
ts << *a;
@@ -2287,7 +2287,7 @@ QTextStream &operator<<(QTextStream &ts, const Q3MainWindow &mainWindow)
for (int i = 0; i < l.size(); ++i) {
Q3DockWindow *dw = l.at(i);
ts << dw->windowTitle();
- ts << ",";
+ ts << ',';
}
ts << endl;
@@ -2295,17 +2295,17 @@ QTextStream &operator<<(QTextStream &ts, const Q3MainWindow &mainWindow)
for (int i = 0; i < l.size(); ++i) {
Q3DockWindow *dw = l.at(i);
ts << dw->windowTitle();
- ts << ",";
+ ts << ',';
}
ts << endl;
for (int i = 0; i < l.size(); ++i) {
Q3DockWindow *dw = l.at(i);
- ts << "[" << dw->windowTitle() << ","
- << (int)dw->geometry().x() << ","
- << (int)dw->geometry().y() << ","
- << (int)dw->geometry().width() << ","
- << (int)dw->geometry().height() << ","
- << (int)dw->isVisible() << "]";
+ ts << '[' << dw->windowTitle() << ','
+ << (int)dw->geometry().x() << ','
+ << (int)dw->geometry().y() << ','
+ << (int)dw->geometry().width() << ','
+ << (int)dw->geometry().height() << ','
+ << (int)dw->isVisible() << ']';
}
ts << endl;
diff --git a/src/qt3support/widgets/q3scrollview.cpp b/src/qt3support/widgets/q3scrollview.cpp
index cea385a..95e2117 100644
--- a/src/qt3support/widgets/q3scrollview.cpp
+++ b/src/qt3support/widgets/q3scrollview.cpp
@@ -669,7 +669,7 @@ bool Q3ScrollView::isVerticalSliderPressed()
}
/*!
- \reimp
+ \internal
*/
void Q3ScrollView::styleChange(QStyle& old)
{
@@ -679,7 +679,7 @@ void Q3ScrollView::styleChange(QStyle& old)
}
/*!
- \reimp
+ \internal
*/
void Q3ScrollView::fontChange(const QFont &old)
{
diff --git a/src/qt3support/widgets/q3titlebar.cpp b/src/qt3support/widgets/q3titlebar.cpp
index a05e4e5..ee3decf 100644
--- a/src/qt3support/widgets/q3titlebar.cpp
+++ b/src/qt3support/widgets/q3titlebar.cpp
@@ -173,35 +173,20 @@ void Q3TitleBarPrivate::readColors()
bool colorsInitialized = false;
#ifdef Q_WS_WIN // ask system properties on windows
-#ifndef SPI_GETGRADIENTCAPTIONS
-#define SPI_GETGRADIENTCAPTIONS 0x1008
-#endif
-#ifndef COLOR_GRADIENTACTIVECAPTION
-#define COLOR_GRADIENTACTIVECAPTION 27
-#endif
-#ifndef COLOR_GRADIENTINACTIVECAPTION
-#define COLOR_GRADIENTINACTIVECAPTION 28
-#endif
if (QApplication::desktopSettingsAware()) {
pal.setColor(QPalette::Active, QPalette::Highlight, colorref2qrgb(GetSysColor(COLOR_ACTIVECAPTION)));
pal.setColor(QPalette::Inactive, QPalette::Highlight, colorref2qrgb(GetSysColor(COLOR_INACTIVECAPTION)));
pal.setColor(QPalette::Active, QPalette::HighlightedText, colorref2qrgb(GetSysColor(COLOR_CAPTIONTEXT)));
pal.setColor(QPalette::Inactive, QPalette::HighlightedText, colorref2qrgb(GetSysColor(COLOR_INACTIVECAPTIONTEXT)));
- if (QSysInfo::WindowsVersion != QSysInfo::WV_95 && QSysInfo::WindowsVersion != QSysInfo::WV_NT) {
- colorsInitialized = true;
- BOOL gradient;
- QT_WA({
- SystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &gradient, 0);
- } , {
- SystemParametersInfoA(SPI_GETGRADIENTCAPTIONS, 0, &gradient, 0);
- });
- if (gradient) {
- pal.setColor(QPalette::Active, QPalette::Base, colorref2qrgb(GetSysColor(COLOR_GRADIENTACTIVECAPTION)));
- pal.setColor(QPalette::Inactive, QPalette::Base, colorref2qrgb(GetSysColor(COLOR_GRADIENTINACTIVECAPTION)));
- } else {
- pal.setColor(QPalette::Active, QPalette::Base, pal.color(QPalette::Active, QPalette::Highlight));
- pal.setColor(QPalette::Inactive, QPalette::Base, pal.color(QPalette::Inactive, QPalette::Highlight));
- }
+ colorsInitialized = true;
+ BOOL gradient = false;
+ SystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &gradient, 0);
+ if (gradient) {
+ pal.setColor(QPalette::Active, QPalette::Base, colorref2qrgb(GetSysColor(COLOR_GRADIENTACTIVECAPTION)));
+ pal.setColor(QPalette::Inactive, QPalette::Base, colorref2qrgb(GetSysColor(COLOR_GRADIENTINACTIVECAPTION)));
+ } else {
+ pal.setColor(QPalette::Active, QPalette::Base, pal.color(QPalette::Active, QPalette::Highlight));
+ pal.setColor(QPalette::Inactive, QPalette::Base, pal.color(QPalette::Inactive, QPalette::Highlight));
}
}
#endif // Q_WS_WIN