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

kjots

  • sources
  • kde-4.14
  • kdepim
  • kjots
kjotsmodel.h
Go to the documentation of this file.
1 /*
2  This file is part of KJots.
3 
4  Copyright (c) 2009 Stephen Kelly <steveire@gmail.com>
5 
6  This library is free software; you can redistribute it and/or modify it
7  under the terms of the GNU Library General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or (at your
9  option) any later version.
10 
11  This library is distributed in the hope that it will be useful, but WITHOUT
12  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
14  License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to the
18  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  02110-1301, USA.
20 */
21 
22 #ifndef KJOTSMODEL_H
23 #define KJOTSMODEL_H
24 
25 #include <akonadi/entitytreemodel.h>
26 
27 class QTextDocument;
28 
29 namespace Akonadi
30 {
31 class ChangeRecorder;
32 }
33 
34 using namespace Akonadi;
35 
39 class KJotsEntity : public QObject
40 {
41  Q_OBJECT
42  Q_PROPERTY(QString title READ title)
43  Q_PROPERTY(QString content READ content)
44  Q_PROPERTY(QString plainContent READ plainContent)
45  Q_PROPERTY(qint64 entityId READ entityId)
46  Q_PROPERTY(bool isBook READ isBook)
47  Q_PROPERTY(bool isPage READ isPage)
48  Q_PROPERTY(QVariantList entities READ entities)
49  Q_PROPERTY(QVariantList breadcrumbs READ breadcrumbs)
50 
51 public:
52  explicit KJotsEntity( const QModelIndex &index, QObject *parent = 0 );
53  void setIndex( const QModelIndex &index );
54 
55  bool isBook() const;
56  bool isPage() const;
57 
58  QString title() const;
59 
60  QString content() const;
61 
62  QString plainContent() const;
63 
64  qint64 entityId() const;
65 
66  QVariantList entities() const;
67 
68  QVariantList breadcrumbs() const;
69 
70 private:
71  QPersistentModelIndex m_index;
72 };
73 
74 class KJotsModel : public EntityTreeModel
75 {
76  Q_OBJECT
77 public:
78  explicit KJotsModel( ChangeRecorder *monitor, QObject *parent = 0 );
79  virtual ~KJotsModel();
80 
81  enum KJotsRoles
82  {
83  GrantleeObjectRole = EntityTreeModel::UserRole,
84  DocumentRole,
85  DocumentCursorPositionRole
86  };
87 
88  // We don't reimplement the Collection overload.
89  using EntityTreeModel::entityData;
90  virtual QVariant entityData( const Akonadi::Item& item, int column, int role = Qt::DisplayRole ) const;
91 
92  QVariant data( const QModelIndex &index, int role ) const;
93 
94  virtual bool setData( const QModelIndex& index, const QVariant& value, int role = Qt::EditRole );
95 
96 
97 private:
98  QHash<Entity::Id, QColor> m_colors;
99  mutable QHash<Item::Id, QTextDocument *> m_documents;
100  QHash<Item::Id, int> m_cursorPositions;
101 
102 };
103 
104 #endif
105 
QModelIndex
KJotsEntity
A wrapper QObject making some book and page properties available to Grantlee.
Definition: kjotsmodel.h:39
EntityTreeModel
QHash< Entity::Id, QColor >
QObject
QString
KJotsModel
Definition: kjotsmodel.h:74
KJotsModel::KJotsRoles
KJotsRoles
Definition: kjotsmodel.h:81
KJotsModel::DocumentRole
Definition: kjotsmodel.h:84
QPersistentModelIndex
QTextDocument
QVariant
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:32:12 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
  • pimprint

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