/** class Tray * Reimplementation of the KStatusNotifierItem class */ Tray::Tray(MainWindow * parent) : KStatusNotifierItem(parent) { // set up the context menu KMenu * cm = contextMenu(); cm->addAction( parent->actionCollection()->action("new_download") ); cm->addAction( parent->actionCollection()->action("import_links") ); cm->addSeparator(); cm->addAction( parent->actionCollection()->action("start_all_download") ); cm->addAction( parent->actionCollection()->action("stop_all_download") ); cm->addSeparator(); cm->addAction( parent->actionCollection()->action("konqueror_integration") ); cm->addAction( parent->actionCollection()->action("options_configure") ); // Set up basic tray parameters setCategory(ApplicationStatus); setIconByName("kget"); setTitle(i18n("KGet")); setContextMenu(cm); setAssociatedWidget(parent); setToolTipIconByName("kget"); setToolTipTitle(i18n("Download Manager")); // Not of much use atm, but maybe we want to set this later? // setToolTipSubTitle("[..]"); // filter middle mouse clicks to ask scheduler to paste URL connect( this, SIGNAL(secondaryActivateRequested(QPoint)), this, SLOT(slotActivated()) ); }
TrayIcon::TrayIcon(QObject* parent) : KStatusNotifierItem(parent), m_unread(0) { setToolTipTitle( i18n("Akregator") ); setToolTipIconByName( i18n("Akregator") ); setIconByName( "akregator" ); m_defaultIcon = KIcon( "akregator" ); }
void KMixDockWidget::setVolumeTip() { shared_ptr<MixDevice> md = Mixer::getGlobalMasterMD(); QString tip; QString subTip; int virtualToolTipValue = 0; if ( md.get() == 0 ) { tip = i18n("Mixer cannot be found"); // !! text could be reworked virtualToolTipValue = -2; } else { // Playback volume will be used for the DockIcon if available. // This heuristic is "good enough" for the DockIcon for now. int val = md->getUserfriendlyVolumeLevel(); tip += "<font size=\"+1\">" + i18n( "Volume at %1%", val ) + "</font>"; if ( md->isMuted() ) tip += i18n( " (Muted)" ); subTip = QString( "%1<br/>%2" ) .arg( Qt::escape(md->mixer()->readableName()) ).arg( Qt::escape(md->readableName()) ); // create a new "virtual" value. With that we see "volume changes" as well as "muted changes" virtualToolTipValue = val; if ( md->isMuted() ) virtualToolTipValue += 10000; } // The actual updating is only done when the "toolTipValue" was changed (to avoid flicker) if ( virtualToolTipValue != _oldToolTipValue ) { // changed (or completely new tooltip) setToolTipTitle(tip); setToolTipSubTitle(subTip); } _oldToolTipValue = virtualToolTipValue; }