• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KDE3Support

  • kde3support
  • kparts
dockmainwindow3.cpp
Go to the documentation of this file.
1/* This file is part of the KDE project
2 Copyright (C) 2000 Falk Brettschneider <gigafalk@yahoo.com>
3 (C) 1999 Simon Hausmann <hausmann@kde.org>
4 (C) 1999 David Faure <faure@kde.org>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library 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 GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
20*/
21
22#include "dockmainwindow3.h"
23#include <kparts/event.h>
24#include <kparts/part.h>
25#include <kparts/plugin.h>
26#include <kstatusbar.h>
27#include <kcomponentdata.h>
28#include <khelpmenu.h>
29#include <kstandarddirs.h>
30#include <QtGui/QApplication>
31
32#include <kdebug.h>
33#include <kxmlguifactory.h>
34
35#include <assert.h>
36
37using namespace KParts;
38
39namespace KParts
40{
41class DockMainWindow3Private
42{
43public:
44 DockMainWindow3Private()
45 {
46 m_activePart = 0;
47 m_bShellGUIActivated = false;
48 m_helpMenu = 0;
49 }
50 ~DockMainWindow3Private()
51 {
52 }
53
54 QPointer<Part> m_activePart;
55 bool m_bShellGUIActivated;
56 KHelpMenu *m_helpMenu;
57};
58}
59
60DockMainWindow3::DockMainWindow3( QWidget* parent, const char *name, Qt::WindowFlags f )
61 : K3DockMainWindow( parent, name, f )
62{
63 d = new DockMainWindow3Private();
64 PartBase::setPartObject( this );
65 setAttribute( Qt::WA_DeleteOnClose );
66}
67
68DockMainWindow3::~DockMainWindow3()
69{
70 delete d;
71}
72
73void DockMainWindow3::createGUI( Part * part )
74{
75 kDebug(1000) << QString("DockMainWindow3::createGUI for %1").arg(part?part->name():"0L");
76
77 KXMLGUIFactory *factory = guiFactory();
78
79 setUpdatesEnabled( false );
80
81 Q3PtrList<Plugin> plugins;
82
83 if ( d->m_activePart )
84 {
85 kDebug(1000) << QString("deactivating GUI for %1").arg(d->m_activePart->name());
86
87 GUIActivateEvent ev( false );
88 QApplication::sendEvent( d->m_activePart, &ev );
89
90 factory->removeClient( d->m_activePart );
91
92 disconnect( d->m_activePart, SIGNAL(setWindowCaption(QString)),
93 this, SLOT(setCaption(QString)) );
94 disconnect( d->m_activePart, SIGNAL(setStatusBarText(QString)),
95 this, SLOT(slotSetStatusBarText(QString)) );
96 }
97
98 if ( !d->m_bShellGUIActivated )
99 {
100 loadPlugins( this, this, KGlobal::mainComponent() );
101 createShellGUI();
102 d->m_bShellGUIActivated = true;
103 }
104
105 if ( part )
106 {
107 // do this before sending the activate event
108 connect( part, SIGNAL(setWindowCaption(QString)),
109 this, SLOT(setCaption(QString)) );
110 connect( part, SIGNAL(setStatusBarText(QString)),
111 this, SLOT(slotSetStatusBarText(QString)) );
112
113 factory->addClient( part );
114
115 GUIActivateEvent ev( true );
116 QApplication::sendEvent( part, &ev );
117
118 }
119
120 setUpdatesEnabled( true );
121
122 d->m_activePart = part;
123}
124
125void DockMainWindow3::slotSetStatusBarText( const QString & text )
126{
127 statusBar()->message( text );
128}
129
130void DockMainWindow3::createShellGUI( bool create )
131{
132 assert( d->m_bShellGUIActivated != create );
133 d->m_bShellGUIActivated = create;
134 if ( create )
135 {
136 if ( isHelpMenuEnabled() )
137 d->m_helpMenu = new KHelpMenu( this, componentData().aboutData(), true, actionCollection() );
138
139 QString f = xmlFile();
140 setXMLFile( KStandardDirs::locate( "config", "ui/ui_standards.rc", componentData() ) );
141 if ( !f.isEmpty() )
142 setXMLFile( f, true );
143 else
144 {
145 QString auto_file( componentData().componentName() + "ui.rc" );
146 setXMLFile( auto_file, true );
147 }
148
149 GUIActivateEvent ev( true );
150 QApplication::sendEvent( this, &ev );
151
152 guiFactory()->addClient( this );
153
154 }
155 else
156 {
157 GUIActivateEvent ev( false );
158 QApplication::sendEvent( this, &ev );
159
160 guiFactory()->removeClient( this );
161 }
162}
163
164#include "dockmainwindow3.moc"
K3DockMainWindow
A special kind of KMainWindow that is able to have dockwidget child widgets (and member of the dockwi...
Definition: k3dockwidget.h:1279
KHelpMenu
KMainWindow::statusBar
KStatusBar * statusBar()
KMainWindow::setCaption
virtual void setCaption(const QString &caption)
KParts::DockMainWindow3::createGUI
void createGUI(KParts::Part *part)
Create the GUI (by merging the host's and the active part's)
Definition: dockmainwindow3.cpp:73
KParts::DockMainWindow3::slotSetStatusBarText
virtual void slotSetStatusBarText(const QString &)
Called when the active part wants to change the statusbar message Reimplement if your dock-mainwindow...
Definition: dockmainwindow3.cpp:125
KParts::DockMainWindow3::DockMainWindow3
DockMainWindow3(QWidget *parent=0L, const char *name=0L, Qt::WindowFlags f=0)
Constructor, same signature as K3DockMainWindow3.
Definition: dockmainwindow3.cpp:60
KParts::DockMainWindow3::createShellGUI
virtual void createShellGUI(bool create=true)
Definition: dockmainwindow3.cpp:130
KParts::DockMainWindow3::~DockMainWindow3
virtual ~DockMainWindow3()
Destructor.
Definition: dockmainwindow3.cpp:68
KParts::GUIActivateEvent
KParts::PartBase::setPartObject
void setPartObject(QObject *object)
KParts::PartBase::loadPlugins
void loadPlugins(QObject *parent, KXMLGUIClient *parentGUIClient, const KComponentData &componentData)
KParts::Part
KStandardDirs::locate
static QString locate(const char *type, const QString &filename, const KComponentData &cData=KGlobal::mainComponent())
KXMLGUIClient::xmlFile
virtual QString xmlFile() const
KXMLGUIClient::actionCollection
virtual KActionCollection * actionCollection() const
KXMLGUIClient::setXMLFile
virtual void setXMLFile(const QString &file, bool merge=false, bool setXMLDoc=true)
KXMLGUIClient::componentData
virtual KComponentData componentData() const
KXMLGUIClient::factory
KXMLGUIFactory * factory() const
KXMLGUIFactory
KXMLGUIFactory::removeClient
void removeClient(KXMLGUIClient *client)
KXMLGUIFactory::addClient
void addClient(KXMLGUIClient *client)
KXmlGuiWindow::guiFactory
virtual KXMLGUIFactory * guiFactory()
KXmlGuiWindow::isHelpMenuEnabled
bool isHelpMenuEnabled() const
Q3PtrList
QWidget
dockmainwindow3.h
event.h
kDebug
#define kDebug
kcomponentdata.h
kdebug.h
khelpmenu.h
kstandarddirs.h
kstatusbar.h
kxmlguifactory.h
KGlobal::mainComponent
const KComponentData & mainComponent()
KParts
name
const char * name(StandardAction id)
create
KAction * create(StandardAction id, const QObject *recvr, const char *slot, QObject *parent)
part.h
plugin.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDE3Support

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

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
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