Changeset 846 for trunk/src/gui/dialogs
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 63 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/dialogs/dialogs.pri
r573 r846 51 51 52 52 win32 { 53 HEADERS += dialogs/qwizard_win_p.h 53 HEADERS += dialogs/qwizard_win_p.h \ 54 dialogs/qfiledialog_win_p.h 54 55 SOURCES += dialogs/qdialogsbinarycompat_win.cpp \ 55 56 dialogs/qfiledialog_win.cpp \ … … 108 109 dialogs/qprintpreviewdialog.cpp 109 110 111 symbian:contains(QT_CONFIG, s60) { 112 LIBS += -lCommonDialogs 113 SOURCES += dialogs/qfiledialog_symbian.cpp \ 114 dialogs/qcolordialog_symbian.cpp 115 } 116 110 117 FORMS += dialogs/qpagesetupwidget.ui 111 118 RESOURCES += dialogs/qprintdialog.qrc 112 119 RESOURCES += dialogs/qmessagebox.qrc 120 121 # Compensate for lack of platform defines in Symbian3 122 symbian: DEFINES += SYMBIAN_VERSION_$$upper($$replace(SYMBIAN_VERSION,\\.,_)) -
trunk/src/gui/dialogs/qabstractpagesetupdialog.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/dialogs/qabstractpagesetupdialog.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/dialogs/qabstractpagesetupdialog_p.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/dialogs/qabstractprintdialog.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 66 66 Use QPrintDialog to display a print dialog in your application. 67 67 68 In Symbian, there is no support for printing. Hence, this dialog should not 69 be used in Symbian. 70 68 71 \sa QPrintDialog, QPrinter, {Printing with Qt} 69 72 */ … … 77 80 \value Selection Only the selection should be printed. 78 81 \value PageRange The specified page range should be printed. 82 \value CurrentPage Only the currently visible page should be printed. 79 83 80 84 \sa QPrinter::PrintRange … … 90 94 \value PrintSelection The print selection option is enabled. 91 95 \value PrintPageRange The page range selection option is enabled. 92 \value PrintCollateCopies 96 \value PrintShowPageSize Show the page size + margins page only if this is enabled. 97 \value PrintCollateCopies The collate copies option is enabled 98 \value PrintCurrentPage The print current page option is enabled 93 99 94 100 This value is obsolete and does nothing since Qt 4.5: … … 98 104 This is no longer supported in Qt 4.5. If you want to use sheets, use 99 105 QPrintDialog::open() instead. 100 101 \value PrintShowPageSize Show the page size + margins page only if this is enabled.102 106 */ 103 107 -
trunk/src/gui/dialogs/qabstractprintdialog.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 66 66 AllPages, 67 67 Selection, 68 PageRange 68 PageRange, 69 CurrentPage 69 70 }; 70 71 … … 76 77 PrintShowPageSize = 0x0008, 77 78 PrintCollateCopies = 0x0010, 78 DontUseSheet = 0x0020 79 DontUseSheet = 0x0020, 80 PrintCurrentPage = 0x0040 79 81 }; 80 82 -
trunk/src/gui/dialogs/qabstractprintdialog_p.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/dialogs/qcolordialog.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 1953 1953 */ 1954 1954 1955 /* 1956 For Symbian color dialogs 1957 */ 1958 #ifdef Q_WS_S60 1959 extern QColor qtSymbianGetColor(const QColor &initial); 1960 #endif 1955 1961 /*! 1956 1962 \since 4.5 … … 1962 1968 1963 1969 The \a options argument allows you to customize the dialog. 1970 1971 On Symbian, this static function will use the native color dialog and not a QColorDialog. 1972 On Symbian the parameters \a title and \a parent has no relevance and the 1973 \a options parameter is only used to define if the native color dialog is 1974 used or not. 1964 1975 */ 1965 1976 QColor QColorDialog::getColor(const QColor &initial, QWidget *parent, const QString &title, 1966 1977 ColorDialogOptions options) 1967 1978 { 1979 #ifdef Q_WS_S60 1980 if (!(options & DontUseNativeDialog)) 1981 return qtSymbianGetColor(initial); 1982 #endif 1968 1983 QColorDialog dlg(parent); 1969 1984 if (!title.isEmpty()) … … 1980 1995 dialog is a child of \a parent. It returns an invalid (see 1981 1996 QColor::isValid()) color if the user cancels the dialog. 1997 1998 On Symbian, this static function will use the native 1999 color dialog and not a QColorDialog. 1982 2000 */ 1983 2001 1984 2002 QColor QColorDialog::getColor(const QColor &initial, QWidget *parent) 1985 2003 { 2004 #ifdef Q_WS_S60 2005 return qtSymbianGetColor(initial); 2006 #endif 1986 2007 return getColor(initial, parent, QString(), ColorDialogOptions(0)); 1987 2008 } -
trunk/src/gui/dialogs/qcolordialog.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/dialogs/qcolordialog_mac.mm
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 66 66 QT_USE_NAMESPACE 67 67 68 @class Q CocoaColorPanelDelegate;69 70 @interface Q CocoaColorPanelDelegate: NSObject<NSWindowDelegate> {68 @class QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate); 69 70 @interface QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) : NSObject<NSWindowDelegate> { 71 71 NSColorPanel *mColorPanel; 72 72 NSView *mStolenContentView; … … 100 100 @end 101 101 102 @implementation Q CocoaColorPanelDelegate102 @implementation QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) 103 103 - (id)initWithColorPanel:(NSColorPanel *)panel 104 104 stolenContentView:(NSView *)stolenContentView … … 433 433 } 434 434 435 delegate = [[Q CocoaColorPanelDelegatealloc] initWithColorPanel:colorPanel435 delegate = [[QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) alloc] initWithColorPanel:colorPanel 436 436 stolenContentView:stolenContentView 437 437 okButton:okButton 438 438 cancelButton:cancelButton 439 439 priv:this]; 440 [colorPanel setDelegate:static_cast<Q CocoaColorPanelDelegate*>(delegate)];440 [colorPanel setDelegate:static_cast<QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) *>(delegate)]; 441 441 } 442 442 [delegate setResultSet:false]; 443 443 setCocoaPanelColor(initial); 444 [static_cast<Q CocoaColorPanelDelegate*>(delegate) showColorPanel];444 [static_cast<QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) *>(delegate) showColorPanel]; 445 445 } 446 446 447 447 void QColorDialogPrivate::closeCocoaColorPanel() 448 448 { 449 [static_cast<Q CocoaColorPanelDelegate*>(delegate) onCancelClicked];449 [static_cast<QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) *>(delegate) onCancelClicked]; 450 450 } 451 451 452 452 void QColorDialogPrivate::releaseCocoaColorPanelDelegate() 453 453 { 454 [static_cast<Q CocoaColorPanelDelegate*>(delegate) release];454 [static_cast<QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) *>(delegate) release]; 455 455 } 456 456 … … 472 472 void QColorDialogPrivate::_q_macRunNativeAppModalPanel() 473 473 { 474 [static_cast<Q CocoaColorPanelDelegate*>(delegate) exec];474 [static_cast<QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) *>(delegate) exec]; 475 475 } 476 476 … … 478 478 { 479 479 QMacCocoaAutoReleasePool pool; 480 Q CocoaColorPanelDelegate *theDelegate = static_cast<QCocoaColorPanelDelegate*>(delegate);480 QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) *theDelegate = static_cast<QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) *>(delegate); 481 481 NSColor *nsColor; 482 482 const QColor::Spec spec = color.spec(); -
trunk/src/gui/dialogs/qcolordialog_p.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/dialogs/qdialog.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 68 68 # include "qfiledialog.h" 69 69 # include "qfontdialog.h" 70 # include "qcolordialog.h"71 70 # include "qwizard.h" 71 # include "private/qt_s60_p.h" 72 72 #endif 73 73 74 74 #if defined(Q_WS_S60) 75 #include "private/qt_s60_p.h"75 #include <AknUtils.h> // AknLayoutUtils 76 76 #endif 77 77 … … 259 259 QDialog::QDialog(QWidget *parent, Qt::WindowFlags f) 260 260 : QWidget(*new QDialogPrivate, parent, 261 f | QFlag((f & Qt::WindowType_Mask) == 0 ? Qt::Dialog : 0))261 f | ((f & Qt::WindowType_Mask) == 0 ? Qt::Dialog : Qt::WindowType(0))) 262 262 { 263 263 #ifdef Q_WS_WINCE … … 283 283 : QWidget(*new QDialogPrivate, parent, 284 284 f 285 | QFlag(modal ? Qt::WShowModal : 0)286 | QFlag((f & Qt::WindowType_Mask) == 0 ? Qt::Dialog : 0)285 | QFlag(modal ? Qt::WShowModal : Qt::WindowType(0)) 286 | QFlag((f & Qt::WindowType_Mask) == 0 ? Qt::Dialog : Qt::WindowType(0)) 287 287 ) 288 288 { … … 296 296 */ 297 297 QDialog::QDialog(QDialogPrivate &dd, QWidget *parent, Qt::WindowFlags f) 298 : QWidget(dd, parent, f | QFlag((f & Qt::WindowType_Mask) == 0 ? Qt::Dialog : 0))298 : QWidget(dd, parent, f | ((f & Qt::WindowType_Mask) == 0 ? Qt::Dialog : Qt::WindowType(0))) 299 299 { 300 300 #ifdef Q_WS_WINCE … … 394 394 } 395 395 396 #if defined(Q_WS_WINCE) || defined(Q_ WS_S60)396 #if defined(Q_WS_WINCE) || defined(Q_OS_SYMBIAN) 397 397 #ifdef Q_WS_WINCE_WM 398 398 void QDialogPrivate::_q_doneAction() … … 414 414 result = true; 415 415 } 416 #el se416 #elif defined(Q_WS_S60) 417 417 if ((e->type() == QEvent::StyleChange) || (e->type() == QEvent::Resize )) { 418 418 if (!testAttribute(Qt::WA_Moved)) { … … 424 424 } 425 425 } 426 // TODO is Symbian, non-S60 behaviour required? 426 427 #endif 427 428 return result; … … 528 529 #endif //Q_WS_WINCE_WM 529 530 531 bool showSystemDialogFullScreen = false; 530 532 #ifdef Q_OS_SYMBIAN 531 533 if (qobject_cast<QFileDialog *>(this) || qobject_cast<QFontDialog *>(this) || 532 qobject_cast<Q ColorDialog *>(this) || qobject_cast<QWizard *>(this))533 show Maximized();534 else534 qobject_cast<QWizard *>(this)) { 535 showSystemDialogFullScreen = true; 536 } 535 537 #endif // Q_OS_SYMBIAN 536 538 537 show(); 539 if (showSystemDialogFullScreen) { 540 setWindowFlags(windowFlags() | Qt::WindowSoftkeysVisibleHint); 541 setWindowState(Qt::WindowFullScreen); 542 } 543 show(); 538 544 539 545 #ifdef Q_WS_MAC … … 642 648 w = w->isWindow() ? 0 : w->parentWidget(); 643 649 if (w) { 644 Q Menu p(this);645 QAction *wt = p. addAction(tr("What's This?"));646 if (p. exec(e->globalPos()) == wt) {650 QWeakPointer<QMenu> p = new QMenu(this); 651 QAction *wt = p.data()->addAction(tr("What's This?")); 652 if (p.data()->exec(e->globalPos()) == wt) { 647 653 QHelpEvent e(QEvent::WhatsThis, w->rect().center(), 648 654 w->mapToGlobal(w->rect().center())); 649 655 QApplication::sendEvent(w, &e); 650 656 } 657 delete p.data(); 651 658 } 652 659 #endif … … 818 825 #endif 819 826 820 #ifdef Q_ WS_S60821 if (s 60AdjustedPosition())827 #ifdef Q_OS_SYMBIAN 828 if (symbianAdjustedPosition()) 822 829 //dialog has already been positioned 823 830 return; … … 887 894 } 888 895 896 #if defined(Q_OS_SYMBIAN) 897 /*! \internal */ 898 bool QDialog::symbianAdjustedPosition() 899 { 889 900 #if defined(Q_WS_S60) 890 /*! \internal */891 bool QDialog::s60AdjustedPosition()892 {893 901 QPoint p; 894 const QSize mainAreaSize = QApplication::desktop()->availableGeometry(QCursor::pos()).size(); 895 const int statusPaneHeight = (S60->screenHeightInPixels - mainAreaSize.height())>>1; 896 const bool doS60Positioning = !(isFullScreen()||isMaximized()); 897 if (doS60Positioning) { 902 QPoint oldPos = pos(); 903 if (isFullScreen()) { 904 p.setX(0); 905 p.setY(0); 906 } else if (isMaximized()) { 907 TRect statusPaneRect = TRect(); 908 if (S60->screenHeightInPixels > S60->screenWidthInPixels) { 909 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStatusPane, statusPaneRect); 910 } else { 911 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStaconTop, statusPaneRect); 912 } 913 914 p.setX(0); 915 p.setY(statusPaneRect.Height()); 916 } else { 898 917 // naive way to deduce screen orientation 899 918 if (S60->screenHeightInPixels > S60->screenWidthInPixels) { 900 919 int cbaHeight; 901 const CEikButtonGroupContainer* bgContainer = S60->buttonGroupContainer(); 902 if (!bgContainer) { 903 cbaHeight = 0; 904 } else { 905 cbaHeight = qt_TSize2QSize(bgContainer->Size()).height(); 906 } 920 TRect rect; 921 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EControlPane, rect); 922 cbaHeight = rect.Height(); 907 923 p.setY(S60->screenHeightInPixels - height() - cbaHeight); 908 924 p.setX(0); … … 934 950 } 935 951 } 952 } 953 if (oldPos != p || p.y() < 0) 936 954 move(p); 937 } 938 return doS60Positioning; 955 return true; 956 #else 957 // TODO - check positioning requirement for Symbian, non-s60 958 return false; 959 #endif 939 960 } 940 961 #endif … … 1102 1123 if (minimumSize() != maximumSize()) { 1103 1124 // In S60, dialogs are always the width of screen (in portrait, regardless of current layout) 1104 return QSize(qM ax(S60->screenHeightInPixels, S60->screenWidthInPixels), QWidget::sizeHint().height());1125 return QSize(qMin(S60->screenHeightInPixels, S60->screenWidthInPixels), QWidget::sizeHint().height()); 1105 1126 } else { 1106 1127 return QWidget::sizeHint(); -
trunk/src/gui/dialogs/qdialog.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 108 108 QDialog(QDialogPrivate &, QWidget *parent, Qt::WindowFlags f = 0); 109 109 110 #if defined(Q_WS_WINCE) || defined(Q_ WS_S60)110 #if defined(Q_WS_WINCE) || defined(Q_OS_SYMBIAN) 111 111 bool event(QEvent *e); 112 112 #endif … … 124 124 Q_DISABLE_COPY(QDialog) 125 125 126 #if defined(Q_ WS_S60)127 bool s 60AdjustedPosition();126 #if defined(Q_OS_SYMBIAN) 127 bool symbianAdjustedPosition(); 128 128 #endif 129 129 -
trunk/src/gui/dialogs/qdialog_p.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/dialogs/qdialogsbinarycompat_win.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/dialogs/qerrormessage.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 71 71 #if defined(QT_SOFTKEYS_ENABLED) 72 72 #include <qaction.h> 73 #endif 73 74 #ifdef Q_WS_S60 74 75 #include "private/qt_s60_p.h" 75 #endif76 76 #endif 77 77 -
trunk/src/gui/dialogs/qerrormessage.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/dialogs/qfiledialog.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 229 229 \value ReadOnly Indicates that the model is readonly. 230 230 231 \value HideNameFilterDetails Indicates if the is hidden or not. 231 \value HideNameFilterDetails Indicates if the file name filter details are 232 hidden or not. 232 233 233 234 \value DontUseSheet In previous versions of Qt, the static … … 302 303 #include <qshortcut.h> 303 304 #ifdef Q_WS_MAC 304 #include <private/qunicodetables_p.h>305 305 #include <qmacstyle_mac.h> 306 306 #endif … … 723 723 // updates the state correctly, but skips showing the non-native version: 724 724 setAttribute(Qt::WA_DontShowOnScreen); 725 #ifndef QT_NO_FSCOMPLETER 726 //So the completer don't try to complete and therefore to show a popup 727 d->completer->setModel(0); 728 #endif 725 729 } else { 726 730 d->nativeDialogInUse = false; 727 731 setAttribute(Qt::WA_DontShowOnScreen, false); 732 #ifndef QT_NO_FSCOMPLETER 733 if (d->proxyModel != 0) 734 d->completer->setModel(d->proxyModel); 735 else 736 d->completer->setModel(d->model); 737 #endif 728 738 } 729 739 } … … 1607 1617 #endif 1608 1618 1619 /* 1620 For Symbian file dialogs 1621 */ 1622 #if defined(Q_WS_S60) 1623 extern QString qtSymbianGetOpenFileName(const QString &caption, 1624 const QString &dir, 1625 const QString &filter); 1626 1627 extern QStringList qtSymbianGetOpenFileNames(const QString &caption, 1628 const QString &dir, 1629 const QString &filter); 1630 1631 extern QString qtSymbianGetSaveFileName(const QString &caption, 1632 const QString &dir); 1633 1634 extern QString qtSymbianGetExistingDirectory(const QString &caption, 1635 const QString &dir); 1636 #endif 1637 1609 1638 /*! 1610 1639 This is a convenience static function that returns an existing file … … 1635 1664 then a default caption will be used. 1636 1665 1637 On Windows and Mac OS X, this static function will use the native file1638 dialog and not a QFileDialog.1666 On Windows, Mac OS X and Symbian^3, this static function will use the 1667 native file dialog and not a QFileDialog. 1639 1668 1640 1669 On Windows the dialog will spin a blocking modal event loop that will not … … 1647 1676 \a options includes DontResolveSymlinks, the file dialog will treat 1648 1677 symlinks as regular directories. 1678 1679 On Symbian^3 the parameter \a selectedFilter has no meaning and the 1680 \a options parameter is only used to define if the native file dialog is 1681 used. 1649 1682 1650 1683 \warning Do not delete \a parent during the execution of the dialog. If you … … 1663 1696 if (qt_filedialog_open_filename_hook && !(options & DontUseNativeDialog)) 1664 1697 return qt_filedialog_open_filename_hook(parent, caption, dir, filter, selectedFilter, options); 1698 #if defined(Q_WS_S60) 1699 if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0 && !(options & DontUseNativeDialog)) 1700 return qtSymbianGetOpenFileName(caption, dir, filter); 1701 #endif 1665 1702 QFileDialogArgs args; 1666 1703 args.parent = parent; … … 1713 1750 then a default caption will be used. 1714 1751 1715 On Windows and Mac OS X, this static function will use the native file1716 dialog and not a QFileDialog.1752 On Windows, Mac OS X and Symbian^3, this static function will use the 1753 native file dialog and not a QFileDialog. 1717 1754 1718 1755 On Windows the dialog will spin a blocking modal event loop that will not … … 1732 1769 \snippet doc/src/snippets/code/src_gui_dialogs_qfiledialog.cpp 10 1733 1770 1771 On Symbian^3 the parameter \a selectedFilter has no meaning and the 1772 \a options parameter is only used to define if the native file dialog is 1773 used. On Symbian^3, this function can only return a single filename. 1774 1734 1775 \warning Do not delete \a parent during the execution of the dialog. If you 1735 1776 want to do this, you should create the dialog yourself using one of the … … 1747 1788 if (qt_filedialog_open_filenames_hook && !(options & DontUseNativeDialog)) 1748 1789 return qt_filedialog_open_filenames_hook(parent, caption, dir, filter, selectedFilter, options); 1790 #if defined(Q_WS_S60) 1791 if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0 && !(options & DontUseNativeDialog)) 1792 return qtSymbianGetOpenFileNames(caption, dir, filter); 1793 #endif 1749 1794 QFileDialogArgs args; 1750 1795 args.parent = parent; … … 1804 1849 a default caption will be used. 1805 1850 1806 On Windows and Mac OS X, this static function will use the native file1807 dialog and not a QFileDialog.1851 On Windows, Mac OS X and Symbian^3, this static function will use the 1852 native file dialog and not a QFileDialog. 1808 1853 1809 1854 On Windows the dialog will spin a blocking modal event loop that will not … … 1817 1862 \a options includes DontResolveSymlinks the file dialog will treat symlinks 1818 1863 as regular directories. 1864 1865 On Symbian^3 the parameters \a filter and \a selectedFilter have no 1866 meaning. The \a options parameter is only used to define if the native file 1867 dialog is used. 1819 1868 1820 1869 \warning Do not delete \a parent during the execution of the dialog. If you … … 1833 1882 if (qt_filedialog_save_filename_hook && !(options & DontUseNativeDialog)) 1834 1883 return qt_filedialog_save_filename_hook(parent, caption, dir, filter, selectedFilter, options); 1884 #if defined(Q_WS_S60) 1885 if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0 && !(options & DontUseNativeDialog)) 1886 return qtSymbianGetSaveFileName(caption, dir); 1887 #endif 1835 1888 QFileDialogArgs args; 1836 1889 args.parent = parent; … … 1881 1934 be set. 1882 1935 1883 On Windows and Mac OS X, this static function will use the native file1884 dialog and not a QFileDialog. On Windows CE, if the device has no native1885 file dialog, a QFileDialog will be used.1936 On Windows, Mac OS X and Symbian^3, this static function will use the 1937 native file dialog and not a QFileDialog. On Windows CE, if the device has 1938 no native file dialog, a QFileDialog will be used. 1886 1939 1887 1940 On Unix/X11, the normal behavior of the file dialog is to resolve and … … 1895 1948 dialog just below the parent's title bar. 1896 1949 1950 On Symbian^3 the \a options parameter is only used to define if the native 1951 file dialog is used. 1952 1897 1953 \warning Do not delete \a parent during the execution of the dialog. If you 1898 1954 want to do this, you should create the dialog yourself using one of the … … 1908 1964 if (qt_filedialog_existing_directory_hook && !(options & DontUseNativeDialog)) 1909 1965 return qt_filedialog_existing_directory_hook(parent, caption, dir, options); 1966 #if defined(Q_WS_S60) 1967 if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0 && !(options & DontUseNativeDialog)) 1968 return qtSymbianGetExistingDirectory(caption, dir); 1969 #endif 1910 1970 QFileDialogArgs args; 1911 1971 args.parent = parent; -
trunk/src/gui/dialogs/qfiledialog.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 68 68 Q_OBJECT 69 69 Q_ENUMS(ViewMode FileMode AcceptMode Option) 70 Q_FLAGS(Options) 70 71 Q_PROPERTY(ViewMode viewMode READ viewMode WRITE setViewMode) 71 72 Q_PROPERTY(FileMode fileMode READ fileMode WRITE setFileMode) -
trunk/src/gui/dialogs/qfiledialog.ui
r769 r846 2 2 <comment>********************************************************************* 3 3 ** 4 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).4 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 5 5 ** All rights reserved. 6 6 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/dialogs/qfiledialog_embedded.ui
r651 r846 2 2 <comment>********************************************************************* 3 3 ** 4 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).4 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 5 5 ** All rights reserved. 6 6 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/dialogs/qfiledialog_mac.mm
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 83 83 QT_USE_NAMESPACE 84 84 85 @class Q NSOpenSavePanelDelegate;86 87 @interface Q NSOpenSavePanelDelegate: NSObject {85 @class QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate); 86 87 @interface QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) : NSObject { 88 88 @public 89 89 NSOpenPanel *mOpenPanel; … … 120 120 - (void)createTextField; 121 121 - (void)createPopUpButton:(const QString &)selectedFilter hideDetails:(BOOL)hideDetails; 122 - (QStringList)findStrippedFilterWithVisualFilterName:(QString)name; 122 123 - (void)createAccessory; 123 124 124 125 @end 125 126 126 @implementation Q NSOpenSavePanelDelegate127 @implementation QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) 127 128 128 129 - (id)initWithAcceptMode:(QT_PREPEND_NAMESPACE(QFileDialog::AcceptMode))acceptMode 129 130 title:(const QString &)title 130 nameFilters:(const QStringList &)nameFilters131 selectedNameFilter:(const QString &)selectedNameFilter132 131 hideNameFilterDetails:(bool)hideNameFilterDetails 133 132 qDirFilter:(QT_PREPEND_NAMESPACE(QDir::Filters))qDirFilter … … 159 158 mLastFilterCheckPath = new QString; 160 159 mQDirFilterEntryList = new QStringList; 161 mNameFilterDropDownList = new QStringList(nameFilters); 162 mSelectedNameFilter = new QStringList(qt_clean_filter_list(selectedNameFilter)); 160 mNameFilterDropDownList = new QStringList(priv->nameFilters); 161 QString selectedVisualNameFilter = priv->qFileDialogUi->fileTypeCombo->currentText(); 162 mSelectedNameFilter = new QStringList([self findStrippedFilterWithVisualFilterName:selectedVisualNameFilter]); 163 163 164 QFileInfo sel(selectFile); 164 165 if (sel.isDir()){ … … 169 170 mCurrentSelection = new QString(sel.absoluteFilePath()); 170 171 } 172 171 173 [mSavePanel setTitle:qt_mac_QStringToNSString(title)]; 172 [self createPopUpButton:selected NameFilter hideDetails:hideNameFilterDetails];174 [self createPopUpButton:selectedVisualNameFilter hideDetails:hideNameFilterDetails]; 173 175 [self createTextField]; 174 176 [self createAccessory]; … … 285 287 return NO; 286 288 289 // Always accept directories regardless of their names (unless it is a bundle): 290 BOOL isDir; 291 if ([[NSFileManager defaultManager] fileExistsAtPath:filename isDirectory:&isDir] && isDir) { 292 if ([mSavePanel treatsFilePackagesAsDirectories] == NO) { 293 if ([[NSWorkspace sharedWorkspace] isFilePackageAtPath:filename] == NO) 294 return YES; 295 } 296 } 297 287 298 QString qtFileName = QT_PREPEND_NAMESPACE(qt_mac_NSStringToQString)(filename); 288 299 QFileInfo info(qtFileName.normalized(QT_PREPEND_NAMESPACE(QString::NormalizationForm_C))); … … 295 306 if (!mQDirFilterEntryList->contains(info.fileName())) 296 307 return NO; 297 298 // Always accept directories regardless of their names:299 BOOL isDir;300 if ([[NSFileManager defaultManager] fileExistsAtPath:filename isDirectory:&isDir] && isDir)301 return YES;302 308 303 309 // No filter means accept everything … … 347 353 Q_UNUSED(sender); 348 354 QString selection = mNameFilterDropDownList->value([mPopUpButton indexOfSelectedItem]); 349 *mSelectedNameFilter = QT_PREPEND_NAMESPACE(qt_clean_filter_list)(selection);355 *mSelectedNameFilter = [self findStrippedFilterWithVisualFilterName:selection]; 350 356 [mSavePanel validateVisibleColumns]; 351 357 [self updateProperties]; … … 490 496 QString filter = hideDetails ? [self removeExtensions:filters->at(i)] : filters->at(i); 491 497 [mPopUpButton addItemWithTitle:QT_PREPEND_NAMESPACE(qt_mac_QStringToNSString)(filter)]; 492 if (filters->at(i) == selectedFilter)498 if (filters->at(i).startsWith(selectedFilter)) 493 499 [mPopUpButton selectItemAtIndex:i]; 494 500 } 495 501 } 502 } 503 504 - (QStringList) findStrippedFilterWithVisualFilterName:(QString)name 505 { 506 for (int i=0; i<mNameFilterDropDownList->size(); ++i) { 507 if (mNameFilterDropDownList->at(i).startsWith(name)) 508 return qt_clean_filter_list(mNameFilterDropDownList->at(i)); 509 } 510 return QStringList(); 496 511 } 497 512 … … 551 566 #else 552 567 QMacCocoaAutoReleasePool pool; 553 Q NSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate*>(mDelegate);568 QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate); 554 569 [delegate->mSavePanel setDirectory:qt_mac_QStringToNSString(directory)]; 555 570 #endif … … 562 577 #else 563 578 QMacCocoaAutoReleasePool pool; 564 Q NSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate*>(mDelegate);579 QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate); 565 580 return qt_mac_NSStringToQString([delegate->mSavePanel directory]); 566 581 #endif … … 619 634 #else 620 635 QMacCocoaAutoReleasePool pool; 621 Q NSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate*>(mDelegate);636 QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate); 622 637 return [delegate selectedFiles]; 623 638 #endif … … 630 645 #else 631 646 QMacCocoaAutoReleasePool pool; 632 Q NSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate*>(mDelegate);647 QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate); 633 648 bool hideDetails = q_func()->testOption(QFileDialog::HideNameFilterDetails); 634 649 [delegate setNameFilters:filters hideDetails:hideDetails]; … … 642 657 Q_Q(QFileDialog); 643 658 QMacCocoaAutoReleasePool pool; 644 Q NSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate*>(mDelegate);659 QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate); 645 660 *(delegate->mQDirFilter) = model->filter(); 646 661 delegate->mFileMode = fileMode; … … 665 680 #else 666 681 QMacCocoaAutoReleasePool pool; 667 Q NSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate*>(mDelegate);682 QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate); 668 683 [delegate->mPopUpButton selectItemAtIndex:index]; 669 684 [delegate filterChanged:nil]; … … 678 693 #else 679 694 QMacCocoaAutoReleasePool pool; 680 Q NSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate*>(mDelegate);695 QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate); 681 696 int index = [delegate->mPopUpButton indexOfSelectedItem]; 682 697 #endif … … 693 708 #else 694 709 QMacCocoaAutoReleasePool pool; 695 [reinterpret_cast<Q NSOpenSavePanelDelegate*>(mDelegate) release];710 [reinterpret_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate) release]; 696 711 mDelegate = 0; 697 712 #endif … … 704 719 if (!visible == q->isHidden()) 705 720 return false; 721 722 if (q->windowFlags() & Qt::WindowStaysOnTopHint) { 723 // The native file dialog tries all it can to stay 724 // on the NSModalPanel level. And it might also show 725 // its own "create directory" dialog that we cannot control. 726 // So we need to use the non-native version in this case... 727 return false; 728 } 706 729 707 730 #ifndef QT_MAC_USE_COCOA … … 726 749 NavFileOrFolderInfo *theInfo = static_cast<NavFileOrFolderInfo *>(info); 727 750 QString file; 751 QString path; 728 752 const QtMacFilterName &fn 729 753 = fileDialogPrivate->filterInfo.filters.at(fileDialogPrivate->filterInfo.currentSelection); … … 733 757 UInt8 str_buffer[1024]; 734 758 FSRefMakePath(&ref, str_buffer, 1024); 735 file= QString::fromUtf8(reinterpret_cast<const char *>(str_buffer));736 int slsh = file.lastIndexOf(QLatin1Char('/'));759 path = QString::fromUtf8(reinterpret_cast<const char *>(str_buffer)); 760 int slsh = path.lastIndexOf(QLatin1Char('/')); 737 761 if (slsh != -1) 738 file = file.right(file.length() - slsh - 1); 762 file = path.right(path.length() - slsh - 1); 763 else 764 file = path; 739 765 } 740 766 QStringList reg = fn.regexp.split(QLatin1String(";")); … … 748 774 return true; 749 775 } 750 return (theInfo->isFolder && !file.endsWith(QLatin1String(".app"))); 776 777 if (theInfo->isFolder) { 778 if ([[NSWorkspace sharedWorkspace] isFilePackageAtPath:qt_mac_QStringToNSString(path)]) 779 return false; 780 return true; 781 } 782 return false; 751 783 } 752 784 … … 770 802 fileDialogPrivate->filterInfo.currentSelection); 771 803 QStringList reg = fn.regexp.split(QLatin1String(";"), QString::SkipEmptyParts); 772 QString r = reg.first(); 773 r = r.right(r.length()-1); // Strip the * 774 base += r; //"." + QString::number(s->menuType); 804 if (reg.count()) { 805 QString r = reg.first(); 806 r = r.right(r.length()-1); // Strip the * 807 base += r; //"." + QString::number(s->menuType); 808 } 775 809 NavDialogSetSaveFileName(p->context, QCFString::toCFStringRef(base)); 776 810 } … … 1022 1056 bool selectDir = q->selectedFiles().isEmpty(); 1023 1057 QString selection(selectDir ? q->directory().absolutePath() : q->selectedFiles().value(0)); 1024 Q NSOpenSavePanelDelegate *delegate = [[QNSOpenSavePanelDelegatealloc]1058 QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = [[QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) alloc] 1025 1059 initWithAcceptMode:acceptMode 1026 1060 title:q->windowTitle() 1027 nameFilters:q->nameFilters()1028 selectedNameFilter:q->selectedNameFilter()1029 1061 hideNameFilterDetails:q->testOption(QFileDialog::HideNameFilterDetails) 1030 1062 qDirFilter:model->filter() … … 1043 1075 QMacCocoaAutoReleasePool pool; 1044 1076 createNSOpenSavePanelDelegate(); 1045 Q NSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate*>(mDelegate);1077 QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate); 1046 1078 if (qt_mac_is_macsheet(q)) 1047 1079 [delegate showWindowModalSheet:q->parentWidget()]; … … 1059 1091 } else { 1060 1092 QMacCocoaAutoReleasePool pool; 1061 Q NSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate*>(mDelegate);1093 QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate); 1062 1094 [delegate closePanel]; 1063 1095 // Even when we hide it, we are still using a … … 1092 1124 Q_Q(QFileDialog); 1093 1125 QMacCocoaAutoReleasePool pool; 1094 Q NSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate*>(mDelegate);1126 QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate); 1095 1127 [delegate runApplicationModalPanel]; 1096 1128 dialogResultCode_sys() == QDialog::Accepted ? q->accept() : q->reject(); … … 1107 1139 return QDialog::Accepted; 1108 1140 #else 1109 Q NSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate*>(mDelegate);1141 QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate); 1110 1142 return [delegate dialogResultCode]; 1111 1143 #endif -
trunk/src/gui/dialogs/qfiledialog_p.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/dialogs/qfiledialog_win.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 53 53 #include <qdir.h> 54 54 #include <qstringlist.h> 55 #include <qlibrary.h> 55 #include <private/qsystemlibrary_p.h> 56 #include "qfiledialog_win_p.h" 56 57 57 58 #ifndef QT_NO_THREAD … … 59 60 #endif 60 61 62 #ifdef Q_WS_WINCE 61 63 #include <shlobj.h> 62 //At some point we can hope that mingw will support that interface 63 #if !defined(Q_WS_WINCE) && !defined(Q_CC_MINGW) 64 #include <shobjidl.h> 64 #include <commdlg.h> 65 bool qt_priv_ptr_valid = false; 66 #else 67 //we have to declare them here because they're not present for all SDK/compilers 68 static const IID QT_IID_IFileOpenDialog = {0xd57c7288, 0xd4ad, 0x4768, {0xbe, 0x02, 0x9d, 0x96, 0x95, 0x32, 0xd9, 0x60} }; 69 static const IID QT_IID_IShellItem = {0x43826d1e, 0xe718, 0x42ee, {0xbc, 0x55, 0xa1, 0xe2, 0x61, 0xc3, 0x7b, 0xfe} }; 70 static const CLSID QT_CLSID_FileOpenDialog = {0xdc1c5a9c, 0xe88a, 0x4dde, {0xa5, 0xa1, 0x60, 0xf8, 0x2a, 0x20, 0xae, 0xf7} }; 65 71 #endif 66 72 67 #include <objbase.h> 68 69 #if defined(__IFileDialog_INTERFACE_DEFINED__) \ 70 && defined(__IFileOpenDialog_INTERFACE_DEFINED__) 71 #define USE_COMMON_ITEM_DIALOG 72 #endif 73 74 #ifdef Q_WS_WINCE 75 #include <commdlg.h> 76 # ifndef BFFM_SETSELECTION 77 # define BFFM_SETSELECTION (WM_USER + 102) 78 # endif 79 // Windows Mobile has a broken definition for BROWSEINFO 80 // Only compile fix 81 typedef struct qt_priv_browseinfo { 82 HWND hwndOwner; 83 LPCITEMIDLIST pidlRoot; 84 LPWSTR pszDisplayName; 85 LPCWSTR lpszTitle; 86 UINT ulFlags; 87 BFFCALLBACK lpfn; 88 LPARAM lParam; 89 int iImage; 90 } qt_BROWSEINFO; 91 bool qt_priv_ptr_valid = false; 92 #endif 93 94 95 // Don't remove the lines below! 96 // 97 // resolving the W methods manually is needed, because Windows 95 doesn't include 98 // these methods in Shell32.lib (not even stubs!), so you'd get an unresolved symbol 99 // when Qt calls getExistingDirectory(), etc. 100 typedef LPITEMIDLIST (WINAPI *PtrSHBrowseForFolder)(BROWSEINFO*); 73 74 typedef qt_LPITEMIDLIST (WINAPI *PtrSHBrowseForFolder)(qt_BROWSEINFO*); 101 75 static PtrSHBrowseForFolder ptrSHBrowseForFolder = 0; 102 typedef BOOL (WINAPI *PtrSHGetPathFromIDList)( LPITEMIDLIST,LPWSTR);76 typedef BOOL (WINAPI *PtrSHGetPathFromIDList)(qt_LPITEMIDLIST, LPWSTR); 103 77 static PtrSHGetPathFromIDList ptrSHGetPathFromIDList = 0; 104 78 typedef HRESULT (WINAPI *PtrSHGetMalloc)(LPMALLOC *); … … 127 101 triedResolve = true; 128 102 #if !defined(Q_WS_WINCE) 129 Q Library lib(QLatin1String("shell32"));130 ptrSHBrowseForFolder = (PtrSHBrowseForFolder) 131 ptrSHGetPathFromIDList = (PtrSHGetPathFromIDList) 132 ptrSHGetMalloc = (PtrSHGetMalloc) 103 QSystemLibrary lib(L"shell32"); 104 ptrSHBrowseForFolder = (PtrSHBrowseForFolder)lib.resolve("SHBrowseForFolderW"); 105 ptrSHGetPathFromIDList = (PtrSHGetPathFromIDList)lib.resolve("SHGetPathFromIDListW"); 106 ptrSHGetMalloc = (PtrSHGetMalloc)lib.resolve("SHGetMalloc"); 133 107 #else 134 108 // CE stores them in a different lib and does not use unicode version 135 HINSTANCE handle = LoadLibrary W(L"Ceshell");109 HINSTANCE handle = LoadLibrary(L"Ceshell"); 136 110 ptrSHBrowseForFolder = (PtrSHBrowseForFolder)GetProcAddress(handle, L"SHBrowseForFolder"); 137 111 ptrSHGetPathFromIDList = (PtrSHGetPathFromIDList)GetProcAddress(handle, L"SHGetPathFromIDList"); … … 245 219 246 220 ofn->lStructSize = sizeof(OPENFILENAME); 247 Q_ASSERT(!parent ||parent->testAttribute(Qt::WA_WState_Created));248 221 ofn->hwndOwner = parent ? parent->winId() : 0; 249 222 ofn->lpstrFilter = (wchar_t*)tFilters.utf16(); … … 422 395 423 396 424 #if defined(USE_COMMON_ITEM_DIALOG)397 #ifndef Q_WS_WINCE 425 398 426 399 typedef HRESULT (WINAPI *PtrSHCreateItemFromParsingName)(PCWSTR pszPath, IBindCtx *pbc, REFIID riid, void **ppv); … … 437 410 if (!pSHCreateItemFromParsingName) { 438 411 // This function is available only in Vista & above. 439 Q Library shellLib(QLatin1String("Shell32"));412 QSystemLibrary shellLib(QLatin1String("Shell32")); 440 413 pSHCreateItemFromParsingName = (PtrSHCreateItemFromParsingName) 441 414 shellLib.resolve("SHCreateItemFromParsingName"); … … 470 443 if (numFilters) { 471 444 wchar_t *szData = (wchar_t*)winfilters.utf16(); 472 COMDLG_FILTERSPEC *filterSpec = newCOMDLG_FILTERSPEC[numFilters];445 qt_COMDLG_FILTERSPEC *filterSpec = new qt_COMDLG_FILTERSPEC[numFilters]; 473 446 for(int i = 0; i<numFilters; i++) { 474 447 filterSpec[i].pszName = szData+offsets[i*2]; … … 482 455 if (!tInitDir.isEmpty()) { 483 456 IShellItem *psiDefaultFolder; 484 hr = pSHCreateItemFromParsingName((wchar_t*)tInitDir.utf16(), 485 NULL, 486 IID_PPV_ARGS(&psiDefaultFolder)); 457 hr = pSHCreateItemFromParsingName((wchar_t*)tInitDir.utf16(), NULL, QT_IID_IShellItem, 458 reinterpret_cast<void**>(&psiDefaultFolder)); 487 459 488 460 if (SUCCEEDED(hr)) { … … 523 495 } 524 496 525 QStringList qt_win_CID_get_open_file_names(const QFileDialogArgs &args,497 static QStringList qt_win_CID_get_open_file_names(const QFileDialogArgs &args, 526 498 QString *initialDirectory, 527 499 const QStringList &filterList, … … 536 508 // Multiple selection is allowed only in IFileOpenDialog. 537 509 IFileOpenDialog *pfd = 0; 538 HRESULT hr = CoCreateInstance(CLSID_FileOpenDialog, 539 NULL, 540 CLSCTX_INPROC_SERVER, 541 IID_PPV_ARGS(&pfd)); 510 HRESULT hr = CoCreateInstance(QT_CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER, QT_IID_IFileOpenDialog, 511 reinterpret_cast<void**>(&pfd)); 542 512 543 513 if (SUCCEEDED(hr)) { … … 613 583 } 614 584 585 QString qt_win_CID_get_existing_directory(const QFileDialogArgs &args) 586 { 587 QString result; 588 QDialog modal_widget; 589 modal_widget.setAttribute(Qt::WA_NoChildEventsForParent, true); 590 modal_widget.setParent(args.parent, Qt::Window); 591 QApplicationPrivate::enterModal(&modal_widget); 592 593 IFileOpenDialog *pfd = 0; 594 HRESULT hr = CoCreateInstance(QT_CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER, 595 QT_IID_IFileOpenDialog, reinterpret_cast<void**>(&pfd)); 596 597 if (SUCCEEDED(hr)) { 598 qt_win_set_IFileDialogOptions(pfd, args.selection, 599 args.directory, args.caption, 600 QStringList(), QFileDialog::ExistingFiles, 601 args.options); 602 603 // Set the FOS_PICKFOLDERS flag 604 DWORD newOptions; 605 hr = pfd->GetOptions(&newOptions); 606 newOptions |= FOS_PICKFOLDERS; 607 if (SUCCEEDED(hr) && SUCCEEDED((hr = pfd->SetOptions(newOptions)))) { 608 QWidget *parentWindow = args.parent; 609 if (parentWindow) 610 parentWindow = parentWindow->window(); 611 else 612 parentWindow = QApplication::activeWindow(); 613 614 // Show the file dialog. 615 hr = pfd->Show(parentWindow ? parentWindow->winId() : 0); 616 if (SUCCEEDED(hr)) { 617 // Retrieve the result 618 IShellItem *psi = 0; 619 hr = pfd->GetResult(&psi); 620 if (SUCCEEDED(hr)) { 621 // Retrieve the file name from shell item. 622 wchar_t *pszPath; 623 hr = psi->GetDisplayName(SIGDN_FILESYSPATH, &pszPath); 624 if (SUCCEEDED(hr)) { 625 result = QString::fromWCharArray(pszPath); 626 CoTaskMemFree(pszPath); 627 } 628 psi->Release(); // Free the current item. 629 } 630 } 631 } 632 } 633 QApplicationPrivate::leaveModal(&modal_widget); 634 635 qt_win_eatMouseMove(); 636 637 if (pfd) 638 pfd->Release(); 639 return result; 640 } 641 615 642 #endif 616 643 … … 644 671 // GetOpenFileName() will return only one folder name for all the files. To retrieve 645 672 // the correct path for all selected files, we have to use Common Item Dialog interfaces. 646 #if defined(USE_COMMON_ITEM_DIALOG)673 #ifndef Q_WS_WINCE 647 674 if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based) 648 675 return qt_win_CID_get_open_file_names(args, initialDirectory, filterLst, selectedFilter, idx); … … 717 744 if (ptrSHGetPathFromIDList) { 718 745 wchar_t path[MAX_PATH]; 719 ptrSHGetPathFromIDList( LPITEMIDLIST(lParam), path);746 ptrSHGetPathFromIDList(qt_LPITEMIDLIST(lParam), path); 720 747 QString tmpStr = QString::fromWCharArray(path); 721 748 if (!tmpStr.isEmpty()) … … 729 756 } 730 757 731 #ifndef BIF_NEWDIALOGSTYLE 732 #define BIF_NEWDIALOGSTYLE 0x0040 // Use the new dialog layout with the ability to resize 758 QString qt_win_get_existing_directory(const QFileDialogArgs &args) 759 { 760 #ifndef Q_WS_WINCE 761 if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based) 762 return qt_win_CID_get_existing_directory(args); 733 763 #endif 734 764 735 736 QString qt_win_get_existing_directory(const QFileDialogArgs &args)737 {738 765 QString currentDir = QDir::currentPath(); 739 766 QString result; … … 758 785 tTitle = args.caption; 759 786 760 #if !defined(Q_WS_WINCE)761 BROWSEINFO bi;762 #else763 787 qt_BROWSEINFO bi; 764 #endif765 788 766 789 Q_ASSERT(!parent ||parent->testAttribute(Qt::WA_WState_Created)); … … 776 799 qt_win_resolve_libs(); 777 800 if (ptrSHBrowseForFolder) { 778 LPITEMIDLIST pItemIDList = ptrSHBrowseForFolder((BROWSEINFO*)&bi);801 qt_LPITEMIDLIST pItemIDList = ptrSHBrowseForFolder(&bi); 779 802 if (pItemIDList) { 780 803 ptrSHGetPathFromIDList(pItemIDList, path); -
trunk/src/gui/dialogs/qfileinfogatherer.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 56 56 #ifndef QT_NO_FILESYSTEMMODEL 57 57 58 bool QFileInfoGatherer::fetchedRoot = false; 58 #ifdef QT_BUILD_INTERNAL 59 static bool fetchedRoot = false; 60 Q_AUTOTEST_EXPORT void qt_test_resetFetchedRoot() 61 { 62 fetchedRoot = false; 63 } 64 65 Q_AUTOTEST_EXPORT bool qt_test_isFetchedRoot() 66 { 67 return fetchedRoot; 68 } 69 #endif 59 70 60 71 /*! … … 217 228 } 218 229 219 /*220 QFileInfo::permissions is different depending upon your platform.221 222 "normalize this" so they can mean the same to us.223 */224 QFile::Permissions QFileInfoGatherer::translatePermissions(const QFileInfo &fileInfo) const {225 QFile::Permissions permissions = fileInfo.permissions();226 #ifdef Q_OS_WIN227 return permissions;228 #else229 QFile::Permissions p = permissions;230 p &= ~(QFile::ReadUser|QFile::WriteUser|QFile::ExeUser);231 if ( permissions & QFile::ReadOther232 || (fileInfo.ownerId() == userId && permissions & QFile::ReadOwner)233 || (fileInfo.groupId() == groupId && permissions & QFile::ReadGroup))234 p |= QFile::ReadUser;235 236 if ( permissions & QFile::WriteOther237 || (fileInfo.ownerId() == userId && permissions & QFile::WriteOwner)238 || (fileInfo.groupId() == groupId && permissions & QFile::WriteGroup))239 p |= QFile::WriteUser;240 241 if ( permissions & QFile::ExeOther242 || (fileInfo.ownerId() == userId && permissions & QFile::ExeOwner)243 || (fileInfo.groupId() == groupId && permissions & QFile::ExeGroup))244 p |= QFile::ExeUser;245 return p;246 #endif247 }248 249 230 QExtendedInformation QFileInfoGatherer::getInfo(const QFileInfo &fileInfo) const 250 231 { 251 232 QExtendedInformation info(fileInfo); 252 233 info.icon = m_iconProvider->icon(fileInfo); 253 info.setPermissions(translatePermissions(fileInfo));254 234 info.displayType = m_iconProvider->type(fileInfo); 255 235 #ifndef QT_NO_FILESYSTEMWATCHER … … 310 290 // List drives 311 291 if (path.isEmpty()) { 312 #if defined Q_AUTOTEST_EXPORT292 #ifdef QT_BUILD_INTERNAL 313 293 fetchedRoot = true; 314 294 #endif … … 329 309 } 330 310 331 QTime base = QTime::currentTime(); 311 QElapsedTimer base; 312 base.start(); 332 313 QFileInfo fileInfo; 333 314 bool firstTime = true; … … 355 336 if (!updatedFiles.isEmpty()) 356 337 emit updates(path, updatedFiles); 357 } 358 359 void QFileInfoGatherer::fetch(const QFileInfo &fileInfo, QTime &base, bool &firstTime, QList<QPair<QString, QFileInfo> > &updatedFiles, const QString &path) { 338 emit directoryLoaded(path); 339 } 340 341 void QFileInfoGatherer::fetch(const QFileInfo &fileInfo, QElapsedTimer &base, bool &firstTime, QList<QPair<QString, QFileInfo> > &updatedFiles, const QString &path) { 360 342 updatedFiles.append(QPair<QString, QFileInfo>(fileInfo.fileName(), fileInfo)); 361 QTime current = QTime::currentTime(); 343 QElapsedTimer current; 344 current.start(); 362 345 if ((firstTime && updatedFiles.count() > 100) || base.msecsTo(current) > 1000) { 363 346 emit updates(path, updatedFiles); -
trunk/src/gui/dialogs/qfileinfogatherer_p.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 61 61 #include <qfsfileengine.h> 62 62 #include <qpair.h> 63 #include <qstack.h> 63 64 #include <qdatetime.h> 64 #include <qstack.h>65 65 #include <qdir.h> 66 #include <qelapsedtimer.h> 66 67 67 68 QT_BEGIN_NAMESPACE … … 89 90 } 90 91 QFile::Permissions permissions() const { 91 return mPermissions; 92 } 93 94 void setPermissions (QFile::Permissions permissions) { 95 mPermissions = permissions; 92 return mFileInfo.permissions(); 96 93 } 97 94 … … 141 138 private : 142 139 QFileInfo mFileInfo; 143 QFile::Permissions mPermissions;144 140 }; 145 141 … … 156 152 void newListOfFiles(const QString &directory, const QStringList &listOfFiles) const; 157 153 void nameResolved(const QString &fileName, const QString &resolvedName) const; 154 void directoryLoaded(const QString &path); 158 155 159 156 public: … … 179 176 180 177 private: 181 void fetch(const QFileInfo &info, Q Time&base, bool &firstTime, QList<QPair<QString, QFileInfo> > &updatedFiles, const QString &path);178 void fetch(const QFileInfo &info, QElapsedTimer &base, bool &firstTime, QList<QPair<QString, QFileInfo> > &updatedFiles, const QString &path); 182 179 QString translateDriveName(const QFileInfo &drive) const; 183 QFile::Permissions translatePermissions(const QFileInfo &fileInfo) const;184 180 185 181 QMutex mutex; … … 200 196 uint groupId; 201 197 #endif 202 public :203 //for testing purpose204 static bool fetchedRoot;205 198 }; 206 199 #endif // QT_NO_FILESYSTEMMODEL -
trunk/src/gui/dialogs/qfilesystemmodel.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 52 52 #include <qt_windows.h> 53 53 #endif 54 #ifdef Q_OS_WIN32 55 #include <QtCore/QVarLengthArray> 56 #endif 54 57 55 58 QT_BEGIN_NAMESPACE … … 77 80 directories. In the simplest case, it can be used with a suitable display 78 81 widget as part of a browser or filter. 79 80 QFileSystemModel will not fetch any files or directories until setRootPath81 is called. This will prevent any unnecessary querying on the file system82 until that point such as listing the drives on Windows.83 84 Unlike the QDirModel, QFileSystemModel uses a separate thread to populate85 itself so it will not cause the main thread to hang as the file system86 is being queried. Calls to rowCount() will return 0 until the model87 populates a directory.88 89 QFileSystemModel keeps a cache with file information. The cache is90 automatically kept up to date using the QFileSystemWatcher.91 82 92 83 QFileSystemModel can be accessed using the standard interface provided by … … 99 90 \note QFileSystemModel requires an instance of a GUI application. 100 91 92 \section1 Example Usage 93 94 A directory model that displays the contents of a default directory 95 is usually constructed with a parent object: 96 97 \snippet doc/src/snippets/shareddirmodel/main.cpp 2 98 99 A tree view can be used to display the contents of the model 100 101 \snippet doc/src/snippets/shareddirmodel/main.cpp 4 102 103 and the contents of a particular directory can be displayed by 104 setting the tree view's root index: 105 106 \snippet doc/src/snippets/shareddirmodel/main.cpp 7 107 108 The view's root index can be used to control how much of a 109 hierarchical model is displayed. QDirModel provides a convenience 110 function that returns a suitable model index for a path to a 111 directory within the model. 112 113 \section1 Caching and Performance 114 115 QFileSystemModel will not fetch any files or directories until setRootPath() 116 is called. This will prevent any unnecessary querying on the file system 117 until that point such as listing the drives on Windows. 118 119 Unlike QDirModel, QFileSystemModel uses a separate thread to populate 120 itself so it will not cause the main thread to hang as the file system 121 is being queried. Calls to rowCount() will return 0 until the model 122 populates a directory. 123 124 QFileSystemModel keeps a cache with file information. The cache is 125 automatically kept up to date using the QFileSystemWatcher. 126 101 127 \sa {Model Classes} 102 128 */ … … 148 174 This signal is emitted whenever a file with the \a oldName is successfully 149 175 renamed to \a newName. The file is located in in the directory \a path. 176 */ 177 178 /*! 179 \since 4.7 180 \fn void QFileSystemModel::directoryLoaded(const QString &path) 181 182 This signal is emitted when the gatherer thread has finished to load the \a path. 183 150 184 */ 151 185 … … 271 305 } 272 306 273 #ifdef Q_OS_WIN 307 #ifdef Q_OS_WIN32 274 308 static QString qt_GetLongPathName(const QString &strShortPath) 275 309 { 276 QString longPath; 277 int i = 0; 278 if (strShortPath == QLatin1String(".") 279 || (strShortPath.startsWith(QLatin1String("//"))) 280 || (strShortPath.startsWith(QLatin1String("\\\\")))) // unc 310 if (strShortPath.isEmpty() 311 || strShortPath == QLatin1String(".") || strShortPath == QLatin1String("..")) 281 312 return strShortPath; 282 QString::const_iterator it = strShortPath.constBegin(); 283 QString::const_iterator constEnd = strShortPath.constEnd(); 284 do { 285 bool isSep = (*it == QLatin1Char('\\') || *it == QLatin1Char('/')); 286 if (isSep || it == constEnd) { 287 QString section = (it == constEnd ? strShortPath : strShortPath.left(i)); 288 // FindFirstFile does not handle volumes ("C:"), so we have to catch that ourselves. 289 if (section.endsWith(QLatin1Char(':'))) { 290 longPath.append(section.toUpper()); 291 } else { 292 HANDLE h; 293 #ifndef Q_OS_WINCE 294 //We add the extend length prefix to handle long path 295 QString longSection = QLatin1String("\\\\?\\")+QDir::toNativeSeparators(section); 296 #else 297 QString longSection = QDir::toNativeSeparators(section); 298 #endif 299 WIN32_FIND_DATA findData; 300 h = ::FindFirstFile((wchar_t*)longSection.utf16(), &findData); 301 if (h != INVALID_HANDLE_VALUE) { 302 longPath.append(QString::fromWCharArray(findData.cFileName)); 303 ::FindClose(h); 304 } else { 305 longPath.append(section); 306 break; 307 } 308 } 309 if (it != constEnd) 310 longPath.append(*it); 311 else 312 break; 313 } 314 ++it; 315 if (isSep && it == constEnd) // break out if the last character is a separator 316 break; 317 ++i; 318 } while (true); 319 return longPath; 313 if (strShortPath.length() == 2 && strShortPath.endsWith(QLatin1Char(':'))) 314 return strShortPath.toUpper(); 315 const QString absPath = QDir(strShortPath).absolutePath(); 316 if (absPath.startsWith(QLatin1String("//")) 317 || absPath.startsWith(QLatin1String("\\\\"))) // unc 318 return QDir::fromNativeSeparators(absPath); 319 if (absPath.startsWith(QLatin1Char('/'))) 320 return QString(); 321 const QString inputString = QLatin1String("\\\\?\\") + QDir::toNativeSeparators(absPath); 322 QVarLengthArray<TCHAR, MAX_PATH> buffer(MAX_PATH); 323 DWORD result = ::GetLongPathName((wchar_t*)inputString.utf16(), 324 buffer.data(), 325 buffer.size()); 326 if (result > DWORD(buffer.size())) { 327 buffer.resize(result); 328 result = ::GetLongPathName((wchar_t*)inputString.utf16(), 329 buffer.data(), 330 buffer.size()); 331 } 332 if (result > 4) { 333 QString longPath = QString::fromWCharArray(buffer.data() + 4); // ignoring prefix 334 longPath[0] = longPath.at(0).toUpper(); // capital drive letters 335 return QDir::fromNativeSeparators(longPath); 336 } else { 337 return QDir::fromNativeSeparators(strShortPath); 338 } 320 339 } 321 340 #endif … … 335 354 // Construct the nodes up to the new root path if they need to be built 336 355 QString absolutePath; 337 #ifdef Q_OS_WIN 356 #ifdef Q_OS_WIN32 338 357 QString longPath = qt_GetLongPathName(path); 339 358 #else … … 673 692 case Qt::DisplayRole: 674 693 switch (index.column()) { 675 case 0: return d-> name(index);694 case 0: return d->displayName(index); 676 695 case 1: return d->size(index); 677 696 case 2: return d->type(index); … … 789 808 return resolvedSymLinks[fullPath]; 790 809 } 791 // ### TODO it would be nice to grab the volume name if dirNode->parent == root792 810 return dirNode->fileName; 811 } 812 813 /*! 814 \internal 815 */ 816 QString QFileSystemModelPrivate::displayName(const QModelIndex &index) const 817 { 818 #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) 819 QFileSystemNode *dirNode = node(index); 820 if (!dirNode->volumeName.isNull()) 821 return dirNode->volumeName + QLatin1String(" (") + name(index) + QLatin1Char(')'); 822 #endif 823 return name(index); 793 824 } 794 825 … … 1337 1368 Q_D(QFileSystemModel); 1338 1369 #ifdef Q_OS_WIN 1339 QString longNewPath = QDir::fromNativeSeparators(qt_GetLongPathName(newPath)); 1370 #ifdef Q_OS_WIN32 1371 QString longNewPath = qt_GetLongPathName(newPath); 1372 #else 1373 QString longNewPath = QDir::fromNativeSeparators(newPath); 1374 #endif 1340 1375 #else 1341 1376 QString longNewPath = newPath; … … 1649 1684 #ifndef QT_NO_FILESYSTEMWATCHER 1650 1685 node->populate(info); 1686 #endif 1687 #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) 1688 //The parentNode is "" so we are listing the drives 1689 if (parentNode->fileName.isEmpty()) { 1690 wchar_t name[MAX_PATH + 1]; 1691 //GetVolumeInformation requires to add trailing backslash 1692 const QString nodeName = fileName + QLatin1String("\\"); 1693 BOOL success = ::GetVolumeInformation((wchar_t *)(nodeName.utf16()), 1694 name, MAX_PATH + 1, NULL, 0, NULL, NULL, 0); 1695 if (success && name[0]) 1696 node->volumeName = QString::fromWCharArray(name); 1697 } 1651 1698 #endif 1652 1699 parentNode->children.insert(fileName, node); … … 1886 1933 q->connect(&fileInfoGatherer, SIGNAL(nameResolved(QString,QString)), 1887 1934 q, SLOT(_q_resolvedName(QString,QString))); 1935 q->connect(&fileInfoGatherer, SIGNAL(directoryLoaded(QString)), 1936 q, SIGNAL(directoryLoaded(QString))); 1888 1937 q->connect(&delayedSortTimer, SIGNAL(timeout()), q, SLOT(_q_performDelayedSort()), Qt::QueuedConnection); 1938 1939 QHash<int, QByteArray> roles = q->roleNames(); 1940 roles.insertMulti(QFileSystemModel::FileIconRole, "fileIcon"); // == Qt::decoration 1941 roles.insert(QFileSystemModel::FilePathRole, "filePath"); 1942 roles.insert(QFileSystemModel::FileNameRole, "fileName"); 1943 roles.insert(QFileSystemModel::FilePermissions, "filePermissions"); 1944 q->setRoleNames(roles); 1889 1945 } 1890 1946 -
trunk/src/gui/dialogs/qfilesystemmodel.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 71 71 void rootPathChanged(const QString &newPath); 72 72 void fileRenamed(const QString &path, const QString &oldName, const QString &newName); 73 void directoryLoaded(const QString &path); 73 74 74 75 public: -
trunk/src/gui/dialogs/qfilesystemmodel_p.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 121 121 122 122 QString fileName; 123 #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) 124 QString volumeName; 125 #endif 123 126 124 127 inline qint64 size() const { if (info && !info->isDir()) return info->size(); return 0; } … … 302 305 QIcon icon(const QModelIndex &index) const; 303 306 QString name(const QModelIndex &index) const; 307 QString displayName(const QModelIndex &index) const; 304 308 QString filePath(const QModelIndex &index) const; 305 309 QString size(const QModelIndex &index) const; -
trunk/src/gui/dialogs/qfontdialog.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 175 175 Q_Q(QFontDialog); 176 176 177 #ifdef Q_WS_MAC 178 nativeDialogInUse = false; 179 delegate = 0; 180 #endif 181 177 182 q->setSizeGripEnabled(true); 178 183 q->setWindowTitle(QFontDialog::tr("Select Font")); … … 330 335 familyList->setFocus(); 331 336 retranslateStrings(); 332 333 #ifdef Q_WS_MAC334 delegate = 0;335 #endif336 337 } 337 338 … … 346 347 Q_D(QFontDialog); 347 348 if (d->delegate) { 348 QFontDialogPrivate::closeCocoaFontPanel(d->delegate); 349 QFontDialogPrivate::sharedFontPanelAvailable = true; 349 d->closeCocoaFontPanel(); 350 350 return; 351 351 } … … 429 429 const QString &title, QFontDialog::FontDialogOptions options) 430 430 { 431 #ifdef Q_WS_MAC432 if (!(options & QFontDialog::DontUseNativeDialog)433 && QFontDialogPrivate::sharedFontPanelAvailable) {434 return QFontDialogPrivate::execCocoaFontPanel(ok, initial, parent,435 title.isEmpty() ? QFontDialog::tr("Select Font") : title, options);436 }437 #endif438 439 431 QFontDialog dlg(parent); 440 432 dlg.setOptions(options); … … 989 981 void QFontDialog::setVisible(bool visible) 990 982 { 991 Q_D(QFontDialog); 992 if (visible) { 993 if (testAttribute(Qt::WA_WState_ExplicitShowHide) && !testAttribute(Qt::WA_WState_Hidden)) 994 return; 995 } else if (testAttribute(Qt::WA_WState_ExplicitShowHide) && testAttribute(Qt::WA_WState_Hidden)) 983 if (testAttribute(Qt::WA_WState_ExplicitShowHide) && testAttribute(Qt::WA_WState_Hidden) != visible) 996 984 return; 997 985 #ifdef Q_WS_MAC 986 Q_D(QFontDialog); 998 987 if (d->canBeNativeDialog()){ 999 988 if (d->setVisible_sys(visible)){ -
trunk/src/gui/dialogs/qfontdialog.h
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/dialogs/qfontdialog_mac.mm
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 59 59 #endif 60 60 61 QT_BEGIN_NAMESPACE 62 63 extern void macStartInterceptNSPanelCtor(); 64 extern void macStopInterceptNSPanelCtor(); 65 extern NSButton *macCreateButton(const char *text, NSView *superview); 66 extern bool qt_mac_is_macsheet(const QWidget *w); // qwidget_mac.mm 67 68 QT_END_NAMESPACE 61 69 QT_USE_NAMESPACE 62 70 … … 75 83 const int StyleMask = NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask; 76 84 77 @class Q CocoaFontPanelDelegate;85 @class QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate); 78 86 79 87 … … 86 94 #endif 87 95 88 @interface Q CocoaFontPanelDelegate: NSObject <NSWindowDelegate> {96 @interface QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) : NSObject <NSWindowDelegate> { 89 97 NSFontPanel *mFontPanel; 90 98 NSView *mStolenContentView; … … 96 104 CGFloat mDialogExtraWidth; 97 105 CGFloat mDialogExtraHeight; 98 NSModalSession mModalSession; 106 int mReturnCode; 107 BOOL mAppModal; 99 108 } 100 109 - (id)initWithFontPanel:(NSFontPanel *)panel … … 105 114 extraWidth:(CGFloat)extraWidth 106 115 extraHeight:(CGFloat)extraHeight; 116 - (void)showModelessPanel; 117 - (void)showWindowModalSheet:(QWidget *)docWidget; 118 - (void)runApplicationModalPanel; 119 - (BOOL)isAppModal; 107 120 - (void)changeFont:(id)sender; 108 121 - (void)changeAttributes:(id)sender; 109 - (void)setModalSession:(NSModalSession)session;110 122 - (BOOL)windowShouldClose:(id)window; 111 123 - (NSSize)windowWillResize:(NSWindow *)window toSize:(NSSize)proposedFrameSize; … … 121 133 - (void)finishOffWithCode:(NSInteger)result; 122 134 - (void)cleanUpAfterMyself; 135 - (void)setSubwindowStacking; 123 136 @end 124 137 … … 146 159 } 147 160 148 @implementation Q CocoaFontPanelDelegate161 @implementation QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) 149 162 - (id)initWithFontPanel:(NSFontPanel *)panel 150 163 stolenContentView:(NSView *)stolenContentView … … 164 177 mDialogExtraWidth = extraWidth; 165 178 mDialogExtraHeight = extraHeight; 166 mModalSession = 0; 179 mReturnCode = -1; 180 mAppModal = false; 167 181 168 182 if (mPanelHackedWithButtons) { … … 175 189 [cancelButton setTarget:self]; 176 190 } 191 177 192 mQtFont = new QFont(); 178 193 return self; 179 194 } 180 195 196 - (void)setSubwindowStacking 197 { 198 #ifdef QT_MAC_USE_COCOA 199 // Stack the native dialog in front of its parent, if any: 200 QFontDialog *q = mPriv->fontDialog(); 201 if (!qt_mac_is_macsheet(q)) { 202 if (QWidget *parent = q->parentWidget()) { 203 if (parent->isWindow()) { 204 [qt_mac_window_for(parent) 205 addChildWindow:[mStolenContentView window] ordered:NSWindowAbove]; 206 } 207 } 208 } 209 #endif 210 } 211 181 212 - (void)dealloc 182 213 { 183 214 delete mQtFont; 184 215 [super dealloc]; 216 } 217 218 - (void)showModelessPanel 219 { 220 mAppModal = false; 221 NSWindow *ourPanel = [mStolenContentView window]; 222 [ourPanel makeKeyAndOrderFront:self]; 223 } 224 225 - (void)runApplicationModalPanel 226 { 227 QBoolBlocker nativeDialogOnTop(QApplicationPrivate::native_modal_dialog_active); 228 mAppModal = true; 229 NSWindow *ourPanel = [mStolenContentView window]; 230 [ourPanel setReleasedWhenClosed:NO]; 231 [NSApp runModalForWindow:ourPanel]; 232 QAbstractEventDispatcher::instance()->interrupt(); 233 234 if (mReturnCode == NSOKButton) 235 mPriv->fontDialog()->accept(); 236 else 237 mPriv->fontDialog()->reject(); 238 } 239 240 - (BOOL)isAppModal 241 { 242 return mAppModal; 243 } 244 245 - (void)showWindowModalSheet:(QWidget *)docWidget 246 { 247 #ifdef QT_MAC_USE_COCOA 248 NSWindow *window = qt_mac_window_for(docWidget); 249 #else 250 WindowRef hiwindowRef = qt_mac_window_for(docWidget); 251 NSWindow *window = [[NSWindow alloc] initWithWindowRef:hiwindowRef]; 252 CFRetain(hiwindowRef); 253 #endif 254 255 mAppModal = false; 256 NSWindow *ourPanel = [mStolenContentView window]; 257 [NSApp beginSheet:ourPanel 258 modalForWindow:window 259 modalDelegate:0 260 didEndSelector:0 261 contextInfo:0 ]; 262 263 #ifndef QT_MAC_USE_COCOA 264 CFRelease(hiwindowRef); 265 #endif 185 266 } 186 267 … … 215 296 if (mPriv) 216 297 mPriv->updateSampleFont(*mQtFont); 217 }218 219 - (void)setModalSession:(NSModalSession)session220 {221 Q_ASSERT(!mModalSession);222 mModalSession = session;223 298 } 224 299 … … 283 358 284 359 const CGFloat ButtonWidth = qMin(qMax(ButtonMinWidth, 285 qMax(okSizeHint.width, cancelSizeHint.width)), 286 CGFloat((frameSize.width - 2.0 * ButtonSideMargin 287 - ButtonSpacing) * 0.5)); 360 qMax(okSizeHint.width, cancelSizeHint.width)), 361 CGFloat((frameSize.width - 2.0 * ButtonSideMargin - ButtonSpacing) * 0.5)); 288 362 const CGFloat ButtonHeight = qMax(ButtonMinHeight, 289 363 qMax(okSizeHint.height, cancelSizeHint.height)); … … 318 392 [self setQtFont:qfontForCocoaFont([fontManager convertFont:[fontManager selectedFont]], 319 393 *mQtFont)]; 320 [[mStolenContentView window] close];321 394 [self finishOffWithCode:NSOKButton]; 322 395 } … … 325 398 { 326 399 Q_ASSERT(mPanelHackedWithButtons); 327 [[mStolenContentView window] close];328 400 [self finishOffWithCode:NSCancelButton]; 329 401 } … … 369 441 - (void)finishOffWithCode:(NSInteger)code 370 442 { 371 if (mPriv) { 372 if (mModalSession) { 373 [NSApp endModalSession:mModalSession]; 374 mModalSession = 0; 443 #ifdef QT_MAC_USE_COCOA 444 QFontDialog *q = mPriv->fontDialog(); 445 if (QWidget *parent = q->parentWidget()) { 446 if (parent->isWindow()) { 447 [qt_mac_window_for(parent) removeChildWindow:[mStolenContentView window]]; 375 448 } 376 // Hack alert! 377 // Since this code path was never intended to be followed when starting from exec 378 // we need to force the dialog to communicate the new font, otherwise the signal 379 // won't get emitted. 380 if(code == NSOKButton) 381 mPriv->sampleEdit->setFont([self qtFont]); 382 mPriv->done((code == NSOKButton) ? QDialog::Accepted : QDialog::Rejected); 449 } 450 #endif 451 452 if(code == NSOKButton) 453 mPriv->sampleEdit->setFont([self qtFont]); 454 455 if (mAppModal) { 456 mReturnCode = code; 457 [NSApp stopModalWithCode:code]; 383 458 } else { 384 [NSApp stopModalWithCode:code]; 459 if (code == NSOKButton) 460 mPriv->fontDialog()->accept(); 461 else 462 mPriv->fontDialog()->reject(); 385 463 } 386 464 } … … 409 487 QT_BEGIN_NAMESPACE 410 488 411 extern void macStartInterceptNSPanelCtor(); 412 extern void macStopInterceptNSPanelCtor(); 413 extern NSButton *macCreateButton(const char *text, NSView *superview); 414 415 void *QFontDialogPrivate::openCocoaFontPanel(const QFont &initial, 416 QWidget *parent, const QString &title, QFontDialog::FontDialogOptions options, 417 QFontDialogPrivate *priv) 418 { 419 Q_UNUSED(parent); // we would use the parent if only NSFontPanel could be a sheet 489 void QFontDialogPrivate::closeCocoaFontPanel() 490 { 420 491 QMacCocoaAutoReleasePool pool; 421 422 /* 423 The standard Cocoa font panel has no OK or Cancel button and 424 is created as a utility window. For strange reasons (which seem 425 to stem from the fact that the font panel is based on a NIB 426 file), the approach we use for the color panel doesn't work for 427 the font panel (and, inversely, the approach we use here doesn't 428 quite work for color panel, and crashed last time I tried). So 429 instead, we take the following steps: 430 431 1. Constructs a plain NSPanel that looks the way we want it 432 to look. Specifically, if the NoButtons option is off, we 433 construct a panel without the NSUtilityWindowMask flag 434 and with buttons (OK and Cancel). 435 436 2. Steal the content view from the shared NSFontPanel and 437 put it inside our new NSPanel's content view, together 438 with the OK and Cancel buttons. 439 440 3. Lay out the original content view and the buttons when 441 the font panel is shown and whenever it is resized. 442 443 4. Clean up after ourselves. 444 445 PS. Some customization is also done in QCocoaApplication 446 validModesForFontPanel:. 447 */ 448 449 Qt::WindowModality modality = Qt::ApplicationModal; 450 if (priv) 451 modality = priv->fontDialog()->windowModality(); 452 453 bool needButtons = !(options & QFontDialog::NoButtons); 454 // don't need our own panel if the title bar isn't visible anyway (in a sheet) 455 bool needOwnPanel = (needButtons && modality != Qt::WindowModal); 456 457 bool sharedFontPanelExisted = [NSFontPanel sharedFontPanelExists]; 458 NSFontPanel *sharedFontPanel = [NSFontPanel sharedFontPanel]; 459 [sharedFontPanel setHidesOnDeactivate:false]; 460 461 // hack to ensure that QCocoaApplication's validModesForFontPanel: 462 // implementation is honored 463 if (!sharedFontPanelExisted && needOwnPanel) { 464 [sharedFontPanel makeKeyAndOrderFront:sharedFontPanel]; 465 [sharedFontPanel close]; 466 } 467 468 NSPanel *ourPanel = 0; 469 NSView *stolenContentView = 0; 470 NSButton *okButton = 0; 471 NSButton *cancelButton = 0; 472 473 CGFloat dialogExtraWidth = 0.0; 474 CGFloat dialogExtraHeight = 0.0; 475 476 if (!needOwnPanel) { 477 // we can reuse the NSFontPanel unchanged 478 ourPanel = sharedFontPanel; 479 } else { 480 // compute dialogExtra{Width,Height} 481 dialogExtraWidth = 2.0 * DialogSideMargin; 482 dialogExtraHeight = DialogTopMargin + ButtonTopMargin + ButtonMinHeight 483 + ButtonBottomMargin; 484 485 // compute initial contents rectangle 486 NSRect contentRect = [sharedFontPanel contentRectForFrameRect:[sharedFontPanel frame]]; 487 contentRect.size.width += dialogExtraWidth; 488 contentRect.size.height += dialogExtraHeight; 489 490 // create the new panel 491 ourPanel = [[NSPanel alloc] initWithContentRect:contentRect 492 styleMask:StyleMask 493 backing:NSBackingStoreBuffered 494 defer:YES]; 495 [ourPanel setReleasedWhenClosed:YES]; 496 } 497 498 stolenContentView = [sharedFontPanel contentView]; 499 500 if (needButtons) { 501 // steal the font panel's contents view 502 [stolenContentView retain]; 503 [sharedFontPanel setContentView:0]; 504 505 // create a new content view and add the stolen one as a subview 506 NSRect frameRect = { { 0.0, 0.0 }, { 0.0, 0.0 } }; 507 NSView *ourContentView = [[NSView alloc] initWithFrame:frameRect]; 508 [ourContentView addSubview:stolenContentView]; 509 510 // create OK and Cancel buttons and add these as subviews 511 okButton = macCreateButton("&OK", ourContentView); 512 cancelButton = macCreateButton("Cancel", ourContentView); 513 514 [ourPanel setContentView:ourContentView]; 515 [ourPanel setDefaultButtonCell:[okButton cell]]; 516 } 517 518 // create a delegate and set it 519 QCocoaFontPanelDelegate *delegate = 520 [[QCocoaFontPanelDelegate alloc] initWithFontPanel:sharedFontPanel 521 stolenContentView:stolenContentView 522 okButton:okButton 523 cancelButton:cancelButton 524 priv:priv 525 extraWidth:dialogExtraWidth 526 extraHeight:dialogExtraHeight]; 527 [ourPanel setDelegate:delegate]; 528 [[NSFontManager sharedFontManager] setDelegate:delegate]; 529 #ifdef QT_MAC_USE_COCOA 530 [[NSFontManager sharedFontManager] setTarget:delegate]; 531 #endif 532 setFont(delegate, initial); 533 534 // hack to get correct initial layout 535 NSRect frameRect = [ourPanel frame]; 536 frameRect.size.width += 1.0; 537 [ourPanel setFrame:frameRect display:NO]; 538 frameRect.size.width -= 1.0; 539 frameRect.size = [delegate windowWillResize:ourPanel toSize:frameRect.size]; 540 [ourPanel setFrame:frameRect display:NO]; 541 [ourPanel center]; 542 543 [ourPanel setTitle:(NSString*)(CFStringRef)QCFString(title)]; 544 545 if (priv) { 546 switch (modality) { 547 case Qt::WindowModal: 548 if (parent) { 549 #ifndef QT_MAC_USE_COCOA 550 WindowRef hiwindowRef = qt_mac_window_for(parent); 551 NSWindow *window = 552 [[NSWindow alloc] initWithWindowRef:hiwindowRef]; 553 // Cocoa docs say I should retain the Carbon ref. 554 CFRetain(hiwindowRef); 555 #else 556 NSWindow *window = qt_mac_window_for(parent); 557 #endif 558 [NSApp beginSheet:ourPanel 559 modalForWindow:window 560 modalDelegate:0 561 didEndSelector:0 562 contextInfo:0]; 563 #ifndef QT_MAC_USE_COCOA 564 [window release]; 565 #endif 566 break; 567 } 568 // fallthrough 569 case Qt::ApplicationModal: 570 [delegate setModalSession:[NSApp beginModalSessionForWindow:ourPanel]]; 571 break; 572 default: 573 [ourPanel makeKeyAndOrderFront:ourPanel]; 574 } 575 } 576 return delegate; 577 } 578 579 void QFontDialogPrivate::closeCocoaFontPanel(void *delegate) 580 { 581 QMacCocoaAutoReleasePool pool; 582 QCocoaFontPanelDelegate *theDelegate = static_cast<QCocoaFontPanelDelegate *>(delegate); 492 QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) *theDelegate = static_cast<QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) *>(delegate); 583 493 NSWindow *ourPanel = [theDelegate actualPanel]; 584 494 [ourPanel close]; 495 if ([theDelegate isAppModal]) 496 [ourPanel release]; 585 497 [theDelegate cleanUpAfterMyself]; 586 [theDelegate autorelease]; 587 } 588 589 QFont QFontDialogPrivate::execCocoaFontPanel(bool *ok, const QFont &initial, 590 QWidget *parent, const QString &title, QFontDialog::FontDialogOptions options) 591 { 592 QMacCocoaAutoReleasePool pool; 593 QCocoaFontPanelDelegate *delegate = 594 static_cast<QCocoaFontPanelDelegate *>( 595 openCocoaFontPanel(initial, parent, title, options)); 596 NSWindow *ourPanel = [delegate actualPanel]; 597 [ourPanel retain]; 598 int rval = [NSApp runModalForWindow:ourPanel]; 599 QFont font([delegate qtFont]); 600 [ourPanel release]; 601 [delegate cleanUpAfterMyself]; 602 [delegate release]; 603 bool isOk = ((options & QFontDialog::NoButtons) || rval == NSOKButton); 604 if (ok) 605 *ok = isOk; 606 if (isOk) { 607 return font; 608 } else { 609 return initial; 610 } 498 [theDelegate release]; 499 this->delegate = 0; 500 sharedFontPanelAvailable = true; 611 501 } 612 502 … … 643 533 644 534 [mgr setSelectedFont:nsFont isMultiple:NO]; 645 [static_cast<QCocoaFontPanelDelegate *>(delegate) setQtFont:font]; 646 } 647 648 void *QFontDialogPrivate::_q_constructNativePanel() 649 { 535 [static_cast<QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) *>(delegate) setQtFont:font]; 536 } 537 538 void QFontDialogPrivate::createNSFontPanelDelegate() 539 { 540 if (delegate) 541 return; 542 543 sharedFontPanelAvailable = false; 650 544 QMacCocoaAutoReleasePool pool; 651 652 545 bool sharedFontPanelExisted = [NSFontPanel sharedFontPanelExists]; 653 546 NSFontPanel *sharedFontPanel = [NSFontPanel sharedFontPanel]; … … 671 564 // compute dialogExtra{Width,Height} 672 565 dialogExtraWidth = 2.0 * DialogSideMargin; 673 dialogExtraHeight = DialogTopMargin + ButtonTopMargin + ButtonMinHeight 674 + ButtonBottomMargin; 566 dialogExtraHeight = DialogTopMargin + ButtonTopMargin + ButtonMinHeight + ButtonBottomMargin; 675 567 676 568 // compute initial contents rectangle … … 685 577 defer:YES]; 686 578 [ourPanel setReleasedWhenClosed:YES]; 687 688 579 stolenContentView = [sharedFontPanel contentView]; 689 580 … … 705 596 [ourPanel setDefaultButtonCell:[okButton cell]]; 706 597 } 707 // create a delegate and set it 708 QCocoaFontPanelDelegate *delegate =709 [[QCocoaFontPanelDelegatealloc] initWithFontPanel:sharedFontPanel598 599 // create the delegate and set it 600 QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) *del = [[QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) alloc] initWithFontPanel:sharedFontPanel 710 601 stolenContentView:stolenContentView 711 602 okButton:okButton … … 714 605 extraWidth:dialogExtraWidth 715 606 extraHeight:dialogExtraHeight]; 716 [ourPanel setDelegate:delegate]; 717 [[NSFontManager sharedFontManager] setDelegate:delegate]; 607 delegate = del; 608 [ourPanel setDelegate:del]; 609 610 [[NSFontManager sharedFontManager] setDelegate:del]; 718 611 #ifdef QT_MAC_USE_COCOA 719 [[NSFontManager sharedFontManager] setTarget:del egate];720 #endif 721 setFont(del egate, QApplication::font());612 [[NSFontManager sharedFontManager] setTarget:del]; 613 #endif 614 setFont(del, q_func()->currentFont()); 722 615 723 616 { … … 727 620 [ourPanel setFrame:frameRect display:NO]; 728 621 frameRect.size.width -= 1.0; 729 frameRect.size = [del egatewindowWillResize:ourPanel toSize:frameRect.size];622 frameRect.size = [del windowWillResize:ourPanel toSize:frameRect.size]; 730 623 [ourPanel setFrame:frameRect display:NO]; 731 624 [ourPanel center]; 732 625 } 626 [del setSubwindowStacking]; 733 627 NSString *title = @"Select font"; 734 628 [ourPanel setTitle:title]; 735 736 [delegate setModalSession:[NSApp beginModalSessionForWindow:ourPanel]];737 return delegate;738 629 } 739 630 … … 760 651 void QFontDialogPrivate::_q_macRunNativeAppModalPanel() 761 652 { 762 QBoolBlocker nativeDialogOnTop(QApplicationPrivate::native_modal_dialog_active); 653 createNSFontPanelDelegate(); 654 QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) *del = static_cast<QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) *>(delegate); 655 [del runApplicationModalPanel]; 656 } 657 658 bool QFontDialogPrivate::showCocoaFontPanel() 659 { 660 if (!sharedFontPanelAvailable) 661 return false; 662 763 663 Q_Q(QFontDialog); 764 QCocoaFontPanelDelegate *delegate = (QCocoaFontPanelDelegate *)_q_constructNativePanel(); 765 NSWindow *ourPanel = [delegate actualPanel]; 766 [ourPanel retain]; 767 int rval = [NSApp runModalForWindow:ourPanel]; 768 QAbstractEventDispatcher::instance()->interrupt(); 769 [ourPanel release]; 770 [delegate cleanUpAfterMyself]; 771 [delegate release]; 772 bool isOk = (rval == NSOKButton); 773 if(isOk) 774 rescode = QDialog::Accepted; 664 QMacCocoaAutoReleasePool pool; 665 createNSFontPanelDelegate(); 666 QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) *del = static_cast<QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) *>(delegate); 667 if (qt_mac_is_macsheet(q)) 668 [del showWindowModalSheet:q->parentWidget()]; 775 669 else 776 rescode = QDialog::Rejected; 777 } 778 670 [del showModelessPanel]; 671 return true; 672 } 673 674 bool QFontDialogPrivate::hideCocoaFontPanel() 675 { 676 if (!delegate){ 677 // Nothing to do. We return false to leave the question 678 // open regarding whether or not to go native: 679 return false; 680 } else { 681 closeCocoaFontPanel(); 682 // Even when we hide it, we are still using a 683 // native dialog, so return true: 684 return true; 685 } 686 } 779 687 bool QFontDialogPrivate::setVisible_sys(bool visible) 780 688 { … … 782 690 if (!visible == q->isHidden()) 783 691 return false; 784 return visible; 692 693 return visible ? showCocoaFontPanel() : hideCocoaFontPanel(); 785 694 } 786 695 -
trunk/src/gui/dialogs/qfontdialog_p.h
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 140 140 141 141 #ifdef Q_WS_MAC 142 static void *openCocoaFontPanel(const QFont &initial,143 QWidget *parent, const QString &title,144 QFontDialog::FontDialogOptions options,145 QFontDialogPrivate *priv = 0);146 static void closeCocoaFontPanel(void *delegate);147 static QFont execCocoaFontPanel(bool *ok, const QFont &initial, QWidget *parent,148 const QString &title, QFontDialog::FontDialogOptions options);149 142 static void setFont(void *delegate, const QFont &font); 150 143 … … 153 146 154 147 void *delegate; 148 void closeCocoaFontPanel(); 155 149 bool nativeDialogInUse; 156 150 bool canBeNativeDialog(); 157 151 bool setVisible_sys(bool visible); 158 void *_q_constructNativePanel();152 void createNSFontPanelDelegate(); 159 153 void _q_macRunNativeAppModalPanel(); 160 154 void mac_nativeDialogModalHelp(); 155 bool showCocoaFontPanel(); 156 bool hideCocoaFontPanel(); 161 157 162 158 static bool sharedFontPanelAvailable; -
trunk/src/gui/dialogs/qfscompleter_p.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/dialogs/qinputdialog.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 232 232 233 233 mainLayout = new QVBoxLayout(q); 234 //we want to let the input dialog grow to available size on Symbian. 235 #ifndef Q_OS_SYMBIAN 234 236 mainLayout->setSizeConstraint(QLayout::SetMinAndMaxSize); 237 #else 238 label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); 239 #endif 235 240 mainLayout->addWidget(label); 236 241 mainLayout->addWidget(inputWidget); … … 245 250 if (!lineEdit) { 246 251 lineEdit = new QLineEdit(q); 252 #ifndef QT_NO_IM 253 qt_widget_private(lineEdit)->inheritsInputMethodHints = 1; 254 #endif 247 255 lineEdit->hide(); 248 256 QObject::connect(lineEdit, SIGNAL(textChanged(QString)), … … 256 264 if (!comboBox) { 257 265 comboBox = new QComboBox(q); 266 #ifndef QT_NO_IM 267 qt_widget_private(comboBox)->inheritsInputMethodHints = 1; 268 #endif 258 269 comboBox->hide(); 259 270 QObject::connect(comboBox, SIGNAL(editTextChanged(QString)), … … 553 564 d->label->setText(text); 554 565 } 566 #ifdef Q_OS_SYMBIAN 567 d->label->setWordWrap(true); 568 #endif 555 569 } 556 570 -
trunk/src/gui/dialogs/qinputdialog.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/dialogs/qmessagebox.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 97 97 #ifndef QT_NO_CONTEXTMENU 98 98 QMenu *menu = createStandardContextMenu(); 99 menu-> exec(e->globalPos());100 delete menu;99 menu->setAttribute(Qt::WA_DeleteOnClose); 100 menu->popup(e->globalPos()); 101 101 #else 102 102 Q_UNUSED(e); … … 123 123 void setText(const QString &text) { textEdit->setPlainText(text); } 124 124 QString text() const { return textEdit->toPlainText(); } 125 QString label(DetailButtonLabel label)126 { return label == ShowLabel ? QMessageBox::tr("Show Details...")127 : QMessageBox::tr("Hide Details..."); }128 125 private: 129 126 TextEdit *textEdit; 130 127 }; 131 128 #endif // QT_NO_TEXTEDIT 129 130 class DetailButton : public QPushButton 131 { 132 public: 133 DetailButton(QWidget *parent) : QPushButton(label(ShowLabel), parent) 134 { 135 setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); 136 } 137 138 QString label(DetailButtonLabel label) const 139 { return label == ShowLabel ? QMessageBox::tr("Show Details...") : QMessageBox::tr("Hide Details..."); } 140 141 void setLabel(DetailButtonLabel lbl) 142 { setText(label(lbl)); } 143 144 QSize sizeHint() const 145 { 146 ensurePolished(); 147 QStyleOptionButton opt; 148 initStyleOption(&opt); 149 const QFontMetrics fm = fontMetrics(); 150 opt.text = label(ShowLabel); 151 QSize sz = fm.size(Qt::TextShowMnemonic, opt.text); 152 QSize ret = style()->sizeFromContents(QStyle::CT_PushButton, &opt, sz, this). 153 expandedTo(QApplication::globalStrut()); 154 opt.text = label(HideLabel); 155 sz = fm.size(Qt::TextShowMnemonic, opt.text); 156 ret.expandedTo(style()->sizeFromContents(QStyle::CT_PushButton, &opt, sz, this). 157 expandedTo(QApplication::globalStrut())); 158 return ret; 159 } 160 }; 161 132 162 133 163 class QMessageBoxPrivate : public QDialogPrivate … … 186 216 QPushButton *defaultButton; 187 217 QAbstractButton *clickedButton; 188 QPushButton *detailsButton;218 DetailButton *detailsButton; 189 219 #ifndef QT_NO_TEXTEDIT 190 220 QMessageBoxDetailsText *detailsText; … … 436 466 #ifndef QT_NO_TEXTEDIT 437 467 if (detailsButton && detailsText && button == detailsButton) { 438 detailsButton->set Text(detailsText->isHidden() ? detailsText->label(HideLabel) : detailsText->label(ShowLabel));468 detailsButton->setLabel(detailsText->isHidden() ? HideLabel : ShowLabel); 439 469 detailsText->setHidden(!detailsText->isHidden()); 440 470 updateSize(); … … 747 777 arguments are passed to the QDialog constructor. 748 778 749 If \a parent is 0, the message box is an \l{Qt::ApplicationModal} 750 {application modal} dialog box. If \a parent is a widget, the 751 message box is \l{Qt::WindowModal} {window modal} relative to \a 752 parent. 779 The message box is an \l{Qt::ApplicationModal} {application modal} 780 dialog box. 753 781 754 782 On Mac OS X, if \a parent is not 0 and you want your message box … … 1520 1548 {escape button} is returned. 1521 1549 1522 If \a parent is 0, the message box is an \l{Qt::ApplicationModal} 1523 {application modal} dialog box. If \a parent is a widget, the 1524 message box is \l{Qt::WindowModal} {window modal} relative to \a 1525 parent. 1550 The message box is an \l{Qt::ApplicationModal} {application modal} 1551 dialog box. 1526 1552 1527 1553 \sa question(), warning(), critical() … … 1550 1576 {escape button} is returned. 1551 1577 1552 If \a parent is 0, the message box is an \l{Qt::ApplicationModal} 1553 {application modal} dialog box. If \a parent is a widget, the 1554 message box is \l{Qt::WindowModal} {window modal} relative to \a 1555 parent. 1578 The message box is an \l{Qt::ApplicationModal} {application modal} 1579 dialog box. 1556 1580 1557 1581 \sa information(), warning(), critical() … … 1578 1602 {escape button} is returned. 1579 1603 1580 If \a parent is 0, the message box is an \l{Qt::ApplicationModal} 1581 {application modal} dialog box. If \a parent is a widget, the 1582 message box is \l{Qt::WindowModal} {window modal} relative to \a 1583 parent. 1604 The message box is an \l{Qt::ApplicationModal} {application modal} 1605 dialog box. 1584 1606 1585 1607 \sa question(), information(), critical() … … 1606 1628 {escape button} is returned. 1607 1629 1608 If \a parent is 0, the message box is an \l{Qt::ApplicationModal} 1609 {application modal} dialog box. If \a parent is a widget, the 1610 message box is \l{Qt::WindowModal} {window modal} relative to \a 1611 parent. 1630 The message box is an \l{Qt::ApplicationModal} {application modal} 1631 dialog box. 1612 1632 1613 1633 \warning Do not delete \a parent during the execution of the dialog. … … 1641 1661 The about box has a single button labelled "OK". On Mac OS X, the 1642 1662 about box is popped up as a modeless window; on other platforms, 1643 it is currently a windowmodal.1663 it is currently application modal. 1644 1664 1645 1665 \sa QWidget::windowIcon(), QApplication::activeWindow() … … 1694 1714 1695 1715 On Mac OS X, the about box is popped up as a modeless window; on 1696 other platforms, it is currently windowmodal.1716 other platforms, it is currently application modal. 1697 1717 1698 1718 \sa QApplication::aboutQt() … … 1742 1762 "<p>Please see <a href=\"http://qt.nokia.com/products/licensing\">qt.nokia.com/products/licensing</a> " 1743 1763 "for an overview of Qt licensing.</p>" 1744 "<p>Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).</p>"1764 "<p>Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).</p>" 1745 1765 "<p>Qt is a Nokia product. See <a href=\"http://qt.nokia.com/\">qt.nokia.com</a> " 1746 1766 "for more information.</p>" … … 1906 1926 #ifndef QT_NO_TEXTEDIT 1907 1927 if (detailsButton) 1908 detailsButton->set Text(detailsText->isHidden() ? detailsText->label(HideLabel) : detailsText->label(ShowLabel));1928 detailsButton->setLabel(detailsText->isHidden() ? HideLabel : ShowLabel); 1909 1929 #endif 1910 1930 } … … 1954 1974 \snippet doc/src/snippets/dialogs/dialogs.cpp 2 1955 1975 1956 If \a parent is 0, the message box is an \l{Qt::ApplicationModal} 1957 {application modal} dialog box. If \a parent is a widget, the 1958 message box is \l{Qt::WindowModal} {window modal} relative to \a 1959 parent. 1976 The message box is an \l{Qt::ApplicationModal} {application modal} 1977 dialog box. 1960 1978 1961 1979 The \a parent and \a f arguments are passed to … … 2006 2024 of the button that was clicked. 2007 2025 2008 If \a parent is 0, the message box is an \l{Qt::ApplicationModal} 2009 {application modal} dialog box. If \a parent is a widget, the 2010 message box is \l{Qt::WindowModal} {window modal} relative to \a 2011 parent. 2026 The message box is an \l{Qt::ApplicationModal} {application modal} 2027 dialog box. 2012 2028 2013 2029 \warning Do not delete \a parent during the execution of the dialog. … … 2044 2060 the relevant button. 2045 2061 2046 If \a parent is 0, the message box is an \l{Qt::ApplicationModal} 2047 {application modal} dialog box. If \a parent is a widget, the 2048 message box is \l{Qt::WindowModal} {window modal} relative to \a 2049 parent. 2062 The message box is an \l{Qt::ApplicationModal} {application modal} 2063 dialog box. 2050 2064 2051 2065 \warning Do not delete \a parent during the execution of the dialog. … … 2096 2110 of the button that was clicked. 2097 2111 2098 If \a parent is 0, the message box is an \l{Qt::ApplicationModal} 2099 {application modal} dialog box. If \a parent is a widget, the 2100 message box is \l{Qt::WindowModal} {window modal} relative to \a 2101 parent. 2112 The message box is an \l{Qt::ApplicationModal} {application modal} 2113 dialog box. 2102 2114 2103 2115 \warning Do not delete \a parent during the execution of the dialog. … … 2134 2146 the relevant button. 2135 2147 2136 If \a parent is 0, the message box is an \l{Qt::ApplicationModal} 2137 {application modal} dialog box. If \a parent is a widget, the 2138 message box is \l{Qt::WindowModal} {window modal} relative to \a 2139 parent. 2148 The message box is an \l{Qt::ApplicationModal} {application modal} 2149 dialog box. 2140 2150 2141 2151 \warning Do not delete \a parent during the execution of the dialog. … … 2186 2196 of the button that was clicked. 2187 2197 2188 If \a parent is 0, the message box is an \l{Qt::ApplicationModal} 2189 {application modal} dialog box. If \a parent is a widget, the 2190 message box is \l{Qt::WindowModal} {window modal} relative to \a 2191 parent. 2198 The message box is an \l{Qt::ApplicationModal} {application modal} 2199 dialog box. 2192 2200 2193 2201 \warning Do not delete \a parent during the execution of the dialog. … … 2224 2232 the relevant button. 2225 2233 2226 If \a parent is 0, the message box is an \l{Qt::ApplicationModal} 2227 {application modal} dialog box. If \a parent is a widget, the 2228 message box is \l{Qt::WindowModal} {window modal} relative to \a 2229 parent. 2234 The message box is an \l{Qt::ApplicationModal} {application modal} 2235 dialog box. 2230 2236 2231 2237 \warning Do not delete \a parent during the execution of the dialog. … … 2275 2281 of the button that was clicked. 2276 2282 2277 If \a parent is 0, the message box is an \l{Qt::ApplicationModal} 2278 {application modal} dialog box. If \a parent is a widget, the 2279 message box is \l{Qt::WindowModal} {window modal} relative to \a 2280 parent. 2283 The message box is an \l{Qt::ApplicationModal} {application modal} 2284 dialog box. 2281 2285 2282 2286 \warning Do not delete \a parent during the execution of the dialog. … … 2314 2318 the relevant button. 2315 2319 2316 If \a parent is 0, the message box is an \l{Qt::ApplicationModal} 2317 {application modal} dialog box. If \a parent is a widget, the 2318 message box is \l{Qt::WindowModal} {window modal} relative to \a 2319 parent. 2320 The message box is an \l{Qt::ApplicationModal} {application modal} 2321 dialog box. 2320 2322 2321 2323 \warning Do not delete \a parent during the execution of the dialog. … … 2414 2416 d->detailsText->hide(); 2415 2417 } 2416 if (!d->detailsButton) { 2417 d->detailsButton = new QPushButton(d->detailsText->label(ShowLabel), this); 2418 QPushButton hideDetails(d->detailsText->label(HideLabel)); 2419 d->detailsButton->setFixedSize(d->detailsButton->sizeHint().expandedTo(hideDetails.sizeHint())); 2420 } 2418 if (!d->detailsButton) 2419 d->detailsButton = new DetailButton(this); 2421 2420 d->detailsText->setText(text); 2422 2421 } -
trunk/src/gui/dialogs/qmessagebox.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 355 355 "%2, found Qt %3.").arg(qAppName()).arg(QString::fromLatin1(\ 356 356 str)).arg(QString::fromLatin1(qVersion())); QMessageBox::critical(0, QApplication::tr(\ 357 "Incompatible Qt Library Error"), s, QMessageBox::Abort, 0); qFatal( s.toLatin1().data()); }}357 "Incompatible Qt Library Error"), s, QMessageBox::Abort, 0); qFatal("%s", s.toLatin1().data()); }} 358 358 359 359 #endif // QT_NO_MESSAGEBOX -
trunk/src/gui/dialogs/qnspanelproxy_mac.mm
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 53 53 QT_USE_NAMESPACE 54 54 55 @class Q NSPanelProxy;56 57 @interface Q NSPanelProxy: NSWindow {55 @class QT_MANGLE_NAMESPACE(QNSPanelProxy); 56 57 @interface QT_MANGLE_NAMESPACE(QNSPanelProxy) : NSWindow { 58 58 } 59 59 - (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)windowStyle … … 67 67 @end 68 68 69 @implementation Q NSPanelProxy69 @implementation QT_MANGLE_NAMESPACE(QNSPanelProxy) 70 70 - (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)windowStyle 71 71 backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation … … 109 109 @end 110 110 111 @class Q NSWindowProxy;112 113 @interface Q NSWindowProxy: NSWindow {111 @class QT_MANGLE_NAMESPACE(QNSWindowProxy); 112 113 @interface QT_MANGLE_NAMESPACE(QNSWindowProxy) : NSWindow { 114 114 } 115 115 - (void)setTitle:(NSString *)title; … … 117 117 @end 118 118 119 @implementation Q NSWindowProxy119 @implementation QT_MANGLE_NAMESPACE(QNSWindowProxy) 120 120 - (void)setTitle:(NSString *)title 121 121 { … … 191 191 macStartIntercept(@selector(initWithContentRect:styleMask:backing:defer:), 192 192 @selector(qt_fakeInitWithContentRect:styleMask:backing:defer:), 193 [NSPanel class], [Q NSPanelProxyclass]);193 [NSPanel class], [QT_MANGLE_NAMESPACE(QNSPanelProxy) class]); 194 194 macStartIntercept(@selector(initWithContentRect:styleMask:backing:defer:screen:), 195 195 @selector(qt_fakeInitWithContentRect:styleMask:backing:defer:screen:), 196 [NSPanel class], [Q NSPanelProxyclass]);196 [NSPanel class], [QT_MANGLE_NAMESPACE(QNSPanelProxy) class]); 197 197 } 198 198 … … 204 204 macStopIntercept(@selector(initWithContentRect:styleMask:backing:defer:screen:), 205 205 @selector(qt_fakeInitWithContentRect:styleMask:backing:defer:screen:), 206 [NSPanel class], [Q NSPanelProxyclass]);206 [NSPanel class], [QT_MANGLE_NAMESPACE(QNSPanelProxy) class]); 207 207 macStopIntercept(@selector(initWithContentRect:styleMask:backing:defer:), 208 208 @selector(qt_fakeInitWithContentRect:styleMask:backing:defer:), 209 [NSPanel class], [Q NSPanelProxyclass]);209 [NSPanel class], [QT_MANGLE_NAMESPACE(QNSPanelProxy) class]); 210 210 } 211 211 … … 218 218 currentWindow = window; 219 219 macStartIntercept(@selector(setTitle:), @selector(qt_fakeSetTitle:), 220 [NSWindow class], [Q NSWindowProxyclass]);220 [NSWindow class], [QT_MANGLE_NAMESPACE(QNSWindowProxy) class]); 221 221 } 222 222 … … 228 228 currentWindow = 0; 229 229 macStopIntercept(@selector(setTitle:), @selector(qt_fakeSetTitle:), 230 [NSWindow class], [Q NSWindowProxyclass]);230 [NSWindow class], [QT_MANGLE_NAMESPACE(QNSWindowProxy) class]); 231 231 } 232 232 -
trunk/src/gui/dialogs/qpagesetupdialog.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 63 63 page setup dialog. 64 64 65 In Symbian, there is no support for printing. Hence, this dialog should not 66 be used in Symbian. 67 65 68 \sa QPrinter, QPrintDialog 66 69 */ -
trunk/src/gui/dialogs/qpagesetupdialog.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/dialogs/qpagesetupdialog_mac.mm
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 51 51 QT_USE_NAMESPACE 52 52 53 @class Q CocoaPageLayoutDelegate;54 55 @interface Q CocoaPageLayoutDelegate: NSObject {53 @class QT_MANGLE_NAMESPACE(QCocoaPageLayoutDelegate); 54 55 @interface QT_MANGLE_NAMESPACE(QCocoaPageLayoutDelegate) : NSObject { 56 56 QMacPrintEnginePrivate *pe; 57 57 } … … 61 61 @end 62 62 63 @implementation Q CocoaPageLayoutDelegate63 @implementation QT_MANGLE_NAMESPACE(QCocoaPageLayoutDelegate) 64 64 - (id)initWithMacPrintEngine:(QMacPrintEnginePrivate *)printEngine; 65 65 { … … 214 214 // Keep a copy to this since we plan on using it for a bit. 215 215 [pageLayout retain]; 216 Q CocoaPageLayoutDelegate *delegate = [[QCocoaPageLayoutDelegatealloc] initWithMacPrintEngine:ep];216 QT_MANGLE_NAMESPACE(QCocoaPageLayoutDelegate) *delegate = [[QT_MANGLE_NAMESPACE(QCocoaPageLayoutDelegate) alloc] initWithMacPrintEngine:ep]; 217 217 218 218 if (modality == Qt::ApplicationModal) { … … 233 233 void QPageSetupDialogPrivate::closeCocoaPageLayout() 234 234 { 235 // NSPageLayout can change the session behind our back and then our 236 // d->ep->session object will become a dangling pointer. Update it 237 // based on the "current" session 238 ep->session = static_cast<PMPrintSession>([ep->printInfo PMPrintSession]); 239 235 240 [pageLayout release]; 236 241 pageLayout = 0; -
trunk/src/gui/dialogs/qpagesetupdialog_unix.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/dialogs/qpagesetupdialog_unix_p.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/dialogs/qpagesetupdialog_win.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/dialogs/qprintdialog.h
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/dialogs/qprintdialog.qdoc
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 7 7 ** This file is part of the documentation of the Qt Toolkit. 8 8 ** 9 ** $QT_BEGIN_LICENSE: LGPL$9 ** $QT_BEGIN_LICENSE:FDL$ 10 10 ** Commercial Usage 11 11 ** Licensees holding valid Qt Commercial licenses may use this file in 12 12 ** accordance with the Qt Commercial License Agreement provided with the 13 ** Software or, alternatively, in accordance with the terms contained in 14 ** awritten agreement between you and Nokia.13 ** Software or, alternatively, in accordance with the terms contained in a 14 ** written agreement between you and Nokia. 15 15 ** 16 ** GNU Lesser General Public License Usage 17 ** Alternatively, this file may be used under the terms of the GNU Lesser 18 ** General Public License version 2.1 as published by the Free Software 19 ** Foundation and appearing in the file LICENSE.LGPL included in the 20 ** packaging of this file. Please review the following information to 21 ** ensure the GNU Lesser General Public License version 2.1 requirements 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 23 ** 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 ** 28 ** GNU General Public License Usage 29 ** Alternatively, this file may be used under the terms of the GNU 30 ** General Public License version 3.0 as published by the Free Software 31 ** Foundation and appearing in the file LICENSE.GPL included in the 32 ** packaging of this file. Please review the following information to 33 ** ensure the GNU General Public License version 3.0 requirements will be 34 ** met: http://www.gnu.org/copyleft/gpl.html. 16 ** GNU Free Documentation License 17 ** Alternatively, this file may be used under the terms of the GNU Free 18 ** Documentation License version 1.3 as published by the Free Software 19 ** Foundation and appearing in the file included in the packaging of this 20 ** file. 35 21 ** 36 22 ** If you have questions regarding the use of this file, please contact -
trunk/src/gui/dialogs/qprintdialog_mac.mm
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 125 125 #ifdef QT_MAC_USE_COCOA 126 126 127 @class Q CocoaPrintPanelDelegate;128 129 @interface Q CocoaPrintPanelDelegate: NSObject {127 @class QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate); 128 129 @interface QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate) : NSObject { 130 130 } 131 131 - (void)printPanelDidEnd:(NSPrintPanel *)printPanel … … 133 133 @end 134 134 135 @implementation Q CocoaPrintPanelDelegate135 @implementation QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate) 136 136 - (void)printPanelDidEnd:(NSPrintPanel *)printPanel 137 137 returnCode:(int)returnCode contextInfo:(void *)contextInfo … … 141 141 QPrintDialogPrivate *d = static_cast<QPrintDialogPrivate *>(contextInfo); 142 142 QPrintDialog *dialog = d->printDialog(); 143 // temporary hack to work around bug in deleteLater() in Qt/Mac Cocoa144 #if 1145 bool deleteDialog = dialog->testAttribute(Qt::WA_DeleteOnClose);146 dialog->setAttribute(Qt::WA_DeleteOnClose, false);147 #endif148 143 149 144 if (returnCode == NSOKButton) { … … 193 188 194 189 dialog->done((returnCode == NSOKButton) ? QDialog::Accepted : QDialog::Rejected); 195 #if 1196 if (deleteDialog)197 delete dialog;198 #endif199 190 } 200 191 @end … … 314 305 macStartInterceptWindowTitle(q); 315 306 printPanel = [NSPrintPanel printPanel]; 316 Q CocoaPrintPanelDelegate *delegate = [[QCocoaPrintPanelDelegatealloc] init];307 QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate) *delegate = [[QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate) alloc] init]; 317 308 [printPanel setOptions:macOptions]; 318 309 -
trunk/src/gui/dialogs/qprintdialog_qws.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 164 164 printer->setPageOrder(pageOrder2); 165 165 printer->setColorMode(colorMode2); 166 printer->set NumCopies(numCopies);166 printer->setCopyCount(numCopies); 167 167 168 168 switch ((rangeCombo->itemData(rangeCombo->currentIndex())).toInt()){ … … 178 178 q->setPrintRange(QPrintDialog::PageRange); 179 179 q->setFromTo(firstPage->value(), lastPage->value()); 180 break; 181 case (int)QPrintDialog::CurrentPage: 182 q->setPrintRange(QPrintDialog::CurrentPage); 183 q->setFromTo(0, 0); 180 184 break; 181 185 } … … 376 380 rangeCombo->addItem(QPrintDialog::tr("Print selection"), QPrintDialog::Selection); 377 381 rangeCombo->addItem(QPrintDialog::tr("Print range"), QPrintDialog::PageRange); 382 rangeCombo->addItem(QPrintDialog::tr("Print current page"), QPrintDialog::CurrentPage); 378 383 QObject::connect(rangeCombo, SIGNAL(activated(int)), 379 384 q, SLOT(_q_printRangeSelected(int))); … … 480 485 481 486 // number of copies 482 copies->setValue(p-> numCopies());483 _q_setNumCopies(p-> numCopies());487 copies->setValue(p->copyCount()); 488 _q_setNumCopies(p->copyCount()); 484 489 } 485 490 … … 491 496 && rangeCombo->findData(QPrintDialog::PageRange) > 0) 492 497 rangeCombo->removeItem(rangeCombo->findData(QPrintDialog::PageRange)); 498 if (!q->isOptionEnabled(QPrintDialog::PrintCurrentPage) 499 && rangeCombo->findData(QPrintDialog::CurrentPage) > 0) 500 rangeCombo->removeItem(rangeCombo->findData(QPrintDialog::CurrentPage)); 493 501 494 502 switch (q->printRange()) { … … 501 509 case QPrintDialog::PageRange: 502 510 rangeCombo->setCurrentIndex((int)(QPrintDialog::PageRange)); 511 break; 512 case QPrintDialog::CurrentPage: 513 rangeCombo->setCurrentIndex((int)(QPrintDialog::CurrentPage)); 503 514 break; 504 515 } -
trunk/src/gui/dialogs/qprintdialog_unix.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 73 73 QT_BEGIN_NAMESPACE 74 74 75 extern int qt_printerRealNumCopies(QPaintEngine *);76 77 75 class QOptionTreeItem; 78 76 class QPPDOptionsModel; … … 443 441 options.duplexShort->setChecked(true); break; 444 442 } 445 options.copies->setValue( qt_printerRealNumCopies(p->paintEngine()));443 options.copies->setValue(p->copyCount()); 446 444 options.collate->setChecked(p->collateCopies()); 447 445 options.reverse->setChecked(p->pageOrder() == QPrinter::LastPageFirst); … … 508 506 p->setPrintRange(QPrinter::Selection); 509 507 p->setFromTo(0,0); 508 } else if (options.printCurrentPage->isChecked()) { 509 p->setPrintRange(QPrinter::CurrentPage); 510 p->setFromTo(0,0); 510 511 } else if (options.printRange->isChecked()) { 511 512 p->setPrintRange(QPrinter::PageRange); … … 514 515 515 516 // copies 516 p->set NumCopies(options.copies->value());517 p->setCopyCount(options.copies->value()); 517 518 p->setCollateCopies(options.collate->isChecked()); 518 519 … … 524 525 Q_Q(QPrintDialog); 525 526 options.gbPrintRange->setVisible(q->isOptionEnabled(QPrintDialog::PrintPageRange) || 526 q->isOptionEnabled(QPrintDialog::PrintSelection)); 527 q->isOptionEnabled(QPrintDialog::PrintSelection) || 528 q->isOptionEnabled(QPrintDialog::PrintCurrentPage)); 527 529 528 530 options.printRange->setEnabled(q->isOptionEnabled(QPrintDialog::PrintPageRange)); 529 531 options.printSelection->setVisible(q->isOptionEnabled(QPrintDialog::PrintSelection)); 532 options.printCurrentPage->setVisible(q->isOptionEnabled(QPrintDialog::PrintCurrentPage)); 530 533 options.collate->setVisible(q->isOptionEnabled(QPrintDialog::PrintCollateCopies)); 531 534 … … 540 543 options.printRange->setChecked(true); 541 544 break; 545 case QPrintDialog::CurrentPage: 546 if (q->isOptionEnabled(QPrintDialog::PrintCurrentPage)) 547 options.printCurrentPage->setChecked(true); 548 break; 542 549 default: 543 550 break; … … 699 706 #endif 700 707 701 #if ndef QT_NO_FILESYSTEMMODEL708 #if !defined(QT_NO_FILESYSTEMMODEL) && !defined(QT_NO_COMPLETER) 702 709 QFileSystemModel *fsm = new QFileSystemModel(widget.filename); 703 710 fsm->setRootPath(QDir::homePath()); 704 #if !defined(QT_NO_FSCOMPLETER) && !defined(QT_NO_FILEDIALOG) 705 widget.filename->setCompleter(new QFSCompleter(fsm, widget.filename)); 706 #endif 711 widget.filename->setCompleter(new QCompleter(fsm, widget.filename)); 707 712 #endif 708 713 _q_printerChanged(currentPrinterIndex); -
trunk/src/gui/dialogs/qprintdialog_win.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 53 53 #include <private/qprinter_p.h> 54 54 55 #if defined(Q_CC_MINGW) &&!defined(PD_NOCURRENTPAGE)55 #if !defined(PD_NOCURRENTPAGE) 56 56 #define PD_NOCURRENTPAGE 0x00800000 57 57 #define PD_RESULT_PRINT 1 … … 129 129 pd->Flags |= PD_NOPAGENUMS; 130 130 131 // we don't have a 'current page' notion in the QPrinter API yet. 132 // Neither do we support more than one page range, so limit those 133 // options 134 pd->Flags |= PD_NOCURRENTPAGE; 131 // Disable Current Page option if not required as default is Enabled 132 if (!pdlg->isOptionEnabled(QPrintDialog::PrintCurrentPage)) 133 pd->Flags |= PD_NOCURRENTPAGE; 134 135 // Default to showing the General tab first 135 136 pd->nStartPage = START_PAGE_GENERAL; 137 138 // We don't support more than one page range in the QPrinter API yet. 136 139 pd->nPageRanges = 1; 137 140 pd->nMaxPageRanges = 1; … … 139 142 if (d->ep->printToFile) 140 143 pd->Flags |= PD_PRINTTOFILE; 141 Q_ASSERT(parent != 0 && parent->testAttribute(Qt::WA_WState_Created));144 Q_ASSERT(parent); 142 145 pd->hwndOwner = parent->window()->winId(); 143 146 pd->lpPageRanges[0].nFromPage = qMax(pdlg->fromPage(), pdlg->minPage()); … … 154 157 pdlg->setPrintRange(QPrintDialog::PageRange); 155 158 pdlg->setFromTo(pd->lpPageRanges[0].nFromPage, pd->lpPageRanges[0].nToPage); 156 } else { 159 } else if (pd->Flags & PD_CURRENTPAGE) { 160 pdlg->setPrintRange(QPrintDialog::CurrentPage); 161 pdlg->setFromTo(0, 0); 162 } else { // PD_ALLPAGES 157 163 pdlg->setPrintRange(QPrintDialog::AllPages); 158 164 pdlg->setFromTo(0, 0); -
trunk/src/gui/dialogs/qprintpreviewdialog.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 677 677 \endlist 678 678 679 In Symbian, there is no support for printing. Hence, this dialog should not 680 be used in Symbian. 679 681 680 682 \sa QPrinter, QPrintDialog, QPageSetupDialog, QPrintPreviewWidget -
trunk/src/gui/dialogs/qprintpreviewdialog.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/dialogs/qprintsettingsoutput.ui
r2 r846 1 <ui version="4.0" > 1 <?xml version="1.0" encoding="UTF-8"?> 2 <ui version="4.0"> 2 3 <class>QPrintSettingsOutput</class> 3 <widget class="QWidget" name="QPrintSettingsOutput" 4 <property name="geometry" 4 <widget class="QWidget" name="QPrintSettingsOutput"> 5 <property name="geometry"> 5 6 <rect> 6 7 <x>0</x> 7 8 <y>0</y> 8 <width>4 16</width>9 <height>1 66</height>9 <width>426</width> 10 <height>171</height> 10 11 </rect> 11 12 </property> 12 <property name="windowTitle" 13 <property name="windowTitle"> 13 14 <string>Form</string> 14 15 </property> 15 <layout class="QHBoxLayout" name="horizontalLayout_2" 16 <property name="margin" 16 <layout class="QHBoxLayout" name="horizontalLayout_2"> 17 <property name="margin"> 17 18 <number>0</number> 18 19 </property> 19 20 <item> 20 <widget class="QTabWidget" name="tabs" 21 <property name="currentIndex" 21 <widget class="QTabWidget" name="tabs"> 22 <property name="currentIndex"> 22 23 <number>0</number> 23 24 </property> 24 <widget class="QWidget" name="copiesTab" > 25 <property name="geometry" > 26 <rect> 27 <x>0</x> 28 <y>0</y> 29 <width>412</width> 30 <height>139</height> 31 </rect> 32 </property> 33 <attribute name="title" > 25 <widget class="QWidget" name="copiesTab"> 26 <attribute name="title"> 34 27 <string>Copies</string> 35 28 </attribute> 36 <layout class="QHBoxLayout" name="horizontalLayout" 29 <layout class="QHBoxLayout" name="horizontalLayout"> 37 30 <item> 38 <widget class="QGroupBox" name="gbPrintRange" 39 <property name="sizePolicy" 40 <sizepolicy vsizetype="Minimum" hsizetype="Preferred">31 <widget class="QGroupBox" name="gbPrintRange"> 32 <property name="sizePolicy"> 33 <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> 41 34 <horstretch>0</horstretch> 42 35 <verstretch>0</verstretch> 43 36 </sizepolicy> 44 37 </property> 45 <property name="title" 38 <property name="title"> 46 39 <string>Print range</string> 47 40 </property> 48 <layout class="QVBoxLayout" name="_3" 49 <property name="spacing" 41 <layout class="QVBoxLayout" name="_3"> 42 <property name="spacing"> 50 43 <number>4</number> 51 44 </property> 52 <property name="margin" 45 <property name="margin"> 53 46 <number>6</number> 54 47 </property> 55 48 <item> 56 <widget class="QRadioButton" name="printAll" 57 <property name="text" 49 <widget class="QRadioButton" name="printAll"> 50 <property name="text"> 58 51 <string>Print all</string> 59 52 </property> 60 <property name="checked" 53 <property name="checked"> 61 54 <bool>true</bool> 62 55 </property> … … 64 57 </item> 65 58 <item> 66 <layout class="QHBoxLayout" name="_4" 67 <property name="spacing" 59 <layout class="QHBoxLayout" name="_4"> 60 <property name="spacing"> 68 61 <number>6</number> 69 62 </property> 70 <property name="margin" 63 <property name="margin"> 71 64 <number>0</number> 72 65 </property> 73 66 <item> 74 <widget class="QRadioButton" name="printRange" 75 <property name="text" 67 <widget class="QRadioButton" name="printRange"> 68 <property name="text"> 76 69 <string>Pages from</string> 77 70 </property> … … 79 72 </item> 80 73 <item> 81 <widget class="QSpinBox" name="from" 82 <property name="enabled" 74 <widget class="QSpinBox" name="from"> 75 <property name="enabled"> 83 76 <bool>false</bool> 84 77 </property> 85 <property name="minimum" 78 <property name="minimum"> 86 79 <number>1</number> 87 80 </property> 88 <property name="maximum" 81 <property name="maximum"> 89 82 <number>999</number> 90 83 </property> … … 92 85 </item> 93 86 <item> 94 <widget class="QLabel" name="label_3" 95 <property name="text" 87 <widget class="QLabel" name="label_3"> 88 <property name="text"> 96 89 <string>to</string> 97 90 </property> … … 99 92 </item> 100 93 <item> 101 <widget class="QSpinBox" name="to" 102 <property name="enabled" 94 <widget class="QSpinBox" name="to"> 95 <property name="enabled"> 103 96 <bool>false</bool> 104 97 </property> 105 <property name="minimum" 98 <property name="minimum"> 106 99 <number>1</number> 107 100 </property> 108 <property name="maximum" 101 <property name="maximum"> 109 102 <number>999</number> 110 103 </property> … … 113 106 <item> 114 107 <spacer> 115 <property name="orientation" 108 <property name="orientation"> 116 109 <enum>Qt::Horizontal</enum> 117 110 </property> 118 <property name="sizeHint" stdset="0" 111 <property name="sizeHint" stdset="0"> 119 112 <size> 120 113 <width>0</width> … … 127 120 </item> 128 121 <item> 129 <widget class="QRadioButton" name="printSelection" > 130 <property name="text" > 122 <widget class="QRadioButton" name="printCurrentPage"> 123 <property name="text"> 124 <string>Current Page</string> 125 </property> 126 </widget> 127 </item> 128 <item> 129 <widget class="QRadioButton" name="printSelection"> 130 <property name="text"> 131 131 <string>Selection</string> 132 132 </property> … … 134 134 </item> 135 135 <item> 136 <spacer name="verticalSpacer" 137 <property name="orientation" 136 <spacer name="verticalSpacer"> 137 <property name="orientation"> 138 138 <enum>Qt::Vertical</enum> 139 139 </property> 140 <property name="sizeHint" stdset="0" 140 <property name="sizeHint" stdset="0"> 141 141 <size> 142 142 <width>1</width> … … 150 150 </item> 151 151 <item> 152 <widget class="QGroupBox" name="groupBox" 153 <property name="title" 152 <widget class="QGroupBox" name="groupBox"> 153 <property name="title"> 154 154 <string>Output Settings</string> 155 155 </property> 156 <layout class="QGridLayout" name="gridLayout" 157 <item row="0" column="0" 158 <widget class="QLabel" name="label" 159 <property name="text" 156 <layout class="QGridLayout" name="gridLayout"> 157 <item row="0" column="0"> 158 <widget class="QLabel" name="label"> 159 <property name="text"> 160 160 <string>Copies:</string> 161 161 </property> 162 <property name="buddy" 162 <property name="buddy"> 163 163 <cstring>copies</cstring> 164 164 </property> 165 165 </widget> 166 166 </item> 167 <item row="0" column="1" colspan="2" 168 <widget class="QSpinBox" name="copies" 169 <property name="minimum" 167 <item row="0" column="1" colspan="2"> 168 <widget class="QSpinBox" name="copies"> 169 <property name="minimum"> 170 170 <number>1</number> 171 171 </property> 172 <property name="maximum" 172 <property name="maximum"> 173 173 <number>999</number> 174 174 </property> 175 175 </widget> 176 176 </item> 177 <item row="0" column="3" 178 <spacer name="horizontalSpacer" 179 <property name="orientation" 177 <item row="0" column="3"> 178 <spacer name="horizontalSpacer"> 179 <property name="orientation"> 180 180 <enum>Qt::Horizontal</enum> 181 181 </property> 182 <property name="sizeHint" stdset="0" 182 <property name="sizeHint" stdset="0"> 183 183 <size> 184 184 <width>91</width> … … 188 188 </spacer> 189 189 </item> 190 <item row="1" column="0" colspan="2" 191 <widget class="QCheckBox" name="collate" 192 <property name="text" 190 <item row="1" column="0" colspan="2"> 191 <widget class="QCheckBox" name="collate"> 192 <property name="text"> 193 193 <string>Collate</string> 194 194 </property> 195 195 </widget> 196 196 </item> 197 <item row span="2" row="1" column="2" colspan="2">198 <widget class="QLabel" name="outputIcon" 199 <property name="sizePolicy" 200 <sizepolicy vsizetype="Ignored" hsizetype="Ignored">197 <item row="1" column="2" rowspan="2" colspan="2"> 198 <widget class="QLabel" name="outputIcon"> 199 <property name="sizePolicy"> 200 <sizepolicy hsizetype="Ignored" vsizetype="Ignored"> 201 201 <horstretch>0</horstretch> 202 202 <verstretch>0</verstretch> … … 205 205 </widget> 206 206 </item> 207 <item row="2" column="0" colspan="2" 208 <widget class="QCheckBox" name="reverse" 209 <property name="text" 207 <item row="2" column="0" colspan="2"> 208 <widget class="QCheckBox" name="reverse"> 209 <property name="text"> 210 210 <string>Reverse</string> 211 211 </property> 212 212 </widget> 213 213 </item> 214 <item row="3" column="0" colspan="4" 215 <spacer name="verticalSpacer_2" 216 <property name="orientation" 214 <item row="3" column="0" colspan="4"> 215 <spacer name="verticalSpacer_2"> 216 <property name="orientation"> 217 217 <enum>Qt::Vertical</enum> 218 218 </property> 219 <property name="sizeHint" stdset="0" 219 <property name="sizeHint" stdset="0"> 220 220 <size> 221 221 <width>0</width> … … 230 230 </layout> 231 231 </widget> 232 <widget class="QWidget" name="optionsTab" > 233 <property name="geometry" > 234 <rect> 235 <x>0</x> 236 <y>0</y> 237 <width>412</width> 238 <height>139</height> 239 </rect> 240 </property> 241 <attribute name="title" > 232 <widget class="QWidget" name="optionsTab"> 233 <attribute name="title"> 242 234 <string>Options</string> 243 235 </attribute> 244 <layout class="QGridLayout" name="gridLayout_2" 245 <item row="0" column="1" 246 <widget class="QGroupBox" name="colorMode" 247 <property name="title" 236 <layout class="QGridLayout" name="gridLayout_2"> 237 <item row="0" column="1"> 238 <widget class="QGroupBox" name="colorMode"> 239 <property name="title"> 248 240 <string>Color Mode</string> 249 241 </property> 250 <layout class="QGridLayout" name="gridLayout_4" 251 <item row="2" column="0" 252 <spacer name="verticalSpacer_6" 253 <property name="orientation" 242 <layout class="QGridLayout" name="gridLayout_4"> 243 <item row="2" column="0"> 244 <spacer name="verticalSpacer_6"> 245 <property name="orientation"> 254 246 <enum>Qt::Vertical</enum> 255 247 </property> 256 <property name="sizeHint" stdset="0" 248 <property name="sizeHint" stdset="0"> 257 249 <size> 258 250 <width>1</width> … … 262 254 </spacer> 263 255 </item> 264 <item row="0" column="0" 265 <widget class="QRadioButton" name="color" 266 <property name="text" 256 <item row="0" column="0"> 257 <widget class="QRadioButton" name="color"> 258 <property name="text"> 267 259 <string>Color</string> 268 260 </property> 269 261 </widget> 270 262 </item> 271 <item row span="3" row="0" column="1">272 <widget class="QLabel" name="colorIcon" 273 </item> 274 <item row="1" column="0" 275 <widget class="QRadioButton" name="grayscale" 276 <property name="text" 263 <item row="0" column="1" rowspan="3"> 264 <widget class="QLabel" name="colorIcon"/> 265 </item> 266 <item row="1" column="0"> 267 <widget class="QRadioButton" name="grayscale"> 268 <property name="text"> 277 269 <string>Grayscale</string> 278 270 </property> … … 282 274 </widget> 283 275 </item> 284 <item row="0" column="0" 285 <widget class="QGroupBox" name="duplex" 286 <property name="title" 276 <item row="0" column="0"> 277 <widget class="QGroupBox" name="duplex"> 278 <property name="title"> 287 279 <string>Duplex Printing</string> 288 280 </property> 289 <layout class="QVBoxLayout" name="verticalLayout" 290 <item> 291 <widget class="QRadioButton" name="noDuplex" 292 <property name="text" 281 <layout class="QVBoxLayout" name="verticalLayout"> 282 <item> 283 <widget class="QRadioButton" name="noDuplex"> 284 <property name="text"> 293 285 <string>None</string> 294 286 </property> 295 <property name="checked" 287 <property name="checked"> 296 288 <bool>true</bool> 297 289 </property> … … 299 291 </item> 300 292 <item> 301 <widget class="QRadioButton" name="duplexLong" 302 <property name="text" 293 <widget class="QRadioButton" name="duplexLong"> 294 <property name="text"> 303 295 <string>Long side</string> 304 296 </property> … … 306 298 </item> 307 299 <item> 308 <widget class="QRadioButton" name="duplexShort" 309 <property name="text" 300 <widget class="QRadioButton" name="duplexShort"> 301 <property name="text"> 310 302 <string>Short side</string> 311 303 </property> … … 313 305 </item> 314 306 <item> 315 <spacer name="verticalSpacer_42" 316 <property name="orientation" 307 <spacer name="verticalSpacer_42"> 308 <property name="orientation"> 317 309 <enum>Qt::Vertical</enum> 318 310 </property> 319 <property name="sizeHint" stdset="0" 311 <property name="sizeHint" stdset="0"> 320 312 <size> 321 313 <width>1</width> … … 342 334 <slot>setEnabled(bool)</slot> 343 335 <hints> 344 <hint type="sourcelabel" 336 <hint type="sourcelabel"> 345 337 <x>76</x> 346 338 <y>59</y> 347 339 </hint> 348 <hint type="destinationlabel" 340 <hint type="destinationlabel"> 349 341 <x>122</x> 350 342 <y>57</y> … … 358 350 <slot>setEnabled(bool)</slot> 359 351 <hints> 360 <hint type="sourcelabel" 352 <hint type="sourcelabel"> 361 353 <x>69</x> 362 354 <y>67</y> 363 355 </hint> 364 <hint type="destinationlabel" 356 <hint type="destinationlabel"> 365 357 <x>215</x> 366 358 <y>67</y> -
trunk/src/gui/dialogs/qprogressdialog.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 47 47 #include "qpainter.h" 48 48 #include "qdrawutil.h" 49 #include "qdatetime.h"50 49 #include "qlabel.h" 51 50 #include "qprogressbar.h" … … 55 54 #include "qcursor.h" 56 55 #include "qtimer.h" 56 #include "qelapsedtimer.h" 57 57 #include <private/qdialog_p.h> 58 58 #include <limits.h> … … 104 104 bool shown_once; 105 105 bool cancellation_flag; 106 Q Timestarttime;106 QElapsedTimer starttime; 107 107 #ifndef QT_NO_CURSOR 108 108 QCursor parentCursor; … … 154 154 bool(q->style()->styleHint(QStyle::SH_ProgressDialog_CenterCancelButton, 0, q)); 155 155 156 int additionalSpacing = 0; 157 #ifdef Q_OS_SYMBIAN 158 //In Symbian, we need to have wider margins for dialog borders, as the actual border is some pixels 159 //inside the dialog area (to enable transparent borders) 160 additionalSpacing = mlr; 161 #endif 162 156 163 QSize cs = cancel ? cancel->sizeHint() : QSize(0,0); 157 164 QSize bh = bar->sizeHint(); … … 186 193 187 194 if (label) 188 label->setGeometry(mlr, 0, q->width()-mlr*2, lh);189 bar->setGeometry(mlr, lh +sp, q->width()-mlr*2, bh.height());195 label->setGeometry(mlr, additionalSpacing, q->width() - mlr * 2, lh); 196 bar->setGeometry(mlr, lh + sp + additionalSpacing, q->width() - mlr * 2, bh.height()); 190 197 } 191 198 -
trunk/src/gui/dialogs/qprogressdialog.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/dialogs/qsidebar.cpp
r766 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/dialogs/qsidebar_p.h
r765 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/dialogs/qwizard.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 219 219 topLevelMarginBottom(-1), childMarginLeft(-1), childMarginRight(-1), 220 220 childMarginTop(-1), childMarginBottom(-1), hspacing(-1), vspacing(-1), 221 222 subTitle(false), extension(false) {}221 wizStyle(QWizard::ClassicStyle), header(false), watermark(false), title(false), 222 subTitle(false), extension(false), sideWidget(false) {} 223 223 224 224 int topLevelMarginLeft; … … 239 239 bool subTitle; 240 240 bool extension; 241 bool sideWidget; 241 242 242 243 bool operator==(const QWizardLayoutInfo &other); … … 262 263 && title == other.title 263 264 && subTitle == other.subTitle 264 && extension == other.extension; 265 && extension == other.extension 266 && sideWidget == other.sideWidget; 265 267 } 266 268 … … 426 428 }; 427 429 430 class QWatermarkLabel : public QLabel 431 { 432 public: 433 QWatermarkLabel(QWidget *parent, QWidget *sideWidget) : QLabel(parent), m_sideWidget(sideWidget) { 434 m_layout = new QVBoxLayout(this); 435 if (m_sideWidget) 436 m_layout->addWidget(m_sideWidget); 437 } 438 439 QSize minimumSizeHint() const { 440 if (!pixmap() && !pixmap()->isNull()) 441 return pixmap()->size(); 442 return QFrame::minimumSizeHint(); 443 } 444 445 void setSideWidget(QWidget *widget) { 446 if (m_sideWidget == widget) 447 return; 448 if (m_sideWidget) { 449 m_layout->removeWidget(m_sideWidget); 450 m_sideWidget->hide(); 451 } 452 m_sideWidget = widget; 453 if (m_sideWidget) 454 m_layout->addWidget(m_sideWidget); 455 } 456 QWidget *sideWidget() const { 457 return m_sideWidget; 458 } 459 private: 460 QVBoxLayout *m_layout; 461 QWidget *m_sideWidget; 462 }; 463 428 464 class QWizardPagePrivate : public QWidgetPrivate 429 465 { … … 502 538 inline QWizardPrivate() 503 539 : start(-1) 540 , startSetByUser(false) 504 541 , current(-1) 505 542 , canContinue(false) … … 514 551 , headerWidget(0) 515 552 , watermarkLabel(0) 553 , sideWidget(0) 516 554 , titleLabel(0) 517 555 , subTitleLabel(0) … … 582 620 QSet<int> initialized; // ### remove and move bit to QWizardPage? 583 621 int start; 622 bool startSetByUser; 584 623 int current; 585 624 bool canContinue; … … 613 652 QWidget *placeholderWidget2; 614 653 QWizardHeader *headerWidget; 615 QLabel *watermarkLabel; 654 QWatermarkLabel *watermarkLabel; 655 QWidget *sideWidget; 616 656 QFrame *pageFrame; 617 657 QLabel *titleLabel; … … 908 948 info.header = (info.wizStyle == QWizard::ClassicStyle || info.wizStyle == QWizard::ModernStyle) 909 949 && !(opts & QWizard::IgnoreSubTitles) && !subTitleText.isEmpty(); 950 info.sideWidget = sideWidget; 910 951 info.watermark = (info.wizStyle != QWizard::MacStyle) && (info.wizStyle != QWizard::AeroStyle) 911 952 && !watermarkPixmap.isNull(); 912 953 info.title = !info.header && !titleText.isEmpty(); 913 954 info.subTitle = !(opts & QWizard::IgnoreSubTitles) && !info.header && !subTitleText.isEmpty(); 914 info.extension = info.watermark&& (opts & QWizard::ExtendedWatermarkPixmap);955 info.extension = (info.watermark || info.sideWidget) && (opts & QWizard::ExtendedWatermarkPixmap); 915 956 916 957 return info; … … 955 996 if (mac) { 956 997 numColumns = 3; 957 } else if (info.watermark ) {998 } else if (info.watermark || info.sideWidget) { 958 999 numColumns = 2; 959 1000 } else { … … 1097 1138 } 1098 1139 1099 if ( info.watermark&& !watermarkLabel) {1100 watermarkLabel = new Q Label(antiFlickerWidget);1140 if ((info.watermark || info.sideWidget) && !watermarkLabel) { 1141 watermarkLabel = new QWatermarkLabel(antiFlickerWidget, sideWidget); 1101 1142 watermarkLabel->setBackgroundRole(QPalette::Base); 1102 1143 watermarkLabel->setMinimumHeight(1); … … 1174 1215 mainLayout->addLayout(buttonLayout, row++, buttonStartColumn, 1, buttonNumColumns); 1175 1216 1176 if (info.watermark ) {1217 if (info.watermark || info.sideWidget) { 1177 1218 if (info.extension) 1178 1219 watermarkEndRow = row; … … 1194 1235 bottomRuler->setVisible(classic || modern); 1195 1236 if (watermarkLabel) 1196 watermarkLabel->setVisible(info.watermark );1237 watermarkLabel->setVisible(info.watermark || info.sideWidget); 1197 1238 1198 1239 layoutInfo = info; … … 1234 1275 } 1235 1276 1236 if (info.watermark) { 1237 Q_ASSERT(page); 1238 watermarkLabel->setPixmap(page->pixmap(QWizard::WatermarkPixmap)); 1239 } 1277 if (info.watermark || info.sideWidget) { 1278 QPixmap pix; 1279 if (info.watermark) { 1280 if (page) 1281 pix = page->pixmap(QWizard::WatermarkPixmap); 1282 else 1283 pix = q->pixmap(QWizard::WatermarkPixmap); 1284 } 1285 watermarkLabel->setPixmap(pix); // in case there is no watermark and we show the side widget we need to clear the watermark 1286 } 1287 1240 1288 if (info.title) { 1241 1289 Q_ASSERT(page); … … 1268 1316 maximumSize.setWidth(headerWidget->maximumWidth()); 1269 1317 } 1270 if (info.watermark ) {1318 if (info.watermark && !info.sideWidget) { 1271 1319 minimumSize.setHeight(mainLayout->totalSizeHint().height()); 1272 1320 maximumSize.setHeight(mainLayout->totalSizeHint().height()); … … 2150 2198 QWizard so far. 2151 2199 2152 \sa setPage(), page() 2200 \sa setPage(), page(), pageAdded() 2153 2201 */ 2154 2202 int QWizard::addPage(QWizardPage *page) … … 2167 2215 Adds the given \a page to the wizard with the given \a id. 2168 2216 2169 \sa addPage(), page() 2217 \note Adding a page may influence the value of the startId property 2218 in case it was not set explicitly. 2219 2220 \sa addPage(), page(), pageAdded() 2170 2221 */ 2171 2222 void QWizard::setPage(int theid, QWizardPage *page) … … 2211 2262 page->hide(); 2212 2263 d->pageVBoxLayout->setEnabled(pageVBoxLayoutEnabled); 2264 2265 if (!d->startSetByUser && d->pageMap.constBegin().key() == theid) 2266 d->start = theid; 2267 emit pageAdded(theid); 2213 2268 } 2214 2269 2215 2270 /*! 2216 2271 Removes the page with the given \a id. cleanupPage() will be called if necessary. 2272 2273 \note Removing a page may influence the value of the startId property. 2274 2217 2275 \since 4.5 2218 \sa addPage(), setPage() 2276 \sa addPage(), setPage(), pageRemoved(), startId() 2219 2277 */ 2220 2278 void QWizard::removePage(int id) … … 2224 2282 QWizardPage *removedPage = 0; 2225 2283 2226 if (d->start == id) 2227 d->start = -1; 2284 // update startItem accordingly 2285 if (d->pageMap.count() > 0) { // only if we have any pages 2286 if (d->start == id) { 2287 const int firstId = d->pageMap.constBegin().key(); 2288 if (firstId == id) { 2289 if (d->pageMap.count() > 1) 2290 d->start = (++d->pageMap.constBegin()).key(); // secondId 2291 else 2292 d->start = -1; // removing the last page 2293 } else { // startSetByUser has to be "true" here 2294 d->start = firstId; 2295 } 2296 d->startSetByUser = false; 2297 } 2298 } 2299 2300 if (d->pageMap.contains(id)) 2301 emit pageRemoved(id); 2228 2302 2229 2303 if (!d->history.contains(id)) { … … 2335 2409 { 2336 2410 Q_D(QWizard); 2337 if (!d->pageMap.contains(theid)) { 2338 qWarning("QWizard::setStartId: Invalid page ID %d", theid); 2411 int newStart = theid; 2412 if (theid == -1) 2413 newStart = d->pageMap.count() ? d->pageMap.constBegin().key() : -1; 2414 2415 if (d->start == newStart) { 2416 d->startSetByUser = theid != -1; 2339 2417 return; 2340 2418 } 2341 d->start = theid; 2419 2420 if (!d->pageMap.contains(newStart)) { 2421 qWarning("QWizard::setStartId: Invalid page ID %d", newStart); 2422 return; 2423 } 2424 d->start = newStart; 2425 d->startSetByUser = theid != -1; 2342 2426 } 2343 2427 … … 2345 2429 { 2346 2430 Q_D(const QWizard); 2347 if (d->start != -1) 2348 return d->start; 2349 if (!d->pageMap.isEmpty()) 2350 return d->pageMap.constBegin().key(); 2351 return -1; 2431 return d->start; 2352 2432 } 2353 2433 … … 2826 2906 2827 2907 /*! 2908 \since 4.7 2909 2910 Sets the given \a widget to be shown on the left side of the wizard. 2911 For styles which use the WatermarkPixmap (ClassicStyle and ModernStyle) 2912 the side widget is displayed on top of the watermark, for other styles 2913 or when the watermark is not provided the side widget is displayed 2914 on the left side of the wizard. 2915 2916 Passing 0 shows no side widget. 2917 2918 When the \a widget is not 0 the wizard reparents it. 2919 2920 Any previous side widget is hidden. 2921 2922 You may call setSideWidget() with the same widget at different 2923 times. 2924 2925 All widgets set here will be deleted by the wizard when it is 2926 destroyed unless you separately reparent the widget after setting 2927 some other side widget (or 0). 2928 2929 By default, no side widget is present. 2930 */ 2931 void QWizard::setSideWidget(QWidget *widget) 2932 { 2933 Q_D(QWizard); 2934 2935 d->sideWidget = widget; 2936 if (d->watermarkLabel) { 2937 d->watermarkLabel->setSideWidget(widget); 2938 d->updateLayout(); 2939 } 2940 } 2941 2942 /*! 2943 \since 4.7 2944 2945 Returns the widget on the left side of the wizard or 0. 2946 2947 By default, no side widget is present. 2948 */ 2949 QWidget *QWizard::sideWidget() const 2950 { 2951 Q_D(const QWizard); 2952 2953 return d->sideWidget; 2954 } 2955 2956 /*! 2828 2957 \reimp 2829 2958 */ … … 2876 3005 2877 3006 \sa currentId(), currentPage() 3007 */ 3008 3009 /*! 3010 \fn void QWizard::pageAdded(int id) 3011 3012 \since 4.7 3013 3014 This signal is emitted whenever a page is added to the 3015 wizard. The page's \a id is passed as parameter. 3016 3017 \sa addPage(), setPage(), startId() 3018 */ 3019 3020 /*! 3021 \fn void QWizard::pageRemoved(int id) 3022 3023 \since 4.7 3024 3025 This signal is emitted whenever a page is removed from the 3026 wizard. The page's \a id is passed as parameter. 3027 3028 \sa removePage(), startId() 2878 3029 */ 2879 3030 -
trunk/src/gui/dialogs/qwizard.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 166 166 QPixmap pixmap(WizardPixmap which) const; 167 167 168 void setSideWidget(QWidget *widget); 169 QWidget *sideWidget() const; 170 168 171 void setDefaultProperty(const char *className, const char *property, 169 172 const char *changedSignal); … … 176 179 void helpRequested(); 177 180 void customButtonClicked(int which); 181 void pageAdded(int id); 182 void pageRemoved(int id); 178 183 179 184 public Q_SLOTS: -
trunk/src/gui/dialogs/qwizard_win.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 44 44 45 45 #include "qwizard_win_p.h" 46 #include "qlibrary.h"46 #include <private/qsystemlibrary_p.h> 47 47 #include "qwizard.h" 48 48 #include "qpaintengine.h" … … 181 181 { 182 182 ensurePolished(); 183 int width = 32, height = 32; 183 int size = int(QStyleHelper::dpiScaled(32)); 184 int width = size, height = size; 184 185 /* 185 186 HANDLE theme = pOpenThemeData(0, L"Navigation"); … … 214 215 //RECT rect; 215 216 RECT clipRect; 216 int xoffset = QWidget::mapToParent(r.topLeft()).x() ;217 int yoffset = QWidget::mapToParent(r.topLeft()).y() ;217 int xoffset = QWidget::mapToParent(r.topLeft()).x() - 1; 218 int yoffset = QWidget::mapToParent(r.topLeft()).y() - 1; 218 219 219 220 clipRect.top = r.top() + yoffset; … … 238 239 239 240 QVistaHelper::QVistaHelper(QWizard *wizard) 240 : pressed(false) 241 : QObject(wizard) 242 , pressed(false) 241 243 , wizard(wizard) 242 244 , backButton_(0) … … 245 247 if (is_vista) 246 248 backButton_ = new QVistaBackButton(wizard); 249 250 // Handle diff between Windows 7 and Vista 251 iconSpacing = QStyleHelper::dpiScaled(7); 252 textSpacing = QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS7 ? 253 iconSpacing : QStyleHelper::dpiScaled(20); 247 254 } 248 255 … … 308 315 void QVistaHelper::drawTitleBar(QPainter *painter) 309 316 { 317 HDC hdc = painter->paintEngine()->getDC(); 318 310 319 if (vistaState() == VistaAero) 311 drawBlackRect( 312 QRect(0, 0, wizard->width(), titleBarSize() + topOffset()), 313 painter->paintEngine()->getDC()); 314 320 drawBlackRect(QRect(0, 0, wizard->width(), 321 titleBarSize() + topOffset()), hdc); 315 322 Q_ASSERT(backButton_); 316 323 const int btnTop = backButton_->mapToParent(QPoint()).y(); 317 324 const int btnHeight = backButton_->size().height(); 318 const int verticalCenter = (btnTop + btnHeight / 2); 319 320 wizard->windowIcon().paint( 321 painter, QRect(leftMargin(), verticalCenter - iconSize() / 2, iconSize(), iconSize())); 325 const int verticalCenter = (btnTop + btnHeight / 2) - 1; 322 326 323 327 const QString text = wizard->window()->windowTitle(); … … 327 331 int textHeight = brect.height(); 328 332 int textWidth = brect.width(); 333 int glowOffset = 0; 334 329 335 if (vistaState() == VistaAero) { 330 336 textHeight += 2 * glowSize(); 331 337 textWidth += 2 * glowSize(); 332 } 338 glowOffset = glowSize(); 339 } 340 333 341 drawTitleText( 334 342 painter, text, 335 QRect(titleOffset(), verticalCenter - textHeight / 2, textWidth, textHeight), 336 painter->paintEngine()->getDC()); 343 QRect(titleOffset() - glowOffset, verticalCenter - textHeight / 2, textWidth, textHeight), 344 hdc); 345 346 if (!wizard->windowIcon().isNull()) { 347 QRect rect(leftMargin(), verticalCenter - iconSize() / 2, iconSize(), iconSize()); 348 HICON hIcon = wizard->windowIcon().pixmap(iconSize()).toWinHICON(); 349 DrawIconEx(hdc, rect.left(), rect.top(), hIcon, 0, 0, 0, NULL, DI_NORMAL | DI_COMPAT); 350 DestroyIcon(hIcon); 351 } 337 352 } 338 353 … … 692 707 if (!tried) { 693 708 tried = true; 694 Q Library dwmLib(QString::fromAscii("dwmapi"));709 QSystemLibrary dwmLib(L"dwmapi"); 695 710 pDwmIsCompositionEnabled = 696 711 (PtrDwmIsCompositionEnabled)dwmLib.resolve("DwmIsCompositionEnabled"); … … 700 715 (PtrDwmExtendFrameIntoClientArea)dwmLib.resolve("DwmExtendFrameIntoClientArea"); 701 716 } 702 Q Library themeLib(QString::fromAscii("uxtheme"));717 QSystemLibrary themeLib(L"uxtheme"); 703 718 pIsAppThemed = (PtrIsAppThemed)themeLib.resolve("IsAppThemed"); 704 719 if (pIsAppThemed) { … … 734 749 int QVistaHelper::titleOffset() 735 750 { 736 int iconOffset = wizard ->windowIcon().isNull() ? 0 : iconSize() + padding();751 int iconOffset = wizard ->windowIcon().isNull() ? 0 : iconSize() + textSpacing; 737 752 return leftMargin() + iconOffset; 738 753 } -
trunk/src/gui/dialogs/qwizard_win_p.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 62 62 #include <qabstractbutton.h> 63 63 #include <QtGui/private/qwidget_p.h> 64 #include <QtGui/private/qstylehelper_p.h> 64 65 65 66 QT_BEGIN_NAMESPACE … … 83 84 class QVistaHelper : public QObject 84 85 { 85 Q_OBJECT86 86 public: 87 87 QVistaHelper(QWizard *wizard); … … 102 102 static VistaState vistaState(); 103 103 static int titleBarSize() { return frameSize() + captionSize(); } 104 static int topPadding() { return 8; } 105 static int topOffset() { return titleBarSize() + (vistaState() == VistaAero ? 13 : 3); } 106 104 static int topPadding() { // padding under text 105 return int(QStyleHelper::dpiScaled( 106 QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS7 ? 4 : 6)); 107 } 108 static int topOffset() { 109 static int aeroOffset = QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS7 ? 110 QStyleHelper::dpiScaled(4) : QStyleHelper::dpiScaled(13); 111 return (titleBarSize() + (vistaState() == VistaAero ? aeroOffset : 3)); } 107 112 private: 108 113 static HFONT getCaptionFont(HANDLE hTheme); … … 113 118 static int captionSize() { return GetSystemMetrics(SM_CYCAPTION); } 114 119 115 static int backButtonSize() { return 31; } // ### should be queried from back button itself120 static int backButtonSize() { return int(QStyleHelper::dpiScaled(30)); } 116 121 static int iconSize() { return 16; } // Standard Aero 117 static int padding() { return 7; } // Standard Aero118 static int leftMargin() { return backButtonSize() + padding(); }119 122 static int glowSize() { return 10; } 123 int leftMargin() { return backButton_->isVisible() ? backButtonSize() + iconSpacing : 0; } 120 124 121 125 int titleOffset(); … … 141 145 QWizard *wizard; 142 146 QVistaBackButton *backButton_; 147 148 int titleBarOffset; // Extra spacing above the text 149 int iconSpacing; // Space between button and icon 150 int textSpacing; // Space between icon and text 143 151 }; 144 152
Note:
See TracChangeset
for help on using the changeset viewer.