Example #1
0
void PopupAppearance::onTestButtonClicked()
{
	Config cfg("behavior");
	cfg.beginGroup("popup");
	QString name = cfg.value("themeName", "default");
	cfg.setValue("themeName", ui->comboBox->currentText());
	cfg.sync();

	NotificationRequest request(Notification::System);
	request.send();

	request.setText(tr("Simple popup"));
	request.setTitle(tr("Preview"));

	NotificationAction act(tr("Test again"), this, SLOT(onTestButtonClicked()));
	request.addAction(act);
	request.setType(Notification::IncomingMessage);
	request.send();

	cfg.setValue("themeName", name);
	cfg.sync();
}
NotifyKindsWidget::NotifyKindsWidget(INotifications *ANotifications, const QString &ATypeId, const QString &ATitle, ushort AKindMask, ushort AKindDefs, QWidget *AParent) : QWidget(AParent)
{
	ui.setupUi(this);
	ui.lblTitle->setText(ATitle);
	ui.lblTest->setVisible(false);

	FNotifications = ANotifications;
	FTypeId = ATypeId;
	FKindMask = AKindMask;
	FKindDefs = AKindDefs;

	ui.chbPopup->setEnabled(AKindMask & INotification::PopupWindow);
	ui.chbSound->setEnabled(AKindMask & INotification::SoundPlay);

	connect(this, SIGNAL(modified()), SLOT(onModified()));
	connect(this, SIGNAL(childReset()), SLOT(onModified()));

	connect(ui.chbPopup,SIGNAL(stateChanged(int)),SIGNAL(modified()));
	connect(ui.chbSound,SIGNAL(stateChanged(int)),SIGNAL(modified()));
	connect(ui.lblTest,SIGNAL(linkActivated(const QString &)),SLOT(onTestLinkActivated(const QString &)));
	connect(ui.pbtTest, SIGNAL(clicked()), SLOT(onTestButtonClicked()));

	reset();
}