void QWinJumpListCategoryPrivate::loadRecents() { Q_ASSERT(jumpList); IApplicationDocumentLists *pDocList = 0; HRESULT hresult = CoCreateInstance(qCLSID_ApplicationDocumentLists, 0, CLSCTX_INPROC_SERVER, qIID_IApplicationDocumentLists, reinterpret_cast<void **>(&pDocList)); if (SUCCEEDED(hresult)) { if (!jumpList->identifier().isEmpty()) { wchar_t *id = qt_qstringToNullTerminated(jumpList->identifier()); hresult = pDocList->SetAppID(id); delete[] id; } if (SUCCEEDED(hresult)) { IObjectArray *array = 0; hresult = pDocList->GetList(type == QWinJumpListCategory::Recent ? ADLT_RECENT : ADLT_FREQUENT, 0, qIID_IObjectArray, reinterpret_cast<void **>(&array)); if (SUCCEEDED(hresult)) { items = QWinJumpListPrivate::fromComCollection(array); array->Release(); } } pDocList->Release(); } if (FAILED(hresult)) QWinJumpListPrivate::warning("loadRecents", hresult); }
void QWinJumpListCategoryPrivate::addRecent(QWinJumpListItem *item) { Q_ASSERT(item->type() == QWinJumpListItem::Link); wchar_t *id = 0; if (jumpList && !jumpList->identifier().isEmpty()) id = qt_qstringToNullTerminated(jumpList->identifier()); SHARDAPPIDINFOLINK info; info.pszAppID = id; info.psl = QWinJumpListPrivate::toIShellLink(item); if (info.psl) { SHAddToRecentDocs(SHARD_APPIDINFOLINK, &info); info.psl->Release(); } delete[] id; }
void QWinJumpListCategoryPrivate::clearRecents() { IApplicationDestinations *pDest = 0; HRESULT hresult = CoCreateInstance(qCLSID_ApplicationDestinations, 0, CLSCTX_INPROC_SERVER, qIID_IApplicationDestinations, reinterpret_cast<void **>(&pDest)); if (SUCCEEDED(hresult)) { const QString identifier = jumpList ? jumpList->identifier() : QString(); if (!identifier.isEmpty()) { wchar_t *id = qt_qstringToNullTerminated(identifier); hresult = pDest->SetAppID(id); delete[] id; } hresult = pDest->RemoveAllDestinations(); pDest->Release(); } if (FAILED(hresult)) QWinJumpListPrivate::warning("clearRecents", hresult); }
void QWinTaskbarButtonPrivate::updateOverlayIcon() { if (!pTbList || !window) return; wchar_t *descrPtr = 0; HICON hicon = 0; if (!overlayAccessibleDescription.isEmpty()) descrPtr = qt_qstringToNullTerminated(overlayAccessibleDescription); if (!overlayIcon.isNull()) hicon = QtWin::toHICON(overlayIcon.pixmap(iconSize())); if (hicon) pTbList->SetOverlayIcon(handle(), hicon, descrPtr); else if (!hicon && !overlayIcon.isNull()) pTbList->SetOverlayIcon(handle(), (HICON)LoadImage(0, IDI_APPLICATION, IMAGE_ICON, SM_CXSMICON, SM_CYSMICON, LR_SHARED), descrPtr); else pTbList->SetOverlayIcon(handle(), NULL, descrPtr); if (hicon) DeleteObject(hicon); if (descrPtr) delete[] descrPtr; }