Skip to content

Commit

Permalink
Rename NemoCalendar classes to just Calendar
Browse files Browse the repository at this point in the history
Nemo part has been quite unnecessary part and hasn't matched the
file names.
  • Loading branch information
pvuorela committed May 24, 2019
1 parent a4c0df4 commit e9cef9f
Show file tree
Hide file tree
Showing 42 changed files with 1,065 additions and 1,064 deletions.
18 changes: 9 additions & 9 deletions lightweight/calendardataservice/calendardataservice.cpp
Expand Up @@ -88,11 +88,11 @@ void CalendarDataService::updated()
{
EventDataList reply;
for (int i = 0; i < mAgendaModel->count(); i++) {
QVariant variant = mAgendaModel->get(i, NemoCalendarAgendaModel::EventObjectRole);
QVariant occurrenceVariant = mAgendaModel->get(i, NemoCalendarAgendaModel::OccurrenceObjectRole);
if (variant.canConvert<NemoCalendarEvent *>() && occurrenceVariant.canConvert<NemoCalendarEventOccurrence *>()) {
NemoCalendarEvent* event = variant.value<NemoCalendarEvent *>();
NemoCalendarEventOccurrence* occurrence = occurrenceVariant.value<NemoCalendarEventOccurrence *>();
QVariant variant = mAgendaModel->get(i, CalendarAgendaModel::EventObjectRole);
QVariant occurrenceVariant = mAgendaModel->get(i, CalendarAgendaModel::OccurrenceObjectRole);
if (variant.canConvert<CalendarEvent *>() && occurrenceVariant.canConvert<CalendarEventOccurrence *>()) {
CalendarEvent* event = variant.value<CalendarEvent *>();
CalendarEventOccurrence* occurrence = occurrenceVariant.value<CalendarEventOccurrence *>();
EventData eventStruct;
eventStruct.displayLabel = event->displayLabel();
eventStruct.description = event->description();
Expand Down Expand Up @@ -128,19 +128,19 @@ void CalendarDataService::shutdown()
connection.unregisterObject("/org/nemomobile/calendardataservice");

if (mAgendaModel) {
// Call NemoCalendarManager dtor to ensure that the QThread managed by it
// Call CalendarManager dtor to ensure that the QThread managed by it
// will be destroyed via deleteLater when control returns to the event loop.
// Delete the AgendaModel first, its destructor refers to NemoCalendarManager
// Delete the AgendaModel first, its destructor refers to CalendarManager
delete mAgendaModel;
delete NemoCalendarManager::instance();
delete CalendarManager::instance();
}
QTimer::singleShot(0, QCoreApplication::instance(), SLOT(quit()));
}

void CalendarDataService::initialize()
{
if (!mAgendaModel) {
mAgendaModel = new NemoCalendarAgendaModel(this);
mAgendaModel = new CalendarAgendaModel(this);
connect(mAgendaModel, SIGNAL(updated()), this, SLOT(updated()));
}
}
Expand Down
4 changes: 2 additions & 2 deletions lightweight/calendardataservice/calendardataservice.h
Expand Up @@ -39,7 +39,7 @@

#include "../common/eventdata.h"

class NemoCalendarAgendaModel;
class CalendarAgendaModel;

class CalendarDataService : public QObject
{
Expand Down Expand Up @@ -70,7 +70,7 @@ private slots:

void initialize();

NemoCalendarAgendaModel *mAgendaModel;
CalendarAgendaModel *mAgendaModel;
QTimer mKillTimer;
int mTransactionIdCounter;
QList<DataRequest> mDataRequestQueue;
Expand Down
50 changes: 25 additions & 25 deletions lightweight/calendareventsmodel/calendareventsmodel.cpp
Expand Up @@ -45,7 +45,7 @@

#include "calendardataserviceproxy.h"

NemoCalendarEventsModel::NemoCalendarEventsModel(QObject *parent) :
CalendarEventsModel::CalendarEventsModel(QObject *parent) :
QAbstractListModel(parent),
mProxy(0),
mWatcher(new QFileSystemWatcher(this)),
Expand Down Expand Up @@ -87,32 +87,32 @@ NemoCalendarEventsModel::NemoCalendarEventsModel(QObject *parent) :
connect(mWatcher, SIGNAL(fileChanged(QString)), &mUpdateDelayTimer, SLOT(start())); // for mkcal tracking
}

int NemoCalendarEventsModel::count() const
int CalendarEventsModel::count() const
{
return qMin(mEventDataList.count(), mEventLimit);
}

int NemoCalendarEventsModel::totalCount() const
int CalendarEventsModel::totalCount() const
{
return mTotalCount;
}

QDateTime NemoCalendarEventsModel::creationDate() const
QDateTime CalendarEventsModel::creationDate() const
{
return mCreationDate;
}

QDateTime NemoCalendarEventsModel::expiryDate() const
QDateTime CalendarEventsModel::expiryDate() const
{
return mExpiryDate;
}

int NemoCalendarEventsModel::eventLimit() const
int CalendarEventsModel::eventLimit() const
{
return mEventLimit;
}

void NemoCalendarEventsModel::setEventLimit(int limit)
void CalendarEventsModel::setEventLimit(int limit)
{
if (mEventLimit == limit || limit <= 0)
return;
Expand All @@ -122,12 +122,12 @@ void NemoCalendarEventsModel::setEventLimit(int limit)
restartUpdateTimer(); // TODO: Could change list content without fetching data
}

int NemoCalendarEventsModel::eventDisplayTime() const
int CalendarEventsModel::eventDisplayTime() const
{
return mEventDisplayTime;
}

void NemoCalendarEventsModel::setEventDisplayTime(int seconds)
void CalendarEventsModel::setEventDisplayTime(int seconds)
{
if (mEventDisplayTime == seconds)
return;
Expand All @@ -138,12 +138,12 @@ void NemoCalendarEventsModel::setEventDisplayTime(int seconds)
restartUpdateTimer();
}

QDateTime NemoCalendarEventsModel::startDate() const
QDateTime CalendarEventsModel::startDate() const
{
return mStartDate;
}

void NemoCalendarEventsModel::setStartDate(const QDateTime &startDate)
void CalendarEventsModel::setStartDate(const QDateTime &startDate)
{
if (mStartDate == startDate)
return;
Expand All @@ -154,12 +154,12 @@ void NemoCalendarEventsModel::setStartDate(const QDateTime &startDate)
restartUpdateTimer();
}

QDateTime NemoCalendarEventsModel::endDate() const
QDateTime CalendarEventsModel::endDate() const
{
return mEndDate;
}

void NemoCalendarEventsModel::setEndDate(const QDateTime &endDate)
void CalendarEventsModel::setEndDate(const QDateTime &endDate)
{
if (mEndDate == endDate)
return;
Expand All @@ -170,12 +170,12 @@ void NemoCalendarEventsModel::setEndDate(const QDateTime &endDate)
restartUpdateTimer();
}

int NemoCalendarEventsModel::filterMode() const
int CalendarEventsModel::filterMode() const
{
return mFilterMode;
}

void NemoCalendarEventsModel::setFilterMode(int mode)
void CalendarEventsModel::setFilterMode(int mode)
{
if (mFilterMode == mode)
return;
Expand All @@ -186,12 +186,12 @@ void NemoCalendarEventsModel::setFilterMode(int mode)
}


int NemoCalendarEventsModel::contentType() const
int CalendarEventsModel::contentType() const
{
return mContentType;
}

void NemoCalendarEventsModel::setContentType(int contentType)
void CalendarEventsModel::setContentType(int contentType)
{
if (mContentType == contentType)
return;
Expand All @@ -201,15 +201,15 @@ void NemoCalendarEventsModel::setContentType(int contentType)
restartUpdateTimer();
}

int NemoCalendarEventsModel::rowCount(const QModelIndex &index) const
int CalendarEventsModel::rowCount(const QModelIndex &index) const
{
if (index != QModelIndex())
return 0;

return mEventDataList.count();
}

QVariant NemoCalendarEventsModel::data(const QModelIndex &index, int role) const
QVariant CalendarEventsModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid() || index.row() >= mEventDataList.count())
return QVariant();
Expand Down Expand Up @@ -250,7 +250,7 @@ QVariant NemoCalendarEventsModel::data(const QModelIndex &index, int role) const
}
}

void NemoCalendarEventsModel::update()
void CalendarEventsModel::update()
{
mTransactionId.clear();
QDateTime endDate = (mEndDate.isValid()) ? mEndDate : mStartDate;
Expand All @@ -261,7 +261,7 @@ void NemoCalendarEventsModel::update()
this, SLOT(updateFinished(QDBusPendingCallWatcher*)));
}

void NemoCalendarEventsModel::updateFinished(QDBusPendingCallWatcher *call)
void CalendarEventsModel::updateFinished(QDBusPendingCallWatcher *call)
{
QDBusPendingReply<QString> reply = *call;
if (reply.isError())
Expand All @@ -272,7 +272,7 @@ void NemoCalendarEventsModel::updateFinished(QDBusPendingCallWatcher *call)
call->deleteLater();
}

void NemoCalendarEventsModel::getEventsResult(const QString &transactionId, const EventDataList &eventDataList)
void CalendarEventsModel::getEventsResult(const QString &transactionId, const EventDataList &eventDataList)
{
// mkcal database didn't necessarily exist on startup but after calendar service has checked
// events it should be there.
Expand Down Expand Up @@ -353,7 +353,7 @@ void NemoCalendarEventsModel::getEventsResult(const QString &transactionId, cons
}
}

QHash<int, QByteArray> NemoCalendarEventsModel::roleNames() const
QHash<int, QByteArray> CalendarEventsModel::roleNames() const
{
QHash<int, QByteArray> roleNames;
roleNames[DisplayLabelRole] = "displayLabel";
Expand All @@ -370,15 +370,15 @@ QHash<int, QByteArray> NemoCalendarEventsModel::roleNames() const
return roleNames;
}

void NemoCalendarEventsModel::restartUpdateTimer()
void CalendarEventsModel::restartUpdateTimer()
{
if (mStartDate.isValid())
mUpdateDelayTimer.start();
else
mUpdateDelayTimer.stop();
}

void NemoCalendarEventsModel::trackMkcal()
void CalendarEventsModel::trackMkcal()
{
if (m_mkcalTracked) {
return;
Expand Down
4 changes: 2 additions & 2 deletions lightweight/calendareventsmodel/calendareventsmodel.h
Expand Up @@ -43,7 +43,7 @@ class QDBusPendingCallWatcher;
class CalendarDataServiceProxy;
class QFileSystemWatcher;

class NemoCalendarEventsModel : public QAbstractListModel
class CalendarEventsModel : public QAbstractListModel
{
Q_OBJECT
Q_ENUMS(FilterMode)
Expand Down Expand Up @@ -85,7 +85,7 @@ class NemoCalendarEventsModel : public QAbstractListModel
ColorRole
};

explicit NemoCalendarEventsModel(QObject *parent = 0);
explicit CalendarEventsModel(QObject *parent = 0);

QDateTime startDate() const;
void setStartDate(const QDateTime &startDate);
Expand Down
2 changes: 1 addition & 1 deletion lightweight/calendareventsmodel/plugin.cpp
Expand Up @@ -50,7 +50,7 @@ class Q_DECL_EXPORT NemoCalendarPlugin : public QQmlExtensionPlugin
void registerTypes(const char *uri)
{
Q_ASSERT(uri == QLatin1String("org.nemomobile.calendar.lightweight"));
qmlRegisterType<NemoCalendarEventsModel>("org.nemomobile.calendar.lightweight", 1, 0, "CalendarEventsModel");
qmlRegisterType<CalendarEventsModel>("org.nemomobile.calendar.lightweight", 1, 0, "CalendarEventsModel");
}
};

Expand Down

0 comments on commit e9cef9f

Please sign in to comment.