diff options
-rw-r--r-- | examples/winextras/jumplistexample/examplewidget.cpp | 1 | ||||
-rw-r--r-- | src/imports/winextras/qquickjumplist.h | 1 | ||||
-rw-r--r-- | src/winextras/qjumplist.cpp | 229 | ||||
-rw-r--r-- | src/winextras/qjumplist.h | 53 | ||||
-rw-r--r-- | src/winextras/qjumplistitem.cpp | 239 | ||||
-rw-r--r-- | src/winextras/qjumplistitem.h | 91 | ||||
-rw-r--r-- | src/winextras/winextras.pro | 2 |
7 files changed, 361 insertions, 255 deletions
diff --git a/examples/winextras/jumplistexample/examplewidget.cpp b/examples/winextras/jumplistexample/examplewidget.cpp index f762a47..9f9efc6 100644 --- a/examples/winextras/jumplistexample/examplewidget.cpp +++ b/examples/winextras/jumplistexample/examplewidget.cpp @@ -48,6 +48,7 @@ #include <QFileDialog> #include <QMessageBox> #include <QJumpList> +#include <QJumpListItem> #include <QDebug> ExampleWidget::ExampleWidget(QWidget *parent) : diff --git a/src/imports/winextras/qquickjumplist.h b/src/imports/winextras/qquickjumplist.h index f500517..6bfaa53 100644 --- a/src/imports/winextras/qquickjumplist.h +++ b/src/imports/winextras/qquickjumplist.h @@ -46,6 +46,7 @@ #include <QQmlListProperty> #include <QIcon> #include <QJumpList> +#include <QJumpListItem> QT_BEGIN_NAMESPACE diff --git a/src/winextras/qjumplist.cpp b/src/winextras/qjumplist.cpp index b9e05c4..5b16143 100644 --- a/src/winextras/qjumplist.cpp +++ b/src/winextras/qjumplist.cpp @@ -40,8 +40,8 @@ ****************************************************************************/ #include "qjumplist.h" +#include "qjumplistitem.h" -#include <QIcon> #include <QDir> #include <QCoreApplication> #include <qt_windows.h> @@ -54,199 +54,32 @@ QT_BEGIN_NAMESPACE -class QJumpListItemPrivate -{ -public: - QString filePath; - QString workingDirectory; - QString title; - QString description; - QIcon icon; - QStringList arguments; - QJumpListItem::Type type; -}; - /*! - \class QJumpListItem + \class QJumpList \inmodule QtWinExtras - \since 5.2 - \inheaderfile QJumpList - \brief The QJumpListItem class represents a Jump List destination or link. - - Objects of this class are returned by QJumpList::removedDestinations() - and can also be used to add items to a Jump List. - */ - -/*! - Constructs a QJumpListItem with the specified \a type. - */ -QJumpListItem::QJumpListItem(QJumpListItem::Type type) : - d_ptr(new QJumpListItemPrivate) -{ - d_ptr->type = type; -} - -/*! - Destroys the QJumpListItem. - */ -QJumpListItem::~QJumpListItem() -{ -} - -/*! - Sets the item \a type. - */ -void QJumpListItem::setType(QJumpListItem::Type type) -{ - Q_D(QJumpListItem); - d->type = type; -} - -/*! - Returns the item type. - */ -QJumpListItem::Type QJumpListItem::type() const -{ - Q_D(const QJumpListItem); - return d->type; -} - -/*! - Sets the item \a filePath, the meaning of which depends on the type of this - item: - - \list - - \li If the item type is QJumpListItem::Destination, \a filePath is the - path to a file that can be opened by an application. - - \li If the item type is QJumpListItem::Link, \a filePath is the path to - an executable that is executed when this item is clicked by the - user. - - \endlist - - \sa setWorkingDirectory(), setArguments() - */ -void QJumpListItem::setFilePath(const QString &filePath) -{ - Q_D(QJumpListItem); - d->filePath = filePath; -} - -/*! - Returns the file path set by setFilePath(). - */ -QString QJumpListItem::filePath() const -{ - Q_D(const QJumpListItem); - return d->filePath; -} - -/*! - Sets the path to the working directory of this item to \a workingDirectory. - - This value is used only if the type of this item is QJumpListItem::Link. - - \sa setFilePath() - */ -void QJumpListItem::setWorkingDirectory(const QString &workingDirectory) -{ - Q_D(QJumpListItem); - d->workingDirectory = workingDirectory; -} - -/*! - Returns the working directory path. - */ -QString QJumpListItem::workingDirectory() const -{ - Q_D(const QJumpListItem); - return d->workingDirectory; -} - -/*! - Sets the \a icon of this item. - - This value is used only if the type of this item is QJumpListItem::Link. - */ -void QJumpListItem::setIcon(const QIcon &icon) -{ - Q_D(QJumpListItem); - d->icon = icon; -} - -/*! - Returns the icon set for this item. - */ -QIcon QJumpListItem::icon() const -{ - Q_D(const QJumpListItem); - return d->icon; -} - -/*! - Sets the \a title of this item. - - This value is used only if the type of this item is QJumpListItem::Link. - */ -void QJumpListItem::setTitle(const QString &title) -{ - Q_D(QJumpListItem); - d->title = title; -} - -/*! - Returns the title of this item. - */ -QString QJumpListItem::title() const -{ - Q_D(const QJumpListItem); - return d->title; -} - -/*! - Sets a \a description for this item. + \brief The QJumpList class represents a transparent wrapper around Windows + Jump Lists. - This value is used only if the type of this item is QJumpListItem::Link. - */ -void QJumpListItem::setDescription(const QString &description) -{ - Q_D(QJumpListItem); - d->description = description; -} + \since 5.2 -/*! - Returns the description of this item. + An application can use Jump Lists to provide users with faster access to + files or to display shortcuts to tasks or commands. */ -QString QJumpListItem::description() const -{ - Q_D(const QJumpListItem); - return d->description; -} /*! - Sets command-line \a arguments for this item. - - This value is used only if the type of this item is QJumpListItem::Link. + \enum QJumpListItem::Type - \sa setFilePath() - */ -void QJumpListItem::setArguments(const QStringList &arguments) -{ - Q_D(QJumpListItem); - d->arguments = arguments; -} + This enum specifies QJumpListItem type, changing its meaning for QJumpList. -/*! - Returns the command-line arguments of this item. + \value Unknown + Invalid item type. + \value Destination + Item acts as a link to a file that the application can open. + \value Link + Item represents a link to some application. + \value Separator + Item becomes a separator. This value is used only for task lists. */ -QStringList QJumpListItem::arguments() const -{ - Q_D(const QJumpListItem); - return d->arguments; -} - class QJumpListPrivate { @@ -541,34 +374,6 @@ public: UINT listSize; }; - -/*! - \class QJumpList - \inmodule QtWinExtras - \brief The QJumpList class represents a transparent wrapper around Windows - Jump Lists. - - \since 5.2 - - An application can use Jump Lists to provide users with faster access to - files or to display shortcuts to tasks or commands. - */ - -/*! - \enum QJumpListItem::Type - - This enum specifies QJumpListItem type, changing its meaning for QJumpList. - - \value Unknown - Invalid item type. - \value Destination - Item acts as a link to a file that the application can open. - \value Link - Item represents a link to some application. - \value Separator - Item becomes a separator. This value is used only for task lists. - */ - /*! Constructs a QJumpList with the parent object \a parent. */ diff --git a/src/winextras/qjumplist.h b/src/winextras/qjumplist.h index aadada1..267a9c7 100644 --- a/src/winextras/qjumplist.h +++ b/src/winextras/qjumplist.h @@ -39,51 +39,18 @@ ** ****************************************************************************/ -#ifndef QJUMPLIST2_H -#define QJUMPLIST2_H +#ifndef QJUMPLIST_H +#define QJUMPLIST_H +#include <QtCore/qobject.h> +#include <QtCore/qstringlist.h> +#include <QtCore/qscopedpointer.h> #include <QtWinExtras/qwinextrasglobal.h> -#include <QObject> -#include <QStringList> QT_BEGIN_NAMESPACE -class QJumpListItemPrivate; - -class Q_WINEXTRAS_EXPORT QJumpListItem -{ -public: - enum Type { - Unknown, - Destination, - Link, - Separator - }; - - explicit QJumpListItem(Type type = Unknown); - ~QJumpListItem(); - - void setType(Type type); - Type type() const; - void setFilePath(const QString &filePath); - QString filePath() const; - void setWorkingDirectory(const QString &workingDirectory); - QString workingDirectory() const; - void setIcon(const QIcon &icon); - QIcon icon() const; - void setTitle(const QString &title); - QString title() const; - void setDescription(const QString &description); - QString description() const; - void setArguments(const QStringList &arguments); - QStringList arguments() const; - -private: - QScopedPointer<QJumpListItemPrivate> d_ptr; - - Q_DECLARE_PRIVATE(QJumpListItem) -}; - +class QIcon; +class QJumpListItem; class QJumpListPrivate; class Q_WINEXTRAS_EXPORT QJumpList : public QObject @@ -125,11 +92,11 @@ public: void addSeparator(); private: - QScopedPointer<QJumpListPrivate> d_ptr; - + Q_DISABLE_COPY(QJumpList) Q_DECLARE_PRIVATE(QJumpList) + QScopedPointer<QJumpListPrivate> d_ptr; }; QT_END_NAMESPACE -#endif // QJUMPLIST2_H +#endif // QJUMPLIST_H diff --git a/src/winextras/qjumplistitem.cpp b/src/winextras/qjumplistitem.cpp new file mode 100644 index 0000000..c25fbce --- /dev/null +++ b/src/winextras/qjumplistitem.cpp @@ -0,0 +1,239 @@ +/**************************************************************************** + ** + ** Copyright (C) 2013 Ivan Vizir <define-true-false@yandex.com> + ** Contact: http://www.qt-project.org/legal + ** + ** This file is part of QtWinExtras in the Qt Toolkit. + ** + ** $QT_BEGIN_LICENSE:LGPL$ + ** Commercial License Usage + ** Licensees holding valid commercial Qt licenses may use this file in + ** accordance with the commercial license agreement provided with the + ** Software or, alternatively, in accordance with the terms contained in + ** a written agreement between you and Digia. For licensing terms and + ** conditions see http://qt.digia.com/licensing. For further information + ** use the contact form at http://qt.digia.com/contact-us. + ** + ** GNU Lesser General Public License Usage + ** Alternatively, this file may be used under the terms of the GNU Lesser + ** General Public License version 2.1 as published by the Free Software + ** Foundation and appearing in the file LICENSE.LGPL included in the + ** packaging of this file. Please review the following information to + ** ensure the GNU Lesser General Public License version 2.1 requirements + ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. + ** + ** In addition, as a special exception, Digia gives you certain additional + ** rights. These rights are described in the Digia Qt LGPL Exception + ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. + ** + ** GNU General Public License Usage + ** Alternatively, this file may be used under the terms of the GNU + ** General Public License version 3.0 as published by the Free Software + ** Foundation and appearing in the file LICENSE.GPL included in the + ** packaging of this file. Please review the following information to + ** ensure the GNU General Public License version 3.0 requirements will be + ** met: http://www.gnu.org/copyleft/gpl.html. + ** + ** + ** $QT_END_LICENSE$ + ** + ****************************************************************************/ + +#include "qjumplistitem.h" + +QT_BEGIN_NAMESPACE + +/*! + \class QJumpListItem + \inmodule QtWinExtras + \since 5.2 + \inheaderfile QJumpList + \brief The QJumpListItem class represents a Jump List destination or link. + + Objects of this class are returned by QJumpList::removedDestinations() + and can also be used to add items to a Jump List. + */ + +class QJumpListItemPrivate +{ +public: + QString filePath; + QString workingDirectory; + QString title; + QString description; + QIcon icon; + QStringList arguments; + QJumpListItem::Type type; +}; + +/*! + Constructs a QJumpListItem with the specified \a type. + */ +QJumpListItem::QJumpListItem(QJumpListItem::Type type) : + d_ptr(new QJumpListItemPrivate) +{ + d_ptr->type = type; +} + +/*! + Destroys the QJumpListItem. + */ +QJumpListItem::~QJumpListItem() +{ +} + +/*! + Sets the item \a type. + */ +void QJumpListItem::setType(QJumpListItem::Type type) +{ + Q_D(QJumpListItem); + d->type = type; +} + +/*! + Returns the item type. + */ +QJumpListItem::Type QJumpListItem::type() const +{ + Q_D(const QJumpListItem); + return d->type; +} + +/*! + Sets the item \a filePath, the meaning of which depends on the type of this + item: + + \list + + \li If the item type is QJumpListItem::Destination, \a filePath is the + path to a file that can be opened by an application. + + \li If the item type is QJumpListItem::Link, \a filePath is the path to + an executable that is executed when this item is clicked by the + user. + + \endlist + + \sa setWorkingDirectory(), setArguments() + */ +void QJumpListItem::setFilePath(const QString &filePath) +{ + Q_D(QJumpListItem); + d->filePath = filePath; +} + +/*! + Returns the file path set by setFilePath(). + */ +QString QJumpListItem::filePath() const +{ + Q_D(const QJumpListItem); + return d->filePath; +} + +/*! + Sets the path to the working directory of this item to \a workingDirectory. + + This value is used only if the type of this item is QJumpListItem::Link. + + \sa setFilePath() + */ +void QJumpListItem::setWorkingDirectory(const QString &workingDirectory) +{ + Q_D(QJumpListItem); + d->workingDirectory = workingDirectory; +} + +/*! + Returns the working directory path. + */ +QString QJumpListItem::workingDirectory() const +{ + Q_D(const QJumpListItem); + return d->workingDirectory; +} + +/*! + Sets the \a icon of this item. + + This value is used only if the type of this item is QJumpListItem::Link. + */ +void QJumpListItem::setIcon(const QIcon &icon) +{ + Q_D(QJumpListItem); + d->icon = icon; +} + +/*! + Returns the icon set for this item. + */ +QIcon QJumpListItem::icon() const +{ + Q_D(const QJumpListItem); + return d->icon; +} + +/*! + Sets the \a title of this item. + + This value is used only if the type of this item is QJumpListItem::Link. + */ +void QJumpListItem::setTitle(const QString &title) +{ + Q_D(QJumpListItem); + d->title = title; +} + +/*! + Returns the title of this item. + */ +QString QJumpListItem::title() const +{ + Q_D(const QJumpListItem); + return d->title; +} + +/*! + Sets a \a description for this item. + + This value is used only if the type of this item is QJumpListItem::Link. + */ +void QJumpListItem::setDescription(const QString &description) +{ + Q_D(QJumpListItem); + d->description = description; +} + +/*! + Returns the description of this item. + */ +QString QJumpListItem::description() const +{ + Q_D(const QJumpListItem); + return d->description; +} + +/*! + Sets command-line \a arguments for this item. + + This value is used only if the type of this item is QJumpListItem::Link. + + \sa setFilePath() + */ +void QJumpListItem::setArguments(const QStringList &arguments) +{ + Q_D(QJumpListItem); + d->arguments = arguments; +} + +/*! + Returns the command-line arguments of this item. + */ +QStringList QJumpListItem::arguments() const +{ + Q_D(const QJumpListItem); + return d->arguments; +} + +QT_END_NAMESPACE diff --git a/src/winextras/qjumplistitem.h b/src/winextras/qjumplistitem.h new file mode 100644 index 0000000..808e93b --- /dev/null +++ b/src/winextras/qjumplistitem.h @@ -0,0 +1,91 @@ +/**************************************************************************** + ** + ** Copyright (C) 2013 Ivan Vizir <define-true-false@yandex.com> + ** Contact: http://www.qt-project.org/legal + ** + ** This file is part of QtWinExtras in the Qt Toolkit. + ** + ** $QT_BEGIN_LICENSE:LGPL$ + ** Commercial License Usage + ** Licensees holding valid commercial Qt licenses may use this file in + ** accordance with the commercial license agreement provided with the + ** Software or, alternatively, in accordance with the terms contained in + ** a written agreement between you and Digia. For licensing terms and + ** conditions see http://qt.digia.com/licensing. For further information + ** use the contact form at http://qt.digia.com/contact-us. + ** + ** GNU Lesser General Public License Usage + ** Alternatively, this file may be used under the terms of the GNU Lesser + ** General Public License version 2.1 as published by the Free Software + ** Foundation and appearing in the file LICENSE.LGPL included in the + ** packaging of this file. Please review the following information to + ** ensure the GNU Lesser General Public License version 2.1 requirements + ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. + ** + ** In addition, as a special exception, Digia gives you certain additional + ** rights. These rights are described in the Digia Qt LGPL Exception + ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. + ** + ** GNU General Public License Usage + ** Alternatively, this file may be used under the terms of the GNU + ** General Public License version 3.0 as published by the Free Software + ** Foundation and appearing in the file LICENSE.GPL included in the + ** packaging of this file. Please review the following information to + ** ensure the GNU General Public License version 3.0 requirements will be + ** met: http://www.gnu.org/copyleft/gpl.html. + ** + ** + ** $QT_END_LICENSE$ + ** + ****************************************************************************/ + +#ifndef QJUMPLISTITEM_H +#define QJUMPLISTITEM_H + +#include <QtGui/qicon.h> +#include <QtCore/qobject.h> +#include <QtCore/qstringlist.h> +#include <QtCore/qscopedpointer.h> +#include <QtWinExtras/qwinextrasglobal.h> + +QT_BEGIN_NAMESPACE + +class QJumpListItemPrivate; + +class Q_WINEXTRAS_EXPORT QJumpListItem +{ +public: + enum Type { + Unknown, + Destination, + Link, + Separator + }; + + explicit QJumpListItem(Type type = Unknown); + ~QJumpListItem(); + + void setType(Type type); + Type type() const; + void setFilePath(const QString &filePath); + QString filePath() const; + void setWorkingDirectory(const QString &workingDirectory); + QString workingDirectory() const; + void setIcon(const QIcon &icon); + QIcon icon() const; + void setTitle(const QString &title); + QString title() const; + void setDescription(const QString &description); + QString description() const; + void setArguments(const QStringList &arguments); + QStringList arguments() const; + +private: + Q_DISABLE_COPY(QJumpListItem) + Q_DECLARE_PRIVATE(QJumpListItem) + QScopedPointer<QJumpListItemPrivate> d_ptr; +}; + +QT_END_NAMESPACE + +#endif // QJUMPLISTITEM_H diff --git a/src/winextras/winextras.pro b/src/winextras/winextras.pro index 210e8bb..74017c1 100644 --- a/src/winextras/winextras.pro +++ b/src/winextras/winextras.pro @@ -8,6 +8,7 @@ SOURCES += \ qwintaskbarbutton.cpp \ windowsguidsdefs.cpp \ qjumplist.cpp \ + qjumplistitem.cpp \ qwineventfilter.cpp \ qwinthumbnailtoolbar.cpp \ qwinthumbnailtoolbutton.cpp \ @@ -20,6 +21,7 @@ HEADERS += \ qwintaskbarbutton_p.h \ qwintaskbarbutton.h \ qjumplist.h \ + qjumplistitem.h \ winshobjidl_p.h \ winpropkey_p.h \ qwineventfilter_p.h \ |