ActivityData: Add source file for implementation details

Add the ident() method and operators.
This commit is contained in:
Klaas Freitag 2016-03-23 16:47:13 +01:00
parent ea2f19b78a
commit 161d21904a
3 changed files with 43 additions and 14 deletions

View file

@ -63,6 +63,7 @@ set(client_SRCS
owncloudgui.cpp
owncloudsetupwizard.cpp
protocolwidget.cpp
activitydata.cpp
activitylistmodel.cpp
activitywidget.cpp
activityitemdelegate.cpp

35
src/gui/activitydata.cpp Normal file
View file

@ -0,0 +1,35 @@
/*
* Copyright (C) by Klaas Freitag <freitag@owncloud.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program 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 General Public License
* for more details.
*/
#include <QtCore>
#include "activitydata.h"
namespace OCC
{
bool Activity::operator<( const Activity& val ) const {
return _dateTime.toMSecsSinceEpoch() > val._dateTime.toMSecsSinceEpoch();
}
bool Activity::operator==( const Activity& val ) const {
return (_type == val._type && _id == val._id && _accName == val._accName);
}
Activity::Identifier Activity::ident() const {
return Identifier( _id, _accName );
}
}

View file

@ -26,17 +26,6 @@ namespace OCC {
class ActivityLink
{
public:
QVariantHash toVariantHash() const {
QVariantHash hash;
hash["label"] = _label;
hash["link"] = _link;
hash["verb"] = _verb;
hash["primary"] = _isPrimary;
return hash;
}
QString _label;
QString _link;
QString _verb;
@ -54,10 +43,13 @@ public:
class Activity
{
public:
typedef QPair<qlonglong, QString> Identifier;
enum Type {
ActivityType,
NotificationType
};
Type _type;
qlonglong _id;
QString _subject;
@ -73,10 +65,11 @@ public:
* @param val
* @return
*/
bool operator<( const Activity& val ) const {
return _dateTime.toMSecsSinceEpoch() > val._dateTime.toMSecsSinceEpoch();
}
bool operator<( const Activity& val ) const;
bool operator==( const Activity& val ) const;
Identifier ident() const;
};
/* ==================================================================== */