~ubuntu-branches/debian/jessie/basket/jessie

« back to all changes in this revision

Viewing changes to src/basket_part.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Sune Vuorela
  • Date: 2008-06-25 20:11:23 UTC
  • mfrom: (4.1.11 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080625201123-06wsi9dla3rs3486
Tags: 1.0.2-5
* Also allow automake 1.10 usage - and just build-dep on automake i
  (Closes: #487981)
* Bye bye ana

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *   Copyright (C) 2003 by Petri Damsten                                   *
 
3
 *   petri.damsten@iki.fi                                                  *
 
4
 *                                                                         *
 
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.                                   *
 
9
 *                                                                         *
 
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.                          *
 
14
 *                                                                         *
 
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
 ***************************************************************************/
 
20
 
 
21
#include "basket_part.h"
 
22
 
 
23
#include <kinstance.h>
 
24
#include <kaction.h>
 
25
#include <kstdaction.h>
 
26
#include <kfiledialog.h>
 
27
#include <kglobal.h>
 
28
#include <klocale.h>
 
29
#include <bnpview.h>
 
30
#include <aboutdata.h>
 
31
#include <kparts/genericfactory.h>
 
32
#include <kparts/statusbarextension.h>
 
33
#include "basketstatusbar.h"
 
34
 
 
35
typedef KParts::GenericFactory< BasketPart > BasketFactory;
 
36
K_EXPORT_COMPONENT_FACTORY( libbasketpart, BasketFactory )
 
37
 
 
38
BasketPart::BasketPart( QWidget *parentWidget, const char *,
 
39
                                                QObject *parent, const char *name, const QStringList & )
 
40
        : KParts::ReadWritePart(parent, name)
 
41
{
 
42
  // we need an instance
 
43
        setInstance( BasketFactory::instance() );
 
44
 
 
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);
 
51
 
 
52
  // notify the part that this is our internal widget
 
53
        setWidget(m_view);
 
54
 
 
55
  // set our XML-UI resource file
 
56
        setXMLFile("basket_part.rc");
 
57
 
 
58
  // we are read-write by default
 
59
        setReadWrite(true);
 
60
 
 
61
  // we are not modified since we haven't done anything yet
 
62
        setModified(false);
 
63
}
 
64
 
 
65
BasketPart::~BasketPart()
 
66
{}
 
67
 
 
68
void BasketPart::setReadWrite(bool rw)
 
69
{
 
70
  // TODO: notify your internal widget of the read-write state
 
71
        ReadWritePart::setReadWrite(rw);
 
72
}
 
73
 
 
74
void BasketPart::setModified(bool modified)
 
75
{
 
76
  // in any event, we want our parent to do it's thing
 
77
        ReadWritePart::setModified(modified);
 
78
}
 
79
 
 
80
bool BasketPart::openFile()
 
81
{
 
82
  // TODO
 
83
        return false;
 
84
}
 
85
 
 
86
bool BasketPart::saveFile()
 
87
{
 
88
  //TODO
 
89
        return false;
 
90
}
 
91
 
 
92
KAboutData *BasketPart::createAboutData()
 
93
{
 
94
        return new AboutData();
 
95
}
 
96
 
 
97
void BasketPart::setCaption(const QString &caption)
 
98
{
 
99
        emit setWindowCaption(caption);
 
100
}
 
101
 
 
102
#include "basket_part.moc"