korganizer Library API Documentation

koeventview.cpp

00001 /*
00002     This file is part of KOrganizer.
00003     Copyright (c) 2000, 2001 Cornelius Schumacher <schumacher@kde.org>
00004 
00005     This program is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation; either version 2 of the License, or
00008     (at your option) any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this program; if not, write to the Free Software
00017     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018 
00019     As a special exception, permission is given to link this program
00020     with any edition of Qt, and distribute the resulting executable,
00021     without including the source code for Qt in the source distribution.
00022 */
00023 
00024 #include <qpopupmenu.h>
00025 #include <qcursor.h>
00026 
00027 #include <klocale.h>
00028 #include <kdebug.h>
00029 #include <kiconloader.h>
00030 #include <kmessagebox.h>
00031 #include <kxmlguiclient.h>
00032 #include <kxmlguifactory.h>
00033 
00034 #include <libkcal/calendar.h>
00035 
00036 
00037 #include "kocore.h"
00038 #include "koeventview.h"
00039 #include "koeventpopupmenu.h"
00040 
00041 using namespace KOrg;
00042 #include "koeventview.moc"
00043 
00044 //---------------------------------------------------------------------------
00045 
00046 KOEventView::KOEventView(Calendar *cal,QWidget *parent,const char *name)
00047   : KOrg::BaseView(cal,parent,name)
00048 {
00049 }
00050 
00051 //---------------------------------------------------------------------------
00052 
00053 KOEventView::~KOEventView()
00054 {
00055 }
00056 
00057 //---------------------------------------------------------------------------
00058 
00059 KOEventPopupMenu *KOEventView::eventPopup()
00060 {
00061   KOEventPopupMenu *eventPopup = new KOEventPopupMenu;
00062   
00063   connect(eventPopup,SIGNAL(editIncidenceSignal(Incidence *)),
00064                      SIGNAL(editIncidenceSignal(Incidence *)));
00065   connect(eventPopup,SIGNAL(showIncidenceSignal(Incidence *)),
00066                      SIGNAL(showIncidenceSignal(Incidence *)));
00067   connect(eventPopup,SIGNAL(deleteIncidenceSignal(Incidence *)),
00068                      SIGNAL(deleteIncidenceSignal(Incidence *)));
00069   connect(eventPopup,SIGNAL(toggleAlarmSignal(Incidence *)),
00070                      SIGNAL(toggleAlarmSignal(Incidence*)));
00071 
00072   return eventPopup;
00073 }
00074 
00075 QPopupMenu *KOEventView::newEventPopup()
00076 {
00077   KXMLGUIClient *client = KOCore::self()->xmlguiClient();
00078   if ( !client ) {
00079     kdError() << "KOEventView::newEventPopup(): no xmlGuiClient." << endl;
00080     return 0;
00081   }
00082   if ( !client->factory() ) {
00083     kdError() << "KOEventView::newEventPopup(): no factory" << endl;
00084     return 0; // can happen if called too early
00085   }
00086 
00087   return static_cast<QPopupMenu*>
00088       ( client->factory()->container( "rmb_selection_popup", client ) );
00089 }
00090 //---------------------------------------------------------------------------
00091 
00092 void KOEventView::popupShow()
00093 {
00094   emit showIncidenceSignal(mCurrentIncidence);
00095 }
00096 
00097 //---------------------------------------------------------------------------
00098 
00099 void KOEventView::popupEdit()
00100 {
00101   emit editIncidenceSignal(mCurrentIncidence);
00102 }
00103 
00104 //---------------------------------------------------------------------------
00105 
00106 void KOEventView::popupDelete()
00107 {
00108   emit deleteIncidenceSignal(mCurrentIncidence);
00109 }
00110 
00111 //---------------------------------------------------------------------------
00112 
00113 void KOEventView::showNewEventPopup()
00114 {
00115   QPopupMenu *popup = newEventPopup();
00116   if ( !popup ) {
00117     kdError() << "KOEventView::showNewEventPopup(): popup creation failed"
00118               << endl;
00119     return;
00120   }
00121 
00122   popup->popup( QCursor::pos() );
00123 }
00124 
00125 //---------------------------------------------------------------------------
00126 
00127 void KOEventView::defaultAction( Incidence *incidence )
00128 {
00129   kdDebug(5850) << "KOEventView::defaultAction()" << endl;
00130 
00131   if ( !incidence ) return;
00132 
00133   kdDebug(5850) << "  type: " << incidence->type() << endl;
00134 
00135   if ( incidence->isReadOnly() )
00136     emit showIncidenceSignal(incidence);
00137   else
00138     emit editIncidenceSignal(incidence);
00139 }
00140 
00141 //---------------------------------------------------------------------------
00142 
00143 #include "baseview.moc"
00144 
KDE Logo
This file is part of the documentation for korganizer Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Dec 21 14:25:44 2007 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003