From 5ab00b78b199b1a03d3f27faa8b1dcffd9a86ff7 Mon Sep 17 00:00:00 2001 From: drw Date: Mon, 07 Mar 2005 16:52:17 +0000 Subject: Use popup menu for edit, duplicate, delete and beam in week list view - patch courtesy of Thomas Schnetzer --- (limited to 'core/pim/datebook/datebookweeklst.cpp') diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp index fe2ab51..771aa00 100644 --- a/core/pim/datebook/datebookweeklst.cpp +++ b/core/pim/datebook/datebookweeklst.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -192,13 +193,35 @@ DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev, s=""; } setText(QString(s) + " " + ev.description()); - connect(this, SIGNAL(clicked()), this, SLOT(editMe())); +// connect(this, SIGNAL(clicked()), this, SLOT(editMe())); setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); } void DateBookWeekLstEvent::editMe() { emit editEvent(event.event()); } - +void DateBookWeekLstEvent::duplicateMe() +{ + emit duplicateEvent(event.event()); +} +void DateBookWeekLstEvent::deleteMe() +{ + emit removeEvent(event.event()); + emit redraw(); +} +void DateBookWeekLstEvent::beamMe() +{ + emit beamEvent( event.event() ); +} +void DateBookWeekLstEvent::mousePressEvent( QMouseEvent *e ) +{ + popmenue = new QPopupMenu; + popmenue->insertItem( tr( "Edit" ), this, SLOT(editMe())); + popmenue->insertItem( tr( "Duplicate" ), this, SLOT(duplicateMe())); + popmenue->insertItem( tr( "Delete" ), this, SLOT(deleteMe())); + if(Ir::supported()) + popmenue->insertItem( tr( "Beam" ), this, SLOT(beamMe())); + popmenue->popup( mapToGlobal( e->pos() )); +} DateBookWeekLstView::DateBookWeekLstView(QValueList &ev, const QDate &d, bool onM, @@ -248,6 +271,10 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList &ev, DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,weeklistviewconfig,this); layout->addWidget(l); connect (l, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); + connect (l, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &))); + connect (l, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &))); + connect (l, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &))); + connect (l, SIGNAL(redraw()), this, SIGNAL(redraw())); } it++; } @@ -269,6 +296,10 @@ DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList &ev1, DateBookWeekLstView *w=new DateBookWeekLstView(ev1,d,onM,this); layout->addWidget(w); connect (w, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); + connect (w, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &))); + connect (w, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &))); + connect (w, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &))); + connect (w, SIGNAL(redraw()), this, SIGNAL(redraw())); connect (w, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); connect (w, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); @@ -277,6 +308,10 @@ DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList &ev1, w=new DateBookWeekLstView(ev2,d.addDays(7),onM,this); layout->addWidget(w); connect (w, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); + connect (w, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &))); + connect (w, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &))); + connect (w, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &))); + connect (w, SIGNAL(redraw()), this, SIGNAL(redraw())); connect (w, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); connect (w, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); @@ -362,6 +397,10 @@ void DateBookWeekLst::getEvents() { } connect (view, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); + connect (view, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &))); + connect (view, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &))); + connect (view, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &))); + connect (view, SIGNAL(redraw()), this, SLOT(redraw())); connect (view, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); connect (view, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); -- cgit v0.9.0.2