Cleanup notifications

Use iconName instead of sending a fixed-size pixmap around, fix wording and use title
capitalization, more meaningful names in notifyrc, QStringLiteral and new style connect.

REVIEW: 122121
This commit is contained in:
Kai Uwe Broulik 2015-01-18 01:52:04 +01:00
parent 260301155f
commit 930c107f7b
7 changed files with 34 additions and 34 deletions

View file

@ -377,13 +377,13 @@ void Device::privateReceivedPackage(const NetworkPackage& np)
qCDebug(KDECONNECT_CORE) << "Pair request";
KNotification* notification = new KNotification("pairingRequest");
notification->setPixmap(QIcon::fromTheme("dialog-information").pixmap(48, 48));
notification->setIconName(QStringLiteral("dialog-information"));
notification->setComponentName("kdeconnect");
notification->setTitle("KDE Connect");
notification->setText(i18n("Pairing request from %1", m_deviceName));
notification->setActions(QStringList() << i18n("Accept") << i18n("Reject"));
connect(notification, SIGNAL(action1Activated()), this, SLOT(acceptPairing()));
connect(notification, SIGNAL(action2Activated()), this, SLOT(rejectPairing()));
connect(notification, &KNotification::closed, this, &Device::rejectPairing);
connect(notification, &KNotification::action1Activated, this, &Device::acceptPairing);
connect(notification, &KNotification::action2Activated, this, &Device::rejectPairing);
notification->sendEvent();
m_pairStatus = Device::RequestedByPeer;

View file

@ -73,9 +73,9 @@ bool BatteryPlugin::receivePackage(const NetworkPackage& np)
if ( thresholdEvent == ThresholdBatteryLow && !isCharging ) {
KNotification* notification = new KNotification("batteryLow");
notification->setPixmap(QIcon::fromTheme("battery-040").pixmap(48, 48));
notification->setIconName("battery-040");
notification->setComponentName("kdeconnect");
notification->setTitle(i18nc("device name: low battery", "%1: low battery", device()->name()));
notification->setTitle(i18nc("device name: low battery", "%1: Low Battery", device()->name()));
notification->setText(i18n("Battery at %1%", currentCharge));
notification->sendEvent();
}

View file

@ -85,7 +85,7 @@ Comment[x-test]=xxPairing request received from a devicesxx
Action=Popup
[Event/callReceived]
Name=Calling
Name=Incoming Call
Name[bg]=Позвъняване
Name[bs]=Poziva se
Name[ca]=Trucada
@ -136,7 +136,7 @@ Comment[x-test]=xxSomeone is calling youxx
Action=Popup
[Event/missedCall]
Name=Missed
Name=Missed Call
Name[bg]=Пропуснати
Name[bs]=Propušten
Name[ca]=Perduda
@ -187,7 +187,7 @@ Comment[x-test]=xxYou have a missed callxx
Action=Popup
[Event/smsReceived]
Name=SMS
Name=SMS Received
Name[bg]=Текстово съобщение
Name[bs]=SMS
Name[ca]=SMS
@ -238,7 +238,7 @@ Comment[x-test]=xxSomeone sent you an SMSxx
Action=Popup
[Event/batteryLow]
Name=Battery
Name=Battery Low
Name[bg]=Батерия
Name[bs]=Baterija
Name[ca]=Bateria
@ -289,7 +289,7 @@ Comment[x-test]=xxYour battery is in low statexx
Action=Popup
[Event/pingReceived]
Name=Ping
Name=Ping Received
Name[bg]=Пинг
Name[bs]=Ping
Name[ca]=Ping
@ -298,7 +298,7 @@ Name[da]=Ping
Name[de]=Ping
Name[es]=Ping
Name[fi]=Tiedustelupaketti
Name[fr]=Commande « Ping »
Name[fr]=Commande « Ping »
Name[hu]=Ping
Name[it]=Ping
Name[ko]=핑
@ -322,7 +322,7 @@ Comment[da]=Ping modtaget
Comment[de]=Ping empfangen
Comment[es]=Ping recibido
Comment[fi]=Vastaanotettiin tiedustelupaketti
Comment[fr]=Commande « Ping » reçue
Comment[fr]=Commande « Ping » reçue
Comment[hu]=Ping érkezett
Comment[it]=Hai ricevuto un ping
Comment[ko]=핑 받음
@ -340,7 +340,7 @@ Comment[x-test]=xxPing receivedxx
Action=Popup
[Event/notification]
Name=Notification
Name=Generic Notification
Name[bg]=Уведомление
Name[bs]=Obavještenje
Name[ca]=Notificació
@ -391,7 +391,7 @@ Comment[x-test]=xxNotification receivedxx
Action=Popup
[Event/transferReceived]
Name=Pairing Request
Name=File Transfer
Name[ca]=Sol·licitud d'aparellament
Name[cs]=Požadavek na párování
Name[de]=Verbindungsanfrage

View file

@ -77,7 +77,7 @@ void NotificationsDbusInterface::processPackage(const NetworkPackage& np)
//Do not show updates to existent notification nor answers to a initialization request
if (!mInternalIdToPublicId.contains(noti->internalId()) && !np.get<bool>("requestAnswer", false)) {
KNotification* notification = new KNotification("notification", KNotification::CloseOnTimeout, this);
notification->setPixmap(QIcon::fromTheme("preferences-desktop-notification").pixmap(48, 48));
notification->setIconName(QStringLiteral("preferences-desktop-notification"));
notification->setComponentName("kdeconnect");
notification->setTitle(mDevice->name());
notification->setText(noti->appName() + ": " + noti->ticker());

View file

@ -47,7 +47,7 @@ PingPlugin::~PingPlugin()
bool PingPlugin::receivePackage(const NetworkPackage& np)
{
KNotification* notification = new KNotification("pingReceived"); //KNotification::Persistent
notification->setPixmap(QIcon::fromTheme("dialog-ok").pixmap(48, 48));
notification->setIconName(QStringLiteral("dialog-ok"));
notification->setComponentName("kdeconnect");
notification->setTitle(device()->name());
notification->setText(np.get<QString>("message",i18n("Ping!"))); //This can be a source of spam

View file

@ -140,12 +140,12 @@ void SharePlugin::finished(KJob* job)
FileTransferJob* transferJob = (FileTransferJob*)job;
KNotification* notification = new KNotification("transferReceived");
notification->setPixmap(QIcon::fromTheme(error? "edit-delete" : "dialog-ok").pixmap(48, 48));
notification->setIconName(error ? QStringLiteral("dialog-error") : QStringLiteral("dialog-ok"));
notification->setComponentName("kdeconnect");
notification->setTitle(i18n("Transfer finished"));
notification->setTitle(i18n("Transfer Finished"));
notification->setText(transferJob->destination().fileName());
notification->setActions(QStringList(i18n("Open destination folder")));
connect(notification, SIGNAL(action1Activated()), this, SLOT(openDestinationFolder()));
notification->setActions(QStringList(i18n("Open")));
connect(notification, &KNotification::action1Activated, this, &SharePlugin::openDestinationFolder);
notification->sendEvent();
}

View file

@ -49,19 +49,19 @@ KNotification* TelephonyPlugin::createNotification(const NetworkPackage& np)
const QString title = device()->name();
if (event == "ringing") {
type = "callReceived";
icon = "call-start";
type = QStringLiteral("callReceived");
icon = QStringLiteral("call-start");
content = i18n("Incoming call from %1", phoneNumber);
} else if (event == "missedCall") {
type = "missedCall";
icon = "call-start";
type = QStringLiteral("missedCall");
icon = QStringLiteral("call-start");
content = i18n("Missed call from %1", phoneNumber);
flags = KNotification::Persistent;
} else if (event == "sms") {
type = "smsReceived";
icon = "mail-receive";
type = QStringLiteral("smsReceived");
icon = QStringLiteral("mail-receive");
QString messageBody = np.get<QString>("messageBody","");
content = i18n("SMS from %1: %2", phoneNumber, messageBody);
content = i18n("SMS from %1<br>%2", phoneNumber, messageBody);
flags = KNotification::Persistent;
} else if (event == "talking") {
return NULL;
@ -69,8 +69,8 @@ KNotification* TelephonyPlugin::createNotification(const NetworkPackage& np)
#ifndef NDEBUG
return NULL;
#else
type = "callReceived";
icon = "phone";
type = QStringLiteral("callReceived");
icon = QStringLiteral("phone");
content = i18n("Unknown telephony event: %1", event);
#endif
}
@ -78,14 +78,14 @@ KNotification* TelephonyPlugin::createNotification(const NetworkPackage& np)
qCDebug(KDECONNECT_PLUGIN_TELEPHONY) << "Creating notification with type:" << type;
KNotification* notification = new KNotification(type, flags, this);
notification->setPixmap(QIcon::fromTheme(icon).pixmap(48, 48));
notification->setIconName(icon);
notification->setComponentName("kdeconnect");
notification->setTitle(title);
notification->setText(content);
if (event == "ringing") {
notification->setActions( QStringList(i18n("Mute call")) );
connect(notification, SIGNAL(action1Activated()), this, SLOT(sendMutePackage()));
if (event == QLatin1String("ringing")) {
notification->setActions( QStringList(i18n("Mute Call")) );
connect(notification, &KNotification::action1Activated, this, &TelephonyPlugin::sendMutePackage);
}
return notification;