projectview.cpp
00001 /* 00002 This file is part of KOrganizer. 00003 Copyright (c) 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #include <tqfile.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 "koprojectview.h" 00031 00032 #include "projectview.h" 00033 using namespace KOrg; 00034 #include "projectview.moc" 00035 00036 class ProjectViewFactory : public KOrg::PartFactory { 00037 public: 00038 KOrg::Part *create(KOrg::MainWindow *parent, const char *name) 00039 { 00040 KGlobal::locale()->insertCatalogue( "kgantt" ); 00041 return new ProjectView(parent,name); 00042 } 00043 }; 00044 00045 K_EXPORT_COMPONENT_FACTORY( libkorg_projectview, ProjectViewFactory ) 00046 00047 00048 ProjectView::ProjectView(KOrg::MainWindow *parent, const char *name) : 00049 KOrg::Part(parent,name), mView(0) 00050 { 00051 setInstance( new KInstance( "korganizer" ) ); 00052 00053 setXMLFile("plugins/projectviewui.rc"); 00054 00055 new KAction(i18n("&Project"), "project", 0, this, TQT_SLOT(showView()), 00056 actionCollection(), "view_project"); 00057 } 00058 00059 ProjectView::~ProjectView() 00060 { 00061 } 00062 00063 TQString ProjectView::info() 00064 { 00065 return i18n("This plugin provides a Gantt diagram as project view."); 00066 } 00067 00068 TQString ProjectView::shortInfo() 00069 { 00070 return i18n("Project View Plugin"); 00071 } 00072 00073 void ProjectView::showView() 00074 { 00075 if (!mView) { 00076 mView = new KOProjectView(mainWindow()->view()->calendar(), 00077 mainWindow()->view()); 00078 mainWindow()->view()->addView(mView); 00079 } 00080 mainWindow()->view()->showView(mView); 00081 }