projectview.cpp
1 /*
2  This file is part of KOrganizer.
3  Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19 
20 #include <tqfile.h>
21 
22 #include <tdeapplication.h>
23 #include <tdeconfig.h>
24 #include <kstandarddirs.h>
25 #include <tdelocale.h>
26 #include <kdebug.h>
27 #include <tdeaction.h>
28 #include <tdeglobal.h>
29 
30 #include "koprojectview.h"
31 
32 #include "projectview.h"
33 using namespace KOrg;
34 #include "projectview.moc"
35 
36 class ProjectViewFactory : public KOrg::PartFactory {
37  public:
38  KOrg::Part *create(KOrg::MainWindow *parent, const char *name)
39  {
40  TDEGlobal::locale()->insertCatalogue( "kgantt" );
41  return new ProjectView(parent,name);
42  }
43 };
44 
45 K_EXPORT_COMPONENT_FACTORY( libkorg_projectview, ProjectViewFactory )
46 
47 
48 ProjectView::ProjectView(KOrg::MainWindow *parent, const char *name) :
49  KOrg::Part(parent,name), mView(0)
50 {
51  setInstance( new TDEInstance( "korganizer" ) );
52 
53  setXMLFile("plugins/projectviewui.rc");
54 
55  new TDEAction(i18n("&Project"), "project", 0, this, TQ_SLOT(showView()),
56  actionCollection(), "view_project");
57 }
58 
59 ProjectView::~ProjectView()
60 {
61 }
62 
63 TQString ProjectView::info()
64 {
65  return i18n("This plugin provides a Gantt diagram as project view.");
66 }
67 
68 TQString ProjectView::shortInfo()
69 {
70  return i18n("Project View Plugin");
71 }
72 
73 void ProjectView::showView()
74 {
75  if (!mView) {
76  mView = new KOProjectView(mainWindow()->view()->calendar(),
77  mainWindow()->view());
78  mainWindow()->view()->addView(mView);
79  }
80  mainWindow()->view()->showView(mView);
81 }
This class provides a Gantt-like project view on todo items.
Definition: koprojectview.h:67
interface for korganizer main window
Definition: mainwindow.h:41
bool view(TQWidget *parent, Attachment *attachment)