Beispiel #1
0
void StackFolder::paintInterface(QPainter *p, const QStyleOptionGraphicsItem *option, const QRect &contentsRect)
{
    Q_UNUSED(p);
    Q_UNUSED(option);
    Q_UNUSED(contentsRect);

    if (m_placesModel && m_iconAnimationGroup->state() != QAbstractAnimation::Stopped) {
        if (m_hoverState) {
            stopAnimation();
        }
        else {
            setPopupIcon(m_icon.pixmap(m_popupIconSize.width(), m_popupIconSize.height()));
            return;
        }
    }

    if (m_hoverShow) {
        if (m_hoverState) {
            QPixmap pixmap = m_icon.pixmap(geometry().width(), geometry().height());
            QPixmap alphaMask(pixmap.width(), pixmap.height());
            const QColor color(127, 127, 127);
            alphaMask.fill(color);
            pixmap.setAlphaChannel(alphaMask);
            setPopupIcon(pixmap);
        }
        else {
            setPopupIcon(m_icon);
        }
    }
}
Beispiel #2
0
ClockApplet::ClockApplet(QObject *parent, const QVariantList &args)
    : Plasma::PopupApplet(parent, args),
      d(new Private(this))
{
    setPopupIcon(QIcon());
    setPassivePopup(true);
}
Beispiel #3
0
void StackFolder::stopAnimation()
{
    if (m_iconAnimationGroup->state() != QAbstractAnimation::Stopped) {
        m_iconAnimationGroup->stop();
        setPopupIcon(m_icon);
    }
}
Beispiel #4
0
void XbmcremoteApplet::paintInterface(QPainter * p, const QStyleOptionGraphicsItem *option, const QRect &contentsRect)
{
    Q_UNUSED( p );
    Q_UNUSED( option );

    if (!m_panelContainment) {
        /* To make applet's size matches the popup's size. The applet is the tray icon, which is 16x16 pixels size by default.*/
        adjustSize();
    }

    QString el = "logo";

    int s = qMin(contentsRect.width(), contentsRect.height());
    QRect rect(0, 0, s, s);
    QPixmap newIcon(QSize(s, s));
    newIcon.fill(Qt::transparent);
    QPainter painter;
    painter.begin(&newIcon);

    m_svg->paint(&painter, rect, el);

    paintStatusOverlay(&painter, rect);

    painter.end();
    setPopupIcon(newIcon);
}
Beispiel #5
0
void Paste::showOk()
{
    // Show ok icon like in DeviceNotifier
    setPopupIcon("dialog-ok");
    m_list->icon->setPixmap(KIcon("dialog-ok").pixmap(KIconLoader::SizeSmall,
                                                      KIconLoader::SizeSmall));
    QTimer::singleShot(2000, this, SLOT(resetIcon()));
}
Beispiel #6
0
Paste::Paste(QObject *parent, const QVariantList &args)
    : Plasma::PopupApplet(parent, args), m_list(0), m_snippetConfig(0)
{
    setHasConfigurationInterface(true);
    setAspectRatioMode(Plasma::IgnoreAspectRatio);
    resize(200, 300);
    setPopupIcon("edit-paste");
}
Beispiel #7
0
KateSessionApplet::KateSessionApplet(QObject *parent, const QVariantList &args)
    : Plasma::PopupApplet(parent, args), m_listView( 0 ), m_config(0)
{
    KDirWatch *dirwatch = new KDirWatch( this );
    QStringList lst = KGlobal::dirs()->findDirs( "data", "kate/sessions/" );
    for ( int i = 0; i < lst.count(); i++ )
    {
        dirwatch->addDir( lst[i] );
    }
    connect( dirwatch, SIGNAL(dirty (const QString &) ), this, SLOT( slotUpdateSessionMenu() ) );
    setPopupIcon( "kate" );
    setHasConfigurationInterface(true);
}
Beispiel #8
0
TodoApplet::TodoApplet(QObject *parent, const QVariantList &args) :
    Plasma::PopupApplet(parent, args),
    m_engine(0),
    m_types(0),
    m_error(0),
    m_proxyWidget(0),
    m_widget(0),
    m_view(0),
    m_configUi()
{
    setAspectRatioMode(Plasma::IgnoreAspectRatio);
    setHasConfigurationInterface(true);

    setPopupIcon("view-pim-tasks");
}
Beispiel #9
0
XbmcremoteApplet::XbmcremoteApplet(QObject * parent, const QVariantList & args)
    : Plasma::PopupApplet(parent, args),
        m_panelContainment(true)
{
    QCoreApplication::setOrganizationName("xbmcremote");
    QCoreApplication::setApplicationName("xbmcremote");
    // TODO: localisation
//    KGlobal::locale()->insertCatalog("libknetworkmanager");

    setPopupIcon("xbmcremote");

    //setPassivePopup(true); // FIXME: disable, only true for testing ...

    m_svg = new Plasma::Svg(this);
    m_svg->setImagePath("icons/xbmcremote");
    m_svg->setContainsMultipleImages(true);
}
Beispiel #10
0
void StackFolder::updateIconWidget()
{
    if (!m_placesModel) {
        m_placesModel = new KFilePlacesModel(this);

        const QModelIndex index = m_placesModel->closestItem(m_topUrl);
        const KUrl url = m_placesModel->url(index);

        KFileItem item = m_dirModel->itemForIndex(QModelIndex());

        if (!item.isNull() && item.iconName() != "inode-directory") {
            m_icon = KIcon(item.iconName(), 0, item.overlays());
        } 
        else if (m_topUrl.protocol() == "desktop") {
            m_icon = KIcon("user-desktop");
        } 
        else if (m_topUrl.protocol() == "trash") {
            m_icon = m_model->rowCount() > 0 ? KIcon("user-trash-full") : KIcon("user-trash");
        } 
        else if (index.isValid() && url.equals(m_topUrl, KUrl::CompareWithoutTrailingSlash)) {
            m_icon = m_placesModel->icon(index);
        }

        m_iconAnimation1 = new QPropertyAnimation(this, "popupIconSize");
        m_iconAnimation1->setDuration(600);
        m_iconAnimation2 = new QPropertyAnimation(this, "popupIconSize");
        m_iconAnimation1->setDuration(600);
        m_iconAnimationGroup = new QSequentialAnimationGroup;
        m_iconAnimationGroup->addAnimation(m_iconAnimation1);
        m_iconAnimationGroup->addAnimation(m_iconAnimation2);
        m_iconAnimationGroup->setLoopCount(4);
        connect(m_iconAnimationGroup, SIGNAL(finished()), this, SLOT(iconAnimationFinished()));

        setPopupIcon(m_icon);

        // Update the tooltip
        Plasma::ToolTipContent data;
        data.setMainText(i18n("Stack Folder"));
        data.setSubText(m_topUrl.fileName(KUrl::IgnoreTrailingSlash));
        data.setImage(m_icon);
        Plasma::ToolTipManager::self()->setContent(this, data);

    }
}
Beispiel #11
0
void KdeObservatory::init()
{
    m_engine = dataEngine("kdeobservatory");

    m_service = m_engine->serviceForSource("");
    connect(m_service, SIGNAL(engineReady()), SLOT(safeInit()));
    connect(m_service, SIGNAL(engineError(QString,QString)), SLOT(engineError(QString,QString)));

    setPopupIcon(KIcon("kdeobservatory"));

    if (Solid::Networking::status() != Solid::Networking::Connected && Solid::Networking::status() != Solid::Networking::Unknown)
    {
        engineError("fatal", i18n("No active network connection"));
        return;
    }

    Plasma::PopupApplet::setBusy(true);
    m_service->startOperationCall(m_service->operationDescription("allProjectsInfo"));
}
Beispiel #12
0
WicdApplet::WicdApplet(QObject *parent, const QVariantList &args)
    : Plasma::PopupApplet(parent, args),
      m_theme(0),
      m_plotter(0)
{
    KGlobal::locale()->insertCatalog("wicd-kde");
    
    Wicd::locate();
    setHasConfigurationInterface(false);
    setAspectRatioMode(Plasma::ConstrainedSquare);
    setPopupIcon(QIcon());
    setStatus(Plasma::ActiveStatus);
    m_theme = new Plasma::Svg(this);
    m_theme->setImagePath("icons/network");
    m_theme->setContainsMultipleImages(true);
    
    // this will get us the standard applet background, for free!
    setBackgroundHints(DefaultBackground);
}
EventApplet::EventApplet(QObject *parent, const QVariantList &args) :
    Plasma::PopupApplet(parent, args),
    m_graphicsWidget(0),
    m_view(0),
    m_delegate(0),
    m_eventFormatConfig(),
    m_todoFormatConfig(),
    m_colorConfigUi(),
    m_timer(0),
    m_agentManager(0),
    m_openEventWatcher(0),
    m_addEventWatcher(0),
    m_addTodoWatcher(0)
{
    KGlobal::locale()->insertCatalog("libkcal");
    KGlobal::locale()->insertCatalog("eventapplet");
    setBackgroundHints(DefaultBackground);
    setAspectRatioMode(Plasma::IgnoreAspectRatio);
    setHasConfigurationInterface(true);

    setPopupIcon("view-pim-tasks");

    Akonadi::ServerManager::start();
}
Beispiel #14
0
StackFolder::StackFolder(QObject *parent, const QVariantList &args)
    : Plasma::PopupApplet(parent, args),
      m_graphicsWidget(0),
      m_placesModel(0)
{
    setAspectRatioMode(Plasma::IgnoreAspectRatio);
    setHasConfigurationInterface(false);

    m_dirModel = new DirModel(this);

    m_model = new ProxyModel(this);
    m_model->setSourceModel(m_dirModel);
    m_model->setSortLocaleAware(true);
    m_model->setFilterCaseSensitivity(Qt::CaseInsensitive);

    m_selectionModel = new QItemSelectionModel(m_model, this);

    if (args.count() > 0) {
        m_url = KUrl(args.value(0).toString());
    }

    m_icon = KIcon("folder");
    setPopupIcon(m_icon);
}
Beispiel #15
0
CharSelectApplet::CharSelectApplet(QObject *parent, const QVariantList &args)
    : Plasma::PopupApplet(parent, args),
      m_mainWidget(0)
{
    setPopupIcon(QLatin1String("accessories-character-map"));
}
Beispiel #16
0
void Paste::resetIcon()
{
    setPopupIcon("edit-paste");
    m_list->icon->setPixmap(KIcon("edit-paste").pixmap(KIconLoader::SizeSmall,
                                                       KIconLoader::SizeSmall));
}
Beispiel #17
0
void StackFolder::iconAnimationFinished()
{
    setPopupIcon(m_icon);
}
ActivityManager::ActivityManager(QObject *parent, const QVariantList &args): Plasma::PopupApplet(parent, args), toggleLockAction(0), m_currentName(""), m_currentIcon("") {
  setPopupIcon("preferences-activities");
  setAspectRatioMode(Plasma::IgnoreAspectRatio);
}