summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNorwegian Rock Cat <qt-info@nokia.com>2009-07-14 09:14:11 (GMT)
committerNorwegian Rock Cat <qt-info@nokia.com>2009-07-14 09:18:24 (GMT)
commitaf619623dd14055b8d37a49f48b14a33dc7ae048 (patch)
tree23612e75ad53b5d41caa186e3d7133d9b1f207ec
parente3c1fdc994a3743f5c69d944003b1c67698ba6d8 (diff)
downloadQt-af619623dd14055b8d37a49f48b14a33dc7ae048.zip
Qt-af619623dd14055b8d37a49f48b14a33dc7ae048.tar.gz
Qt-af619623dd14055b8d37a49f48b14a33dc7ae048.tar.bz2
Make the window title set by setWindowFilePath() match our docs.
On the mac, we were setting the absolute path of the file passed in while we document that we only set the filename. The filename is actually what all the other Mac apps do, so we should really do it. Unfortunately, this task laid around longer than it should, but the description text was bad. Additionally, fix a bug in the Cocoa version where we would set a proxy icon for items that didn't exist, this is not a good idea. Task-number: 220501 Reviewed-by: Trust Me
-rw-r--r--src/gui/kernel/qwidget.cpp4
-rw-r--r--src/gui/kernel/qwidget_mac.mm4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index c21ebda..5f076ff 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -5443,8 +5443,6 @@ QString QWidget::windowIconText() const
\list
\o The file name of the specified path, obtained using QFileInfo::fileName().
- \o An optional \c{*} character, if the \l windowModified property is set,
- as per the Apple Human Interface Guidelines.
\endlist
On Windows and X11:
@@ -5493,7 +5491,7 @@ void QWidgetPrivate::setWindowFilePath_helper(const QString &filePath)
{
if (extra->topextra && extra->topextra->caption.isEmpty()) {
#ifdef Q_WS_MAC
- setWindowTitle_helper(filePath);
+ setWindowTitle_helper(QFileInfo(filePath).fileName());
#else
Q_Q(QWidget);
Q_UNUSED(filePath);
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index 6cdb5fe..5577224 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -83,6 +83,7 @@
#include "qcursor.h"
#include "qdesktopwidget.h"
#include "qevent.h"
+#include "qfileinfo.h"
#include "qimage.h"
#include "qlayout.h"
#include "qmenubar.h"
@@ -2886,7 +2887,8 @@ void QWidgetPrivate::setWindowFilePath_sys(const QString &filePath)
Q_Q(QWidget);
#ifdef QT_MAC_USE_COCOA
QMacCocoaAutoReleasePool pool;
- [qt_mac_window_for(q) setRepresentedFilename:reinterpret_cast<const NSString *>(static_cast<CFStringRef>(QCFString(filePath)))];
+ QFileInfo fi(filePath);
+ [qt_mac_window_for(q) setRepresentedFilename:fi.exists() ? qt_mac_QStringToNSString(filePath) : @""];
#else
bool validRef = false;
FSRef ref;