From 460c52653ab0dcca6f19a4f492ed2c5e4e963ab0 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- korganizer/koeventview.cpp | 169 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 169 insertions(+) create mode 100644 korganizer/koeventview.cpp (limited to 'korganizer/koeventview.cpp') diff --git a/korganizer/koeventview.cpp b/korganizer/koeventview.cpp new file mode 100644 index 000000000..1f3e62a59 --- /dev/null +++ b/korganizer/koeventview.cpp @@ -0,0 +1,169 @@ +/* + This file is part of KOrganizer. + Copyright (c) 2000, 2001 Cornelius Schumacher + Copyright (C) 2003-2004 Reinhold Kainhofer + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + As a special exception, permission is given to link this program + with any edition of Qt, and distribute the resulting executable, + without including the source code for Qt in the source distribution. +*/ + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + + +#include "kocore.h" +#include "koeventview.h" +#include "koeventpopupmenu.h" + +using namespace KOrg; +#include "koeventview.moc" + +//--------------------------------------------------------------------------- + +KOEventView::KOEventView(Calendar *cal,QWidget *parent,const char *name) + : KOrg::BaseView(cal,parent,name) +{ +} + +//--------------------------------------------------------------------------- + +KOEventView::~KOEventView() +{ +} + +//--------------------------------------------------------------------------- + +KOEventPopupMenu *KOEventView::eventPopup() +{ + KOEventPopupMenu *eventPopup = new KOEventPopupMenu; + + connect(eventPopup,SIGNAL(editIncidenceSignal(Incidence *)), + SIGNAL(editIncidenceSignal(Incidence *))); + connect(eventPopup,SIGNAL(showIncidenceSignal(Incidence *)), + SIGNAL(showIncidenceSignal(Incidence *))); + connect(eventPopup,SIGNAL(deleteIncidenceSignal(Incidence *)), + SIGNAL(deleteIncidenceSignal(Incidence *))); + connect(eventPopup,SIGNAL(cutIncidenceSignal(Incidence *)), + SIGNAL(cutIncidenceSignal(Incidence *))); + connect(eventPopup,SIGNAL(copyIncidenceSignal(Incidence *)), + SIGNAL(copyIncidenceSignal(Incidence *))); + connect(eventPopup,SIGNAL(pasteIncidenceSignal()), + SIGNAL(pasteIncidenceSignal())); + connect(eventPopup,SIGNAL(toggleAlarmSignal(Incidence *)), + SIGNAL(toggleAlarmSignal(Incidence*))); + connect(eventPopup,SIGNAL(dissociateOccurrenceSignal( Incidence *, const QDate & )), + SIGNAL(dissociateOccurrenceSignal( Incidence *, const QDate & ))); + connect(eventPopup,SIGNAL(dissociateFutureOccurrenceSignal( Incidence *, const QDate & )), + SIGNAL(dissociateFutureOccurrenceSignal( Incidence *, const QDate & ))); + + return eventPopup; +} + +QPopupMenu *KOEventView::newEventPopup() +{ + KXMLGUIClient *client = KOCore::self()->xmlguiClient( this ); + if ( !client ) { + kdError() << "KOEventView::newEventPopup(): no xmlGuiClient." << endl; + return 0; + } + if ( !client->factory() ) { + kdError() << "KOEventView::newEventPopup(): no factory" << endl; + return 0; // can happen if called too early + } + + return static_cast + ( client->factory()->container( "rmb_selection_popup", client ) ); +} +//--------------------------------------------------------------------------- + +void KOEventView::popupShow() +{ + emit showIncidenceSignal(mCurrentIncidence); +} + +//--------------------------------------------------------------------------- + +void KOEventView::popupEdit() +{ + emit editIncidenceSignal(mCurrentIncidence); +} + +//--------------------------------------------------------------------------- + +void KOEventView::popupDelete() +{ + emit deleteIncidenceSignal(mCurrentIncidence); +} + +//--------------------------------------------------------------------------- + +void KOEventView::popupCut() +{ + emit cutIncidenceSignal(mCurrentIncidence); +} + +//--------------------------------------------------------------------------- + +void KOEventView::popupCopy() +{ + emit copyIncidenceSignal(mCurrentIncidence); +} + +//--------------------------------------------------------------------------- + +void KOEventView::showNewEventPopup() +{ + QPopupMenu *popup = newEventPopup(); + if ( !popup ) { + kdError() << "KOEventView::showNewEventPopup(): popup creation failed" + << endl; + return; + } + + popup->popup( QCursor::pos() ); +} + +//--------------------------------------------------------------------------- + +void KOEventView::defaultAction( Incidence *incidence ) +{ + kdDebug(5850) << "KOEventView::defaultAction()" << endl; + + if ( !incidence ) return; + + kdDebug(5850) << " type: " << incidence->type() << endl; + + if ( incidence->isReadOnly() ) + emit showIncidenceSignal(incidence); + else + emit editIncidenceSignal(incidence); +} + +//--------------------------------------------------------------------------- + +#include "baseview.moc" + -- cgit v1.2.1