Changeset 561 for trunk/src/gui/util
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 23 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/gui/util/qcompleter.cpp
r172 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 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 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 159 159 QCompletionModel::QCompletionModel(QCompleterPrivate *c, QObject *parent) 160 160 : QAbstractProxyModel(*new QCompletionModelPrivate, parent), 161 c(c), engine(0),showAll(false)161 c(c), showAll(false) 162 162 { 163 163 createEngine(); … … 209 209 } 210 210 211 delete engine;212 211 if (sortedEngine) 213 engine = new QSortedModelEngine(c);212 engine.reset(new QSortedModelEngine(c)); 214 213 else 215 engine = new QUnsortedModelEngine(c);214 engine.reset(new QUnsortedModelEngine(c)); 216 215 } 217 216 … … 483 482 QString str = source->index(i, c->column).data().toString(); 484 483 if (str.startsWith(c->prefix, c->cs) 485 #if !defined(Q_OS_OS2) && (!defined(Q_OS_WIN) || defined(Q_OS_WINCE))484 #if (!defined(Q_OS_WIN) || defined(Q_OS_WINCE)) && !defined(Q_OS_SYMBIAN) && !defined(Q_OS_OS2) 486 485 && (!dirModel || QDir::toNativeSeparators(str) != QDir::separator()) 487 486 #endif … … 773 772 QCompleterPrivate::QCompleterPrivate() 774 773 : widget(0), proxy(0), popup(0), cs(Qt::CaseSensitive), role(Qt::EditRole), column(0), 775 sorting(QCompleter::UnsortedModel), wrap(true), eatFocusOut(true)774 maxVisibleItems(7), sorting(QCompleter::UnsortedModel), wrap(true), eatFocusOut(true) 776 775 { 777 776 } … … 825 824 QString completion; 826 825 827 if (!index.isValid() || ( index.row() >= proxy->engine->matchCount())) {826 if (!index.isValid() || (!proxy->showAll && (index.row() >= proxy->engine->matchCount()))) { 828 827 completion = prefix; 829 828 } else { 829 if (!(index.flags() & Qt::ItemIsEnabled)) 830 return; 830 831 QModelIndex si = proxy->mapToSource(index); 831 832 si = si.sibling(si.row(), column); // for clicked() … … 862 863 QPoint pos; 863 864 int rw, rh, w; 864 int h = (popup->sizeHintForRow(0) * qMin( 7, popup->model()->rowCount()) + 3) + 3;865 int h = (popup->sizeHintForRow(0) * qMin(maxVisibleItems, popup->model()->rowCount()) + 3) + 3; 865 866 QScrollBar *hsb = popup->horizontalScrollBar(); 866 867 if (hsb && hsb->isVisible()) … … 988 989 #ifndef QT_NO_DIRMODEL 989 990 if (qobject_cast<QDirModel *>(model)) { 990 #if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_ OS2)991 #if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_SYMBIAN) || defined(Q_OS_OS2) 991 992 setCaseSensitivity(Qt::CaseInsensitive); 992 993 #else … … 1078 1079 if (popup->model() != d->proxy) 1079 1080 popup->setModel(d->proxy); 1080 popup->hide(); 1081 popup->setParent(0, Qt::Popup); 1082 1083 Qt::FocusPolicy origPolicy; 1081 #ifdef Q_OS_MAC 1082 popup->show(); 1083 #else 1084 popup->hide(); 1085 #endif 1086 1087 Qt::FocusPolicy origPolicy = Qt::NoFocus; 1084 1088 if (d->widget) 1085 1089 origPolicy = d->widget->focusPolicy(); 1090 popup->setParent(0, Qt::Popup); 1086 1091 popup->setFocusPolicy(Qt::NoFocus); 1087 1092 if (d->widget) … … 1099 1104 QObject::connect(popup, SIGNAL(clicked(QModelIndex)), 1100 1105 this, SLOT(_q_complete(QModelIndex))); 1101 QObject::connect(popup, SIGNAL(clicked(QModelIndex)), popup, SLOT(hide())); 1106 QObject::connect(this, SIGNAL(activated(QModelIndex)), 1107 popup, SLOT(hide())); 1102 1108 1103 1109 QObject::connect(popup->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), … … 1179 1185 if (!curIndex.isValid()) { 1180 1186 int rowCount = d->proxy->rowCount(); 1181 QModelIndex lastIndex = d->proxy->index(rowCount - 1, 0);1187 QModelIndex lastIndex = d->proxy->index(rowCount - 1, d->column); 1182 1188 d->setCurrentIndex(lastIndex); 1183 1189 return true; … … 1191 1197 case Qt::Key_Down: 1192 1198 if (!curIndex.isValid()) { 1193 QModelIndex firstIndex = d->proxy->index(0, 0);1199 QModelIndex firstIndex = d->proxy->index(0, d->column); 1194 1200 d->setCurrentIndex(firstIndex); 1195 1201 return true; … … 1507 1513 1508 1514 /*! 1515 \property QCompleter::maxVisibleItems 1516 \brief the maximum allowed size on screen of the completer, measured in items 1517 \since 4.6 1518 1519 By default, this property has a value of 7. 1520 */ 1521 int QCompleter::maxVisibleItems() const 1522 { 1523 Q_D(const QCompleter); 1524 return d->maxVisibleItems; 1525 } 1526 1527 void QCompleter::setMaxVisibleItems(int maxItems) 1528 { 1529 Q_D(QCompleter); 1530 if (maxItems < 0) { 1531 qWarning("QCompleter::setMaxVisibleItems: " 1532 "Invalid max visible items (%d) must be >= 0", maxItems); 1533 return; 1534 } 1535 d->maxVisibleItems = maxItems; 1536 } 1537 1538 /*! 1509 1539 \property QCompleter::caseSensitivity 1510 1540 \brief the case sensitivity of the matching … … 1578 1608 that contains all the possible matches for the current completion prefix. 1579 1609 The completion model is auto-updated to reflect the current completions. 1610 1611 \note The return value of this function is defined to be an QAbstractItemModel 1612 purely for generality. This actual kind of model returned is an instance of an 1613 QAbstractProxyModel subclass. 1580 1614 1581 1615 \sa completionPrefix, model() … … 1621 1655 } while (idx.isValid()); 1622 1656 1623 #if !defined(Q_OS_OS2) && (!defined(Q_OS_WIN) || defined(Q_OS_WINCE))1657 #if (!defined(Q_OS_WIN) || defined(Q_OS_WINCE)) && !defined(Q_OS_SYMBIAN) && !defined(Q_OS_OS2) 1624 1658 if (list.count() == 1) // only the separator or some other text 1625 1659 return list[0]; … … 1655 1689 QString pathCopy = QDir::toNativeSeparators(path); 1656 1690 QString sep = QDir::separator(); 1657 #if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_OS2) 1691 #if defined(Q_OS_SYMBIAN) 1692 if (pathCopy == QLatin1String("\\")) 1693 return QStringList(pathCopy); 1694 #elif (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_OS2) 1658 1695 if (pathCopy == QLatin1String("\\") || pathCopy == QLatin1String("\\\\")) 1659 1696 return QStringList(pathCopy); … … 1665 1702 #endif 1666 1703 1667 QRegExp re(QLatin1 String("[") + QRegExp::escape(sep) + QLatin1String("]"));1704 QRegExp re(QLatin1Char('[') + QRegExp::escape(sep) + QLatin1Char(']')); 1668 1705 QStringList parts = pathCopy.split(re); 1669 1706 1670 #if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_OS2) 1707 #if defined(Q_OS_SYMBIAN) 1708 // Do nothing 1709 #elif (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_OS2) 1671 1710 if (!doubleSlash.isEmpty()) 1672 1711 parts[0].prepend(doubleSlash); -
trunk/src/gui/util/qcompleter.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 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 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 70 70 Q_PROPERTY(int completionColumn READ completionColumn WRITE setCompletionColumn) 71 71 Q_PROPERTY(int completionRole READ completionRole WRITE setCompletionRole) 72 Q_PROPERTY(int maxVisibleItems READ maxVisibleItems WRITE setMaxVisibleItems) 72 73 Q_PROPERTY(Qt::CaseSensitivity caseSensitivity READ caseSensitivity WRITE setCaseSensitivity) 73 74 Q_PROPERTY(bool wrapAround READ wrapAround WRITE setWrapAround) … … 119 120 bool wrapAround() const; 120 121 122 int maxVisibleItems() const; 123 void setMaxVisibleItems(int maxItems); 124 121 125 int completionCount() const; 122 126 bool setCurrentRow(int row); -
trunk/src/gui/util/qcompleter_p.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 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 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 88 88 int role; 89 89 int column; 90 int maxVisibleItems; 90 91 QCompleter::ModelSorting sorting; 91 92 bool wrap; … … 214 215 public: 215 216 QCompletionModel(QCompleterPrivate *c, QObject *parent); 216 ~QCompletionModel() { delete engine; }217 217 218 218 void createEngine(); … … 237 237 238 238 QCompleterPrivate *c; 239 Q CompletionEngine *engine;239 QScopedPointer<QCompletionEngine> engine; 240 240 bool showAll; 241 241 -
trunk/src/gui/util/qdesktopservices.cpp
r132 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 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 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 56 56 #elif defined(Q_WS_MAC) 57 57 #include "qdesktopservices_mac.cpp" 58 #elif defined(Q_OS_SYMBIAN) 59 #include "qdesktopservices_s60.cpp" 58 60 #endif 59 61 … … 289 291 may need to be created by the system or the user. 290 292 291 \note On Mac OS X, DataLocation does not include QCoreApplication::organizationName. 292 Use code like this to add it: 293 294 \code 295 QString location = QDesktopServices::storageLocation(QDesktopServices::DataLocation); 296 #ifdef Q_WS_MAC 297 location.insert(location.count() - QCoreApplication::applicationName().count(), 298 QCoreApplication::organizationName() + "/"); 299 #endif 300 \endcode 293 \note On Symbian OS, ApplicationsLocation always point /sys/bin folder on the same drive 294 with executable. FontsLocation always points to folder on ROM drive. Symbian OS does not 295 have desktop concept, DesktopLocation returns same path as DocumentsLocation. 296 Rest of the standard locations point to folder on same drive with executable, except 297 that if executable is in ROM the folder from C drive is returned. 301 298 */ 302 299 -
trunk/src/gui/util/qdesktopservices.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 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 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/src/gui/util/qdesktopservices_mac.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 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 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 97 97 static bool lsOpen(const QUrl &url) 98 98 { 99 if (!url.isValid() )99 if (!url.isValid() || url.scheme().isEmpty()) 100 100 return false; 101 101 … … 135 135 QString QDesktopServices::storageLocation(StandardLocation type) 136 136 { 137 if ( QDesktopServices::HomeLocation == type)137 if (type == HomeLocation) 138 138 return QDir::homePath(); 139 140 if (type == TempLocation) 141 return QDir::tempPath(); 139 142 140 143 short domain = kOnAppropriateDisk; 141 144 142 if (QDesktopServices::DataLocation == type 143 || QDesktopServices::CacheLocation == type) 145 if (type == DataLocation || type == CacheLocation) 144 146 domain = kUserDomain; 145 147 … … 152 154 QString path = getFullPath(ref); 153 155 154 QString appName = QCoreApplication::applicationName(); 155 if (!appName.isEmpty() && 156 (QDesktopServices::DataLocation == type || QDesktopServices::CacheLocation == type)) 157 path += QLatin1String("/") + appName; 156 if (type == DataLocation || type == CacheLocation) { 157 if (QCoreApplication::organizationName().isEmpty() == false) 158 path += QLatin1Char('/') + QCoreApplication::organizationName(); 159 if (QCoreApplication::applicationName().isEmpty() == false) 160 path += QLatin1Char('/') + QCoreApplication::applicationName(); 161 } 158 162 159 163 return path; -
trunk/src/gui/util/qdesktopservices_win.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 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 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 42 42 #include <qsettings.h> 43 43 #include <qdir.h> 44 #include <qlibrary.h> 44 45 #include <qurl.h> 45 46 #include <qstringlist.h> … … 48 49 #include <qcoreapplication.h> 49 50 50 #include < windows.h>51 #include <qt_windows.h> 51 52 #include <shlobj.h> 52 53 #if !defined(Q_OS_WINCE) … … 59 60 #endif 60 61 62 #if defined(Q_CC_MINGW) && !defined(CSIDL_MYMUSIC) 63 #define CSIDL_MYMUSIC 13 64 #define CSIDL_MYVIDEO 14 65 #endif 66 61 67 #ifndef QT_NO_DESKTOPSERVICES 62 68 63 69 QT_BEGIN_NAMESPACE 64 65 //#undef UNICODE66 70 67 71 static bool openDocument(const QUrl &file) … … 69 73 if (!file.isValid()) 70 74 return false; 71 72 quintptr returnValue; 73 QT_WA({ 74 returnValue = (quintptr)ShellExecute(0, 0, (TCHAR *)file.toString().utf16(), 0, 0, SW_SHOWNORMAL); 75 } , { 76 returnValue = (quintptr)ShellExecuteA(0, 0, file.toString().toLocal8Bit().constData(), 0, 0, SW_SHOWNORMAL); 77 }); 75 QString filePath = file.toLocalFile(); 76 if (filePath.isEmpty()) 77 filePath = file.toString(); 78 quintptr returnValue = (quintptr)ShellExecute(0, 0, (wchar_t*)filePath.utf16(), 0, 0, SW_SHOWNORMAL); 78 79 return (returnValue > 32); //ShellExecute returns a value greater than 32 if successful 79 80 } … … 81 82 static QString expandEnvStrings(const QString &command) 82 83 { 83 84 84 #if defined(Q_OS_WINCE) 85 85 return command; 86 86 #else 87 QByteArray path = command.toLocal8Bit(); 88 char commandValue[2 * MAX_PATH] = {0}; 89 DWORD returnValue = ExpandEnvironmentStringsA(path.data(), commandValue, MAX_PATH); 90 if (returnValue) 91 return QString::fromLocal8Bit(commandValue); 87 wchar_t buffer[MAX_PATH]; 88 if (ExpandEnvironmentStrings((wchar_t*)command.utf16(), buffer, MAX_PATH)) 89 return QString::fromWCharArray(buffer); 92 90 else 93 91 return command; … … 99 97 if (url.scheme() == QLatin1String("mailto")) { 100 98 //Retrieve the commandline for the default mail client 101 //the key used below is the command line for the mailto: shell command99 //the default key used below is the command line for the mailto: shell command 102 100 DWORD bufferSize = 2 * MAX_PATH; 103 101 long returnValue = -1; … … 106 104 HKEY handle; 107 105 LONG res; 108 QT_WA ({ 109 res = RegOpenKeyExW(HKEY_CLASSES_ROOT, L"mailto\\Shell\\Open\\Command", 0, KEY_READ, &handle); 110 if (res != ERROR_SUCCESS) 111 return false; 112 113 wchar_t keyValue[2 * MAX_PATH] = {0}; 114 returnValue = RegQueryValueExW(handle, L"", 0, 0, reinterpret_cast<unsigned char*>(keyValue), &bufferSize); 106 wchar_t keyValue[2 * MAX_PATH] = {0}; 107 QString keyName(QLatin1String("mailto")); 108 109 //Check if user has set preference, otherwise use default. 110 res = RegOpenKeyExW(HKEY_CURRENT_USER, 111 L"Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\mailto\\UserChoice", 112 0, KEY_READ, &handle); 113 if (res == ERROR_SUCCESS) { 114 returnValue = RegQueryValueEx(handle, L"Progid", 0, 0, reinterpret_cast<unsigned char*>(keyValue), &bufferSize); 115 115 if (!returnValue) 116 command = QString::fromRawData((QChar*)keyValue, bufferSize); 117 }, { 118 res = RegOpenKeyExA(HKEY_CLASSES_ROOT, "mailto\\Shell\\Open\\Command", 0, KEY_READ, &handle); 119 if (res != ERROR_SUCCESS) 120 return false; 121 122 char keyValue[2 * MAX_PATH] = {0}; 123 returnValue = RegQueryValueExA(handle, "", 0, 0, reinterpret_cast<unsigned char*>(keyValue), &bufferSize); 124 if (!returnValue) 125 command = QString::fromLocal8Bit(keyValue); 126 }); 116 keyName = QString::fromUtf16((const ushort*)keyValue); 117 RegCloseKey(handle); 118 } 119 keyName += QLatin1String("\\Shell\\Open\\Command"); 120 res = RegOpenKeyExW(HKEY_CLASSES_ROOT, (const wchar_t*)keyName.utf16(), 0, KEY_READ, &handle); 121 if (res != ERROR_SUCCESS) 122 return false; 123 124 bufferSize = 2 * MAX_PATH; 125 returnValue = RegQueryValueExW(handle, L"", 0, 0, reinterpret_cast<unsigned char*>(keyValue), &bufferSize); 126 if (!returnValue) 127 command = QString::fromRawData((QChar*)keyValue, bufferSize); 127 128 RegCloseKey(handle); 128 129 129 if (returnValue)130 if (returnValue) 130 131 return false; 132 131 133 command = expandEnvStrings(command); 132 134 command = command.trimmed(); … … 146 148 PROCESS_INFORMATION pi; 147 149 ZeroMemory(&pi, sizeof(pi)); 148 QT_WA ({ 149 STARTUPINFO si; 150 ZeroMemory(&si, sizeof(si)); 151 si.cb = sizeof(si); 152 153 returnValue = CreateProcess(NULL, (TCHAR*)command.utf16(), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); 154 }, { 155 STARTUPINFOA si; 156 ZeroMemory(&si, sizeof(si)); 157 si.cb = sizeof(si); 158 159 returnValue = CreateProcessA(NULL, command.toLocal8Bit().data(), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); 160 }); 150 STARTUPINFO si; 151 ZeroMemory(&si, sizeof(si)); 152 si.cb = sizeof(si); 153 154 returnValue = CreateProcess(NULL, (wchar_t*)command.utf16(), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); 161 155 162 156 if (!returnValue) … … 171 165 return false; 172 166 173 quintptr returnValue; 174 QT_WA ({ 175 returnValue = (quintptr)ShellExecute(0, 0, (TCHAR *) QString::fromUtf8(url.toEncoded().constData()).utf16(), 0, 0, SW_SHOWNORMAL); 176 } , { 177 returnValue = (quintptr)ShellExecuteA(0, 0, url.toEncoded().constData(), 0, 0, SW_SHOWNORMAL); 178 }); 167 if (url.scheme().isEmpty()) 168 return openDocument(url); 169 170 quintptr returnValue = (quintptr)ShellExecute(0, 0, (wchar_t *)QString::fromUtf8(url.toEncoded().constData()).utf16(), 171 0, 0, SW_SHOWNORMAL); 179 172 return (returnValue > 32); 180 173 } … … 182 175 QString QDesktopServices::storageLocation(StandardLocation type) 183 176 { 184 #if !defined(QT_NO_SETTINGS) 185 QSettings settings(QSettings::UserScope, QLatin1String("Microsoft"), QLatin1String("Windows")); 186 settings.beginGroup(QLatin1String("CurrentVersion/Explorer/Shell Folders")); 177 QString result; 178 179 #ifndef Q_OS_WINCE 180 QLibrary library(QLatin1String("shell32")); 181 #else 182 QLibrary library(QLatin1String("coredll")); 183 #endif // Q_OS_WINCE 184 typedef BOOL (WINAPI*GetSpecialFolderPath)(HWND, LPWSTR, int, BOOL); 185 static GetSpecialFolderPath SHGetSpecialFolderPath = 186 (GetSpecialFolderPath)library.resolve("SHGetSpecialFolderPathW"); 187 if (!SHGetSpecialFolderPath) 188 return QString(); 189 190 wchar_t path[MAX_PATH]; 191 187 192 switch (type) { 193 case DataLocation: 194 #if defined Q_WS_WINCE 195 if (SHGetSpecialFolderPath(0, path, CSIDL_APPDATA, FALSE)) 196 #else 197 if (SHGetSpecialFolderPath(0, path, CSIDL_LOCAL_APPDATA, FALSE)) 198 #endif 199 result = QString::fromWCharArray(path); 200 if (!QCoreApplication::organizationName().isEmpty()) 201 result = result + QLatin1String("\\") + QCoreApplication::organizationName(); 202 if (!QCoreApplication::applicationName().isEmpty()) 203 result = result + QLatin1String("\\") + QCoreApplication::applicationName(); 204 break; 205 206 case DesktopLocation: 207 if (SHGetSpecialFolderPath(0, path, CSIDL_DESKTOPDIRECTORY, FALSE)) 208 result = QString::fromWCharArray(path); 209 break; 210 211 case DocumentsLocation: 212 if (SHGetSpecialFolderPath(0, path, CSIDL_PERSONAL, FALSE)) 213 result = QString::fromWCharArray(path); 214 break; 215 216 case FontsLocation: 217 if (SHGetSpecialFolderPath(0, path, CSIDL_FONTS, FALSE)) 218 result = QString::fromWCharArray(path); 219 break; 220 221 case ApplicationsLocation: 222 if (SHGetSpecialFolderPath(0, path, CSIDL_PROGRAMS, FALSE)) 223 result = QString::fromWCharArray(path); 224 break; 225 226 case MusicLocation: 227 if (SHGetSpecialFolderPath(0, path, CSIDL_MYMUSIC, FALSE)) 228 result = QString::fromWCharArray(path); 229 break; 230 231 case MoviesLocation: 232 if (SHGetSpecialFolderPath(0, path, CSIDL_MYVIDEO, FALSE)) 233 result = QString::fromWCharArray(path); 234 break; 235 236 case PicturesLocation: 237 if (SHGetSpecialFolderPath(0, path, CSIDL_MYPICTURES, FALSE)) 238 result = QString::fromWCharArray(path); 239 break; 240 188 241 case CacheLocation: 189 242 // Although Microsoft has a Cache key it is a pointer to IE's cache, not a cache … … 191 244 // cache directory located in their AppData directory 192 245 return storageLocation(DataLocation) + QLatin1String("\\cache"); 193 case DataLocation:194 if (!settings.contains(QLatin1String("Local AppData")))195 break;196 return settings.value(QLatin1String("Local AppData")).toString()197 + QLatin1String("\\") + QCoreApplication::organizationName()198 + QLatin1String("\\") + QCoreApplication::applicationName();199 break;200 case DesktopLocation:201 return settings.value(QLatin1String("Desktop")).toString();202 break;203 204 case DocumentsLocation:205 return settings.value(QLatin1String("Personal")).toString();206 break;207 208 case FontsLocation:209 return settings.value(QLatin1String("Fonts")).toString();210 break;211 212 case ApplicationsLocation:213 return settings.value(QLatin1String("Programs")).toString();214 break;215 216 case MusicLocation:217 return settings.value(QLatin1String("My Music")).toString();218 break;219 220 case MoviesLocation:221 return settings.value(QLatin1String("My Video")).toString();222 break;223 224 case PicturesLocation:225 return settings.value(QLatin1String("My Pictures")).toString();226 break;227 246 228 247 case QDesktopServices::HomeLocation: … … 235 254 break; 236 255 } 237 #endif 238 return QString(); 256 return result; 239 257 } 240 258 -
trunk/src/gui/util/qdesktopservices_x11.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 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 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 57 57 inline static bool launch(const QUrl &url, const QString &client) 58 58 { 59 #if !defined(QT_NO_PROCESS) 59 60 return (QProcess::startDetached(client + QLatin1Char(' ') + QString::fromLatin1(url.toEncoded().constData()))); 61 #else 62 return (::system((client + QLatin1Char(' ') + QString::fromLatin1(url.toEncoded().constData())).toLocal8Bit().constData()) != -1); 63 #endif 60 64 } 61 65 … … 165 169 QString value = lst.at(2); 166 170 if (value.length() > 2 167 && value.startsWith(QLatin1 String("\""))168 && value.endsWith(QLatin1 String("\"")))171 && value.startsWith(QLatin1Char('\"')) 172 && value.endsWith(QLatin1Char('\"'))) 169 173 value = value.mid(1, value.length() - 2); 170 174 // Store the key and value: "DESKTOP", "$HOME/Desktop" -
trunk/src/gui/util/qsystemtrayicon.cpp
r290 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 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 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 66 66 \brief The QSystemTrayIcon class provides an icon for an application in the system tray. 67 67 \since 4.2 68 \ingroup application69 68 \ingroup desktop 70 69 … … 382 381 when the application has focus. 383 382 383 On Mac OS X, the Growl notification system must be installed for this function to 384 display messages. 385 384 386 \sa show() supportsMessages() 385 387 */ … … 435 437 QFont f = titleLabel->font(); 436 438 f.setBold(true); 437 #ifdef Q_ OS_WINCE439 #ifdef Q_WS_WINCE 438 440 f.setPointSize(f.pointSize() - 2); 439 441 #endif … … 441 443 titleLabel->setTextFormat(Qt::PlainText); // to maintain compat with windows 442 444 443 #ifdef Q_ OS_WINCE445 #ifdef Q_WS_WINCE 444 446 const int iconSize = style()->pixelMetric(QStyle::PM_SmallIconSize); 445 447 const int closeButtonSize = style()->pixelMetric(QStyle::PM_SmallIconSize) - 2; … … 457 459 458 460 QLabel *msgLabel = new QLabel; 459 #ifdef Q_ OS_WINCE461 #ifdef Q_WS_WINCE 460 462 f.setBold(false); 461 463 msgLabel->setFont(f); … … 467 469 468 470 // smart size for the message label 469 #ifdef Q_ OS_WINCE471 #ifdef Q_WS_WINCE 470 472 int limit = QApplication::desktop()->availableGeometry(msgLabel).size().width() / 2; 471 473 #else … … 482 484 } 483 485 } 484 #ifdef Q_ OS_WINCE486 #ifdef Q_WS_WINCE 485 487 // Make sure that the text isn't wrapped "somewhere" in the balloon widget 486 488 // in the case that we have a long title label. -
trunk/src/gui/util/qsystemtrayicon.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 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 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/src/gui/util/qsystemtrayicon_mac.mm
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 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 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 125 125 @end 126 126 127 @interface QNSMenu : NSMenu { 127 128 #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5 129 130 @protocol NSMenuDelegate <NSObject> 131 -(void)menuNeedsUpdate:(NSMenu*)menu; 132 @end 133 #endif 134 135 136 @interface QNSMenu : NSMenu <NSMenuDelegate> { 128 137 QMenu *qmenu; 129 138 } 130 139 -(QMenu*)menu; 131 140 -(id)initWithQMenu:(QMenu*)qmenu; 132 -(void)menuNeedsUpdate:(QNSMenu*)menu;133 141 -(void)selectedAction:(id)item; 134 142 @end … … 307 315 Q_UNUSED(notification); 308 316 down = NO; 317 318 if( ![self icon]->icon().isNull() ) { 319 #ifndef QT_MAC_USE_COCOA 320 const short scale = GetMBarHeight()-4; 321 #else 322 CGFloat hgt = [[[NSApplication sharedApplication] mainMenu] menuBarHeight]; 323 const short scale = hgt - 4; 324 #endif 325 NSImage *nsimage = static_cast<NSImage *>(qt_mac_create_nsimage([self icon]->icon().pixmap(QSize(scale, scale)))); 326 [self setImage: nsimage]; 327 [nsimage release]; 328 } 329 309 330 if([self icon]->contextMenu()) 310 331 [self icon]->contextMenu()->hide(); 332 311 333 [self setNeedsDisplay:YES]; 312 334 } … … 319 341 [self icon]->contextMenu()->hide(); 320 342 [self setNeedsDisplay:YES]; 343 344 #ifndef QT_MAC_USE_COCOA 345 const short scale = GetMBarHeight()-4; 346 #else 347 CGFloat hgt = [[[NSApplication sharedApplication] mainMenu] menuBarHeight]; 348 const short scale = hgt - 4; 349 #endif 350 351 if( down && ![self icon]->icon().isNull() ) { 352 NSImage *nsaltimage = static_cast<NSImage *>(qt_mac_create_nsimage([self icon]->icon().pixmap(QSize(scale, scale), QIcon::Selected))); 353 [self setImage: nsaltimage]; 354 [nsaltimage release]; 355 } 356 321 357 322 358 if (down) … … 456 492 return self; 457 493 } 458 -(QMenu*)menu { 459 return qmenu; 460 } 461 -(void)menuNeedsUpdate:(QNSMenu*)menu { 494 -(QMenu*)menu { 495 return qmenu; 496 } 497 -(void)menuNeedsUpdate:(NSMenu*)nsmenu { 498 QNSMenu *menu = static_cast<QNSMenu *>(nsmenu); 462 499 emit static_cast<QSystemTrayIconQMenu*>(menu->qmenu)->doAboutToShow(); 463 500 for(int i = [menu numberOfItems]-1; i >= 0; --i) -
trunk/src/gui/util/qsystemtrayicon_p.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 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 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 95 95 class QBalloonTip : public QWidget 96 96 { 97 Q_OBJECT 97 98 public: 98 99 static void showBalloon(QSystemTrayIcon::MessageIcon icon, const QString& title, -
trunk/src/gui/util/qsystemtrayicon_win.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 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 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 42 42 #include "qsystemtrayicon_p.h" 43 43 #ifndef QT_NO_SYSTEMTRAYICON 44 //#define _WIN32_IE 0x0500 45 #define _WIN32_IE 0x0600 //required for NOTIFYICONDATAW_V2_SIZE 44 #define _WIN32_IE 0x0600 //required for NOTIFYICONDATA_V2_SIZE 46 45 47 46 //missing defines for MINGW : … … 63 62 #include <QSettings> 64 63 65 #if defined(Q_ OS_WINCE) && !defined(STANDARDSHELL_UI_MODEL)64 #if defined(Q_WS_WINCE) && !defined(STANDARDSHELL_UI_MODEL) 66 65 # include <streams.h> 67 66 #endif … … 69 68 QT_BEGIN_NAMESPACE 70 69 71 #if defined(Q_ OS_WINCE)70 #if defined(Q_WS_WINCE) 72 71 static const UINT q_uNOTIFYICONID = 13; // IDs from 0 to 12 are reserved on WinCE. 73 72 #else … … 78 77 #define MYWM_NOTIFYICON (WM_APP+101) 79 78 80 typedef BOOL (WINAPI *PtrShell_NotifyIcon)(DWORD,PNOTIFYICONDATA); 81 static PtrShell_NotifyIcon ptrShell_NotifyIcon = 0; 82 83 static void resolveLibs() 84 { 85 static bool triedResolve = false; 86 #if defined Q_OS_WINCE 87 QString libName(QLatin1String("coredll")); 88 const char* funcName = "Shell_NotifyIcon"; 89 #else 90 QString libName(QLatin1String("shell32")); 91 const char* funcName = "Shell_NotifyIconW"; 92 #endif 93 if (!triedResolve) { 94 QLibrary lib(libName); 95 triedResolve = true; 96 ptrShell_NotifyIcon = (PtrShell_NotifyIcon) lib.resolve(funcName); 97 } 98 } 79 struct Q_NOTIFYICONIDENTIFIER { 80 DWORD cbSize; 81 HWND hWnd; 82 UINT uID; 83 GUID guidItem; 84 }; 85 86 #define Q_MSGFLT_ALLOW 1 87 88 typedef HRESULT (WINAPI *PtrShell_NotifyIconGetRect)(const Q_NOTIFYICONIDENTIFIER* identifier, RECT* iconLocation); 89 typedef BOOL (WINAPI *PtrChangeWindowMessageFilter)(UINT message, DWORD dwFlag); 90 typedef BOOL (WINAPI *PtrChangeWindowMessageFilterEx)(HWND hWnd, UINT message, DWORD action, void* pChangeFilterStruct); 99 91 100 92 class QSystemTrayIconSys : QWidget … … 104 96 ~QSystemTrayIconSys(); 105 97 bool winEvent( MSG *m, long *result ); 106 bool trayMessageA(DWORD msg);107 bool trayMessageW(DWORD msg);108 98 bool trayMessage(DWORD msg); 109 99 bool iconDrawItem(LPDRAWITEMSTRUCT lpdi); 110 void setIconContentsW(NOTIFYICONDATAW &data); 111 void setIconContentsA(NOTIFYICONDATAA &data); 112 bool showMessageW(const QString &title, const QString &message, QSystemTrayIcon::MessageIcon type, uint uSecs); 113 bool showMessageA(const QString &title, const QString &message, QSystemTrayIcon::MessageIcon type, uint uSecs); 100 void setIconContents(NOTIFYICONDATA &data); 101 bool showMessage(const QString &title, const QString &message, QSystemTrayIcon::MessageIcon type, uint uSecs); 114 102 bool allowsMessages(); 115 103 bool supportsMessages(); 116 104 QRect findIconGeometry(const int a_iButtonID); 117 QRect findTrayGeometry();118 HBITMAP createIconMask(const QBitmap &bitmap);119 105 void createIcon(); 120 int detectShellVersion() const;121 106 HICON hIcon; 122 107 QPoint globalPos; 123 108 QSystemTrayIcon *q; 124 109 private: 125 uint notifyIconSizeW; 126 uint notifyIconSizeA; 127 int currentShellVersion; 110 uint notifyIconSize; 128 111 int maxTipLength; 112 bool ignoreNextMouseRelease; 129 113 }; 130 114 131 // Checks for the shell32 dll version number, since only version132 // 5 or later of supports ballon messages133 115 bool QSystemTrayIconSys::allowsMessages() 134 116 { 135 117 #ifndef QT_NO_SETTINGS 136 137 118 QSettings settings(QLatin1String("HKEY_CURRENT_USER\\Software\\Microsoft" 138 119 "\\Windows\\CurrentVersion\\Explorer\\Advanced"), QSettings::NativeFormat); … … 143 124 } 144 125 145 // Checks for the shell32 dll version number, since only version146 // 5 or later of supports ballon messages147 126 bool QSystemTrayIconSys::supportsMessages() 148 127 { 149 #if NOTIFYICON_VERSION >= 3150 if (currentShellVersion >= 5)151 return allowsMessages();152 else153 #endif154 return false;155 }156 157 //Returns the runtime major version of the shell32 dll158 int QSystemTrayIconSys::detectShellVersion() const159 {160 128 #ifndef Q_OS_WINCE 161 int shellVersion = 4; //NT 4.0 and W95 162 DLLGETVERSIONPROC pDllGetVersion = (DLLGETVERSIONPROC)QLibrary::resolve( 163 QLatin1String("shell32"), "DllGetVersion"); 164 if (pDllGetVersion) 165 { 166 DLLVERSIONINFO dvi; 167 HRESULT hr; 168 ZeroMemory(&dvi, sizeof(dvi)); 169 dvi.cbSize = sizeof(dvi); 170 hr = (*pDllGetVersion)(&dvi); 171 if (SUCCEEDED(hr)) { 172 if (dvi.dwMajorVersion >= 5) 173 { 174 shellVersion = dvi.dwMajorVersion; 175 } 176 } 177 } 178 return shellVersion; 179 #endif 180 return 4; //No ballonMessages and MaxTipLength = 64 for WindowsCE 129 return allowsMessages(); 130 #endif 131 return false; 181 132 } 182 133 183 134 QSystemTrayIconSys::QSystemTrayIconSys(QSystemTrayIcon *object) 184 : hIcon(0), q(object) 185 { 186 currentShellVersion = detectShellVersion(); 187 notifyIconSizeA = FIELD_OFFSET(NOTIFYICONDATAA, szTip[64]); // NOTIFYICONDATAA_V1_SIZE 188 notifyIconSizeW = FIELD_OFFSET(NOTIFYICONDATAW, szTip[64]); // NOTIFYICONDATAW_V1_SIZE; 135 : hIcon(0), q(object), ignoreNextMouseRelease(false) 136 137 { 138 #ifndef Q_OS_WINCE 139 notifyIconSize = FIELD_OFFSET(NOTIFYICONDATA, guidItem); // NOTIFYICONDATAW_V2_SIZE; 140 maxTipLength = 128; 141 #else 142 notifyIconSize = FIELD_OFFSET(NOTIFYICONDATA, szTip[64]); // NOTIFYICONDATAW_V1_SIZE; 189 143 maxTipLength = 64; 190 191 #if NOTIFYICON_VERSION >= 3192 if (currentShellVersion >=5) {193 notifyIconSizeA = FIELD_OFFSET(NOTIFYICONDATAA, guidItem); // NOTIFYICONDATAA_V2_SIZE194 notifyIconSizeW = FIELD_OFFSET(NOTIFYICONDATAW, guidItem); // NOTIFYICONDATAW_V2_SIZE;195 maxTipLength = 128;196 }197 144 #endif 198 145 199 146 // For restoring the tray icon after explorer crashes 200 147 if (!MYWM_TASKBARCREATED) { 201 MYWM_TASKBARCREATED = QT_WA_INLINE(RegisterWindowMessageW(L"TaskbarCreated"),RegisterWindowMessageA("TaskbarCreated")); 148 MYWM_TASKBARCREATED = RegisterWindowMessage(L"TaskbarCreated"); 149 } 150 151 // Allow the WM_TASKBARCREATED message through the UIPI filter on Windows Vista and higher 152 static PtrChangeWindowMessageFilterEx pChangeWindowMessageFilterEx = 153 (PtrChangeWindowMessageFilterEx)QLibrary::resolve(QLatin1String("user32"), "ChangeWindowMessageFilterEx"); 154 155 if (pChangeWindowMessageFilterEx) { 156 // Call the safer ChangeWindowMessageFilterEx API if available 157 pChangeWindowMessageFilterEx(winId(), MYWM_TASKBARCREATED, Q_MSGFLT_ALLOW, 0); 158 } else { 159 static PtrChangeWindowMessageFilter pChangeWindowMessageFilter = 160 (PtrChangeWindowMessageFilter)QLibrary::resolve(QLatin1String("user32"), "ChangeWindowMessageFilter"); 161 162 if (pChangeWindowMessageFilter) { 163 // Call the deprecated ChangeWindowMessageFilter API otherwise 164 pChangeWindowMessageFilter(MYWM_TASKBARCREATED, Q_MSGFLT_ALLOW); 165 } 202 166 } 203 167 } … … 209 173 } 210 174 211 void QSystemTrayIconSys::setIconContents W(NOTIFYICONDATAW&tnd)212 { 213 tnd.uFlags = NIF_MESSAGE |NIF_ICON|NIF_TIP;175 void QSystemTrayIconSys::setIconContents(NOTIFYICONDATA &tnd) 176 { 177 tnd.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP; 214 178 tnd.uCallbackMessage = MYWM_NOTIFYICON; 215 179 tnd.hIcon = hIcon; … … 217 181 218 182 if (!tip.isNull()) { 219 // Tip is limited to maxTipLength - NULL; lstrcpyn appends a NULL terminator.220 183 tip = tip.left(maxTipLength - 1) + QChar(); 221 #if defined(Q_OS_WINCE) 222 wcsncpy(tnd.szTip, reinterpret_cast<const wchar_t *> (tip.utf16()), qMin(tip.length()+1, maxTipLength)); 223 #else 224 lstrcpynW(tnd.szTip, (TCHAR*)tip.utf16(), qMin(tip.length()+1, maxTipLength)); 225 #endif 226 } 227 } 228 229 void QSystemTrayIconSys::setIconContentsA(NOTIFYICONDATAA &tnd) 230 { 231 tnd.uFlags = NIF_MESSAGE|NIF_ICON|NIF_TIP; 232 tnd.uCallbackMessage = MYWM_NOTIFYICON; 233 tnd.hIcon = hIcon; 234 QString tip = q->toolTip(); 235 236 if (!tip.isNull()) { 237 // Tip is limited to maxTipLength - NULL; lstrcpyn appends a NULL terminator. 238 tip = tip.left(maxTipLength - 1) + QChar(); 239 #if defined(Q_OS_WINCE) 240 strncpy(tnd.szTip, tip.toLocal8Bit().constData(), qMin(tip.length()+1, maxTipLength)); 241 #else 242 lstrcpynA(tnd.szTip, tip.toLocal8Bit().constData(), qMin(tip.length()+1, maxTipLength)); 243 #endif 244 } 245 } 246 247 int iconFlag( QSystemTrayIcon::MessageIcon icon ) 248 { 249 int flag = 0; 184 memcpy(tnd.szTip, tip.utf16(), qMin(tip.length() + 1, maxTipLength) * sizeof(wchar_t)); 185 } 186 } 187 188 static int iconFlag( QSystemTrayIcon::MessageIcon icon ) 189 { 250 190 #if NOTIFYICON_VERSION >= 3 251 191 switch (icon) { 192 case QSystemTrayIcon::Information: 193 return NIIF_INFO; 194 case QSystemTrayIcon::Warning: 195 return NIIF_WARNING; 196 case QSystemTrayIcon::Critical: 197 return NIIF_ERROR; 252 198 case QSystemTrayIcon::NoIcon: 253 break; 254 case QSystemTrayIcon::Critical: 255 flag = NIIF_ERROR; 256 break; 257 case QSystemTrayIcon::Warning: 258 flag = NIIF_WARNING; 259 break; 260 case QSystemTrayIcon::Information: 261 default : // fall through 262 flag = NIIF_INFO; 199 return NIIF_NONE; 200 default: 201 Q_ASSERT_X(false, "QSystemTrayIconSys::showMessage", "Invalid QSystemTrayIcon::MessageIcon value"); 202 return NIIF_NONE; 263 203 } 264 204 #else 265 205 Q_UNUSED(icon); 266 #endif 267 return flag; 268 } 269 270 bool QSystemTrayIconSys::showMessage W(const QString &title, const QString &message, QSystemTrayIcon::MessageIcon type, uint uSecs)271 { 272 #if NOTIFYICON_VERSION >=3206 return 0; 207 #endif 208 } 209 210 bool QSystemTrayIconSys::showMessage(const QString &title, const QString &message, QSystemTrayIcon::MessageIcon type, uint uSecs) 211 { 212 #if NOTIFYICON_VERSION >= 3 273 213 NOTIFYICONDATA tnd; 274 memset(&tnd, 0, notifyIconSize W);214 memset(&tnd, 0, notifyIconSize); 275 215 Q_ASSERT(testAttribute(Qt::WA_WState_Created)); 276 216 277 setIconContentsW(tnd); 278 #if defined(Q_OS_WINCE) 279 wcsncpy(tnd.szInfo, message.utf16(), qMin(message.length() + 1, 256)); 280 wcsncpy(tnd.szInfoTitle, title.utf16(), qMin(title.length()+1, 64)); 281 #else 282 lstrcpynW(tnd.szInfo, (TCHAR*)message.utf16(), qMin(message.length() + 1, 256)); 283 lstrcpynW(tnd.szInfoTitle, (TCHAR*)title.utf16(), qMin(title.length() + 1, 64)); 284 #endif 217 setIconContents(tnd); 218 memcpy(tnd.szInfo, message.utf16(), qMin(message.length() + 1, 256) * sizeof(wchar_t)); 219 memcpy(tnd.szInfoTitle, title.utf16(), qMin(title.length() + 1, 64) * sizeof(wchar_t)); 220 285 221 tnd.uID = q_uNOTIFYICONID; 286 222 tnd.dwInfoFlags = iconFlag(type); 287 tnd.cbSize = notifyIconSize W;223 tnd.cbSize = notifyIconSize; 288 224 tnd.hWnd = winId(); 289 225 tnd.uTimeout = uSecs; 290 226 tnd.uFlags = NIF_INFO; 291 return ptrShell_NotifyIcon(NIM_MODIFY, &tnd); 227 228 return Shell_NotifyIcon(NIM_MODIFY, &tnd); 292 229 #else 293 230 Q_UNUSED(title); … … 299 236 } 300 237 301 bool QSystemTrayIconSys::showMessageA(const QString &title, const QString &message, QSystemTrayIcon::MessageIcon type, uint uSecs) 302 { 303 #if NOTIFYICON_VERSION>=3 304 NOTIFYICONDATAA tnd; 305 memset(&tnd, 0, notifyIconSizeA); 238 bool QSystemTrayIconSys::trayMessage(DWORD msg) 239 { 240 NOTIFYICONDATA tnd; 241 memset(&tnd, 0, notifyIconSize); 242 tnd.uID = q_uNOTIFYICONID; 243 tnd.cbSize = notifyIconSize; 244 tnd.hWnd = winId(); 245 306 246 Q_ASSERT(testAttribute(Qt::WA_WState_Created)); 307 247 308 setIconContentsA(tnd);309 #if defined(Q_OS_WINCE)310 strncpy(tnd.szInfo, message.toLocal8Bit().constData(), qMin(message.length() + 1, 256));311 strncpy(tnd.szInfoTitle, title.toLocal8Bit().constData(), qMin(title.length()+1, 64));312 #else313 lstrcpynA(tnd.szInfo, message.toLocal8Bit().constData(), qMin(message.length() + 1, 256));314 lstrcpynA(tnd.szInfoTitle, title.toLocal8Bit().constData(), qMin(title.length() + 1, 64));315 #endif316 tnd.uID = q_uNOTIFYICONID;317 tnd.dwInfoFlags = iconFlag(type);318 tnd.cbSize = notifyIconSizeA;319 tnd.hWnd = winId();320 tnd.uTimeout = uSecs;321 tnd.uFlags = NIF_INFO;322 return Shell_NotifyIconA(NIM_MODIFY, &tnd);323 #else324 Q_UNUSED(title);325 Q_UNUSED(message);326 Q_UNUSED(type);327 Q_UNUSED(uSecs);328 return false;329 #endif330 }331 332 bool QSystemTrayIconSys::trayMessageA(DWORD msg)333 {334 #if !defined(Q_OS_WINCE)335 NOTIFYICONDATAA tnd;336 memset(&tnd, 0, notifyIconSizeA);337 tnd.uID = q_uNOTIFYICONID;338 tnd.cbSize = notifyIconSizeA;339 tnd.hWnd = winId();340 Q_ASSERT(testAttribute(Qt::WA_WState_Created));341 342 248 if (msg != NIM_DELETE) { 343 setIconContentsA(tnd); 344 } 345 return Shell_NotifyIconA(msg, &tnd); 346 #else 347 Q_UNUSED(msg); 348 return false; 349 #endif 350 } 351 352 bool QSystemTrayIconSys::trayMessageW(DWORD msg) 353 { 354 NOTIFYICONDATAW tnd; 355 memset(&tnd, 0, notifyIconSizeW); 356 tnd.uID = q_uNOTIFYICONID; 357 tnd.cbSize = notifyIconSizeW; 358 tnd.hWnd = winId(); 359 Q_ASSERT(testAttribute(Qt::WA_WState_Created)); 360 361 if (msg != NIM_DELETE) { 362 setIconContentsW(tnd); 363 } 364 return ptrShell_NotifyIcon(msg, &tnd); 365 } 366 367 bool QSystemTrayIconSys::trayMessage(DWORD msg) 368 { 369 resolveLibs(); 370 if (!(ptrShell_NotifyIcon)) 371 return false; 372 373 QT_WA({ 374 return trayMessageW(msg); 375 }, 376 { 377 return trayMessageA(msg); 378 }); 249 setIconContents(tnd); 250 } 251 252 return Shell_NotifyIcon(msg, &tnd); 379 253 } 380 254 … … 386 260 DrawIconEx(lpdi->hDC, lpdi->rcItem.left, lpdi->rcItem.top, hIcon, 0, 0, 0, 0, DI_NORMAL); 387 261 return true; 388 }389 390 HBITMAP QSystemTrayIconSys::createIconMask(const QBitmap &bitmap)391 {392 QImage bm = bitmap.toImage().convertToFormat(QImage::Format_Mono);393 int w = bm.width();394 int h = bm.height();395 int bpl = ((w+15)/16)*2; // bpl, 16 bit alignment396 uchar *bits = new uchar[bpl*h];397 bm.invertPixels();398 for (int y=0; y<h; y++)399 memcpy(bits+y*bpl, bm.scanLine(y), bpl);400 HBITMAP hbm = CreateBitmap(w, h, 1, 1, bits);401 delete [] bits;402 return hbm;403 262 } 404 263 … … 417 276 return; 418 277 419 QBitmap mask = pm.mask(); 420 if (mask.isNull()) { 421 mask = QBitmap(pm.size()); 422 mask.fill(Qt::color1); 423 } 424 425 HBITMAP im = createIconMask(mask); 426 ICONINFO ii; 427 ii.fIcon = true; 428 ii.hbmMask = im; 429 ii.hbmColor = pm.toWinHBITMAP(QPixmap::Alpha); 430 ii.xHotspot = 0; 431 ii.yHotspot = 0; 432 hIcon = CreateIconIndirect(&ii); 433 434 DeleteObject(ii.hbmColor); 435 DeleteObject(im); 278 hIcon = pm.toWinHICON(); 436 279 } 437 280 … … 460 303 switch (m->lParam) { 461 304 case WM_LBUTTONUP: 462 emit q->activated(QSystemTrayIcon::Trigger); 305 if (ignoreNextMouseRelease) 306 ignoreNextMouseRelease = false; 307 else 308 emit q->activated(QSystemTrayIcon::Trigger); 463 309 break; 464 310 465 #if !defined(Q_OS_WINCE)466 311 case WM_LBUTTONDBLCLK: 312 ignoreNextMouseRelease = true; // Since DBLCLICK Generates a second mouse 313 // release we must ignore it 467 314 emit q->activated(QSystemTrayIcon::DoubleClick); 468 315 break; … … 471 318 if (q->contextMenu()) { 472 319 q->contextMenu()->popup(gpos); 320 #if defined(Q_WS_WINCE) 321 // We must ensure that the popup menu doesn't show up behind the task bar. 322 QRect desktopRect = qApp->desktop()->availableGeometry(); 323 int maxY = desktopRect.y() + desktopRect.height() - q->contextMenu()->height(); 324 if (gpos.y() > maxY) { 325 gpos.ry() = maxY; 326 q->contextMenu()->move(gpos); 327 } 328 #endif 473 329 q->contextMenu()->activateWindow(); 474 330 //Must be activated for proper keyboardfocus and menu closing on windows: … … 477 333 break; 478 334 335 #if !defined(Q_WS_WINCE) 479 336 case NIN_BALLOONUSERCLICK: 480 337 emit q->messageClicked(); 481 338 break; 339 #endif 482 340 483 341 case WM_MBUTTONUP: 484 342 emit q->activated(QSystemTrayIcon::MiddleClick); 485 343 break; 486 #endif487 344 default: 488 345 break; … … 515 372 } 516 373 517 //fallback on win 95/98518 QRect QSystemTrayIconSys::findTrayGeometry()519 {520 //Use lower right corner as fallback521 QPoint brCorner = qApp->desktop()->screenGeometry().bottomRight();522 QRect ret(brCorner.x() - 10, brCorner.y() - 10, 10, 10);523 #if defined(Q_OS_WINCE)524 HWND trayHandle = FindWindowW(L"Shell_TrayWnd", NULL);525 #else526 HWND trayHandle = FindWindowA("Shell_TrayWnd", NULL);527 #endif528 if (trayHandle) {529 #if defined(Q_OS_WINCE)530 trayHandle = FindWindowW(L"TrayNotifyWnd", NULL);531 #else532 trayHandle = FindWindowExA(trayHandle, NULL, "TrayNotifyWnd", NULL);533 #endif534 if (trayHandle) {535 RECT r;536 if (GetWindowRect(trayHandle, &r)) {537 ret = QRect(r.left, r.top, r.right- r.left, r.bottom - r.top);538 }539 }540 }541 return ret;542 }543 544 374 /* 545 375 * This function tries to determine the icon geometry from the tray … … 549 379 QRect QSystemTrayIconSys::findIconGeometry(const int iconId) 550 380 { 381 static PtrShell_NotifyIconGetRect Shell_NotifyIconGetRect = 382 (PtrShell_NotifyIconGetRect)QLibrary::resolve(QLatin1String("shell32"), "Shell_NotifyIconGetRect"); 383 384 if (Shell_NotifyIconGetRect) { 385 Q_NOTIFYICONIDENTIFIER nid; 386 memset(&nid, 0, sizeof(nid)); 387 nid.cbSize = sizeof(nid); 388 nid.hWnd = winId(); 389 nid.uID = iconId; 390 391 RECT rect; 392 HRESULT hr = Shell_NotifyIconGetRect(&nid, &rect); 393 if (SUCCEEDED(hr)) { 394 return QRect(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top); 395 } 396 } 397 551 398 QRect ret; 552 399 553 400 TBBUTTON buttonData; 554 401 DWORD processID = 0; 555 #if defined(Q_OS_WINCE) 556 HWND trayHandle = FindWindowW(L"Shell_TrayWnd", NULL); 557 #else 558 HWND trayHandle = FindWindowA("Shell_TrayWnd", NULL); 559 #endif 402 HWND trayHandle = FindWindow(L"Shell_TrayWnd", NULL); 560 403 561 404 //find the toolbar used in the notification area 562 405 if (trayHandle) { 563 406 #if defined(Q_OS_WINCE) 564 trayHandle = FindWindow W(L"TrayNotifyWnd", NULL);565 #else 566 trayHandle = FindWindowEx A(trayHandle, NULL,"TrayNotifyWnd", NULL);407 trayHandle = FindWindow(L"TrayNotifyWnd", NULL); 408 #else 409 trayHandle = FindWindowEx(trayHandle, NULL, L"TrayNotifyWnd", NULL); 567 410 #endif 568 411 if (trayHandle) { 569 412 #if defined(Q_OS_WINCE) 570 HWND hwnd = FindWindow W(L"SysPager", NULL);413 HWND hwnd = FindWindow(L"SysPager", NULL); 571 414 #else 572 415 HWND hwnd = FindWindowEx(trayHandle, NULL, L"SysPager", NULL); … … 613 456 SendMessage(trayHandle, TB_GETBUTTON, toolbarButton , (LPARAM)data); 614 457 615 if (!ReadProcessMemory(trayProcess, data, &buttonData, sizeof(TBBUTTON), &numBytes))458 if (!ReadProcessMemory(trayProcess, data, &buttonData, sizeof(TBBUTTON), &numBytes)) 616 459 continue; 617 460 618 if (!ReadProcessMemory(trayProcess, (LPVOID) buttonData.dwData, appData, sizeof(appData), &numBytes))461 if (!ReadProcessMemory(trayProcess, (LPVOID) buttonData.dwData, appData, sizeof(appData), &numBytes)) 619 462 continue; 620 463 … … 647 490 } 648 491 649 650 492 void QSystemTrayIconPrivate::showMessage_sys(const QString &title, const QString &message, QSystemTrayIcon::MessageIcon type, int timeOut) 651 493 { … … 658 500 else uSecs = (int)timeOut; 659 501 660 resolveLibs();661 662 502 //message is limited to 255 chars + NULL 663 503 QString messageString; 664 504 if (message.isEmpty() && !title.isEmpty()) 665 messageString = QLatin1 String(" "); //ensures that the message shows when only title is set505 messageString = QLatin1Char(' '); //ensures that the message shows when only title is set 666 506 else 667 507 messageString = message.left(255) + QChar(); … … 671 511 672 512 if (sys->supportsMessages()) { 673 QT_WA({ 674 sys->showMessageW(titleString, messageString, type, (unsigned int)uSecs); 675 }, { 676 sys->showMessageA(titleString, messageString, type, (unsigned int)uSecs); 677 }); 513 sys->showMessage(titleString, messageString, type, (unsigned int)uSecs); 678 514 } else { 679 //use fallback s680 QRect iconPos = sys->findIconGeometry( 0);515 //use fallback 516 QRect iconPos = sys->findIconGeometry(q_uNOTIFYICONID); 681 517 if (iconPos.isValid()) { 682 518 QBalloonTip::showBalloon(type, title, message, sys->q, iconPos.center(), uSecs, true); 683 } else {684 QRect trayRect = sys->findTrayGeometry();685 QBalloonTip::showBalloon(type, title, message, sys->q, QPoint(trayRect.left(),686 trayRect.center().y()), uSecs, false);687 519 } 688 520 } … … 693 525 if (!sys) 694 526 return QRect(); 695 return sys->findIconGeometry( 0);527 return sys->findIconGeometry(q_uNOTIFYICONID); 696 528 } 697 529 … … 727 559 void QSystemTrayIconPrivate::updateToolTip_sys() 728 560 { 729 #ifdef Q_ OS_WINCE561 #ifdef Q_WS_WINCE 730 562 // Calling sys->trayMessage(NIM_MODIFY) on an existing icon is broken on Windows CE. 731 563 // So we need to call updateIcon_sys() which creates a new icon handle. -
trunk/src/gui/util/qsystemtrayicon_x11.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 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 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/src/gui/util/qundogroup.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 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 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 62 62 \brief The QUndoGroup class is a group of QUndoStack objects. 63 63 \since 4.2 64 \ingroup misc65 64 66 65 For an overview of the Qt's undo framework, see the -
trunk/src/gui/util/qundogroup.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 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 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/src/gui/util/qundostack.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 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 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 53 53 \brief The QUndoCommand class is the base class of all commands stored on a QUndoStack. 54 54 \since 4.2 55 \ingroup misc56 55 57 56 For an overview of Qt's Undo Framework, see the … … 293 292 \brief The QUndoStack class is a stack of QUndoCommand objects. 294 293 \since 4.2 295 \ingroup misc296 294 297 295 For an overview of Qt's Undo Framework, see the … … 716 714 717 715 /*! 718 Repeatedly calls undo() or redo() until the thecurrent command index reaches716 Repeatedly calls undo() or redo() until the current command index reaches 719 717 \a idx. This function can be used to roll the state of the document forwards 720 718 of backwards. indexChanged() is emitted only once. -
trunk/src/gui/util/qundostack.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 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 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/src/gui/util/qundostack_p.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 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 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/src/gui/util/qundoview.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 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 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 254 254 \brief The QUndoView class displays the contents of a QUndoStack. 255 255 \since 4.2 256 \ingroup misc 256 257 257 \ingroup advanced 258 258 -
trunk/src/gui/util/qundoview.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 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 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/src/gui/util/util.pri
r255 r561 47 47 OBJECTIVE_SOURCES += util/qsystemtrayicon_mac.mm 48 48 } 49 50 symbian { 51 LIBS += -lsendas2 -letext -lapmime 52 contains(QT_CONFIG, s60): LIBS += -lplatformenv -lcommonui 53 }
Note:
See TracChangeset
for help on using the changeset viewer.