summaryrefslogtreecommitdiffstats
path: root/src/basket_part.cpp
blob: c42afe392a282d0a55f258a78c3d70d29cd84de0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/***************************************************************************
 *   Copyright (C) 2003 by Petri Damsten                                   *
 *   petri.damsten@iki.fi                                                  *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.             *
 ***************************************************************************/

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "basket_part.h"

#include <kinstance.h>
#include <tdeaction.h>
#include <kstdaction.h>
#include <tdefiledialog.h>
#include <tdeglobal.h>
#include <tdelocale.h>
#include <bnpview.h>
#include <aboutdata.h>
#include <tdeparts/genericfactory.h>
#include <tdeparts/statusbarextension.h>
#include "basketstatusbar.h"

typedef KParts::GenericFactory< BasketPart > BasketFactory;
K_EXPORT_COMPONENT_FACTORY( libbasketpart, BasketFactory )

BasketPart::BasketPart( TQWidget *parentWidget, const char *,
						TQObject *parent, const char *name, const TQStringList & )
	: KParts::ReadWritePart(parent, name)
{
  // we need an instance
	setInstance( BasketFactory::instance() );

	BasketStatusBar* bar = new BasketStatusBar(new KParts::StatusBarExtension(this));
  // this should be your custom internal widget
	m_view = new BNPView(parentWidget, "BNPViewPart", this, actionCollection(), bar);
	connect(m_view, TQ_SIGNAL(setWindowCaption(const TQString &)), this, TQ_SLOT(setCaption(const TQString &)));
	connect(m_view, TQ_SIGNAL(showPart()), this, TQ_SIGNAL(showPart()));
	m_view->setFocusPolicy(TQWidget::ClickFocus);

  // notify the part that this is our internal widget
	setWidget(m_view);

  // set our XML-UI resource file
	setXMLFile("basket_part.rc");

  // we are read-write by default
	setReadWrite(true);

  // we are not modified since we haven't done anything yet
	setModified(false);
}

BasketPart::~BasketPart()
{}

void BasketPart::setReadWrite(bool rw)
{
  // TODO: notify your internal widget of the read-write state
	ReadWritePart::setReadWrite(rw);
}

void BasketPart::setModified(bool modified)
{
  // in any event, we want our parent to do it's thing
	ReadWritePart::setModified(modified);
}

bool BasketPart::openFile()
{
  // TODO
	return false;
}

bool BasketPart::saveFile()
{
  //TODO
	return false;
}

TDEAboutData *BasketPart::createAboutData()
{
	return new AboutData();
}

void BasketPart::setCaption(const TQString &caption)
{
	emit setWindowCaption(caption);
}

#include "basket_part.moc"