summaryrefslogtreecommitdiff
path: root/saltoqd/cardmanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'saltoqd/cardmanager.cpp')
-rw-r--r--saltoqd/cardmanager.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/saltoqd/cardmanager.cpp b/saltoqd/cardmanager.cpp
index ab3a0bc..070a53c 100644
--- a/saltoqd/cardmanager.cpp
+++ b/saltoqd/cardmanager.cpp
@@ -1,4 +1,7 @@
+#include <QtCore/QFile>
#include <QtCore/QRegularExpression>
+#include "msolimageiohandler.h"
+#include "cardmanageradaptor.h"
#include "cardmanager.h"
Card::Card(const QString &id, QObject *parent) :
@@ -64,6 +67,26 @@ void Card::setDateTime(const QDateTime &dt)
}
}
+QString Card::icon() const
+{
+ return _icon;
+}
+
+void Card::setIcon(const QString &url)
+{
+ _icon = url;
+}
+
+QString Card::picture() const
+{
+ return _picture;
+}
+
+void Card::setPicture(const QString &url)
+{
+ _picture = url;
+}
+
bool Card::isVibrate() const
{
return _vibrate;
@@ -217,6 +240,10 @@ CardManager::CardManager(FmsManager *fms, ToqManager *toq) :
QObject(toq), _toq(toq), _fms(fms)
{
_toq->setEndpointListener(ToqConnection::AppMessagingEndpoint, this);
+
+ new CardManagerAdaptor(this);
+ QDBusConnection::sessionBus().registerObject("/com/javispedro/saltoq/CardManager", this,
+ QDBusConnection::ExportAdaptors | QDBusConnection::ExportChildObjects);
}
void CardManager::handleMessage(const ToqConnection::Message &msg)
@@ -274,6 +301,13 @@ void CardManager::uninstallDeck(CardDeck *deck)
disconnect(deck, 0, this, 0);
}
+QString CardManager::sendImage(CardDeck *deck, const QString &iconName, const QImage &image)
+{
+ QString remoteFile = QString("/packages/%1/%2.img").arg(deck->package()).arg(iconName);
+ _fms->updateFile(remoteFile, convertImageToMsol(image));
+ return QString("fms:/%1.img").arg(iconName);
+}
+
QString CardManager::escapeString(const QString &s)
{
QString e(s);
@@ -300,6 +334,9 @@ QString CardManager::generateCardDescription(const QString &verb, Card *card) co
if (!card->info().isEmpty()) {
desc += QString("info = \"%1\", ").arg(escapeString(card->info()));
}
+ if (!card->icon().isEmpty()) {
+ desc += QString("icon = \"%1\", ").arg(escapeString(card->icon()));
+ }
if (!card->isVibrate()) {
desc += QString("suppressvibe = \"true\", ");
}