{}
protected:
- virtual QString iconNameForAction(QAction *action) // TODO Qt 4.7: fixme when we have converted our iconloader
+ QString iconNameForAction(QAction *action) override // TODO Qt 4.7: fixme when we have converted our iconloader
{
QIcon icon(action->icon());
return icon.isNull() ? QString() : icon.name();
StatusNotifierItem::StatusNotifierItem(QWidget *parent)
: StatusNotifierItemParent(parent)
-#if QT_VERSION >= 0x050000
, _iconThemeDir{QDir::tempPath() + QLatin1String{"/quassel-sni-XXXXXX"}}
-#endif
{
static bool registered = []() -> bool {
qDBusRegisterMetaType<DBusImageStruct>();
trayMenu()->installEventFilter(this);
// Create a temporary directory that holds copies of the tray icons. That way, visualizers can find our icons.
- // For Qt4 the relevant icons are installed in hicolor already, so nothing to be done.
-#if QT_VERSION >= 0x050000
if (_iconThemeDir.isValid()) {
_iconThemePath = _iconThemeDir.path();
}
else {
qWarning() << "Could not create temporary directory for themed tray icons!";
}
-#endif
connect(this, SIGNAL(iconsChanged()), this, SLOT(refreshIcons()));
refreshIcons();
connect(this, SIGNAL(toolTipChanged(QString, QString)), _statusNotifierItemDBus, SIGNAL(NewToolTip()));
// Service watcher to keep track of the StatusNotifierWatcher service
- QDBusServiceWatcher *watcher = new QDBusServiceWatcher(kSniWatcherService,
- QDBusConnection::sessionBus(),
- QDBusServiceWatcher::WatchForOwnerChange,
- this);
- connect(watcher, SIGNAL(serviceOwnerChanged(QString, QString, QString)), SLOT(serviceChange(QString, QString, QString)));
+ _serviceWatcher = new QDBusServiceWatcher(kSniWatcherService,
+ QDBusConnection::sessionBus(),
+ QDBusServiceWatcher::WatchForOwnerChange,
+ this);
+ connect(_serviceWatcher, SIGNAL(serviceOwnerChanged(QString, QString, QString)), SLOT(serviceChange(QString, QString, QString)));
// Client instance for StatusNotifierWatcher
_statusNotifierWatcher = new org::kde::StatusNotifierWatcher(kSniWatcherService,
void StatusNotifierItem::refreshIcons()
{
-#if QT_VERSION >= 0x050000
if (!_iconThemePath.isEmpty()) {
QDir baseDir{_iconThemePath + "/hicolor"};
baseDir.removeRecursively();
}
}
}
-#endif
+
if (_statusNotifierItemDBus) {
emit _statusNotifierItemDBus->NewIcon();
emit _statusNotifierItemDBus->NewAttentionIcon();
bool StatusNotifierItem::eventFilter(QObject *watched, QEvent *event)
{
if (mode() == StatusNotifier) {
- //FIXME: ugly ugly workaround to weird QMenu's focus problems
-#ifdef HAVE_KDE4
- if (watched == trayMenu() &&
- (event->type() == QEvent::WindowDeactivate || (event->type() == QEvent::MouseButtonRelease && static_cast<QMouseEvent *>(event)->button() == Qt::LeftButton))) {
- // put at the back of event queue to let the action activate anyways
- QTimer::singleShot(0, trayMenu(), SLOT(hide()));
- }
-#else
if (watched == trayMenu() && event->type() == QEvent::HoverLeave) {
trayMenu()->hide();
}
-#endif
}
return StatusNotifierItemParent::eventFilter(watched, event);
}
{
QString message = message_;
if (_notificationsClient->isValid()) {
- if (_notificationsClientSupportsMarkup)
-#if QT_VERSION < 0x050000
- message = Qt::escape(message);
-#else
+ if (_notificationsClientSupportsMarkup) {
message = message.toHtmlEscaped();
-#endif
+ }
QStringList actions;
if (_notificationsClientSupportsActions)