Skip to content

Commit

Permalink
Merge pull request #13 from special/sqlite-backend
Browse files Browse the repository at this point in the history
Port to libcommhistory 1.6.0
  • Loading branch information
special committed Jul 17, 2013
2 parents f1f4f89 + 3bc25b2 commit fca32af
Show file tree
Hide file tree
Showing 15 changed files with 27 additions and 506 deletions.
20 changes: 10 additions & 10 deletions src/accountoperationsobserver.cpp
Expand Up @@ -20,7 +20,6 @@
**
******************************************************************************/

#include "accountspecificcallmodel.h"
#include "accountoperationsobserver.h"
#include "notificationmanager.h"

Expand Down Expand Up @@ -146,10 +145,11 @@ void AccountOperationsObserver::slotAccountRemoved()
are really handled. */
m_accountPathsForConvs.append(accountPath);

AccountSpecificCallModel *callModel = new AccountSpecificCallModel(this);
CommHistory::CallModel *callModel = new CommHistory::CallModel(this);
callModel->setPropertyMask(CommHistory::Event::PropertySet()
<< CommHistory::Event::Type
<< CommHistory::Event::LocalUid);
callModel->setFilterAccount(accountPath);

connect(callModel,
SIGNAL(modelReady(bool)),
Expand All @@ -163,7 +163,7 @@ void AccountOperationsObserver::slotAccountRemoved()
SLOT(slotRowsRemoved(const QModelIndex&,int,int)),
Qt::UniqueConnection);

callModel->getEvents(accountPath);
callModel->getEvents();
m_accountPathsForCalls.insert(accountPath, callModel);

if (!m_pGroupModel) {
Expand Down Expand Up @@ -213,7 +213,7 @@ void AccountOperationsObserver::slotDeleteConversations()
}

if (!groupsToBeDeleted.isEmpty()) {
if (!m_pGroupModel->deleteGroups(groupsToBeDeleted, true)) {
if (!m_pGroupModel->deleteGroups(groupsToBeDeleted)) {
qWarning() << "Error while deleting groups: " << groupsToBeDeleted;
}
}
Expand All @@ -227,10 +227,10 @@ void AccountOperationsObserver::slotDeleteCalls()
{
qDebug() << Q_FUNC_INFO << "START";

AccountSpecificCallModel *callModel = qobject_cast<AccountSpecificCallModel *>(sender());
CommHistory::CallModel *callModel = qobject_cast<CommHistory::CallModel *>(sender());

if (!callModel) {
qWarning() << "Null AccountSpecificCallModel!";
qWarning() << "Null CallModel!";
return;
}

Expand All @@ -254,7 +254,7 @@ void AccountOperationsObserver::slotDeleteCalls()

if (callsToBeDeleted.isEmpty()) {
QString accountPath = m_accountPathsForCalls.key(callModel);
qDebug() << Q_FUNC_INFO << "No calls to be deleted for " << accountPath << ". We can delete the AccountSpecificCallModel.";
qDebug() << Q_FUNC_INFO << "No calls to be deleted for " << accountPath << ". We can delete the CallModel.";
m_accountPathsForCalls.take(accountPath)->deleteLater();

// delete notifcations of this account
Expand All @@ -270,15 +270,15 @@ void AccountOperationsObserver::slotRowsRemoved(const QModelIndex& index, int st

qDebug() << Q_FUNC_INFO << "start: " << start << " end: " << end;

AccountSpecificCallModel *callModel = qobject_cast<AccountSpecificCallModel *>(sender());
CommHistory::CallModel *callModel = qobject_cast<CommHistory::CallModel *>(sender());

if (!callModel) {
qWarning() << "Null AccountSpecificCallModel!";
qWarning() << "Null CallModel!";
return;
}

if (callModel->rowCount() == 0) {
qDebug() << Q_FUNC_INFO << "Last event in AccountSpecificCallModel deleted. We can delete the model.";
qDebug() << Q_FUNC_INFO << "Last event in CallModel deleted. We can delete the model.";
QString accountPath = m_accountPathsForCalls.key(callModel);
m_accountPathsForCalls.take(accountPath)->deleteLater();

Expand Down
9 changes: 2 additions & 7 deletions src/accountoperationsobserver.h
Expand Up @@ -34,11 +34,6 @@ namespace CommHistory
class Event;
}

namespace RTComLogger
{
class AccountSpecificCallModel;
}

namespace RTComLogger
{
/**
Expand Down Expand Up @@ -114,7 +109,7 @@ private Q_SLOTS:
*/
void slotDeleteCalls();
/*!
* \brief Slot getting called when a row is deleted from AccountSpecificCallModel.
* \brief Slot getting called when a row is deleted from the call model.
*
* \param index Parent item under which the rows are being removed.
* \param start Starting row for removal.
Expand All @@ -135,7 +130,7 @@ private Q_SLOTS:
CommHistory::GroupModel *m_pGroupModel;
Tp::AccountManagerPtr m_AccountManager;
QList<QString> m_accountPathsForConvs; // Conversations of these account paths should be removed.
QMap<QString,RTComLogger::AccountSpecificCallModel*> m_accountPathsForCalls; // Calls of these account paths should be removed.
QMap<QString,CommHistory::CallModel*> m_accountPathsForCalls; // Calls of these account paths should be removed.
QMap<QString, Tp::AccountPtr> m_accounts;
};

Expand Down
118 changes: 0 additions & 118 deletions src/accountspecificcallmodel.cpp

This file was deleted.

79 changes: 0 additions & 79 deletions src/accountspecificcallmodel.h

This file was deleted.

52 changes: 0 additions & 52 deletions src/accountspecificcallmodel_p.h

This file was deleted.

0 comments on commit fca32af

Please sign in to comment.