summaryrefslogtreecommitdiff
path: root/qorgwatchlet/qorgwatchletplugin.cpp
blob: 24db91f9d6dc47bb195d67586699f500efaa6564 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "qorgwatchlet.h"
#include "qorgwatchletplugin.h"

#include <QtOrganizer/QOrganizerAbstractRequest>

using namespace sowatch;
QTM_USE_NAMESPACE

QOrgWatchletPlugin::QOrgWatchletPlugin(QObject *parent) :
    QObject(parent)
{
	// Workaround a weird QtOrganizer issue
	qRegisterMetaType<QOrganizerAbstractRequest::State>("QOrganizerAbstractRequest::State");
}

QOrgWatchletPlugin::~QOrgWatchletPlugin()
{
}

QStringList QOrgWatchletPlugin::watchlets()
{
	QStringList l;
	l << "com.javispedro.sowatch.qorg";
	return l;
}

WatchletPluginInterface::WatchletInfo QOrgWatchletPlugin::describeWatchlet(const QString &id, const QString &watchModel)
{
	WatchletInfo info;
	if (id != "com.javispedro.sowatch.qorg") return info;
	info.name = "Calendar";
	info.phoneIcon = QUrl::fromLocalFile(SOWATCH_QML_DIR "/qorgwatchlet/icon.png");
	info.icon = QUrl::fromLocalFile(SOWATCH_QML_DIR "/qorgwatchlet/" + watchModel + "-icon.png");
	info.visible = true;
	return info;
}

Watchlet* QOrgWatchletPlugin::getWatchlet(const QString &id, ConfigKey *config, Watch *watch)
{
	Q_UNUSED(config);
	if (id != "com.javispedro.sowatch.qorg") return 0;
	return new QOrgWatchlet(watch);
}

Q_EXPORT_PLUGIN2(qmsgwatchlet, QOrgWatchletPlugin)