Changeset c81f30a for src


Ignore:
Timestamp:
10/17/11 21:04:20 (11 years ago)
Author:
Philipp Spitzer <philipp@…>
Branches:
master, qt5
Children:
1ca13ef
Parents:
dc66a91
Message:

The conflict editor works again.

Location:
src/gui
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • src/gui/conflictdialogcontainer.cpp

    rdc66a91 rc81f30a  
    2222
    2323ConflictDialogContainer::ConflictDialogContainer(QWidget *aParent)
    24     : TabContainer( aParent )
    25 {
     24    : TabContainer( aParent ), mEventId(-1), mConferenceId(-1)
     25{}
     26
     27
     28void ConflictDialogContainer::setEventId(int aEventId, int conferenceId) {
     29    mEventId = aEventId;
     30    mConferenceId = conferenceId;
     31    loadEvents();
    2632}
    2733
    28 void ConflictDialogContainer::loadEvents( const QDate &aDate, const int aConferenceId )
    29 {
    30     Q_UNUSED(aDate);
    3134
    32     static_cast<EventModel*>(treeView->model())->loadConflictEvents( mEventId, aConferenceId );
    33 }
    34 
    35 void ConflictDialogContainer::updateTreeView(const QDate &aDate)
    36 {
    37     TabContainer::updateTreeView(aDate);
     35void ConflictDialogContainer::loadEvents() {
     36    static_cast<EventModel*>(treeView->model())->loadConflictEvents(mEventId, mConferenceId);
    3837    treeView->setAllExpanded(true);
    3938}
    4039
     40
     41void ConflictDialogContainer::loadEvents(const QDate &aDate, const int aConferenceId) {
     42    Q_UNUSED(aDate);
     43    Q_ASSERT(aConferenceId == mConferenceId);
     44    Q_ASSERT(mConferenceId > 0);
     45    Q_ASSERT(mEventId > 0);
     46    loadEvents();
     47}
     48
     49
  • src/gui/conflictdialogcontainer.h

    rdc66a91 rc81f30a  
    2929public:
    3030    ConflictDialogContainer(QWidget *aParent);
    31     virtual ~ConflictDialogContainer(){}
     31    virtual ~ConflictDialogContainer() {}
    3232
    33     void setEventId(int aEventId) { mEventId = aEventId; }
     33public slots:
     34    void setEventId(int aEventId, int conferenceId);
     35    void loadEvents(); // update the conflicts
    3436
    3537protected:
    36     virtual void loadEvents( const QDate &aDate, const int aConferenceId );
    37 
    38 protected slots:
    39     virtual void updateTreeView(const QDate &aDate);
     38    virtual void loadEvents(const QDate &aDate, const int aConferenceId); // the date and conference are ignored
    4039
    4140private:
    4241    int mEventId;
     42    int mConferenceId;
    4343};
    4444
  • src/gui/conflictsdialog.cpp

    rdc66a91 rc81f30a  
    2020#include "conflictsdialog.h"
    2121
    22 ConflictsDialog::ConflictsDialog(int aEventId, QWidget *aParent)
     22ConflictsDialog::ConflictsDialog(int aEventId, int aConferenceId, QWidget *aParent)
    2323    : QDialog(aParent)
    2424{
    2525    setupUi(this);
    26     connect(container, SIGNAL(eventHasChanged(int,bool)), this, SIGNAL(eventHasChanged(int,bool)));
    27     connect(container, SIGNAL(eventHasChanged(int,bool)), container, SLOT(updateTreeViewModel(int,bool)));
     26    connect(container, SIGNAL(eventChanged(int,bool)), this, SIGNAL(eventChanged(int,bool)));
     27    connect(container, SIGNAL(eventChanged(int,bool)), container, SLOT(loadEvents()));
    2828
    29     container->setEventId(aEventId);
     29    container->setEventId(aEventId, aConferenceId);
    3030}
     31
    3132
    3233ConflictsDialog::~ConflictsDialog()
    3334{
    34     disconnect(container, SIGNAL(eventHasChanged(int,bool)), this, SIGNAL(eventHasChanged(int,bool)));
     35    disconnect(container, SIGNAL(eventChanged(int,bool)), this, SIGNAL(eventChanged(int,bool)));
    3536}
    3637
  • src/gui/conflictsdialog.h

    rdc66a91 rc81f30a  
    2828    Q_OBJECT
    2929public:
    30     ConflictsDialog(int aEventId, QWidget *aParent = NULL);
     30    ConflictsDialog(int aEventId, int aConferenceId, QWidget *aParent = NULL);
    3131    ~ConflictsDialog();
    3232signals:
    33     void eventHasChanged(int aEventId, bool aReloadModel = false);
     33    void eventChanged(int aEventId, bool favouriteChanged);
    3434};
    3535
  • src/gui/eventdialog.cpp

    rdc66a91 rc81f30a  
    8787    }
    8888
    89     // have to emit 'eventHasChanged' signal on all events in conflict
     89    // have to emit 'eventChanged' signal on all events in conflict
    9090    for(int i=0; i<conflicts.count(); i++)
    91         emit(eventHasChanged(conflicts[i].id()));
     91        emit eventChanged(conflicts[i].id(), false);
    9292
    9393    // since the Favourite icon has changed, update TreeViews accordingly
    9494    // all TreeViews have to listen on this signal
    95     emit(eventHasChanged(event.id(),true));
     95    emit eventChanged(event.id(), true);
    9696}
    9797
     
    124124    // since the Alarm icon has changed, update TreeView accordingly
    125125    // all TreeViews have to listen on this signal
    126     emit(eventHasChanged(event.id()));
     126    emit eventChanged(event.id(), false);
    127127}
    128128
  • src/gui/eventdialog.h

    rdc66a91 rc81f30a  
    3535    void alarmClicked();
    3636signals:
    37     void eventHasChanged(int aEventId, bool aReloadModel = false); // emited when user changes some event details, eg. sets it Favourite
     37    void eventChanged(int aEventId, bool favouriteChanged); // emited when user changes some event details, eg. sets it Favourite
    3838private:
    3939    int mEventId;
  • src/gui/tabcontainer.cpp

    rdc66a91 rc81f30a  
    7777void TabContainer::displayConflicts(const QModelIndex &aIndex)
    7878{
    79     ConflictsDialog dialog(static_cast<Event*>(aIndex.internalPointer())->id(),this);
     79    Event* event = static_cast<Event*>(aIndex.internalPointer());
     80    ConflictsDialog dialog(event->id(), event->conferenceId(), this);
    8081#ifdef N810
    8182    dialog.setFixedWidth(static_cast<QWidget*>(parent())->width());
Note: See TracChangeset for help on using the changeset viewer.