mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +00:00
kdeui: drop KStatusNotifierItem and KSystemTrayIcon movie support
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
4a2d569877
commit
aaa643765c
8 changed files with 7 additions and 133 deletions
|
@ -23,7 +23,6 @@
|
|||
#include "kstatusnotifieritemdbus_p.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QMovie>
|
||||
#include <QPainter>
|
||||
#include <QMetaObject>
|
||||
#include <QTimer>
|
||||
|
@ -236,7 +235,7 @@ QIcon KStatusNotifierItem::overlayIconPixmap() const
|
|||
return d->overlayIcon;
|
||||
}
|
||||
|
||||
//Icons and movie for requesting attention state
|
||||
//Icons for requesting attention state
|
||||
|
||||
void KStatusNotifierItem::setAttentionIconByName(const QString &name)
|
||||
{
|
||||
|
@ -271,30 +270,6 @@ QIcon KStatusNotifierItem::attentionIconPixmap() const
|
|||
return d->attentionIcon;
|
||||
}
|
||||
|
||||
void KStatusNotifierItem::setAttentionMovieByName(const QString &name)
|
||||
{
|
||||
if (d->movieName == name) {
|
||||
return;
|
||||
}
|
||||
|
||||
d->movieName = name;
|
||||
|
||||
delete d->movie;
|
||||
d->movie = 0;
|
||||
|
||||
emit d->statusNotifierItemDBus->NewAttentionIcon();
|
||||
|
||||
if (d->systemTrayIcon) {
|
||||
d->movie = new QMovie(d->movieName);
|
||||
d->systemTrayIcon->setMovie(d->movie);
|
||||
}
|
||||
}
|
||||
|
||||
QString KStatusNotifierItem::attentionMovieName() const
|
||||
{
|
||||
return d->movieName;
|
||||
}
|
||||
|
||||
//ToolTip
|
||||
|
||||
void KStatusNotifierItem::setToolTip(const QString &iconName, const QString &title, const QString &subTitle)
|
||||
|
@ -677,7 +652,6 @@ KStatusNotifierItemPrivate::KStatusNotifierItemPrivate(KStatusNotifierItem *item
|
|||
: q(item),
|
||||
category(KStatusNotifierItem::ApplicationStatus),
|
||||
status(KStatusNotifierItem::Passive),
|
||||
movie(0),
|
||||
menu(0),
|
||||
titleAction(0),
|
||||
statusNotifierWatcher(0),
|
||||
|
@ -843,12 +817,7 @@ void KStatusNotifierItemPrivate::setLegacySystemTrayEnabled(bool enabled)
|
|||
void KStatusNotifierItemPrivate::syncLegacySystemTrayIcon()
|
||||
{
|
||||
if (status == KStatusNotifierItem::NeedsAttention) {
|
||||
if (!movieName.isNull()) {
|
||||
if (!movie) {
|
||||
movie = new QMovie(movieName);
|
||||
}
|
||||
systemTrayIcon->setMovie(movie);
|
||||
} else if (!attentionIconName.isNull()) {
|
||||
if (!attentionIconName.isNull()) {
|
||||
systemTrayIcon->setIcon(KIcon(attentionIconName));
|
||||
} else {
|
||||
systemTrayIcon->setIcon(attentionIcon);
|
||||
|
|
|
@ -29,9 +29,6 @@
|
|||
|
||||
class KActionCollection;
|
||||
class KMenu;
|
||||
#include <QMovie>
|
||||
|
||||
|
||||
class KStatusNotifierItemPrivate;
|
||||
|
||||
/**
|
||||
|
@ -276,19 +273,6 @@ public:
|
|||
*/
|
||||
QIcon attentionIconPixmap() const;
|
||||
|
||||
/**
|
||||
* Sets a movie as the requesting attention icon.
|
||||
* This overrides anything set in setAttentionIcon()
|
||||
*/
|
||||
void setAttentionMovieByName(const QString &name);
|
||||
|
||||
/**
|
||||
* @return the name of the movie to be displayed when the application is
|
||||
* requesting the user attention
|
||||
*/
|
||||
QString attentionMovieName() const;
|
||||
|
||||
|
||||
//ToolTip handling
|
||||
/**
|
||||
* Sets a new toolTip or this icon, a toolTip is composed of an icon,
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "kstatusnotifieritem.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QMovie>
|
||||
#include <QMetaObject>
|
||||
|
||||
#include <kdebug.h>
|
||||
|
@ -235,7 +234,7 @@ KDbusImageVector KStatusNotifierItemDBus::OverlayIconPixmap() const
|
|||
return m_statusNotifierItem->d->serializedOverlayIcon;
|
||||
}
|
||||
|
||||
//Requesting attention icon and movie
|
||||
//Requesting attention icon
|
||||
|
||||
QString KStatusNotifierItemDBus::AttentionIconName() const
|
||||
{
|
||||
|
@ -247,11 +246,6 @@ KDbusImageVector KStatusNotifierItemDBus::AttentionIconPixmap() const
|
|||
return m_statusNotifierItem->d->serializedAttentionIcon;
|
||||
}
|
||||
|
||||
QString KStatusNotifierItemDBus::AttentionMovieName() const
|
||||
{
|
||||
return m_statusNotifierItem->d->movieName;
|
||||
}
|
||||
|
||||
|
||||
//ToolTip
|
||||
|
||||
|
|
|
@ -63,7 +63,6 @@ class KStatusNotifierItemDBus : public QObject
|
|||
Q_PROPERTY(KDbusImageVector OverlayIconPixmap READ OverlayIconPixmap)
|
||||
Q_PROPERTY(QString AttentionIconName READ AttentionIconName)
|
||||
Q_PROPERTY(KDbusImageVector AttentionIconPixmap READ AttentionIconPixmap)
|
||||
Q_PROPERTY(QString AttentionMovieName READ AttentionMovieName)
|
||||
Q_PROPERTY(KDbusToolTipStruct ToolTip READ ToolTip)
|
||||
Q_PROPERTY(QString IconThemePath READ IconThemePath)
|
||||
Q_PROPERTY(QDBusObjectPath Menu READ Menu)
|
||||
|
@ -149,11 +148,6 @@ public:
|
|||
*/
|
||||
KDbusImageVector AttentionIconPixmap() const;
|
||||
|
||||
/**
|
||||
* @return the name of the attention movie
|
||||
*/
|
||||
QString AttentionMovieName() const;
|
||||
|
||||
/**
|
||||
* all the data needed for a tooltip
|
||||
*/
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include <QtCore/qpointer.h>
|
||||
#include <QtGui/qevent.h>
|
||||
#include <QAction>
|
||||
|
||||
#include <ksystemtrayicon.h>
|
||||
|
||||
|
@ -35,9 +36,6 @@
|
|||
class KActionCollection;
|
||||
class KSystemTrayIcon;
|
||||
class KMenu;
|
||||
#include <QMovie>
|
||||
#include <QAction>
|
||||
|
||||
|
||||
// this class is needed because we can't just put an event filter on it:
|
||||
// the events that are passed to QSystemTrayIcon are done so in a way that
|
||||
|
@ -110,8 +108,6 @@ public:
|
|||
QString attentionIconName;
|
||||
QIcon attentionIcon;
|
||||
KDbusImageVector serializedAttentionIcon;
|
||||
QString movieName;
|
||||
QPointer<QMovie> movie;
|
||||
|
||||
QString toolTipIconName;
|
||||
KDbusImageVector serializedToolTipIcon;
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
#include <kconfiggroup.h>
|
||||
|
||||
#include <QToolButton>
|
||||
#include <QMovie>
|
||||
|
||||
class KSystemTrayIconPrivate
|
||||
{
|
||||
|
@ -53,7 +52,6 @@ public:
|
|||
hasQuit = false;
|
||||
onAllDesktops = false;
|
||||
window = parent;
|
||||
movie = 0;
|
||||
}
|
||||
|
||||
~KSystemTrayIconPrivate()
|
||||
|
@ -62,13 +60,6 @@ public:
|
|||
delete menu;
|
||||
}
|
||||
|
||||
|
||||
void _k_slotNewFrame()
|
||||
{
|
||||
q->setIcon(QIcon(movie->currentPixmap()));
|
||||
}
|
||||
|
||||
|
||||
KSystemTrayIcon* q;
|
||||
KActionCollection* actionCollection;
|
||||
KMenu* menu;
|
||||
|
@ -76,7 +67,6 @@ public:
|
|||
QAction* titleAction;
|
||||
bool onAllDesktops : 1; // valid only when the parent widget was hidden
|
||||
bool hasQuit : 1;
|
||||
QPointer<QMovie> movie;
|
||||
};
|
||||
|
||||
KSystemTrayIcon::KSystemTrayIcon( QWidget* parent )
|
||||
|
@ -100,14 +90,6 @@ KSystemTrayIcon::KSystemTrayIcon( const QIcon& icon, QWidget* parent )
|
|||
init( parent );
|
||||
}
|
||||
|
||||
KSystemTrayIcon::KSystemTrayIcon(QMovie* movie, QWidget *parent)
|
||||
: QSystemTrayIcon(parent),
|
||||
d( new KSystemTrayIconPrivate( this, parent ) )
|
||||
{
|
||||
init(parent);
|
||||
setMovie(movie);
|
||||
}
|
||||
|
||||
void KSystemTrayIcon::init( QWidget* parent )
|
||||
{
|
||||
// Ensure that closing the last KMainWindow doesn't exit the application
|
||||
|
@ -349,21 +331,4 @@ QAction *KSystemTrayIcon::contextMenuTitle() const
|
|||
return button->defaultAction();
|
||||
}
|
||||
|
||||
void KSystemTrayIcon::setMovie(QMovie* m)
|
||||
{
|
||||
if (d->movie == m) {
|
||||
return;
|
||||
}
|
||||
delete d->movie;
|
||||
m->setParent(this);
|
||||
d->movie = m;
|
||||
connect(d->movie, SIGNAL(frameChanged(int)), this, SLOT(_k_slotNewFrame()));
|
||||
d->movie->setCacheMode(QMovie::CacheAll);
|
||||
}
|
||||
|
||||
const QMovie* KSystemTrayIcon::movie() const
|
||||
{
|
||||
return d->movie;
|
||||
}
|
||||
|
||||
#include "moc_ksystemtrayicon.cpp"
|
||||
|
|
|
@ -23,12 +23,11 @@
|
|||
#include <kdeui_export.h>
|
||||
#include <kglobal.h>
|
||||
|
||||
#include <QtGui/QSystemTrayIcon>
|
||||
#include <QSystemTrayIcon>
|
||||
#include <QAction>
|
||||
|
||||
class KActionCollection;
|
||||
class KSystemTrayIconPrivate;
|
||||
#include <QAction>
|
||||
#include <QMovie>
|
||||
|
||||
/**
|
||||
* \brief %KDE System Tray Window class
|
||||
|
@ -88,34 +87,11 @@ public:
|
|||
*/
|
||||
explicit KSystemTrayIcon( const QIcon& icon, QWidget* parent = 0 );
|
||||
|
||||
/**
|
||||
* Same as above but allows one to define the movie by QMovie that should
|
||||
* be used for the system tray icon. Memory management for the movie will
|
||||
* be handled by KSystemTrayIcon.
|
||||
*/
|
||||
explicit KSystemTrayIcon(QMovie* movie, QWidget* parent);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~KSystemTrayIcon();
|
||||
|
||||
/**
|
||||
* Set the movie to use. To manipulate the movie (start, stop, pause), call
|
||||
* @see movie() and make calls on the QMovie* that it returns.
|
||||
* Memory management for the movie will be handled by KSystemTrayIcon.
|
||||
* @since 4.2
|
||||
*/
|
||||
void setMovie(QMovie* movie);
|
||||
|
||||
/**
|
||||
* Get a pointer to the movie. Use this pointer to manipulate the movie
|
||||
* (start, stop, pause).
|
||||
* Will return null if no movie has been set
|
||||
* @since 4.2
|
||||
*/
|
||||
const QMovie* movie() const;
|
||||
|
||||
/**
|
||||
Easy access to the actions in the context menu
|
||||
Currently includes KStandardAction::Quit and minimizeRestore
|
||||
|
@ -182,8 +158,6 @@ private:
|
|||
void minimizeRestore( bool restore );
|
||||
|
||||
KSystemTrayIconPrivate* const d;
|
||||
|
||||
Q_PRIVATE_SLOT(d, void _k_slotNewFrame())
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -22,8 +22,7 @@
|
|||
|
||||
#include "notifications/kstatusnotifieritem.h"
|
||||
#include <QDateTime>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QMovie>
|
||||
#include <QLabel>
|
||||
|
||||
#include <kapplication.h>
|
||||
#include <kcmdlineargs.h>
|
||||
|
@ -96,7 +95,6 @@ int main(int argc, char **argv)
|
|||
//tray->setImage(KIcon("konqueror"));
|
||||
//tray->setAttentionIconByName("kmail");
|
||||
tray->setOverlayIconByName("emblem-important");
|
||||
tray->setAttentionMovieByName(KIconLoader::global()->moviePath( QLatin1String( "newmessage" ), KIconLoader::Panel ));
|
||||
|
||||
tray->setToolTipIconByName("konqueror");
|
||||
tray->setToolTipTitle("DBus System tray test");
|
||||
|
|
Loading…
Add table
Reference in a new issue