2
* Copyright (C) 2002 Richard Moore <rich@kde.org>
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
13
#include <kaboutapplication.h>
14
#include <kaboutdata.h>
16
#include <kapplication.h>
17
#include <kcmenumngr.h>
21
#include <kpopupmenu.h>
22
#include <kstandarddirs.h>
23
#include <kxmlguifactory.h>
25
#include <kparts/genericfactory.h>
28
#include "kdetvwidget.h"
29
#include "libkdetvactions.h"
31
#include "viewmanager.h"
33
#include "kdetvpart.h"
35
typedef KParts::GenericFactory<KdetvPart> KdetvPartFactory;
36
K_EXPORT_COMPONENT_FACTORY( libkdetvpart, KdetvPartFactory );
38
KdetvPart::KdetvPart( QWidget *wparent, const char *wname,
39
QObject *parent, const char *name,
40
const QStringList &/*args*/ )
41
: KParts::ReadOnlyPart( parent ? parent : wparent, name ? name : "kdetv_part" ),
44
kdDebug() << "Creating KdetvPart" << endl;
46
setInstance( KdetvPartFactory::instance() );
49
tv = new KdetvWidget( wparent, wname ? wname : 0 );
52
kdDebug() << "KdetvPart: Created TV widget" << endl;
55
actions = new LibKdetvActions( tv->driver() );
56
actions->createActions( actionCollection() );
58
// Setup Action Collection
59
actionCollection()->setHighlightingEnabled( true );
62
setXMLFile( "kdetvpartui.rc" );
64
QTimer::singleShot( 0, this, SLOT(maybeStart()) );
65
kdDebug() << "KdetvPart: Created" << endl;
68
KdetvPart::~KdetvPart()
72
void KdetvPart::start()
74
tv->driver()->start();
75
addContextMenu( tv->view() );
78
void KdetvPart::maybeStart()
84
KAboutData *KdetvPart::createAboutData()
86
// the non-i18n name here must be the same as the directory in
87
// which the part's rc file is installed ('partrcdir' in the
89
KAboutData *about = new KAboutData( "kdetv", I18N_NOOP("kdetv"),
90
"Development post 0.8.0",
91
I18N_NOOP("TV for KDE"),
92
KAboutData::License_LGPL,
93
I18N_NOOP("(c) 2002-2004 The kdetv Developers"),
94
0, "http://www.kdetv.org/");
95
about->addAuthor("George Staikos", I18N_NOOP("Primary author and maintainer"), "staikos@kde.org");
96
about->addAuthor("Richard Moore", I18N_NOOP("GUI design, channel plugins"), "rich@kde.org");
97
about->addAuthor("Kevin Hessels", I18N_NOOP("Configuration dialog"), "khessels@shaw.ca");
98
about->addAuthor("Stefan Hellwig", I18N_NOOP("Webmaster, developer"), "stefan@stefanhellwig.de");
99
about->addAuthor("Rizsanyi Zsolt", I18N_NOOP("Infrared remote support, developer"), "rizsanyi@myrealbox.com");
100
about->addAuthor("Dawit Alemayehu", I18N_NOOP("Developer"), "adawit@kde.org");
105
void KdetvPart::addContextMenu( bool xmlgui )
107
tv->addContextMenu( createContextMenu( xmlgui ) );
110
KPopupMenu *KdetvPart::createContextMenu( bool xmlgui )
114
pop = createContextMenu( createContextMenu(QString("screen_context_popup")) );
119
// Fall back to manual menu creation
120
pop = new KPopupMenu;
122
actions->channel()->plug( pop );
123
actions->channelUp()->plug( pop );
124
actions->channelDown()->plug( pop );
125
actions->volumeSlider()->plug( pop );
126
actions->volumeMute()->plug( pop );
127
pop->insertSeparator();
132
KPopupMenu *KdetvPart::createContextMenu( const QString &name )
134
kdDebug() << "KdetvPart: createContextMenu(...)" << endl;
136
KXMLGUIFactory *fact = factory();
140
QWidget *w = fact->container( name.isNull() ? QString("screen_context_popup") : name, this );
144
KPopupMenu *pop = static_cast<KPopupMenu *>( w );
145
pop->insertTitle( i18n("kdetv"), -1, 0 );
149
bool KdetvPart::openFile()
151
kdDebug() << "KdetvPart::openFile() '" << filename() << "'" << endl;
153
kdDebug() << "KdetvPart::openFile(): Extend Kdetv interface to cover loading" << endl;
158
void KdetvPart::about()
160
KAboutApplication dlg( createAboutData() );
164
void KdetvPart::help()
166
KApplication::kApplication()->invokeHelp( QString::null, QString("kdetv") );
170
void KdetvPart::preferences()
172
Kdetv *ktv = tv->driver();
174
ktv->views()->launchSettings(0L);
177
void KdetvPart::reportBug()
179
KApplication::kApplication()->invokeMailer( QString("kwintv@mail.kde.org"), QString::null );