Commit aa435b8e authored by Paolo Capriotti's avatar Paolo Capriotti

Initial commit

parents
Makefile*
.moc
.obj
lib*.so*
*.a
*.prl
tests/model_example/model_example
tests/group_example/group_example
tests/async_example/async_example
modeltest
conversationmodeltest
groupmodeltest
callmodeltest
draftmodeltest
smsinboxmodeltest
outboxmodeltest
*~
doc/html
doc/libcommhistory.tags
tools/commhistory-tool
.project
.cproject
*.pro.user*
core
core.*
*-stamp
tests/ut_unreadeventsmodel/ut_unreadeventsmodel
tests/bin/*
.dotest/
tests/perf_bin/*
README
--------
How to quickly generate test conversations:
===========================================
Ensure that your D-BUS is set up correctly, by either sourcing
/tmp/session_bus_address.user or using dui-run.
% commhistory-tool add -newgroup gabble/jabber/user1 friend@gmail.com 10
% commhistory-tool add -newgroup gabble/jabber/user2 another@jabber.org 10
...
where "gabble/jabber/..." is the local telepathy account and 10 is the
number of messages to create. Use listgroups and "add -group <id>" to
add new messages into an existing conversation.
"commhistory-tool deleteall" removes all messages and conversations from
the tracker database. For best results (i.e. to avoid weird sync
problems), kill all applications that use commhistory before deleteall
and restart afterwards.
###############################################################################
#
# This file is part of libcommhistory.
#
# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
# Contact: Alexander Shalamov <alexander.shalamov@nokia.com>
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License version 2.1 as
# published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
# License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this library; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
###############################################################################
#-----------------------------------------------------------------------------
# Common installation configuration for all projects.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# setup the installation prefix
#-----------------------------------------------------------------------------
INSTALL_PREFIX = /usr # default installation prefix
# default prefix can be overriden by defining PREFIX when running qmake
isEmpty( PREFIX ) {
message("====")
message("==== NOTE: To override the installation path run: `qmake PREFIX=/custom/path'")
message("==== (current installation path is `$${INSTALL_PREFIX}')")
} else {
INSTALL_PREFIX = $${PREFIX}
message("====")
message("==== install prefix set to `$${INSTALL_PREFIX}'")
}
#-----------------------------------------------------------------------------
# default installation target for applications
#-----------------------------------------------------------------------------
contains( TEMPLATE, app ) {
target.path = $${INSTALL_PREFIX}/bin
INSTALLS += target
message("====")
message("==== INSTALLS += target")
}
#-----------------------------------------------------------------------------
# default installation target for libraries
#-----------------------------------------------------------------------------
contains( TEMPLATE, lib ) {
target.path = $${INSTALL_PREFIX}/lib
INSTALLS += target
message("====")
message("==== INSTALLS += target")
# reset the .pc file's `prefix' variable
#include( tools/fix-pc-prefix.pri )
}
#-----------------------------------------------------------------------------
# target for header files
#-----------------------------------------------------------------------------
!isEmpty( headers.files ) {
headers.path = $${INSTALL_PREFIX}/include/CommHistory
INSTALLS += headers
message("====")
message("==== INSTALLS += headers")
} else {
message("====")
message("==== NOTE: Remember to add your API headers into `headers.files' for installation!")
}
# End of File
###############################################################################
#
# This file is part of libcommhistory.
#
# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
# Contact: Alexander Shalamov <alexander.shalamov@nokia.com>
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License version 2.1 as
# published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
# License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this library; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
###############################################################################
#-----------------------------------------------------------------------------
# Common configuration for all projects.
#-----------------------------------------------------------------------------
CONFIG += link_pkgconfig
MOC_DIR = .moc
OBJECTS_DIR = .obj
RCC_DIR = resources
UI_DIR = ui
UI_HEADERS_DIR = ui/include
UI_SOURCES_DIR = ui/src
# we don't like warnings...
QMAKE_CXXFLAGS *= -Werror
# End of File
###############################################################################
#
# This file is part of libcommhistory.
#
# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
# Contact: Alexander Shalamov <alexander.shalamov@nokia.com>
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License version 2.1 as
# published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
# License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this library; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
###############################################################################
#------------------------------------------------------------------------------
# Common variables for all projects.
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Project name (used e.g. in include file and doc install path).
# remember to update debian/* files if you changes this
#------------------------------------------------------------------------------
PROJECT_NAME = libcommhistory
#------------------------------------------------------------------------------
# Project version
# remember to update debian/* files if you changes this
#-----------------------------------------------------------------------------
PROJECT_VERSION = 1.0.35
#------------------------------------------------------------------------------
# Library version
#------------------------------------------------------------------------------
LIBRARY_VERSION = 0.0.1
# End of File
###############################################################################
#
# This file is part of libcommhistory.
#
# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
# Contact: Alexander Shalamov <alexander.shalamov@nokia.com>
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License version 2.1 as
# published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
# License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this library; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
###############################################################################
#-----------------------------------------------------------------------------
# doc.pri
#-----------------------------------------------------------------------------
# list of documentation folders to install
DOC_FOLDERS = doc/html \
doc/qch
# files and folders listed in the installation target's .files section
# must exist _before_ qmake generates the Makefile...so, make sure our
# documentation target folders exist in the current build folder
for( folder, DOC_FOLDERS ) {
system( mkdir -p $$(PWD)/$${folder} )
}
#-----------------------------------------------------------------------------
# extra build targets for generating and cleaning documentation
#-----------------------------------------------------------------------------
for( subdir, SUBDIRS) {
DOC_INPUT += $${_PRO_FILE_PWD_}/$${subdir}
}
# target for generating documentation
doctarget.target = docs
doctarget.commands = OUTPUT_DIRECTORY=doc \
PROJECT_NAME=\"$${PROJECT_NAME}\" \
PROJECT_NUMBER=\"$${PROJECT_VERSION}\" \
STRIP_FROM_PATH=\"$${_PRO_FILE_PWD_}\" \
INPUT=\"$${DOC_INPUT}\" \
QHP_NAMESPACE=\"com.nokia.example.$${TARGET}\" \
QHP_VIRTUAL_FOLDER=\"$${TARGET}\" \
TAGFILES=\"$$system(pwd)/qt.tags\" \
TAGFILE=\"doc/$${TARGET}.tags\" \
doxygen $$system(pwd)/doxy.conf
doctarget.depends = FORCE
QMAKE_EXTRA_TARGETS += doctarget
# target for cleaning generated documentation
doccleantarget.target = cleandocs
for( folder, DOC_FOLDERS ) {
doccleantarget.commands += rm -r -f $${folder};
}
doccleantarget.commands += rm -r -f doc/libeventlogger.tags;
doccleantarget.depends = FORCE
QMAKE_EXTRA_TARGETS += doccleantarget
#-----------------------------------------------------------------------------
# installation setup
# NOTE: remember to set headers.files before this include to have the headers
# properly setup.
#-----------------------------------------------------------------------------
include( ../common-installs-config.pri )
#-----------------------------------------------------------------------------
# Installation target setup for documentation
#-----------------------------------------------------------------------------
documentation.path = $${INSTALL_PREFIX}/share/doc/$${PROJECT_NAME}
for( folder, DOC_FOLDERS ) {
documentation.files += $${OUT_PWD}/$${folder}
}
INSTALLS += documentation
message("====")
message("==== INSTALLS += documentation")
# End of File
This diff is collapsed.
This diff is collapsed.
###############################################################################
#
# This file is part of libcommhistory.
#
# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
# Contact: Alexander Shalamov <alexander.shalamov@nokia.com>
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License version 2.1 as
# published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
# License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this library; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
###############################################################################
!include( common-vars.pri ):error( "Unable to install common-vars.pri" )
TEMPLATE = subdirs
CONFIG += ordered
SUBDIRS = src \
tools \
tests
#-----------------------------------------------------------------------------
# installation setup
#-----------------------------------------------------------------------------
!include( common-installs-config.pri ) : \
error( "Unable to include common-installs-config.pri!" )
include( doc/doc.pri )
# End of File
/******************************************************************************
**
** This file is part of libcommhistory.
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Alexander Shalamov <alexander.shalamov@nokia.com>
**
** This library is free software; you can redistribute it and/or modify it
** under the terms of the GNU Lesser General Public License version 2.1 as
** published by the Free Software Foundation.
**
** This library is distributed in the hope that it will be useful, but
** WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
** License for more details.
**
** You should have received a copy of the GNU Lesser General Public License
** along with this library; if not, write to the Free Software Foundation, Inc.,
** 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
**
******************************************************************************/
#include "adaptor.h"
#include "messagepart.h"
using namespace CommHistory;
Adaptor::Adaptor(QObject *parent)
: QDBusAbstractAdaptor(parent)
{
qDBusRegisterMetaType<CommHistory::Event>();
qDBusRegisterMetaType<QList<CommHistory::Event> >();
qDBusRegisterMetaType<CommHistory::MessagePart>();
qDBusRegisterMetaType<QList<CommHistory::MessagePart> >();
qDBusRegisterMetaType<CommHistory::Group>();
qDBusRegisterMetaType<QList<CommHistory::Group> >();
setAutoRelaySignals(true);
}
/******************************************************************************
**
** This file is part of libcommhistory.
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Alexander Shalamov <alexander.shalamov@nokia.com>
**
** This library is free software; you can redistribute it and/or modify it
** under the terms of the GNU Lesser General Public License version 2.1 as
** published by the Free Software Foundation.
**
** This library is distributed in the hope that it will be useful, but
** WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
** License for more details.
**
** You should have received a copy of the GNU Lesser General Public License
** along with this library; if not, write to the Free Software Foundation, Inc.,
** 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
**
******************************************************************************/
#ifndef COMMHISTORY_ADAPTOR_H
#define COMMHISTORY_ADAPTOR_H
#include <QtDBus/QtDBus>
#include "event.h"
#include "group.h"
namespace CommHistory {
class Adaptor : public QDBusAbstractAdaptor
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "com.nokia.commhistory")
public:
Adaptor(QObject *parent = 0);
Q_SIGNALS:
void eventsAdded(const QList<CommHistory::Event> &events);
void eventsUpdated(const QList<CommHistory::Event> &events);
void eventDeleted(int id);
void groupAdded(int id,
const QString &localUid,
const QStringList &remoteUids,
const QString &chatName,
int chatType,
// id and name of the contact that matches the first remoteUid
int contactId,
const QString &contactName,
bool isPermanent);
void groupsUpdated(const QList<int> &groupIds);
void groupsUpdatedFull(const QList<CommHistory::Group> &groups);
void groupsDeleted(const QList<int> &groupIds);
};
}
#endif
/******************************************************************************
**
** This file is part of libcommhistory.
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Alexander Shalamov <alexander.shalamov@nokia.com>
**
** This library is free software; you can redistribute it and/or modify it
** under the terms of the GNU Lesser General Public License version 2.1 as
** published by the Free Software Foundation.
**
** This library is distributed in the hope that it will be useful, but
** WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
** License for more details.
**
** You should have received a copy of the GNU Lesser General Public License
** along with this library; if not, write to the Free Software Foundation, Inc.,
** 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
**
******************************************************************************/
#ifndef COMMHISTORY_CALLEVENT_H
#define COMMHISTORY_CALLEVENT_H
#include "event.h"
#include "libcommhistoryexport.h"
namespace CommHistory
{
class LIBCOMMHISTORY_EXPORT CallEvent : public Event
{
public:
enum CallType
{
UnknownCallType = 0,
DialedCallType,
MissedCallType,
ReceivedCallType
};
};
}
#endif /* CALLEVENT_H_ */
This diff is collapsed.
/******************************************************************************
**
** This file is part of libcommhistory.
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Alexander Shalamov <alexander.shalamov@nokia.com>
**
** This library is free software; you can redistribute it and/or modify it
** under the terms of the GNU Lesser General Public License version 2.1 as
** published by the Free Software Foundation.
**
** This library is distributed in the hope that it will be useful, but
** WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
** License for more details.
**
** You should have received a copy of the GNU Lesser General Public License
** along with this library; if not, write to the Free Software Foundation, Inc.,
** 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
**
******************************************************************************/
#ifndef COMMHISTORY_CALLMODEL_H
#define COMMHISTORY_CALLMODEL_H
#include "eventmodel.h"
#include "event.h"
#include "callevent.h"
#include "group.h"
#include "libcommhistoryexport.h"
namespace CommHistory {
class CallModelPrivate;
/*!
* \class CallModel
*
* \brief Model for accessing the call history. Initialize with getEvents().
*
* CallModel is a model class to access call events. It uses a
* grouped tree mode by default. Flat mode can be used to get all the call
* events based on type and time filters. Call events are grouped together
* if they have the same call type (dialed, received, missed), they were initiated
* to/from the same remote party and directly follow eachother in the timeline.
* Furthermore sorting applies on the events: by time or by type. Sorting is set
* in the constructor, and can be modified later in the getEvents() method as
* parameter. If no sorting is specified, by contact is used as default.
*
* Tracking contact changes is enabled by default; call
* enableContactChanges(false) after creating the model to disable.
*
*/
class LIBCOMMHISTORY_EXPORT CallModel: public EventModel
{
Q_OBJECT
Q_ENUMS( Sorting )
public:
enum Sorting
{
SortByContact = 0,
SortByTime,
SortByType,
SortByService
};
public:
/*!
* \brief Model constructor.
*
* \param parent Parent object.
*/
CallModel(QObject *parent = 0);
/*!
* \brief Model constructor.
* \deprecated DO NOT use this method, it is deprecated. You should use CallModel( QObject* ) and setFilter(CallModel::Sorting, CallEvent::CallType, const QDateTime &) instead.
*
* \param sortBy Sorting of call events.
* \param parent Parent object.
*/
CallModel(CallModel::Sorting sorting, QObject* parent);
/*!
* Destructor.
*/
~CallModel();
/*!
* \brief Sets optional filters.
*
* Sets optional filters. It will result in a new tracker query if called
* after getEvents().
*
* \param sortBy Sets sorting of call events in the result set.
* \param type Only specified type events appear in result set, if other
* than CallEvent::UnknownCallType.
* \param referenceTime Only call events with newer startTime() are in
* result set if value is valid.
*
* \return true if successful; false, otherwise. Additionally, it sets
* lastError() on failure.
*/
bool setFilter(CallModel::Sorting sortBy = SortByContact,
CallEvent::CallType type = CallEvent::UnknownCallType,
const QDateTime &referenceTime = QDateTime());
/*!
* \brief Resets model and fetch call events.
*
* \return true if successful; false, otherwise. Additionally, it sets
* lastError() on failure.
*/
bool getEvents();
/*!
* \brief Sets optional filters.
* \deprecated DO NOT use this method, it is deprecated. You should use getEvents() and/or setFilter(CallModel::Sorting, CallEvent::CallType, const QDateTime &) instead.
*
* Sets optional filters. It will result in a new tracker query if called
* after getEvents().
*
* \param sortBy Sets sorting of call events in the result set.
* \param type Only specified type events appear in result set, if other
* than CallEvent::UnknownCallType.
* \param referenceTime Only call events with newer startTime() are in
* result set if value is valid.
*
* \return true if successful; false, otherwise. Additionally, it sets
* lastError() on failure.
*/
bool getEvents(CallModel::Sorting sortBy,
CallEvent::CallType type = CallEvent::UnknownCallType,
const QDateTime &referenceTime = QDateTime());
/*!
* \brief Deletes all call events from tracker and clears model.
*
* \return true if successful; false, otherwise.
*/
bool deleteAll();
// reimp
// Override - call model works in sync mode.
virtual void setQueryMode( EventModel::QueryMode mode );
virtual bool addEvent( Event &event );
virtual bool modifyEvent( Event &event );
virtual bool deleteEvent( int id );
virtual bool deleteEvent( Event &event );
private:
Q_DECLARE_PRIVATE(CallModel);
};
}
#endif
/******************************************************************************
**
** This file is part of libcommhistory.
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Alexander Shalamov <alexander.shalamov@nokia.com>
**
** This library is free software; you can redistribute it and/or modify it
** under the terms of the GNU Lesser General Public License version 2.1 as
** published by the Free Software Foundation.