knode
knode_part.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "knode_part.h"
00026 #include "knglobals.h"
00027 #include "knmainwidget.h"
00028 #include "aboutdata.h"
00029 #include "kncollectionview.h"
00030
00031 #include <kparts/genericfactory.h>
00032 #include <kparts/statusbarextension.h>
00033 #include <kiconloader.h>
00034 #include <kdebug.h>
00035 #include <kstatusbar.h>
00036 #include <ksqueezedtextlabel.h>
00037
00038 #include <QVBoxLayout>
00039
00040
00041 K_PLUGIN_FACTORY(KNodeFactory, registerPlugin<KNodePart>();)
00042 K_EXPORT_PLUGIN(KNodeFactory(KNode::AboutData()))
00043
00044 KNodePart::KNodePart( QWidget *parentWidget, QObject *parent, const QVariantList &)
00045 : KParts::ReadOnlyPart( parent ),
00046 mParentWidget( parentWidget )
00047 {
00048 kDebug(5003) <<"KNodePart()";
00049 kDebug(5003) <<" InstanceName:" << KGlobal::mainComponent().componentName();
00050
00051 setComponentData( KNodeFactory::componentData() );
00052
00053 kDebug(5003) <<"KNodePart()...";
00054 kDebug(5003) <<" InstanceName:" << KGlobal::mainComponent().componentName();
00055
00056 KGlobal::locale()->insertCatalog("libkdepim");
00057 KGlobal::locale()->insertCatalog("libkpgp");
00058 #ifdef __GNUC__
00059 #warning Port me!
00060 #endif
00061
00062 KIconLoader::global()->addAppDir("knode");
00063 KIconLoader::global()->addAppDir("kdepim");
00064 knGlobals.setComponentData( KNodeFactory::componentData() );
00065
00066
00067 QWidget *canvas = new QWidget(parentWidget);
00068 canvas->setFocusPolicy( Qt::ClickFocus );
00069 setWidget(canvas);
00070
00071 mainWidget = new KNMainWidget( this, canvas );
00072 QVBoxLayout *topLayout = new QVBoxLayout(canvas);
00073 topLayout->addWidget(mainWidget);
00074 mainWidget->setFocusPolicy( Qt::ClickFocus );
00075
00076 #ifdef __GNUC__
00077 #warning Port me!
00078 #endif
00079
00080
00081 KParts::StatusBarExtension* statusBar = new KParts::StatusBarExtension(this);
00082 statusBar->addStatusBarItem(mainWidget->statusBarLabelFilter(), 10, false);
00083 statusBar->addStatusBarItem(mainWidget->statusBarLabelGroup(), 15, false);
00084
00085 setXMLFile( "knodeui.rc" );
00086 }
00087
00088 KNodePart::~KNodePart()
00089 {
00090 mainWidget->prepareShutdown();
00091 }
00092
00093 KAboutData *KNodePart::createAboutData()
00094 {
00095 return new KNode::AboutData();
00096 }
00097
00098 bool KNodePart::openFile()
00099 {
00100 kDebug(5003) <<"KNodePart:openFile()";
00101
00102 mainWidget->show();
00103 return true;
00104 }
00105
00106 void KNodePart::guiActivateEvent(KParts::GUIActivateEvent *e)
00107 {
00108 kDebug(5003) <<"KNodePart::guiActivateEvent";
00109 KParts::ReadOnlyPart::guiActivateEvent(e);
00110 }
00111
00112
00113 QWidget* KNodePart::parentWidget() const
00114 {
00115 return mParentWidget;
00116 }
00117
00118
00119
00120 #include "knode_part.moc"
00121