korganizer

timespanview.cpp

00001 /*
00002     This file is part of KOrganizer.
00003     Copyright (c) 2004 Reinhold Kainhofer <reinhold@kainhofer.com>
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #include <qfile.h>
00021 
00022 #include <kapplication.h>
00023 #include <kconfig.h>
00024 #include <kstandarddirs.h>
00025 #include <klocale.h>
00026 #include <kdebug.h>
00027 #include <kaction.h>
00028 #include <kglobal.h>
00029 
00030 #include "kotimespanview.h"
00031 
00032 #include "timespanview.h"
00033 using namespace KOrg;
00034 #include "timespanview.moc"
00035 
00036 class TimespanViewFactory : public KOrg::PartFactory {
00037   public:
00038     KOrg::Part *create( KOrg::MainWindow *parent, const char *name )
00039     {
00040       return new TimespanView( parent, name );
00041     }
00042 };
00043 
00044 K_EXPORT_COMPONENT_FACTORY( libkorg_timespanview, TimespanViewFactory )
00045 
00046 
00047 TimespanView::TimespanView(KOrg::MainWindow *parent, const char *name) :
00048   KOrg::Part(parent,name), mView(0)
00049 {
00050   setInstance( new KInstance( "korganizer" ) );
00051 
00052   setXMLFile( "plugins/timespanviewui.rc" );
00053 
00054   new KAction( i18n("&Timespan"), "timespan", 0, this, SLOT( showView() ),
00055               actionCollection(), "view_timespan" );
00056 }
00057 
00058 TimespanView::~TimespanView()
00059 {
00060 }
00061 
00062 QString TimespanView::info()
00063 {
00064   return i18n("This plugin provides a Gantt-like Timespan view.");
00065 }
00066 
00067 QString TimespanView::shortInfo()
00068 {
00069   return i18n( "Timespan View Plugin" );
00070 }
00071 
00072 void TimespanView::showView()
00073 {
00074   if (!mView) {
00075     mView = new KOTimeSpanView( mainWindow()->view()->calendar(),
00076                                 mainWindow()->view() );
00077     mainWindow()->view()->addView( mView );
00078   }
00079   mainWindow()->view()->showView( mView );
00080 }
KDE Home | KDE Accessibility Home | Description of Access Keys