diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 92b9b5008..6d9a3a2df 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -63,6 +63,7 @@ set(client_SRCS owncloudgui.cpp owncloudsetupwizard.cpp protocolwidget.cpp + activitydata.cpp activitylistmodel.cpp activitywidget.cpp activityitemdelegate.cpp diff --git a/src/gui/activitydata.cpp b/src/gui/activitydata.cpp new file mode 100644 index 000000000..2d8001c9f --- /dev/null +++ b/src/gui/activitydata.cpp @@ -0,0 +1,35 @@ +/* + * Copyright (C) by Klaas Freitag + * + * 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 + +#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 ); +} + + +} diff --git a/src/gui/activitydata.h b/src/gui/activitydata.h index 68067f553..f35611ede 100644 --- a/src/gui/activitydata.h +++ b/src/gui/activitydata.h @@ -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 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; }; /* ==================================================================== */