diff options
author | J-P Nurmi <jpnurmi@digia.com> | 2013-09-13 18:47:29 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-20 10:12:21 +0200 |
commit | 0eade30f37980c38b14d5cfa475837d15b69a8c5 (patch) | |
tree | 1c4f4232086ede3cb3ad62bed1eca053c2977b52 /src/imports/winextras/qquickjumplist.cpp | |
parent | 6e81cfd302e48e7ae4ecab44b377eeffaa45cd73 (diff) |
Jump Lists: introduce "categories" & hide COM
QWinJumpList now has three built-in categories: Recent,
Frequent and Tasks. In addition to that, user can add
custom categories. A new type, QWinJumpListCategory,
represents all these categories, providing access to
items in the category.
The former COM-like begin(), append(), commit(),
abort() API has been replaced by a more property/
attribute-based API. The jump list automatically
invalidates and lazily rebuilds itself behind the
scenes. Furthermore, the API has been minimalized
for now - restoring the application identifier as
a full-fledged property is in the works.
Change-Id: I623a658b4b1fcfc881006f67e2300acadb483c97
Reviewed-by: Ivan Vizir <define-true-false@yandex.com>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
Diffstat (limited to 'src/imports/winextras/qquickjumplist.cpp')
-rw-r--r-- | src/imports/winextras/qquickjumplist.cpp | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/src/imports/winextras/qquickjumplist.cpp b/src/imports/winextras/qquickjumplist.cpp index 8ff70c2..b49be6d 100644 --- a/src/imports/winextras/qquickjumplist.cpp +++ b/src/imports/winextras/qquickjumplist.cpp @@ -124,24 +124,19 @@ void QQuickJumpList::componentComplete() { QQuickItem::componentComplete(); QWinJumpList jumplist; - jumplist.begin(); - jumplist.setFrequentCategoryShown(frequentCategoryShown); - jumplist.setRecentCategoryShown(recentCategoryShown); + jumplist.frequent()->setVisible(frequentCategoryShown); + jumplist.recent()->setVisible(recentCategoryShown); if (!taskList.isEmpty()) { - jumplist.beginTasks(); Q_FOREACH (QQuickJumpListItem *item, taskList) - jumplist.addItem(item->toJumpListItem()); + jumplist.tasks()->addItem(item->toJumpListItem()); taskList.clear(); } if (!categoryList.isEmpty()) { Q_FOREACH (QQuickJumpListCategory *category, categoryList) { - jumplist.beginCategory(category->title()); QList<QWinJumpListItem *> items = category->toItemList(); - Q_FOREACH (QWinJumpListItem *item, items) - jumplist.addItem(item); + jumplist.addCategory(category->title(), items); } } - jumplist.commit(); } void QQuickJumpList::appendTaskItem(QQmlListProperty<QQuickJumpListItem> *property, QQuickJumpListItem *value) @@ -242,11 +237,8 @@ int QQuickJumpListItem::type() const QWinJumpListItem *QQuickJumpListItem::toJumpListItem() const { - QWinJumpListItem *item = new QWinJumpListItem(); + QWinJumpListItem *item = new QWinJumpListItem(QWinJumpListItem::Separator); switch (m_type) { - case ItemTypeSeparator : - item->setType(QWinJumpListItem::Separator); - break; case ItemTypeDestination : item->setType(QWinJumpListItem::Destination); item->setFilePath(property("filePath").toString()); |