void SystemTray::updateToolTip() { // return; ///////////////////////////////////////////////////// Basket *basket = Global::bnpView->currentBasket(); if (!basket) return; if (basket->icon().isEmpty() || basket->icon() == "basket" || ! Settings::showIconInSystray()) setPixmap(basket->isLocked() ? m_lockedIconPixmap : m_iconPixmap); else { // Code that comes from JuK: QPixmap bgPix = loadIcon("basket"); QPixmap fgPix = SmallIcon(basket->icon()); QImage bgImage = bgPix.convertToImage(); // Probably 22x22 QImage fgImage = fgPix.convertToImage(); // Should be 16x16 QImage lockOverlayImage = loadIcon("lockoverlay").convertToImage(); KIconEffect::semiTransparent(bgImage); copyImage(bgImage, fgImage, (bgImage.width() - fgImage.width()) / 2, (bgImage.height() - fgImage.height()) / 2); if (basket->isLocked()) KIconEffect::overlay(bgImage, lockOverlayImage); bgPix.convertFromImage(bgImage); setPixmap(bgPix); } //QTimer::singleShot( Container::c_delayTooltipTime, this, SLOT(updateToolTipDelayed()) ); // No need to delay: it's be called when notes are changed: updateToolTipDelayed(); }
void SystemTray::updateToolTipDelayed() { Basket *basket = Global::bnpView->currentBasket(); QString tip = "<p><nobr>" + ( basket->isLocked() ? KDialog::makeStandardCaption(i18n("%1 (Locked)")) : KDialog::makeStandardCaption( "%1") ) .arg(Tools::textToHTMLWithoutP(basket->basketName())); QToolTip::add(this, tip); }
/** Updates the icon and tooltip in the system tray */ void SystemTray::updateDisplay() { Basket *basket = Global::bnpView->currentBasket(); if (!basket) return; // Update the icon if (basket->icon().isEmpty() || basket->icon() == "basket" || !Settings::showIconInSystray()) setIcon(basket->isLocked() ? m_lockedIcon : m_icon); else { // Code that comes from JuK: QPixmap bgPix = loadIcon("basket").pixmap(m_iconSize); int smallIconSize = kapp->style()->pixelMetric(QStyle::PM_SmallIconSize); QPixmap fgPix = loadIcon(basket->icon()).pixmap(smallIconSize); QImage bgImage = bgPix.toImage(); // Probably 22x22 QImage fgImage = fgPix.toImage(); // Should be 16x16 KIconEffect::semiTransparent(bgImage); copyImage(bgImage, fgImage, bgImage.width()-fgImage.width() / 2, bgImage.height()-fgImage.height() / 2); if (basket->isLocked()) { QImage lockOverlay = loadIcon("lockoverlay").pixmap(m_iconSize).toImage(); KIconEffect::overlay(bgImage, lockOverlay); } setIcon(QPixmap::fromImage(bgImage)); } // update the tooltip QString tip = "<p><nobr>"; QString basketName = "%1"; if (basket->isLocked()) basketName += i18n(" (Locked)"); tip += KDialog::makeStandardCaption(basketName); tip = tip.arg(Tools::textToHTMLWithoutP(basket->basketName())); setToolTip(tip); }