1
/***************************************************************************
2
* Copyright (C) 2003 by Petri Damsten *
3
* petri.damsten@iki.fi *
5
* This program is free software; you can redistribute it and/or modify *
6
* it under the terms of the GNU General Public License as published by *
7
* the Free Software Foundation; either version 2 of the License, or *
8
* (at your option) any later version. *
10
* This program is distributed in the hope that it will be useful, *
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13
* GNU General Public License for more details. *
15
* You should have received a copy of the GNU General Public License *
16
* along with this program; if not, write to the *
17
* Free Software Foundation, Inc., *
18
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19
***************************************************************************/
21
#include "basket_part.h"
23
#include <kinstance.h>
25
#include <kstdaction.h>
26
#include <kfiledialog.h>
30
#include <aboutdata.h>
31
#include <kparts/genericfactory.h>
32
#include <kparts/statusbarextension.h>
33
#include "basketstatusbar.h"
35
typedef KParts::GenericFactory< BasketPart > BasketFactory;
36
K_EXPORT_COMPONENT_FACTORY( libbasketpart, BasketFactory )
38
BasketPart::BasketPart( QWidget *parentWidget, const char *,
39
QObject *parent, const char *name, const QStringList & )
40
: KParts::ReadWritePart(parent, name)
42
// we need an instance
43
setInstance( BasketFactory::instance() );
45
BasketStatusBar* bar = new BasketStatusBar(new KParts::StatusBarExtension(this));
46
// this should be your custom internal widget
47
m_view = new BNPView(parentWidget, "BNPViewPart", this, actionCollection(), bar);
48
connect(m_view, SIGNAL(setWindowCaption(const QString &)), this, SLOT(setCaption(const QString &)));
49
connect(m_view, SIGNAL(showPart()), this, SIGNAL(showPart()));
50
m_view->setFocusPolicy(QWidget::ClickFocus);
52
// notify the part that this is our internal widget
55
// set our XML-UI resource file
56
setXMLFile("basket_part.rc");
58
// we are read-write by default
61
// we are not modified since we haven't done anything yet
65
BasketPart::~BasketPart()
68
void BasketPart::setReadWrite(bool rw)
70
// TODO: notify your internal widget of the read-write state
71
ReadWritePart::setReadWrite(rw);
74
void BasketPart::setModified(bool modified)
76
// in any event, we want our parent to do it's thing
77
ReadWritePart::setModified(modified);
80
bool BasketPart::openFile()
86
bool BasketPart::saveFile()
92
KAboutData *BasketPart::createAboutData()
94
return new AboutData();
97
void BasketPart::setCaption(const QString &caption)
99
emit setWindowCaption(caption);
102
#include "basket_part.moc"