From af619623dd14055b8d37a49f48b14a33dc7ae048 Mon Sep 17 00:00:00 2001 From: Norwegian Rock Cat Date: Tue, 14 Jul 2009 11:14:11 +0200 Subject: 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 --- src/gui/kernel/qwidget.cpp | 4 +--- src/gui/kernel/qwidget_mac.mm | 4 +++- 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(static_cast(QCFString(filePath)))]; + QFileInfo fi(filePath); + [qt_mac_window_for(q) setRepresentedFilename:fi.exists() ? qt_mac_QStringToNSString(filePath) : @""]; #else bool validRef = false; FSRef ref; -- cgit v0.12