26 #include "korganizer_part.h"
28 #include "calendarview.h"
29 #include "actionmanager.h"
30 #include "koglobals.h"
32 #include "resourceview.h"
33 #include "aboutdata.h"
35 #include "korganizerifaceimpl.h"
36 #include "stdcalendar.h"
37 #include "alarmclient.h"
39 #include <libkcal/calendarlocal.h>
41 #include <libkcal/resourcecalendar.h>
43 #include <tdepopupmenu.h>
44 #include <kinstance.h>
45 #include <tdelocale.h>
46 #include <kiconloader.h>
47 #include <tdeaction.h>
49 #include <kstandarddirs.h>
50 #include <tdeconfig.h>
51 #include <tdeprocess.h>
52 #include <tdetempfile.h>
53 #include <kstatusbar.h>
54 #include <tdeparts/genericfactory.h>
55 #include <tdeparts/partmanager.h>
56 #include <tdeparts/statusbarextension.h>
58 #include <sidebarextension.h>
59 #include <infoextension.h>
61 #include <tqapplication.h>
66 typedef KParts::GenericFactory< KOrganizerPart > KOrganizerFactory;
67 K_EXPORT_COMPONENT_FACTORY( libkorganizerpart, KOrganizerFactory )
69 KOrganizerPart::KOrganizerPart( TQWidget *parentWidget,
const char *widgetName,
70 TQObject *parent,
const char *name,
71 const TQStringList & ) :
72 KParts::ReadOnlyPart(parent, name), mTopLevelWidget( parentWidget->topLevelWidget() )
74 TDEGlobal::locale()->insertCatalogue(
"libkcal" );
75 TDEGlobal::locale()->insertCatalogue(
"libtdepim" );
76 TDEGlobal::locale()->insertCatalogue(
"kdgantt" );
78 KOCore::self()->addXMLGUIClient( mTopLevelWidget,
this );
80 TQString pname( name );
83 TQWidget *canvas =
new TQWidget( parentWidget, widgetName );
84 canvas->setFocusPolicy( TQWidget::ClickFocus );
88 mActionManager =
new ActionManager(
this, mView,
this,
this,
true );
89 (void)
new KOrganizerIfaceImpl( mActionManager,
this,
"IfaceImpl" );
91 if ( pname ==
"kontact" ) {
92 mActionManager->createCalendarResources();
93 setHasDocument(
false );
94 KOrg::StdCalendar::self()->load();
95 mView->updateCategories();
97 mActionManager->createCalendarLocal();
98 setHasDocument(
true );
101 mStatusBarExtension =
new KParts::StatusBarExtension(
this );
103 setInstance( KOrganizerFactory::instance() );
105 TQVBoxLayout *topLayout =
new TQVBoxLayout( canvas );
106 topLayout->addWidget( mView );
108 new KParts::SideBarExtension( mView->leftFrame(),
this,
"SBE" );
110 KParts::InfoExtension *ie =
new KParts::InfoExtension(
this,
112 connect( mView, TQ_SIGNAL( incidenceSelected(
Incidence *,
const TQDate & ) ),
113 TQ_SLOT( slotChangeInfo(
Incidence *,
const TQDate & ) ) );
114 connect(
this, TQ_SIGNAL( textChanged(
const TQString & ) ),
115 ie, TQ_SIGNAL( textChanged(
const TQString & ) ) );
117 mActionManager->init();
118 mActionManager->readSettings();
120 setXMLFile(
"korganizer_part.rc" );
121 mActionManager->loadParts();
125 KOrganizerPart::~KOrganizerPart()
127 mActionManager->saveCalendar();
128 mActionManager->writeSettings();
130 delete mActionManager;
135 KOCore::self()->removeXMLGUIClient( mTopLevelWidget );
138 TDEAboutData *KOrganizerPart::createAboutData()
140 return new KOrg::AboutData;
143 void KOrganizerPart::startCompleted( TDEProcess *process )
148 void KOrganizerPart::slotChangeInfo(
Incidence *incidence,
const TQDate & )
151 emit textChanged( incidence->
summary() +
" / " +
154 emit textChanged( TQString() );
158 TQWidget *KOrganizerPart::topLevelWidget()
160 return mView->topLevelWidget();
165 return mActionManager;
168 void KOrganizerPart::showStatusMessage(
const TQString &message )
170 KStatusBar *statusBar = mStatusBarExtension->statusBar();
171 if ( statusBar ) statusBar->message( message );
179 bool KOrganizerPart::openURL(
const KURL &url,
bool merge )
181 return mActionManager->openURL( url, merge );
184 bool KOrganizerPart::saveURL()
186 return mActionManager->saveURL();
189 bool KOrganizerPart::saveAsURL(
const KURL &kurl )
191 return mActionManager->saveAsURL( kurl );
194 KURL KOrganizerPart::getCurrentURL()
const
196 return mActionManager->url();
199 bool KOrganizerPart::openFile()
201 mView->openCalendar( m_file );
207 void KOrganizerPart::setTitle()
237 bool KOrganizerPart::isCurrentlyActivePart()
240 return ( manager()->activePart() ==
this );
246 #include "korganizer_part.moc"
The ActionManager creates all the actions in KOrganizer.
This is the main calendar widget.
virtual TDE_DEPRECATED TQString dtStartTimeStr() const
interface for main calendar view widget