timespanview.cpp
1 /*
2  This file is part of KOrganizer.
3  Copyright (c) 2004 Reinhold Kainhofer <reinhold@kainhofer.com>
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 "kotimespanview.h"
31 
32 #include "timespanview.h"
33 using namespace KOrg;
34 #include "timespanview.moc"
35 
36 class TimespanViewFactory : public KOrg::PartFactory {
37  public:
38  KOrg::Part *create( KOrg::MainWindow *parent, const char *name )
39  {
40  return new TimespanView( parent, name );
41  }
42 };
43 
44 K_EXPORT_COMPONENT_FACTORY( libkorg_timespanview, TimespanViewFactory )
45 
46 
47 TimespanView::TimespanView(KOrg::MainWindow *parent, const char *name) :
48  KOrg::Part(parent,name), mView(0)
49 {
50  setInstance( new TDEInstance( "korganizer" ) );
51 
52  setXMLFile( "plugins/timespanviewui.rc" );
53 
54  new TDEAction( i18n("&Timespan"), "timespan", 0, this, TQ_SLOT( showView() ),
55  actionCollection(), "view_timespan" );
56 }
57 
58 TimespanView::~TimespanView()
59 {
60 }
61 
62 TQString TimespanView::info()
63 {
64  return i18n("This plugin provides a Gantt-like Timespan view.");
65 }
66 
67 TQString TimespanView::shortInfo()
68 {
69  return i18n( "Timespan View Plugin" );
70 }
71 
72 void TimespanView::showView()
73 {
74  if (!mView) {
75  mView = new KOTimeSpanView( mainWindow()->view()->calendar(),
76  mainWindow()->view() );
77  mainWindow()->view()->addView( mView );
78  }
79  mainWindow()->view()->showView( mView );
80 }
interface for korganizer main window
Definition: mainwindow.h:41
bool view(TQWidget *parent, Attachment *attachment)