You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kdbusnotification/src/daemon/NotifyWidget.cpp

85 lines
2.2 KiB
C++

/*
* NotifyWidget.cpp
*
* Created on: May 14, 2021
* Author: emanoil
*
* kdbusnotification Copyright (C) 2009 kdbusnotification development team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <tqtimer.h>
#include "NotifyWidget.h"
#include "NotificationsService.h"
NotifyWidget::NotifyWidget(TQWidget *parent, const char *name, NotificationsService *ns, TQ_INT32 id )
: TQLabel( parent, name, WStyle_Customize | WStyle_Splash),
mName(TQString(name)), notificationService(ns), mId(id)
{
// TODO Auto-generated constructor stub
}
NotifyWidget::~NotifyWidget()
{
// TODO Auto-generated destructor stub
}
void NotifyWidget::mousePressEvent( TQMouseEvent *e )
{
if (e->button() == TQMouseEvent::LeftButton)
{
// The notification was dismissed by the user.
notificationService->closeNotifyWidget(mId, 2);
}
}
void NotifyWidget::timeout()
{
notificationService->closeNotifyWidget(mId, 1); // The notification expired.
}
void NotifyWidget::setAutoMask(bool b)
{
if (b)
setBackgroundMode( PaletteForeground );
else
setBackgroundMode( PaletteBackground );
TQWidget::setAutoMask(b);
}
void NotifyWidget::setIcon(const TQString& icon) {
mIcon = icon;
// TODO handle icon
}
void NotifyWidget::setActions(const TQStringList& actions) {
mActions = actions;
// TODO handle actions
}
void NotifyWidget::setHints(const TQMap< TQString, TQT_DBusVariant >& hints) {
mHints = hints;
// TODO handle hints
}
void NotifyWidget::setTimeout(TQ_INT32 t) {
TQTimer::singleShot(t, this, TQT_SLOT(timeout()));
}
#include "NotifyWidget.moc"