Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[nemo-qml-plugin-calendar] Remove Qt4 support
  • Loading branch information
pvuorela committed Jan 23, 2014
1 parent 4584bec commit 63d2b4a
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 158 deletions.
62 changes: 0 additions & 62 deletions rpm/nemo-qml-plugin-calendar.spec

This file was deleted.

24 changes: 0 additions & 24 deletions rpm/nemo-qml-plugin-calendar.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions src/calendaragendamodel.cpp
Expand Up @@ -48,10 +48,6 @@ NemoCalendarAgendaModel::NemoCalendarAgendaModel(QObject *parent)
mRoleNames[OccurrenceObjectRole] = "occurrence";
mRoleNames[SectionBucketRole] = "sectionBucket";

#ifndef NEMO_USE_QT5
setRoleNames(mRoleNames);
#endif

connect(NemoCalendarEventCache::instance(), SIGNAL(modelReset()), this, SLOT(refresh()));
}

Expand All @@ -61,12 +57,10 @@ NemoCalendarAgendaModel::~NemoCalendarAgendaModel()
qDeleteAll(mEvents);
}

#ifdef NEMO_USE_QT5
QHash<int, QByteArray> NemoCalendarAgendaModel::roleNames() const
{
return mRoleNames;
}
#endif

QDate NemoCalendarAgendaModel::startDate() const
{
Expand Down
10 changes: 0 additions & 10 deletions src/calendaragendamodel.h
Expand Up @@ -36,23 +36,15 @@
#include <QDate>
#include <extendedcalendar.h>
#include <QAbstractListModel>

#ifdef NEMO_USE_QT5
#include <QQmlParserStatus>
#else
#include <QDeclarativeParserStatus>
#define QQmlParserStatus QDeclarativeParserStatus
#endif

class NemoCalendarEvent;
class NemoCalendarEventOccurrence;

class NemoCalendarAgendaModel : public QAbstractListModel, public QQmlParserStatus
{
Q_OBJECT
#ifdef NEMO_USE_QT5
Q_INTERFACES(QQmlParserStatus)
#endif
Q_PROPERTY(int count READ count NOTIFY countChanged)
Q_PROPERTY(QDate startDate READ startDate WRITE setStartDate NOTIFY startDateChanged)
Q_PROPERTY(QDate endDate READ endDate WRITE setEndDate NOTIFY endDateChanged)
Expand Down Expand Up @@ -97,10 +89,8 @@ class NemoCalendarAgendaModel : public QAbstractListModel, public QQmlParserStat
void startDateIndexChanged();
void endDateChanged();

#ifdef NEMO_USE_QT5
protected:
virtual QHash<int, QByteArray> roleNames() const;
#endif

private slots:
void refresh();
Expand Down
5 changes: 0 additions & 5 deletions src/calendarevent.cpp
Expand Up @@ -32,12 +32,7 @@

#include "calendarevent.h"


#ifdef NEMO_USE_QT5
#include <QQmlInfo>
#else
#include <QDeclarativeInfo>
#endif

#include "calendardb.h"
#include "calendareventcache.h"
Expand Down
32 changes: 5 additions & 27 deletions src/plugin.cpp
Expand Up @@ -32,25 +32,16 @@

#include <QtGlobal>

#ifdef NEMO_USE_QT5
# include <QtQml>
# include <QQmlEngine>
# include <QQmlExtensionPlugin>
# define QDeclarativeEngine QQmlEngine
# define QDeclarativeExtensionPlugin QQmlExtensionPlugin
#include <QtQml>
#include <QQmlEngine>
#include <QQmlExtensionPlugin>
#include "calendarapi.h"
#include "calendareventquery.h"
#include "calendarnotebookmodel.h"
#include "calendardb.h"
#else
# include <QtDeclarative/qdeclarative.h>
# include <QtDeclarative/QDeclarativeExtensionPlugin>
#endif

#include "calendarevent.h"
#include "calendaragendamodel.h"

#ifdef NEMO_USE_QT5
class QtDate : public QObject
{
Q_OBJECT
Expand Down Expand Up @@ -102,43 +93,30 @@ class DbReleaser: public QObject
NemoCalendarDb::dropReferences();
}
};
#endif


class Q_DECL_EXPORT NemoCalendarPlugin : public QDeclarativeExtensionPlugin
class Q_DECL_EXPORT NemoCalendarPlugin : public QQmlExtensionPlugin
{
Q_OBJECT
#ifdef NEMO_USE_QT5
Q_PLUGIN_METADATA(IID "org.nemomobile.calendar")
#endif
public:

#ifdef NEMO_USE_QT5
public:
void initializeEngine(QQmlEngine *engine, const char *uri)
{
Q_UNUSED(uri)
new DbReleaser(engine);
}
#endif

void registerTypes(const char *uri)
{
Q_ASSERT(uri == QLatin1String("org.nemomobile.calendar"));
qmlRegisterUncreatableType<NemoCalendarEvent>(uri, 1, 0, "CalendarEvent", "Create CalendarEvent instances through a model");
qmlRegisterType<NemoCalendarAgendaModel>(uri, 1, 0, "AgendaModel");
#ifdef NEMO_USE_QT5
qmlRegisterType<NemoCalendarEventQuery>(uri, 1, 0, "EventQuery");
qmlRegisterType<NemoCalendarNotebookModel>(uri, 1, 0, "NotebookModel");
qmlRegisterSingletonType<QtDate>(uri, 1, 0, "QtDate", QtDate::New);
qmlRegisterSingletonType<NemoCalendarApi>(uri, 1, 0, "Calendar", NemoCalendarApi::New);
#endif
}
};

#ifndef NEMO_USE_QT5
Q_EXPORT_PLUGIN2(nemocalendar, NemoCalendarPlugin);
#endif

#ifdef NEMO_USE_QT5
#include "plugin.moc"
#endif
34 changes: 10 additions & 24 deletions src/src.pro
Expand Up @@ -4,32 +4,12 @@ PLUGIN_IMPORT_PATH = org/nemomobile/calendar
TEMPLATE = lib
CONFIG += qt plugin hide_symbols

equals(QT_MAJOR_VERSION, 4) {
QT += declarative
target.path = $$[QT_INSTALL_IMPORTS]/$$PLUGIN_IMPORT_PATH
PKGCONFIG += libkcalcoren libmkcal libical
}

equals(QT_MAJOR_VERSION, 5) {
QT += qml
target.path = $$[QT_INSTALL_QML]/$$PLUGIN_IMPORT_PATH
PKGCONFIG += libkcalcoren-qt5 libmkcal-qt5 libical

SOURCES += \
calendarapi.cpp \
calendareventquery.cpp \
calendarnotebookmodel.cpp \

HEADERS += \
calendarapi.h \
calendareventquery.h \
calendarnotebookmodel.h \

DEFINES += NEMO_USE_QT5
}

QT += qml
QT -= gui

target.path = $$[QT_INSTALL_QML]/$$PLUGIN_IMPORT_PATH
PKGCONFIG += libkcalcoren-qt5 libmkcal-qt5 libical

INSTALLS += target

qmldir.files += $$_PRO_FILE_PWD_/qmldir
Expand All @@ -44,12 +24,18 @@ SOURCES += \
calendaragendamodel.cpp \
calendardb.cpp \
calendareventcache.cpp \
calendarapi.cpp \
calendareventquery.cpp \
calendarnotebookmodel.cpp \

HEADERS += \
calendarevent.h \
calendaragendamodel.h \
calendardb.h \
calendareventcache.h \
calendarapi.h \
calendareventquery.h \
calendarnotebookmodel.h \

MOC_DIR = $$PWD/.moc
OBJECTS_DIR = $$PWD/.obj

0 comments on commit 63d2b4a

Please sign in to comment.