kitchensync

part.cpp
1 /*
2  This file is part of KitchenSync.
3 
4  Copyright (c) 2005 Tobias Koenig <tokoe@kde.org>
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 */
20 
21 #include <tqlayout.h>
22 #include <tqvbox.h>
23 
24 #include <tdeaction.h>
25 #include <tdeapplication.h>
26 #include <kdebug.h>
27 #include <kiconloader.h>
28 #include <kinstance.h>
29 #include <tdelocale.h>
30 #include <tdeparts/genericfactory.h>
31 
32 #include "mainwidget.h"
33 
34 #include "part.h"
35 
36 typedef KParts::GenericFactory< KitchenSyncPart > KitchenSyncFactory;
37 K_EXPORT_COMPONENT_FACTORY( libkitchensyncpart, KitchenSyncFactory )
38 
39 KitchenSyncPart::KitchenSyncPart( TQWidget *parentWidget, const char *widgetName,
40  TQObject *parent, const char *name,
41  const TQStringList& )
42  : KParts::ReadOnlyPart( parent, name )
43 {
44  setInstance( KitchenSyncFactory::instance() );
45 
46  TQVBox *canvas = new TQVBox( parentWidget, widgetName );
47  setWidget( canvas );
48 
49  new MainWidget( this, canvas );
50 
51  TDEGlobal::iconLoader()->addAppDir( "kitchensync" );
52 
53  setXMLFile( "kitchensync_part.rc" );
54 }
55 
56 KitchenSyncPart::~KitchenSyncPart()
57 {
58  closeURL();
59 }
60 
61 TDEAboutData *KitchenSyncPart::createAboutData()
62 {
63  return MainWidget::aboutData();
64 }
65 
66 void KitchenSyncPart::exit()
67 {
68  delete this;
69 }
70 
71 bool KitchenSyncPart::openURL( const KURL &url )
72 {
73  emit setWindowCaption( url.prettyURL() );
74 
75  return true;
76 }
77 
78 bool KitchenSyncPart::openFile()
79 {
80  return true;
81 }
82 
83 void KitchenSyncPart::guiActivateEvent( KParts::GUIActivateEvent *e )
84 {
85  KParts::ReadOnlyPart::guiActivateEvent( e );
86 }
87 
88 #include "part.moc"
89