This commit is contained in:
Albert Vaca 2013-09-04 21:19:02 +02:00
parent d4ce9bac9c
commit 0ff5600ce2
8 changed files with 47 additions and 18 deletions

9
kcm/Messages.sh Executable file
View file

@ -0,0 +1,9 @@
#!/usr/bin/env bash
$EXTRACTRC `find -name '*.ui' -o -name '*.rc'` >> rc.cpp
$XGETTEXT rc.cpp -o $podir/kdeconnect-kcm.pot
rm -f rc.cpp
#.cpp (-j passed to merge into existing file)
$XGETTEXT `find . -name '*.cpp'` -j -o $podir/kdeconnect-kcm.pot

View file

@ -134,14 +134,14 @@ void KdeConnectKcm::deviceSelected(const QModelIndex& current)
kcmUi->verticalLayout_2->addWidget(kcmUi->pluginSelector);
kcmUi->name_label->setText(currentDevice->name());
kcmUi->status_label->setText(currentDevice->isPaired()? "paired" : "unpaired");
kcmUi->status_label->setText(currentDevice->isPaired()? i18n("(paired)") : i18n("(unpaired)"));
KService::List offers = KServiceTypeTrader::self()->query("KdeConnect/Plugin");
QList<KPluginInfo> scriptinfos = KPluginInfo::fromServices(offers);
QString path = KStandardDirs().resourceDirs("config").first()+"kdeconnect/";
KSharedConfigPtr deviceConfig = KSharedConfig::openConfig(path + currentDevice->id());
kcmUi->pluginSelector->addPlugins(scriptinfos, KPluginSelector::ReadConfigFile, "Plugins", QString(), deviceConfig);
kcmUi->pluginSelector->addPlugins(scriptinfos, KPluginSelector::ReadConfigFile, i18n("Plugins"), QString(), deviceConfig);
connect(kcmUi->pluginSelector, SIGNAL(changed(bool)),
this, SLOT(pluginsConfigChanged()));
@ -176,14 +176,14 @@ void KdeConnectKcm::unpair()
currentDevice->unpair();
kcmUi->status_label->setText("(unpaired)");
kcmUi->status_label->setText(i18n("(unpaired)"));
devicesModel->deviceStatusChanged(currentDevice->id());
}
void KdeConnectKcm::pairingFailed(const QString& error)
{
kcmUi->messages->setText("Error trying to pair: "+error);
kcmUi->messages->setText(i18n("Error trying to pair: %1",error));
kcmUi->messages->animatedShow();
kcmUi->progressBar->setVisible(false);
kcmUi->pair_button->setVisible(true);
@ -196,7 +196,7 @@ void KdeConnectKcm::pairingSuccesful()
kcmUi->pair_button->setVisible(false);
kcmUi->ping_button->setVisible(true);
kcmUi->status_label->setText("(paired)");
kcmUi->status_label->setText(i18n("(paired)"));
devicesModel->deviceStatusChanged(currentDevice->id());
}

5
kded/Messages.sh Executable file
View file

@ -0,0 +1,5 @@
#!/usr/bin/env bash
$XGETTEXT `find . -name '*.cpp'` -o $podir/kdeconnect-kded.pot
#.desktop and .notifyrc files doesn't need to be included here

View file

@ -185,7 +185,7 @@ void Device::pairingTimeout()
np.set("pair", false);
sendPackage(np);
m_pairStatus = Device::NotPaired;
Q_EMIT pairingFailed("Timed out");
Q_EMIT pairingFailed(i18n("Timed out"));
}
static bool lessThan(DeviceLink* p1, DeviceLink* p2)

View file

@ -23,6 +23,7 @@
#include <QDebug>
#include <KNotification>
#include <KIcon>
#include <KLocalizedString>
#include "batterydbusinterface.h"
@ -72,8 +73,8 @@ bool BatteryPlugin::receivePackage(const NetworkPackage& np)
KNotification* notification = new KNotification("batteryLow");
notification->setPixmap(KIcon("battery-040").pixmap(48, 48));
notification->setComponentData(KComponentData("kdeconnect", "kdeconnect"));
notification->setTitle(device()->name() + ": low battery");
notification->setText("Battery at 14%");
notification->setTitle(i18nc("device name: low battery", "%1: low battery",device()->name()));
notification->setText(i18n("Battery at 14%"));
notification->sendEvent();
}

View file

@ -20,9 +20,11 @@
#include "pingplugin.h"
#include <QDebug>
#include <KNotification>
#include <KIcon>
#include <QDebug>
#include <KLocalizedString>
K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< PingPlugin >(); )
K_EXPORT_PLUGIN( KdeConnectPluginFactory("kdeconnect_ping", "kdeconnect_ping") )
@ -47,7 +49,7 @@ bool PingPlugin::receivePackage(const NetworkPackage& np)
notification->setPixmap(KIcon("dialog-ok").pixmap(48, 48));
notification->setComponentData(KComponentData("kdeconnect", "kdeconnect"));
notification->setTitle(device()->name());
notification->setText(np.get<QString>("message","Ping!"));
notification->setText(np.get<QString>("message",i18n("Ping!")));
notification->sendEvent();
return true;

View file

@ -21,7 +21,9 @@
#include "telephonyplugin.h"
#include <QDebug>
#include <kicon.h>
#include <KLocalizedString>
#include <KIcon>
K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< TelephonyPlugin >(); )
K_EXPORT_PLUGIN( KdeConnectPluginFactory("kdeconnect_telephony", "kdeconnect_telephony") )
@ -36,6 +38,7 @@ KNotification* TelephonyPlugin::createNotification(const NetworkPackage& np)
{
QString event = np.get<QString>("event");
QString phoneNumber = np.get<QString>("phoneNumber", i18n("unknown number"));
QString title, content, type, icon;
@ -44,25 +47,23 @@ KNotification* TelephonyPlugin::createNotification(const NetworkPackage& np)
if (event == "ringing") {
type = "callReceived";
icon = "call-start";
content = "Incoming call from " + np.get<QString>("phoneNumber","unknown number");
content = i18n("Incoming call from %1", phoneNumber);
} else if (event == "missedCall") {
type = "missedCall";
icon = "call-start";
content = "Missed call from " + np.get<QString>("phoneNumber","unknown number");
content = i18n("Missed call from %1", phoneNumber);
} else if (event == "sms") {
type = "smsReceived";
icon = "mail-receive";
content = "SMS from "
+ np.get<QString>("phoneNumber","unknown number")
+ ":\n"
+ np.get<QString>("messageBody","");
QString content = np.get<QString>("messageBody","");
content = i18n("SMS from %1: %2", phoneNumber, content);
} else if (event == "talking") {
return NULL;
} else {
//TODO: return NULL if !debug
type = "unknownEvent";
icon = "pda";
content = "Unknown telephony event: " + event;
content = i18n("Unknown telephony event: %2", event);
}
qDebug() << "Creating notification with type:" << type;

11
plasmoid/Messages.sh Executable file
View file

@ -0,0 +1,11 @@
#!/usr/bin/env bash
#.qml
$XGETTEXT `find package -name '*.qml'` -L Java -o $podir/kdeconnect-plasmoid.pot
#.ui (-j passed to merge into existing file)
$EXTRACTRC `find -name '*.ui' -o -name '*.rc'` >> rc.cpp
$XGETTEXT rc.cpp -o -j $podir/kdeconnect-plasmoid.pot
rm -f rc.cpp