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

kjots

  • sources
  • kde-4.12
  • kdepim
  • kjots
kjotspart.cpp
Go to the documentation of this file.
1 /*
2  This file is part of KJots.
3 
4  Copyright (c) 2008 Stephen Kelly <steveire@gmail.com>
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 
20  As a special exception, permission is given to link this program
21  with any edition of Qt, and distribute the resulting executable,
22  without including the source code for Qt in the source distribution.
23 */
24 
25 #include "kjotspart.h"
26 
27 #include "kjotspart.moc"
28 #include "aboutdata.h"
29 
30 #include <kdebug.h>
31 
32 #include <kaction.h>
33 #include <kactioncollection.h>
34 #include <kcomponentdata.h>
35 #include <kfiledialog.h>
36 #include <kstandardaction.h>
37 #include <kstandarddirs.h>
38 #include <kpluginfactory.h>
39 #include <klocale.h>
40 #include <kstatusbar.h>
41 
42 #include <QtCore/QFile>
43 #include <QtCore/QTextStream>
44 #include <QTimer>
45 #include <QTextEdit>
46 #include <QLabel>
47 #include "kjotswidget.h"
48 
49 const KAboutData &createAboutData()
50 {
51  static AboutData aboutData;
52  return aboutData;
53 }
54 
55 K_PLUGIN_FACTORY(KJotsPartFactory, registerPlugin<KJotsPart>();)
56 K_EXPORT_PLUGIN(KJotsPartFactory(createAboutData()))
57 
58 KJotsPart::KJotsPart( QWidget *parentWidget, QObject *parent, const QVariantList & /*args*/ )
59  : KParts::ReadOnlyPart(parent)
60 {
61  // we need an instance
62  setComponentData( KJotsPartFactory::componentData() );
63 
64  // this should be your custom internal widget
65  mComponent = new KJotsWidget(parentWidget, this);
66 
67  mStatusBar = new KParts::StatusBarExtension(this);
68  // notify the part that this is our internal widget
69  setWidget(mComponent);
70  initAction();
71 
72  // set our XML-UI resource file
73  setXMLFile(KStandardDirs::locate("data", QLatin1String("kjots/kjotspartui.rc")));
74 
75  QTimer::singleShot(0, this, SLOT(delayedInitialization()));
76 }
77 
78 KJotsPart::~KJotsPart()
79 {
80  mComponent->queryClose();
81 }
82 
83 void KJotsPart::initAction()
84 {
85  KAction *action = new KAction( KIcon( QLatin1String("configure") ), i18n( "&Configure KJots..." ), this );
86  actionCollection()->addAction( QLatin1String("kjots_configure"), action );
87  connect( action, SIGNAL(triggered(bool)), mComponent,
88  SLOT(configure()) );
89 }
90 
91 bool KJotsPart::openFile()
92 {
93  return false;
94 }
95 
96 void KJotsPart::delayedInitialization()
97 {
98  connect(mComponent, SIGNAL(activeAnchorChanged(QString,QString)),
99  SLOT(activeAnchorChanged(QString,QString)));
100 }
101 
102 void KJotsPart::activeAnchorChanged(const QString &anchorTarget, const QString &anchorText)
103 {
104  if (!anchorTarget.isEmpty())
105  {
106  mStatusBar->statusBar()->showMessage(anchorText + QLatin1String(" -> ") + anchorTarget);
107  } else {
108  mStatusBar->statusBar()->showMessage(QString());
109  }
110 }
111 
112 //
113 // bool KJotsPart::saveFile()
114 // {
115 // return false;
116 // }
KJotsPart::openFile
virtual bool openFile()
This must be implemented by each part.
Definition: kjotspart.cpp:91
KJotsPart::~KJotsPart
virtual ~KJotsPart()
Destructor.
Definition: kjotspart.cpp:78
KJotsPart::KJotsPart
KJotsPart(QWidget *parentWidget, QObject *parent, const QVariantList &)
Default constructor.
QWidget
KJotsWidget::queryClose
Q_SCRIPTABLE bool queryClose()
Definition: kjotswidget.cpp:1765
KJotsWidget
Definition: kjotswidget.h:67
QObject
KJotsPart::delayedInitialization
void delayedInitialization()
Definition: kjotspart.cpp:96
AboutData
Definition: aboutdata.h:29
kjotspart.h
aboutdata.h
K_EXPORT_PLUGIN
K_EXPORT_PLUGIN(KJotsPartFactory(createAboutData())) KJotsPart
Definition: kjotspart.cpp:56
kjotswidget.h
KAboutData
KJotsPart::activeAnchorChanged
void activeAnchorChanged(const QString &, const QString &)
Definition: kjotspart.cpp:102
createAboutData
const KAboutData & createAboutData()
Definition: kjotspart.cpp:49
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:55:39 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kjots

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

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

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