part.cpp
00001 /* 00002 This file is part of KitchenSync. 00003 00004 Copyright (c) 2005 Tobias Koenig <tokoe@kde.org> 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software 00018 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #include <tqlayout.h> 00022 #include <tqvbox.h> 00023 00024 #include <tdeaction.h> 00025 #include <tdeapplication.h> 00026 #include <kdebug.h> 00027 #include <kiconloader.h> 00028 #include <kinstance.h> 00029 #include <tdelocale.h> 00030 #include <tdeparts/genericfactory.h> 00031 00032 #include "mainwidget.h" 00033 00034 #include "part.h" 00035 00036 typedef KParts::GenericFactory< KitchenSyncPart > KitchenSyncFactory; 00037 K_EXPORT_COMPONENT_FACTORY( libkitchensyncpart, KitchenSyncFactory ) 00038 00039 KitchenSyncPart::KitchenSyncPart( TQWidget *parentWidget, const char *widgetName, 00040 TQObject *parent, const char *name, 00041 const TQStringList& ) 00042 : KParts::ReadOnlyPart( parent, name ) 00043 { 00044 setInstance( KitchenSyncFactory::instance() ); 00045 00046 TQVBox *canvas = new TQVBox( parentWidget, widgetName ); 00047 setWidget( canvas ); 00048 00049 new MainWidget( this, canvas ); 00050 00051 TDEGlobal::iconLoader()->addAppDir( "kitchensync" ); 00052 00053 setXMLFile( "kitchensync_part.rc" ); 00054 } 00055 00056 KitchenSyncPart::~KitchenSyncPart() 00057 { 00058 closeURL(); 00059 } 00060 00061 TDEAboutData *KitchenSyncPart::createAboutData() 00062 { 00063 return MainWidget::aboutData(); 00064 } 00065 00066 void KitchenSyncPart::exit() 00067 { 00068 delete this; 00069 } 00070 00071 bool KitchenSyncPart::openURL( const KURL &url ) 00072 { 00073 emit setWindowCaption( url.prettyURL() ); 00074 00075 return true; 00076 } 00077 00078 bool KitchenSyncPart::openFile() 00079 { 00080 return true; 00081 } 00082 00083 void KitchenSyncPart::guiActivateEvent( KParts::GUIActivateEvent *e ) 00084 { 00085 KParts::ReadOnlyPart::guiActivateEvent( e ); 00086 } 00087 00088 #include "part.moc" 00089