void IconApplet::init() { QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(this); layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); layout->addItem(m_icon); KConfigGroup cg = config(); if (m_url.isValid()) { // we got this in via the ctor, e.g. as a result of a drop cg.writeEntry("Url", m_url); emit configNeedsSaving(); } else { configChanged(); } setDisplayLines(2); registerAsDragHandle(m_icon); setAspectRatioMode(Plasma::ConstrainedSquare); connect(KGlobalSettings::self(), SIGNAL(iconChanged(int)), this, SLOT(iconSizeChanged(int))); }
void SpellCheck::init() { Plasma::IconWidget *icon = new Plasma::IconWidget(KIcon("tools-check-spelling"), QString(), this); registerAsDragHandle(icon); QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(this); layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); layout->addItem(icon); Plasma::ToolTipManager::self()->setContent(this, Plasma::ToolTipContent(i18n("Spell Checking"), i18n("Check spelling of clipboard contents."), icon->icon().pixmap(IconSize(KIconLoader::Desktop)))); connect(this, SIGNAL(activate()), this, SLOT(toggleDialog())); connect(icon, SIGNAL(clicked()), this, SLOT(toggleDialog())); }
void WindowList::init() { Plasma::IconWidget *icon = new Plasma::IconWidget(KIcon("preferences-system-windows"), QString(), this); m_listMenu = new KWindowListMenu; m_listMenu->installEventFilter(this); registerAsDragHandle(icon); QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(this); layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); layout->addItem(icon); Plasma::ToolTipManager::self()->setContent(this, Plasma::ToolTipContent(i18n("Window list"), i18n("Show list of opened windows"), KIcon("preferences-system-windows").pixmap(IconSize(KIconLoader::Desktop)))); connect(this, SIGNAL(activate()), this, SLOT(showMenu())); connect(this, SIGNAL(destroyed()), m_listMenu, SLOT(deleteLater())); connect(icon, SIGNAL(clicked()), this, SLOT(showMenu())); connect(m_listMenu, SIGNAL(triggered(QAction*)), this, SLOT(triggered(QAction*))); }