From a704f02fa9ab53fbf4e0f2fcacd95eaa4ebdebff Mon Sep 17 00:00:00 2001 From: konrad Date: Tue, 29 Dec 2009 17:27:59 +0000 Subject: [PATCH] implemented max age for events git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@369 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33 --- src/mwin/eventstab.cpp | 23 ++++++++++++++++++----- 1 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/mwin/eventstab.cpp b/src/mwin/eventstab.cpp index 5ab6ee3..071b851 100644 --- a/src/mwin/eventstab.cpp +++ b/src/mwin/eventstab.cpp @@ -100,22 +100,35 @@ QMenu*MEventsTab::menu() void MEventsTab::updateEvents() { + //get events MTGetAllEvents gae=req->queryGetAllEvents(); if(gae.stage()!=gae.Success){ qDebug("Error getting all events (%s): %s",gae.errorType().toAscii().data(),gae.errorString().toAscii().data()); return; } QListevl=gae.getevents(); - eventmodel->clear(); - eventmodel->insertColumns(0,6); - eventmodel->setHorizontalHeaderLabels(QStringList()<isChecked(); else showold=QSettings().value("profiles/"+profilekey+"/showOldEvents",false).toBool(); + if(showold){ + QSettings set; + set.beginGroup("profiles/"+profilekey); + int maxage=set.value("maxeventage", 0).toInt(); + if(maxage==0)showveryold=true; + now=now.addDays(-maxage); + } + //fill model + eventmodel->clear(); + eventmodel->insertColumns(0,6); + eventmodel->setHorizontalHeaderLabels(QStringList()<insertRow(j); eventmodel->setData(eventmodel->index(j,0),evl[i].id().value(),Qt::UserRole); eventmodel->setData(eventmodel->index(j,0),stime.toString(tr("ddd MMMM d yyyy, h:mm ap","time format"))); -- 1.7.2.5