• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdesdk API Reference
  • KDE Home
  • Contact Us
 

kapptemplate

  • sources
  • kde-4.12
  • kdesdk
  • kapptemplate
  • templates
  • C++
  • konqplugin
  • src
konqplugin/src/%{APPNAMELC}plugin.cpp
Go to the documentation of this file.
1 #include "%{APPNAMELC}plugin.h"
2 
3 #include <KPluginFactory>
4 #include <KPluginLoader>
5 #include <KLocale>
6 #include <KAction>
7 #include <KActionCollection>
8 #include <KAboutData>
9 #include <KDebug>
10 #include <KStandardDirs>
11 #include <KStandardAction>
12 #include <KMessageBox>
13 #include <KActionMenu>
14 #include <KConfigDialog>
15 #include <QGraphicsWidget>
16 
17 #include "settings.h"
18 
19 static const KAboutData aboutdata("%{APPNAMELC}plugin", 0, ki18n("%{APPNAME} Settings") , "0.1" );
20 
21 K_PLUGIN_FACTORY(%{APPNAMELC}PluginFactory, registerPlugin<%{APPNAMELC}Plugin>(); )
22 K_EXPORT_PLUGIN(%{APPNAMELC}PluginFactory(aboutdata))
23 
24 
25 %{APPNAMELC}Plugin::%{APPNAMELC}Plugin(QObject *parent, const QVariantList &args)
26  : KParts::Plugin(parent)
27 {
28  Q_UNUSED(args);
29 
30  setComponentData(%{APPNAMELC}PluginFactory::componentData());
31 
32  m_Part = dynamic_cast<KParts::ReadOnlyPart *>(parent);
33  if (! m_Part)
34  {
35  kDebug() << "Unable to get KHTMLPart" << endl;
36  return;
37  }
38 
39  kDebug() << "%{APPNAMELC} created" << endl;
40 
41 
42  // Config Action
43  QAction *actConfig = actionCollection()->addAction("configure_%{APPNAMELC}");
44  actConfig->setText(i18n("&Configure %{APPNAME}"));
45 
46  // Setup our menu
47  KActionMenu*menu = new KActionMenu("%{APPNAME}", actionCollection());
48  actionCollection()->addAction("tools_%{APPNAMELC}", menu);
49  connect(actConfig, SIGNAL(triggered(bool)), this, SLOT(showConfig()));
50  menu->addAction(actConfig);
51 }
52 
53 %{APPNAMELC}Plugin::~%{APPNAMELC}Plugin()
54 {
55 }
56 
57 
58 void %{APPNAMELC}Plugin::showConfig()
59 {
60  kDebug() << "Configure %{APPNAMELC}" << endl;
61  // The preference dialog is derived from config.ui
62  //
63  // compare the names of the widgets in the .ui file
64  // to the names of the variables in the .kcfg file
65  //avoid to have 2 dialogs shown
66  if ( KConfigDialog::showDialog ( "settings" ) )
67  {
68  return;
69  }
70  KConfigDialog *dialog = new KConfigDialog ( NULL, "settings", Settings::self() );
71  QWidget *generalSettingsDlg = new QWidget;
72  ui_configdialog.setupUi ( generalSettingsDlg );
73  dialog->addPage ( generalSettingsDlg, i18n ( "General" ), "package_setting" );
74  //connect ( dialog, SIGNAL ( settingsChanged ( QString ) ), m_view, SLOT ( settingsChanged() ) );
75  dialog->setAttribute ( Qt::WA_DeleteOnClose );
76  dialog->show();
77 
78 }
79 
QWidget
class @6 QWidget
This is the main view class for %{APPNAME}.
Settings::self
static Settings * self()
Definition: C++/akonadiresource/settings.cpp:19
%{APPNAMELC}plugin.h
aboutdata
static const KAboutData aboutdata("%{APPNAMELC}plugin", 0, ki18n("%{APPNAME} Settings"),"0.1")
Plugin
class @0 Plugin(QObject *parent, const QVariantList &args)
settings.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:03:22 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kapptemplate

Skip menu "kapptemplate"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdesdk API Reference

Skip menu "kdesdk API Reference"
  • kapptemplate
  • kcachegrind
  • kompare
  • lokalize
  • okteta
  • umbrello
  •   umbrello

Search



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