X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;ds=sidebyside;f=switchingeventlist.cpp;h=8773bcbcf48c282dd8ddd800e7f2a632635f17ca;hb=518c5899683e6f5a8bb6b46fabdb87bfe622f7ed;hp=abcc147ea14992e258cbace54b973dd2933866a7;hpb=218e501cb1531ee7f99a87da54e38b5470577979;p=timedsilencer diff --git a/switchingeventlist.cpp b/switchingeventlist.cpp index abcc147..8773bcb 100644 --- a/switchingeventlist.cpp +++ b/switchingeventlist.cpp @@ -25,6 +25,8 @@ #include "eventlistdelegate.h" #include "alarmd_backend.h" +const int ROW_HEIGHT = 60; + SwitchingEventList::SwitchingEventList(QWidget *parent) : QTableView(parent) { @@ -44,6 +46,11 @@ SwitchingEventList::SwitchingEventList(QWidget *parent) : hideColumn(EV_ID); // Load saved events loadSavedEvents(); + // Height hint + if(verticalHeader()->defaultSectionSize() < ROW_HEIGHT) + verticalHeader()->setDefaultSectionSize(ROW_HEIGHT); + if (sizeHintForRow(0)>0) + setMinimumHeight(sizeHintForRow(0) * 5); } SwitchingEventList::~SwitchingEventList() { @@ -51,7 +58,7 @@ SwitchingEventList::~SwitchingEventList() { } void SwitchingEventList::updateRow(int row, ProfileEvent *pe) { - model->setData(model->index(row, EV_STATUS), pe->activated); + model->setData(model->index(row, EV_STATUS), pe->activated, Qt::UserRole); model->setData(model->index(row, EV_FROM), pe->from_time.toString()); model->setData(model->index(row, EV_TO), pe->to_time.toString()); model->setData(model->index(row, EV_REPEAT), ProfileEvent::formatDays(pe->days)); @@ -101,8 +108,8 @@ void SwitchingEventList::loadSavedEvents() { long to_cookie = settings.value("unsilencing_cookie", 0).toLongLong(); if(to_cookie > 0) pe.alarmd_cookies << to_cookie; - if(to_cookie == 0 || from_cookie == 0) - pe.activated = 0; + if(to_cookie <= 0 || from_cookie <= 0) + pe.activated = false; events.insert(pe.getID(), pe.save()); // Remove old format values settings.clear(); @@ -145,7 +152,7 @@ void SwitchingEventList::editEvent(QByteArray id, bool new_status) { const int row = getRowFromID(id); qDebug("Editing event at row %d", row); Q_ASSERT(row >= 0); - model->setData(model->index(row, EV_STATUS), new_status); + model->setData(model->index(row, EV_STATUS), new_status, Qt::UserRole); } void SwitchingEventList::deleteEvent(QByteArray id) {