• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

knode

  • sources
  • kde-4.12
  • kdepim
  • knode
knode_part.cpp
Go to the documentation of this file.
1 /*
2  This file is part of KNode.
3  Copyright (c) 2003 Laurent Montel <montel@kde.org>,
4  Based on the work of Cornelius Schumacher <schumacher@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  As a special exception, permission is given to link this program
21  with any edition of Qt, and distribute the resulting executable,
22  without including the source code for Qt in the source distribution.
23 */
24 
25 #include "knode_part.h"
26 
27 #include "knglobals.h"
28 #include "knmainwidget.h"
29 #include "aboutdata.h"
30 #include "kncollectionview.h"
31 #include "utils/startup.h"
32 
33 
34 #include <kpluginfactory.h>
35 #include <kparts/statusbarextension.h>
36 #include <kiconloader.h>
37 #include <kdebug.h>
38 #include <kstatusbar.h>
39 #include <ksqueezedtextlabel.h>
40 
41 #include <QVBoxLayout>
42 
43 
44 K_PLUGIN_FACTORY(KNodeFactory, registerPlugin<KNodePart>();)
45 K_EXPORT_PLUGIN(KNodeFactory(KNode::AboutData()))
46 
47 KNodePart::KNodePart( QWidget *parentWidget, QObject *parent, const QVariantList &)
48  : KParts::ReadOnlyPart( parent ),
49  mParentWidget( parentWidget )
50 {
51  kDebug(5003) <<"KNodePart()";
52  kDebug(5003) <<" InstanceName:" << KGlobal::mainComponent().componentName();
53 
54  setComponentData( KNodeFactory::componentData() );
55 
56  kDebug(5003) <<"KNodePart()...";
57  kDebug(5003) <<" InstanceName:" << KGlobal::mainComponent().componentName();
58 
59 
60  KNode::Utilities::Startup s;
61  s.loadLibrariesIconsAndTranslations();
62  s.updateDataAndConfiguration();
63 
64 #ifdef __GNUC__
65 #warning Port me!
66 #endif
67 // kapp->dcopClient()->suspend(); // Don't handle DCOP requests yet
68 
69  knGlobals.setComponentData( KNodeFactory::componentData() );
70 
71  // create a canvas to insert our widget
72  QWidget *canvas = new QWidget(parentWidget);
73  canvas->setFocusPolicy( Qt::ClickFocus );
74  setWidget(canvas);
75 
76  mainWidget = new KNMainWidget( this, canvas );
77  QVBoxLayout *topLayout = new QVBoxLayout( canvas );
78  topLayout->setContentsMargins( 0, 0, 0, 0 );
79  topLayout->addWidget(mainWidget);
80  mainWidget->setFocusPolicy( Qt::ClickFocus );
81 
82 #ifdef __GNUC__
83 #warning Port me!
84 #endif
85 // kapp->dcopClient()->resume(); // Ok. We are ready for DCOP requests.
86 
87  KParts::StatusBarExtension* statusBar = new KParts::StatusBarExtension(this);
88  statusBar->addStatusBarItem(mainWidget->statusBarLabelFilter(), 10, false);
89  statusBar->addStatusBarItem(mainWidget->statusBarLabelGroup(), 15, false);
90 
91  setXMLFile( "knodeui.rc" );
92 }
93 
94 KNodePart::~KNodePart()
95 {
96  mainWidget->prepareShutdown();
97 }
98 
99 KAboutData *KNodePart::createAboutData()
100 {
101  return new KNode::AboutData();
102 }
103 
104 bool KNodePart::openFile()
105 {
106  kDebug(5003) <<"KNodePart:openFile()";
107 
108  mainWidget->show();
109  return true;
110 }
111 
112 void KNodePart::guiActivateEvent(KParts::GUIActivateEvent *e)
113 {
114  kDebug(5003) <<"KNodePart::guiActivateEvent";
115  KParts::ReadOnlyPart::guiActivateEvent(e);
116 }
117 
118 
119 QWidget* KNodePart::parentWidget() const
120 {
121  return mParentWidget;
122 }
123 
124 
125 
126 #include "knode_part.moc"
127 
KNode::Utilities::Startup
A class to deals with start-up/initialization of KNode.
Definition: startup.h:37
KNodePart::openFile
virtual bool openFile()
Definition: knode_part.cpp:104
KNodePart::createAboutData
static KAboutData * createAboutData()
Definition: knode_part.cpp:99
KNodePart::guiActivateEvent
virtual void guiActivateEvent(KParts::GUIActivateEvent *e)
Definition: knode_part.cpp:112
KNode::AboutData
Content of the about dialog.
Definition: aboutdata.h:24
QWidget
QObject
KNMainWidget
This is the central part of the KNode GUI.
Definition: knmainwidget.h:57
KNode::Utilities::Startup::updateDataAndConfiguration
void updateDataAndConfiguration() const
Updates internal data at startup.
Definition: startup.cpp:56
startup.h
aboutdata.h
KAboutData
kncollectionview.h
knmainwidget.h
K_EXPORT_PLUGIN
K_EXPORT_PLUGIN(KNodeFactory(KNode::AboutData())) KNodePart
Definition: knode_part.cpp:45
KNMainWidget::prepareShutdown
void prepareShutdown()
Definition: knmainwidget.cpp:906
knglobals.h
KNodePart::parentWidget
QWidget * parentWidget() const
Definition: knode_part.cpp:119
KNodePart::~KNodePart
virtual ~KNodePart()
Definition: knode_part.cpp:94
KNodePart::KNodePart
KNodePart(QWidget *parentWidget, QObject *parent, const QVariantList &)
knode_part.h
knGlobals
#define knGlobals
Keep compatibility with the old way.
Definition: knglobals.h:28
KNode::Utilities::Startup::loadLibrariesIconsAndTranslations
void loadLibrariesIconsAndTranslations() const
Loads translation catalogs and icons directories for imported libraries.
Definition: startup.cpp:42
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:58:36 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

knode

Skip menu "knode"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal