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

messagelist

  • sources
  • kde-4.12
  • kdepim
  • messagelist
  • core
item.h
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  * Copyright 2008 Szymon Tomasz Stefanek <pragma@kvirc.net>
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 Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  *
19  *******************************************************************************/
20 
21 #ifndef __MESSAGELIST_CORE_ITEM_H__
22 #define __MESSAGELIST_CORE_ITEM_H__
23 
24 #include <QList>
25 #include <QString>
26 #include <QDate>
27 
28 #include <time.h> // for time_t
29 
30 #include <kmime/kmime_headers.h>
31 
32 #include <akonadi/kmime/messagestatus.h>
33 
34 #include <messagelist/core/model.h>
35 #include <messagelist/messagelist_export.h>
36 
37 
38 namespace MessageList
39 {
40 
41 namespace Core
42 {
43 
44 class ItemPrivate;
45 
52 class MESSAGELIST_EXPORT Item
53 {
54  friend class Model;
55  friend class ModelPrivate;
56 
57 public:
61  enum Type
62  {
63  GroupHeader,
64  Message,
65  InvisibleRoot
66  };
67 
73  enum InitialExpandStatus
74  {
75  ExpandNeeded,
76  NoExpandNeeded,
77  ExpandExecuted
78  };
79 
80 protected:
84  Item( Type type );
85  Item( Type type, ItemPrivate *dd );
86 
87 public:
92  virtual ~Item();
93 
97  Type type() const;
98 
102  InitialExpandStatus initialExpandStatus() const;
103 
107  void setInitialExpandStatus( InitialExpandStatus initialExpandStatus );
108 
112  bool isViewable() const;
113 
118  bool hasAncestor( const Item * it ) const;
119 
126  void setViewable( Model *model, bool bViewable );
127 
131  QList< Item * > * childItems() const;
132 
136  Item * childItem( int idx ) const;
137 
141  Item * firstChildItem() const;
142 
147  Item * itemBelowChild( Item * child );
148 
153  Item * itemAboveChild( Item * child );
154 
158  Item * deepestItem();
159 
164  Item * itemBelow();
165 
170  Item * itemAbove();
171 
175  void dump( const QString &prefix );
176 
180  int childItemCount() const;
181 
185  bool hasChildren() const;
186 
191  class ChildItemStats
192  {
193  public:
194  unsigned int mTotalChildCount; // total
195  unsigned int mUnreadChildCount; // unread only
196  public:
197  ChildItemStats()
198  : mTotalChildCount( 0 ), mUnreadChildCount( 0 )
199  {}
200  };
201 
207  void childItemStats( ChildItemStats &stats ) const;
208 
213  int indexOfChildItem( Item *item ) const;
214 
223  void setIndexGuess( int index );
224 
230  Item * parent() const;
231 
236  void setParent( Item *pParent );
237 
241  Item * topmostNonRoot();
242 
246  const Akonadi::MessageStatus & status() const;
247 
251  void setStatus( const Akonadi::MessageStatus &status );
252 
256  QString statusDescription(bool hasNepomukTag) const;
257 
261  size_t size() const;
262 
266  void setSize( size_t size );
267 
272  QString formattedSize() const;
273 
277  time_t date() const;
278 
282  void setDate( time_t date );
283 
288  QString formattedDate() const;
289 
294  time_t maxDate() const;
295 
299  void setMaxDate( time_t date );
300 
305  QString formattedMaxDate() const;
306 
311  bool recomputeMaxDate();
312 
316  const QString & sender() const;
317 
321  void setSender( const QString &sender );
322 
326  const QString & receiver() const;
327 
331  void setReceiver( const QString &receiver );
332 
336  const QString & senderOrReceiver() const;
337 
341  bool useReceiver() const;
342 
346  const QString & subject() const;
347 
351  void setSubject( const QString &subject );
352 
358  void initialSetup( time_t date, size_t size,
359  const QString &sender,
360  const QString &receiver,
361  bool useReceiver );
362 
363  void setItemId(qint64 id);
364  qint64 itemId() const;
365 
370  void setSubjectAndStatus( const QString &subject,
371  const Akonadi::MessageStatus &status );
372 
377  int appendChildItem( Model *model, Item *child );
378 
384  void rawAppendChildItem( Item * child );
385 
390  void takeChildItem( Model *model, Item *child );
391 
396  void killAllChildItems();
397 
398 protected:
399  ItemPrivate * const d_ptr;
400  Q_DECLARE_PRIVATE( Item )
401 };
402 
403 } // namespace Core
404 
405 } // namespace MessageList
406 
407 #endif
messagelist_export.h
MessageList::Core::Item::ExpandNeeded
Must expand when this item becomes viewable.
Definition: item.h:75
MessageList::Core::Item::Type
Type
The type of the Item.
Definition: item.h:61
MessageList::Core::Item::NoExpandNeeded
No expand needed at all.
Definition: item.h:76
MessageList::Core::ItemPrivate
Definition: item_p.h:41
model.h
MessageList::Core::Item::ChildItemStats::mUnreadChildCount
unsigned int mUnreadChildCount
Definition: item.h:195
MessageList::Core::Item::ChildItemStats::mTotalChildCount
unsigned int mTotalChildCount
Definition: item.h:194
MessageList::Core::Model
This class manages the huge tree of displayable objects: GroupHeaderItems and MessageItems.
Definition: model.h:77
MessageList::Core::ModelPrivate
Definition: model_p.h:33
MessageList::Core::Item::ChildItemStats::ChildItemStats
ChildItemStats()
Definition: item.h:197
MessageList::Core::Item::GroupHeader
This item is a GroupHeaderItem.
Definition: item.h:63
MessageList::Core::Item::InitialExpandStatus
InitialExpandStatus
Specifies the initial expand status for the item that should be applied when it's attached to the vie...
Definition: item.h:73
MessageList::Core::Item::Message
This item is a MessageItem.
Definition: item.h:64
MessageList::Core::Item
A single item of the MessageList tree managed by MessageList::Model.
Definition: item.h:52
MESSAGELIST_EXPORT
#define MESSAGELIST_EXPORT
Definition: messagelist_export.h:34
MessageList::Core::Item::ChildItemStats
A structure used with MessageList::Item::childItemStats().
Definition: item.h:191
MessageList::Core::Item::d_ptr
ItemPrivate *const d_ptr
Definition: item.h:399
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:55:32 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

messagelist

Skip menu "messagelist"
  • Main Page
  • Namespace List
  • Namespace Members
  • 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