diff --git a/src/widget/friendlistwidget.cpp b/src/widget/friendlistwidget.cpp index a7693e2df..eecf6f1ea 100644 --- a/src/widget/friendlistwidget.cpp +++ b/src/widget/friendlistwidget.cpp @@ -53,7 +53,7 @@ bool last7DaysWasLastMonth() return QDate::currentDate().addDays(-7).month() == QDate::currentDate().month(); } -Time getTime(const QDate date) +Time getTime(const QDate& date) { if (date == QDate()) return Never; @@ -231,12 +231,15 @@ void FriendListWidget::setMode(Mode mode) activityLayout->addWidget(categoryLastWeek); QDate currentDate = QDate::currentDate(); - if (last7DaysWasLastMonth()) + //if (last7DaysWasLastMonth()) { CategoryWidget* categoryThisMonth = new CategoryWidget(this); categoryThisMonth->setName(tr("This month", "Category for sorting friends by activity")); activityLayout->addWidget(categoryThisMonth); - currentDate = currentDate.addMonths(-1); + categoryThisMonth->setVisible(last7DaysWasLastMonth()); + + if (categoryThisMonth->isVisible()) + currentDate = currentDate.addMonths(-1); } CategoryWidget* categoryLast1Month = new CategoryWidget(this); @@ -276,8 +279,6 @@ void FriendListWidget::setMode(Mode mode) { QDate activityDate = getDateFriend(contact); Time time = getTime(activityDate); - if (!last7DaysWasLastMonth()) - time = static_cast