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 using namespace KOrg;
00040 #include "koeventview.moc"
00041 
00042 //---------------------------------------------------------------------------
00043 
00044 KOEventView::KOEventView(Calendar *cal,QWidget *parent,const char *name)
00045   : KOrg::BaseView(cal,parent,name)
00046 {
00047 }
00048 
00049 //---------------------------------------------------------------------------
00050 
00051 KOEventView::~KOEventView()
00052 {
00053 }
00054 
00055 //---------------------------------------------------------------------------
00056 
00057 KOEventPopupMenu *KOEventView::eventPopup()
00058 {
00059   KOEventPopupMenu *eventPopup = new KOEventPopupMenu;
00060   
00061   connect(eventPopup,SIGNAL(editIncidenceSignal(Incidence *)),
00062                      SIGNAL(editIncidenceSignal(Incidence *)));
00063   connect(eventPopup,SIGNAL(showIncidenceSignal(Incidence *)),
00064                      SIGNAL(showIncidenceSignal(Incidence *)));
00065   connect(eventPopup,SIGNAL(deleteIncidenceSignal(Incidence *)),
00066                      SIGNAL(deleteIncidenceSignal(Incidence *)));
00067 
00068   return eventPopup;
00069 }
00070 
00071 QPopupMenu *KOEventView::newEventPopup()
00072 {
00073   KXMLGUIClient *client = KOCore::self()->xmlguiClient();
00074   if ( !client ) {
00075     kdError() << "KOEventView::newEventPopup(): no xmlGuiClient." << endl;
00076     return 0;
00077   }
00078   if ( !client->factory() ) {
00079     kdError() << "KOEventView::newEventPopup(): no factory" << endl;
00080     return 0; // can happen if called too early
00081   }
00082 
00083   return static_cast<QPopupMenu*>
00084       ( client->factory()->container( "rmb_selection_popup", client ) );
00085 }
00086 //---------------------------------------------------------------------------
00087 
00088 void KOEventView::showIncidencePopup(QPopupMenu *popup,Incidence *event)
00089 {
00090   mCurrentIncidence = event;
00091   if (event) popup->popup(QCursor::pos());
00092   else kdDebug(5850) << "KOEventView::showEventPopup(): No event selected" << endl;
00093 }
00094 
00095 //---------------------------------------------------------------------------
00096 
00097 void KOEventView::popupShow()
00098 {
00099   emit showIncidenceSignal(mCurrentIncidence);
00100 }
00101 
00102 //---------------------------------------------------------------------------
00103 
00104 void KOEventView::popupEdit()
00105 {
00106   emit editIncidenceSignal(mCurrentIncidence);
00107 }
00108 
00109 //---------------------------------------------------------------------------
00110 
00111 void KOEventView::popupDelete()
00112 {
00113   emit deleteIncidenceSignal(mCurrentIncidence);
00114 }
00115 
00116 //---------------------------------------------------------------------------
00117 
00118 void KOEventView::defaultAction( Incidence *incidence )
00119 {
00120   kdDebug(5850) << "KOEventView::defaultAction()" << endl;
00121 
00122   if ( !incidence ) return;
00123 
00124   kdDebug(5850) << "  type: " << incidence->type() << endl;
00125 
00126   if ( incidence->isReadOnly() )
00127     emit showIncidenceSignal(incidence);
00128   else
00129     emit editIncidenceSignal(incidence);
00130 }
00131 
00132 //---------------------------------------------------------------------------
00133 
00134 #include "baseview.moc"
00135 
KDE Logo
This file is part of the documentation for korganizer Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 11:38:29 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003