Ignore:
Timestamp:
01/21/10 23:03:07 (12 years ago)
Author:
pavelpa <pavelpa@…>
Branches:
master, qt5
Children:
d336730
Parents:
1735f55
Message:

EventModel? signaling changed

  • if some of the data (favourite,alarm) has changed on the event, signal 'eventHasChanged' is emitted
  • all treeViews (eg. DayView?, FavsView?, TracksView?, ...) have to listen on this signal

Only favouritiesView is 'reset' when current tab is changed in mainWindow

  • 'cause time groupings have to be recreated, since favs may have changed
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mvc/treeview.cpp

    r1735f55 rc718a77  
    4949                Event event = Event::getById(aIndex.data().toInt(),1);
    5050                if(event.isFavourite())
    51                 {
    52                     static_cast<Event*>(aIndex.internalPointer())->setFavourite(false); // list of events
    53                     event.setFavourite(false); // update DB
    54                 }
     51                    event.setFavourite(false);
    5552                else
    56                 {
    57                     static_cast<Event*>(aIndex.internalPointer())->setFavourite(true); // list of events
    5853                    event.setFavourite(true);
    59                 }
     54                event.update("favourite");
    6055                qDebug() << " FAVOURITE [" << qVariantValue<QString>(aIndex.data()) << "] -> " << event.isFavourite();
    61                 event.update("favourite");
    62                 // since the Favourite icon has changed, update TreeView accordingly
    63                 static_cast<EventModel*>(model())->emitDataChangedSignal(aIndex,aIndex);
     56                // since the Favourite icon has changed, update TreeViews accordingly
     57                // all TreeViews have to listen on this signal
     58                emit(eventHasChanged(event.id()));
    6459                handled = true;
    6560            }
     
    7267                if(event.hasAlarm())
    7368                {
    74                     static_cast<Event*>(aIndex.internalPointer())->setHasAlarm(false); // list of events
    7569                    event.setHasAlarm(false); // update DB
    7670#ifdef MAEMO
     
    8377                else
    8478                {
    85                     static_cast<Event*>(aIndex.internalPointer())->setHasAlarm(true); // list of events
    8679                    event.setHasAlarm(true);
    8780#ifdef MAEMO
     
    9285#endif /* MAEMO */
    9386                }
     87                event.update("alarm");
    9488                qDebug() << " ALARM [" << qVariantValue<QString>(aIndex.data()) << "] -> " << event.hasAlarm();
    95                 event.update("alarm");
    9689                // since the Alarm icon has changed, update TreeView accordingly
    97                 static_cast<EventModel*>(model())->emitDataChangedSignal(aIndex,aIndex);
     90                // all TreeViews have to listen on this signal
     91                emit(eventHasChanged(event.id()));
    9892                handled = true;
    9993            }
Note: See TracChangeset for help on using the changeset viewer.