aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@digia.com>2013-09-13 18:47:29 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-20 10:12:21 +0200
commit0eade30f37980c38b14d5cfa475837d15b69a8c5 (patch)
tree1c4f4232086ede3cb3ad62bed1eca053c2977b52 /examples
parent6e81cfd302e48e7ae4ecab44b377eeffaa45cd73 (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 'examples')
-rw-r--r--examples/winextras/jumplistexample/examplewidget.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/examples/winextras/jumplistexample/examplewidget.cpp b/examples/winextras/jumplistexample/examplewidget.cpp
index 10db514..9eff582 100644
--- a/examples/winextras/jumplistexample/examplewidget.cpp
+++ b/examples/winextras/jumplistexample/examplewidget.cpp
@@ -49,6 +49,7 @@
#include <QMessageBox>
#include <QWinJumpList>
#include <QWinJumpListItem>
+#include <QWinJumpListCategory>
#include <QDebug>
ExampleWidget::ExampleWidget(QWidget *parent) :
@@ -104,28 +105,24 @@ void ExampleWidget::showFile(const QString &path)
void ExampleWidget::updateJumpList()
{
QWinJumpList jumplist;
- jumplist.begin();
- if (ui->cbShowFrequent->isChecked())
- jumplist.setFrequentCategoryShown(true);
- if (ui->cbShowRecent->isChecked())
- jumplist.setRecentCategoryShown(true);
- jumplist.beginTasks();
+ jumplist.recent()->setVisible(ui->cbShowRecent->isChecked());
+ jumplist.frequent()->setVisible(ui->cbShowFrequent->isChecked());
if (ui->cbRunFullscreen->isChecked()) {
QWinJumpListItem *item = new QWinJumpListItem(QWinJumpListItem::Link);
item->setTitle(ui->cbRunFullscreen->text());
item->setFilePath(QDir::toNativeSeparators(QCoreApplication::applicationFilePath()));
item->setArguments(QStringList("-fullscreen"));
item->setIcon(style()->standardIcon(QStyle::SP_TitleBarMaxButton));
- jumplist.addItem(item);
+ jumplist.tasks()->addItem(item);
}
if (ui->cbRunFusion->isChecked()) {
- jumplist.addLink(style()->standardIcon(QStyle::SP_DesktopIcon), ui->cbRunFusion->text(), QDir::toNativeSeparators(QCoreApplication::applicationFilePath()), (QStringList() << "-style" << "fusion"));
+ jumplist.tasks()->addLink(style()->standardIcon(QStyle::SP_DesktopIcon), ui->cbRunFusion->text(), QDir::toNativeSeparators(QCoreApplication::applicationFilePath()), (QStringList() << "-style" << "fusion"));
}
if (ui->cbRunText->isChecked()) {
- jumplist.addSeparator();
- jumplist.addLink(ui->cbRunText->text(), QDir::toNativeSeparators(QCoreApplication::applicationFilePath()), QStringList("-text"));
+ jumplist.tasks()->addSeparator();
+ jumplist.tasks()->addLink(ui->cbRunText->text(), QDir::toNativeSeparators(QCoreApplication::applicationFilePath()), QStringList("-text"));
}
- jumplist.commit();
+ jumplist.tasks()->setVisible(!jumplist.tasks()->isEmpty());
}
void ExampleWidget::openFile()