Navigation Menu

Skip to content

Commit

Permalink
Merge pull request #8 from matthewvogt/qt5
Browse files Browse the repository at this point in the history
[commhistory-daemon] Build with either Qt4 or Qt5
  • Loading branch information
matthewvogt committed Jun 18, 2013
2 parents 803845c + 0682994 commit 2df741f
Show file tree
Hide file tree
Showing 34 changed files with 643 additions and 298 deletions.
5 changes: 4 additions & 1 deletion common-vars.pri
Expand Up @@ -27,7 +27,8 @@
# Project name (used e.g. in include file and doc install path).
# remember to update debian/* files if you changes this
# -----------------------------------------------------------------------------
PROJECT_NAME = commhistory-daemon
equals(QT_MAJOR_VERSION, 4): PROJECT_NAME = commhistory-daemon
equals(QT_MAJOR_VERSION, 5): PROJECT_NAME = commhistory-daemon-qt5

# -----------------------------------------------------------------------------
# Project version
Expand All @@ -43,3 +44,5 @@ DEFINES += COMMHISTORYD_DATADIR="\\\"$$COMMHISTORYD_DATADIR\\\""
DEFINES += COMMHISTORYD_VCARDSDIR="\\\"$$COMMHISTORYD_DATADIR/vcards\\\""
DEFINES += COMMHISTORYD_NOTIFICATIONSDIR="\\\"/$$COMMHISTORYD_DATADIR/notifications\\\""
DEFINES += COMMHISTORYD_NOTIFICATIONSSTORAGE="\\\"/$$COMMHISTORYD_DATADIR/notifications/storage.dat\\\""

include(contacts-namespace.pri)
18 changes: 18 additions & 0 deletions contacts-namespace.pri
@@ -0,0 +1,18 @@
# We need different macros depending on which Contacts we're using
equals(QT_MAJOR_VERSION, 4) {
DEFINES *= BEGIN_CONTACTS_NAMESPACE=QTM_BEGIN_NAMESPACE
DEFINES *= END_CONTACTS_NAMESPACE=QTM_END_NAMESPACE
DEFINES *= USE_CONTACTS_NAMESPACE=QTM_USE_NAMESPACE
DEFINES *= BEGIN_VERSIT_NAMESPACE=
DEFINES *= END_VERSIT_NAMESPACE=
DEFINES *= USE_VERSIT_NAMESPACE=
}
equals(QT_MAJOR_VERSION, 5) {
DEFINES *= USING_QTPIM
DEFINES *= BEGIN_CONTACTS_NAMESPACE=QT_BEGIN_NAMESPACE_CONTACTS
DEFINES *= END_CONTACTS_NAMESPACE=QT_END_NAMESPACE_CONTACTS
DEFINES *= USE_CONTACTS_NAMESPACE=QTCONTACTS_USE_NAMESPACE
DEFINES *= BEGIN_VERSIT_NAMESPACE=QT_BEGIN_NAMESPACE_VERSIT
DEFINES *= END_VERSIT_NAMESPACE=QT_END_NAMESPACE_VERSIT
DEFINES *= USE_VERSIT_NAMESPACE=QTVERSIT_USE_NAMESPACE
}
71 changes: 71 additions & 0 deletions rpm/commhistory-daemon-qt5.spec
@@ -0,0 +1,71 @@
Name: commhistory-daemon-qt5
Summary: Communications event history database daemon
Version: 0.4.11
Release: 2
Group: Communications/Telephony and IM
License: LGPL
URL: https://github.com/nemomobile/commhistory-daemon
Source0: %{name}-%{version}.tar.bz2
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5Contacts)
BuildRequires: pkgconfig(commhistory-qt5)
BuildRequires: pkgconfig(contextkit-statefs)
BuildRequires: pkgconfig(TelepathyQt5)
BuildRequires: pkgconfig(mlite5)
BuildRequires: pkgconfig(mlocale5)
BuildRequires: pkgconfig(qmsystem2-qt5)
BuildRequires: python

Obsoletes: smshistory <= 0.1.8
Provides: smshistory > 0.1.8
Obsoletes: voicecallhistory <= 0.1.5
Provides: voicecallhistory > 0.1.5
Obsoletes: commhistory-daemon
Provides: commhistory-daemon

%package tests
Summary: Unit tests for commhistory-daemon
Group: Development/Libraries

%description tests
Unit tests for commhistory-daemon

%package ts-devel
Summary: Translation source for commhistory-daemon
Group: System/Applications

%description ts-devel
Translation source for commhistory-daemon

%description
Daemon for logging communications (IM, SMS and call) in history database.

%prep
%setup -q -n %{name}-%{version}

%build
unset LD_AS_NEEDED
%qmake5
make %{?jobs:-j%jobs}
%install
rm -rf %{buildroot}
%qmake5_install

%files
%defattr(-,root,root,-)
%{_bindir}/commhistoryd-qt5
%{_datadir}/dbus-1/services/com.nokia.CommHistory.service
%{_datadir}/dbus-1/services/org.freedesktop.Telepathy.Client.CommHistory.service
%{_datadir}/dbus-1/services/org.nemomobile.AccountPresence.service
%{_datadir}/translations/commhistoryd-qt5.qm
%{_datadir}/lipstick/notificationcategories/*
%{_datadir}/telepathy/clients/CommHistory.client

%files tests
%defattr(-,root,root,-)
/opt/tests/commhistory-daemon-qt5/*

%files ts-devel
%defattr(-,root,root,-)
%{_datadir}/translations/source/commhistoryd-qt5.ts

2 changes: 1 addition & 1 deletion rpm/commhistory-daemon.spec
@@ -1,6 +1,6 @@
Name: commhistory-daemon
Summary: Communications event history database daemon
Version: 0.4.7
Version: 0.4.11
Release: 2
Group: Communications/Telephony and IM
License: LGPL
Expand Down
6 changes: 4 additions & 2 deletions src/accountspecificcallmodel.cpp
Expand Up @@ -79,8 +79,9 @@ bool AccountSpecificCallModel::getEvents(QString accountPath)

d->filterAccountPath = accountPath;

reset();
beginResetModel();
d->clearEvents();
endResetModel();

EventsQuery query(d->propertyMask);
query.addPattern(QLatin1String("%1 a nmo:Call .")).variable(Event::Id);
Expand All @@ -101,8 +102,9 @@ bool AccountSpecificCallModel::getEvents(QDateTime date)

d->filterReferenceDate = date;

reset();
beginResetModel();
d->clearEvents();
endResetModel();

qDebug() << __PRETTY_FUNCTION__ << "Date to compare in database: " << date.toUTC().toString(Qt::ISODate);

Expand Down
2 changes: 0 additions & 2 deletions src/constants.h
Expand Up @@ -79,8 +79,6 @@ namespace RTComLogger {

#define TELEPATHY_CHANNEL_INTERFACE_PERSISTENT_ID QLatin1String("com.nokia.Telepathy.Channel.Interface.Persistent.PersistentID")

// DUI didnt define namespace for events, remove this
#define CONTACT_STORAGE_TYPE QLatin1String("tracker")
// notification threshold is 3 seconds
#define NOTIFICATION_THRESHOLD 3000
// threshold to trigger contact request after added/modified contacts signals
Expand Down
2 changes: 1 addition & 1 deletion src/contactauthorizer.cpp
Expand Up @@ -420,7 +420,7 @@ void ContactAuthorizer::fireAuthorisationRequest()
id = request.contact->id();
filename = request.filename;
message = request.message;
transactionId = request.transactionId;
transactionId = request.transactionId.toString();
} else {
m_authRequests.removeOne(request);
continue;
Expand Down
13 changes: 13 additions & 0 deletions src/main.cpp
Expand Up @@ -45,7 +45,11 @@ using namespace RTComLogger;

namespace {

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
void messageHandler(QtMsgType type, const QMessageLogContext &, const QString &message)
#else
void messageHandler(QtMsgType type, const char *msg)
#endif
{
#ifndef QT_DEBUG
if (!(type == QtCriticalMsg || type == QtFatalMsg))
Expand Down Expand Up @@ -73,6 +77,11 @@ void messageHandler(QtMsgType type, const char *msg)
priority = LOG_ALERT;
}

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
const QByteArray &msgData(message.toLocal8Bit());
const char *msg = msgData.constData();
#endif

QByteArray timestamp = QDateTime::currentDateTime().toString("ss:zzz").toLocal8Bit();
syslog(LOG_MAKEPRI(LOG_USER, priority),
"%s [%s] %s",
Expand Down Expand Up @@ -123,7 +132,11 @@ int main(int argc, char **argv)

openlog("COMMHISTORYD", logOption, 0);

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
qInstallMessageHandler(messageHandler);
#else
qInstallMsgHandler(messageHandler);
#endif

qDebug() << "MApplication created";

Expand Down

0 comments on commit 2df741f

Please sign in to comment.