• 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.cpp
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 #include "core/item.h"
22 #include "core/item_p.h"
23 #include "core/model.h"
24 #include "core/manager.h"
25 
26 #include <kio/global.h> // for KIO::filesize_t and related functions
27 #include <kmime/kmime_dateformatter.h> // kdepimlibs
28 
29 #include <KLocale>
30 
31 using namespace MessageList::Core;
32 
33 Item::Item( Type type )
34  : d_ptr( new ItemPrivate( this ) )
35 {
36  d_ptr->mType = type;
37 }
38 
39 Item::Item ( Item::Type type, ItemPrivate* dd )
40  : d_ptr( dd )
41 {
42  d_ptr->mType = type;
43 }
44 
45 Item::~Item()
46 {
47  killAllChildItems();
48 
49  if ( d_ptr->mParent )
50  d_ptr->mParent->d_ptr->childItemDead( this );
51 
52  delete d_ptr;
53 }
54 
55 void Item::childItemStats( ChildItemStats &stats ) const
56 {
57  Q_ASSERT( d_ptr->mChildItems );
58 
59  stats.mTotalChildCount += d_ptr->mChildItems->count();
60  QList< Item * >::ConstIterator end( d_ptr->mChildItems->constEnd() );
61  for( QList< Item * >::ConstIterator it = d_ptr->mChildItems->constBegin(); it != end; ++it )
62  {
63  if ( !( *it )->status().isRead() )
64  stats.mUnreadChildCount++;
65  if ( ( *it )->d_ptr->mChildItems )
66  ( *it )->childItemStats( stats );
67  }
68 }
69 
70 QList< Item * > *Item::childItems() const
71 {
72  return d_ptr->mChildItems;
73 }
74 
75 Item *Item::childItem( int idx ) const
76 {
77  if ( idx < 0 )
78  return 0;
79  if ( !d_ptr->mChildItems )
80  return 0;
81  if ( d_ptr->mChildItems->count() <= idx )
82  return 0;
83  return d_ptr->mChildItems->at( idx );
84 }
85 
86 Item * Item::firstChildItem() const
87 {
88  return d_ptr->mChildItems ? ( d_ptr->mChildItems->count() > 0 ? d_ptr->mChildItems->at( 0 ) : 0 ) : 0;
89 }
90 
91 Item * Item::itemBelowChild( Item * child )
92 {
93  Q_ASSERT( d_ptr->mChildItems );
94 
95  int idx = indexOfChildItem(child);
96  Q_ASSERT( idx >= 0 );
97 
98  idx++;
99 
100  if ( idx < d_ptr->mChildItems->count() )
101  return d_ptr->mChildItems->at( idx );
102 
103  if ( !d_ptr->mParent )
104  return 0;
105 
106  return d_ptr->mParent->itemBelowChild( this );
107 }
108 
109 Item * Item::itemBelow()
110 {
111  if ( d_ptr->mChildItems )
112  {
113  if ( !d_ptr->mChildItems->isEmpty() )
114  return d_ptr->mChildItems->at( 0 );
115  }
116 
117  if ( !d_ptr->mParent )
118  return 0;
119 
120  return d_ptr->mParent->itemBelowChild( this );
121 }
122 
123 Item * Item::deepestItem()
124 {
125  if ( d_ptr->mChildItems )
126  {
127  if ( !d_ptr->mChildItems->isEmpty() )
128  return d_ptr->mChildItems->at( d_ptr->mChildItems->count() - 1 )->deepestItem();
129  }
130 
131  return this;
132 }
133 
134 Item * Item::itemAboveChild( Item * child )
135 {
136  if ( d_ptr->mChildItems )
137  {
138  int idx = indexOfChildItem(child);
139  Q_ASSERT( idx >= 0 );
140  idx--;
141 
142  if ( idx >= 0 )
143  return d_ptr->mChildItems->at( idx );
144  }
145 
146  return this;
147 }
148 
149 Item * Item::itemAbove()
150 {
151  if ( !d_ptr->mParent )
152  return 0;
153 
154  Item *siblingAbove = d_ptr->mParent->itemAboveChild( this );
155  if ( siblingAbove && siblingAbove != this && siblingAbove != d_ptr->mParent &&
156  siblingAbove->childItemCount() > 0 ) {
157  return siblingAbove->deepestItem();
158  }
159 
160  return d_ptr->mParent->itemAboveChild( this );
161 }
162 
163 int Item::childItemCount() const
164 {
165  return d_ptr->mChildItems ? d_ptr->mChildItems->count() : 0;
166 }
167 
168 bool Item::hasChildren() const
169 {
170  return childItemCount() > 0;
171 }
172 
173 int Item::indexOfChildItem( Item *child ) const
174 {
175  if (!d_ptr->mChildItems)
176  return -1;
177  int idx = child->d_ptr->mThisItemIndexGuess;
178  if (idx < d_ptr->mChildItems->count() && d_ptr->mChildItems->at(idx) == child)
179  return idx; // good guess
180 
181  idx = d_ptr->mChildItems->indexOf(child);
182  if (idx >= 0)
183  child->d_ptr->mThisItemIndexGuess = idx;
184  return idx;
185 }
186 
187 void Item::setIndexGuess( int index )
188 {
189  d_ptr->mThisItemIndexGuess = index;
190 }
191 
192 Item * Item::topmostNonRoot()
193 {
194  Q_ASSERT( d_ptr->mType != InvisibleRoot );
195 
196  if ( !d_ptr->mParent )
197  return this;
198 
199  if ( d_ptr->mParent->type() == InvisibleRoot )
200  return this;
201 
202  return d_ptr->mParent->topmostNonRoot();
203 }
204 
205 
206 static inline void append_string( QString &buffer, const QString &append )
207 {
208  if ( !buffer.isEmpty() )
209  buffer += QLatin1String( ", " );
210  buffer += append;
211 }
212 
213 QString Item::statusDescription(bool hasNepomukTag) const
214 {
215  QString ret;
216  if( status().isRead() )
217  append_string( ret, i18nc( "Status of an item", "Read" ) );
218  else
219  append_string( ret, i18nc( "Status of an item", "Unread" ) );
220 
221  if( status().hasAttachment() )
222  append_string( ret, i18nc( "Status of an item", "Has Attachment" ) );
223 
224  if( status().isToAct() )
225  append_string( ret, i18nc( "Status of an item", "Action Item" ) );
226 
227  if (!hasNepomukTag) {
228  if( status().isReplied() )
229  append_string( ret, i18nc( "Status of an item", "Replied" ) );
230 
231  if( status().isForwarded() )
232  append_string( ret, i18nc( "Status of an item", "Forwarded" ) );
233 
234  if( status().isSent() )
235  append_string( ret, i18nc( "Status of an item", "Sent" ) );
236 
237  if( status().isImportant() )
238  append_string( ret, i18nc( "Status of an item", "Important" ) );
239 
240  if( status().isSpam() )
241  append_string( ret, i18nc( "Status of an item", "Spam" ) );
242 
243  if( status().isHam() )
244  append_string( ret, i18nc( "Status of an item", "Ham" ) );
245 
246  if( status().isWatched() )
247  append_string( ret, i18nc( "Status of an item", "Watched" ) );
248 
249  if( status().isIgnored() )
250  append_string( ret, i18nc( "Status of an item", "Ignored" ) );
251  }
252  return ret;
253 }
254 
255 QString Item::formattedSize() const
256 {
257  return KIO::convertSize( ( KIO::filesize_t ) size() );
258 }
259 
260 QString Item::formattedDate() const
261 {
262  if ( static_cast< uint >( date() ) == static_cast< uint >( -1 ) )
263  return Manager::instance()->cachedLocalizedUnknownText();
264  else
265  return Manager::instance()->dateFormatter()->dateString( date() );
266 }
267 
268 QString Item::formattedMaxDate() const
269 {
270  if ( static_cast< uint >( maxDate() ) == static_cast< uint >( -1 ) )
271  return Manager::instance()->cachedLocalizedUnknownText();
272  else
273  return Manager::instance()->dateFormatter()->dateString( maxDate() );
274 }
275 
276 bool Item::recomputeMaxDate()
277 {
278  time_t newMaxDate = d_ptr->mDate;
279 
280  if ( d_ptr->mChildItems )
281  {
282  QList< Item * >::ConstIterator end = d_ptr->mChildItems->constEnd();
283  for ( QList< Item * >::ConstIterator it = d_ptr->mChildItems->constBegin(); it != end; ++it ) {
284  if ( ( *it )->d_ptr->mMaxDate > newMaxDate )
285  newMaxDate = ( *it )->d_ptr->mMaxDate;
286  }
287  }
288 
289  if ( newMaxDate != d_ptr->mMaxDate )
290  {
291  setMaxDate( newMaxDate );
292  return true;
293  }
294  return false;
295 }
296 
297 
298 Item::Type Item::type() const
299 {
300  return d_ptr->mType;
301 }
302 
303 Item::InitialExpandStatus Item::initialExpandStatus() const
304 {
305  return d_ptr->mInitialExpandStatus;
306 }
307 
308 void Item::setInitialExpandStatus( InitialExpandStatus initialExpandStatus )
309 {
310  d_ptr->mInitialExpandStatus = initialExpandStatus;
311 }
312 
313 bool Item::isViewable() const
314 {
315  return d_ptr->mIsViewable;
316 }
317 
318 bool Item::hasAncestor( const Item * it ) const
319 {
320  return d_ptr->mParent ? ( d_ptr->mParent == it ? true : d_ptr->mParent->hasAncestor( it ) ) : false;
321 }
322 
323 void Item::setViewable( Model *model,bool bViewable )
324 {
325  if ( d_ptr->mIsViewable == bViewable )
326  return;
327 
328  if ( !d_ptr->mChildItems ) {
329  d_ptr->mIsViewable = bViewable;
330  return;
331  }
332 
333  if ( d_ptr->mChildItems->isEmpty() ) {
334  d_ptr->mIsViewable = bViewable;
335  return;
336  }
337 
338  if ( bViewable )
339  {
340  if ( model )
341  {
342  // fake having no children, for a second
343  QList< Item * > * tmp = d_ptr->mChildItems;
344  d_ptr->mChildItems = 0;
345  //qDebug("BEGIN INSERT ROWS FOR PARENT %x: from %d to %d, (will) have %d children",this,0,tmp->count()-1,tmp->count());
346  model->beginInsertRows( model->index( this, 0 ), 0, tmp->count() - 1 );
347  d_ptr->mChildItems = tmp;
348  d_ptr->mIsViewable = true;
349  model->endInsertRows();
350  } else {
351  d_ptr->mIsViewable = true;
352  }
353 
354  QList< Item * >::ConstIterator end( d_ptr->mChildItems->constEnd() );
355  for ( QList< Item * >::ConstIterator it = d_ptr->mChildItems->constBegin(); it != end ;++it )
356  ( *it )->setViewable( model, bViewable );
357  } else {
358  QList< Item * >::ConstIterator end( d_ptr->mChildItems->constEnd() );
359  for ( QList< Item * >::ConstIterator it = d_ptr->mChildItems->constBegin(); it != end ;++it )
360  ( *it )->setViewable( model, bViewable );
361 
362  // It seems that we can avoid removing child items here since the parent has been removed: this is a hack tough
363  // and should check if Qt4 still supports it in the next (hopefully largely fixed) release
364 
365  if ( model )
366  {
367  // fake having no children, for a second
368  model->beginRemoveRows( model->index( this, 0 ), 0, d_ptr->mChildItems->count() - 1 );
369  QList< Item * > * tmp = d_ptr->mChildItems;
370  d_ptr->mChildItems = 0;
371  d_ptr->mIsViewable = false;
372  model->endRemoveRows();
373  d_ptr->mChildItems = tmp;
374  } else {
375  d_ptr->mIsViewable = false;
376  }
377  }
378 }
379 
380 void Item::killAllChildItems()
381 {
382  if ( !d_ptr->mChildItems )
383  return;
384 
385  while( !d_ptr->mChildItems->isEmpty() )
386  delete d_ptr->mChildItems->first(); // this will call childDead() which will remove the child from the list
387 
388  delete d_ptr->mChildItems;
389  d_ptr->mChildItems = 0;
390 }
391 
392 Item * Item::parent() const
393 {
394  return d_ptr->mParent;
395 }
396 
397 void Item::setParent( Item *pParent )
398 {
399  d_ptr->mParent = pParent;
400 }
401 
402 const Akonadi::MessageStatus &Item::status() const
403 {
404  return d_ptr->mStatus;
405 }
406 
407 void Item::setStatus( const Akonadi::MessageStatus &status )
408 {
409  d_ptr->mStatus = status;
410 }
411 
412 size_t Item::size() const
413 {
414  return d_ptr->mSize;
415 }
416 
417 void Item::setSize( size_t size )
418 {
419  d_ptr->mSize = size;
420 }
421 
422 time_t Item::date() const
423 {
424  return d_ptr->mDate;
425 }
426 
427 void Item::setDate( time_t date )
428 {
429  d_ptr->mDate = date;
430 }
431 
432 time_t Item::maxDate() const
433 {
434  return d_ptr->mMaxDate;
435 }
436 
437 void Item::setMaxDate( time_t date )
438 {
439  d_ptr->mMaxDate = date;
440 }
441 
442 const QString &Item::sender() const
443 {
444  return d_ptr->mSender;
445 }
446 
447 void Item::setSender( const QString &sender )
448 {
449  d_ptr->mSender = sender;
450 }
451 
452 const QString &Item::receiver() const
453 {
454  return d_ptr->mReceiver;
455 }
456 
457 void Item::setReceiver( const QString &receiver )
458 {
459  d_ptr->mReceiver = receiver;
460 }
461 
462 const QString &Item::senderOrReceiver() const
463 {
464  return d_ptr->mUseReceiver ? d_ptr->mReceiver : d_ptr->mSender;
465 }
466 
467 bool Item::useReceiver() const
468 {
469  return d_ptr->mUseReceiver;
470 }
471 
472 const QString &Item::subject() const
473 {
474  return d_ptr->mSubject;
475 }
476 
477 void Item::setSubject( const QString &subject )
478 {
479  d_ptr->mSubject = subject;
480 }
481 
482 void MessageList::Core::Item::initialSetup( time_t date, size_t size,
483  const QString &sender,
484  const QString &receiver,
485  bool useReceiver )
486 {
487  d_ptr->mDate = date;
488  d_ptr->mMaxDate = date;
489  d_ptr->mSize = size;
490  d_ptr->mSender = sender;
491  d_ptr->mReceiver = receiver;
492  d_ptr->mUseReceiver = useReceiver;
493 }
494 
495 void MessageList::Core::Item::setItemId(qint64 id)
496 {
497  d_ptr->mItemId = id;
498 }
499 
500 qint64 MessageList::Core::Item::itemId() const
501 {
502  return d_ptr->mItemId;
503 }
504 
505 void MessageList::Core::Item::setSubjectAndStatus(const QString &subject,
506  const Akonadi::MessageStatus &status)
507 {
508  d_ptr->mSubject = subject;
509  d_ptr->mStatus = status;
510 }
511 
512 // FIXME: Try to "cache item insertions" and call beginInsertRows() and endInsertRows() in a chunked fashion...
513 
514 void Item::rawAppendChildItem( Item * child )
515 {
516  if ( !d_ptr->mChildItems )
517  d_ptr->mChildItems = new QList< Item * >();
518  d_ptr->mChildItems->append( child );
519 }
520 
521 int Item::appendChildItem( Model *model, Item *child )
522 {
523  if ( !d_ptr->mChildItems )
524  d_ptr->mChildItems = new QList< Item * >();
525  const int idx = d_ptr->mChildItems->count();
526  if ( d_ptr->mIsViewable )
527  {
528  if ( model )
529  model->beginInsertRows( model->index( this, 0 ), idx, idx ); // THIS IS EXTREMELY UGLY, BUT IT'S THE ONLY POSSIBLE WAY WITH QT4 AT THE TIME OF WRITING
530  d_ptr->mChildItems->append( child );
531  child->setIndexGuess( idx );
532  if ( model )
533  model->endInsertRows(); // THIS IS EXTREMELY UGLY, BUT IT'S THE ONLY POSSIBLE WAY WITH QT4 AT THE TIME OF WRITING
534  child->setViewable( model, true );
535  } else {
536  d_ptr->mChildItems->append( child );
537  child->setIndexGuess( idx );
538  }
539  return idx;
540 }
541 
542 
543 void Item::dump( const QString &prefix )
544 {
545  QString out = QString::fromLatin1( "%1 %x VIEWABLE:%2" ).arg(prefix).arg(d_ptr->mIsViewable ? QLatin1String( "yes" ) : QLatin1String( "no" ));
546  qDebug( out.toUtf8().data(),this );
547 
548  QString nPrefix( prefix );
549  nPrefix += QLatin1String(" ");
550 
551  if (!d_ptr->mChildItems )
552  return;
553 
554  QList< Item * >::ConstIterator end( d_ptr->mChildItems->constEnd() );
555  for ( QList< Item * >::ConstIterator it = d_ptr->mChildItems->constBegin(); it != end ;++it )
556  (*it)->dump(nPrefix);
557 }
558 
559 void Item::takeChildItem( Model *model, Item *child )
560 {
561  if ( !d_ptr->mChildItems )
562  return; // Ugh... not our child ?
563 
564  if ( !d_ptr->mIsViewable )
565  {
566  //qDebug("TAKING NON VIEWABLE CHILD ITEM %x",child);
567  // We can highly optimize this case
568  d_ptr->mChildItems->removeOne( child );
569 #if 0
570  // This *could* be done, but we optimize and avoid it.
571  if ( d->mChildItems->isEmpty() )
572  {
573  delete d->mChildItems;
574  d->mChildItems = 0;
575  }
576 #endif
577  child->setParent( 0 );
578  return;
579  }
580 
581  const int idx = indexOfChildItem(child);
582  if (idx < 0)
583  return; // Aaargh... not our child ?
584 
585  child->setViewable( model, false );
586  if ( model )
587  model->beginRemoveRows( model->index( this, 0 ), idx, idx );
588  child->setParent( 0 );
589  d_ptr->mChildItems->removeAt( idx );
590  if ( model )
591  model->endRemoveRows();
592 
593 #if 0
594  // This *could* be done, but we optimize and avoid it.
595  if ( d->mChildItems->isEmpty() )
596  {
597  delete d->mChildItems;
598  d->mChildItems = 0;
599  }
600 #endif
601 }
602 
603 
604 void ItemPrivate::childItemDead( Item *child )
605 {
606  // mChildItems MUST be non zero here, if it's not then it's a bug in THIS FILE
607  mChildItems->removeOne( child ); // since we always have ONE (if we not, it's a bug)
608 }
append_string
static void append_string(QString &buffer, const QString &append)
Definition: item.cpp:206
MessageList::Core::ItemPrivate::mStatus
Akonadi::MessageStatus mStatus
The status of the message (may be extended to groups in the future)
Definition: item_p.h:247
MessageList::Core::Manager::dateFormatter
const KMime::DateFormatter * dateFormatter() const
Definition: manager.h:118
MessageList::Core::Item::childItemStats
void childItemStats(ChildItemStats &stats) const
Gathers statistics about child items.
Definition: item.cpp:55
MessageList::Core::ItemPrivate::mDate
time_t mDate
The date of the message (or group date)
Definition: item_p.h:241
MessageList::Core::Item::Type
Type
The type of the Item.
Definition: item.h:61
MessageList::Core::Item::rawAppendChildItem
void rawAppendChildItem(Item *child)
Appends a child item without inserting it via the model.
Definition: item.cpp:514
MessageList::Core::ItemPrivate::mSize
size_t mSize
The size of the message in bytes.
Definition: item_p.h:242
MessageList::Core::Item::setIndexGuess
void setIndexGuess(int index)
Sets the cached guess for the index of this item in the parent's child list.
Definition: item.cpp:187
MessageList::Core::Item::isViewable
bool isViewable() const
Is this item attached to the viewable root ?
Definition: item.cpp:313
MessageList::Core::Item::date
time_t date() const
Returns the date of this item.
Definition: item.cpp:422
MessageList::Core::Item::setDate
void setDate(time_t date)
Sets the date of this item.
Definition: item.cpp:427
MessageList::Core::Item::senderOrReceiver
const QString & senderOrReceiver() const
Returns the sender or the receiver, depending on the underlying StorageModel settings.
Definition: item.cpp:462
MessageList::Core::ItemPrivate::mParent
Item * mParent
The parent view item.
Definition: item_p.h:239
MessageList::Core::ItemPrivate::mReceiver
QString mReceiver
The receiver of the message (or group receiver)
Definition: item_p.h:244
MessageList::Core::Item::setSize
void setSize(size_t size)
Sets the size of this item (size of the Message, mainly)
Definition: item.cpp:417
MessageList::Core::Item::childItemCount
int childItemCount() const
Returns the number of children of this Item.
Definition: item.cpp:163
MessageList::Core::Item::formattedSize
QString formattedSize() const
A string with a text rappresentation of size().
Definition: item.cpp:255
MessageList::Core::ItemPrivate
Definition: item_p.h:41
MessageList::Core::Manager::cachedLocalizedUnknownText
const QString & cachedLocalizedUnknownText() const
Definition: manager.h:183
MessageList::Core::Item::itemId
qint64 itemId() const
Definition: item.cpp:500
MessageList::Core::Item::receiver
const QString & receiver() const
Returns the receiver associated to this item.
Definition: item.cpp:452
model.h
MessageList::Core::Item::setViewable
void setViewable(Model *model, bool bViewable)
Makes this item viewable, that is, notifies its existence to any listener attacched to the "rowsInser...
Definition: item.cpp:323
MessageList::Core::Item::setSubject
void setSubject(const QString &subject)
Sets the subject associated to this Item.
Definition: item.cpp:477
MessageList::Core::Item::subject
const QString & subject() const
Returns the subject associated to this Item.
Definition: item.cpp:472
MessageList::Core::Item::ChildItemStats::mUnreadChildCount
unsigned int mUnreadChildCount
Definition: item.h:195
MessageList::Core::Item::setItemId
void setItemId(qint64 id)
Definition: item.cpp:495
MessageList::Core::Item::size
size_t size() const
Returns the size of this item (size of the Message, mainly)
Definition: item.cpp:412
MessageList::Core::Item::recomputeMaxDate
bool recomputeMaxDate()
Recompute the maximum date from the current children list.
Definition: item.cpp:276
MessageList::Core::ItemPrivate::mType
Item::Type mType
The type of this item.
Definition: item_p.h:249
MessageList::Core::Item::ChildItemStats::mTotalChildCount
unsigned int mTotalChildCount
Definition: item.h:194
MessageList::Core::Item::setSubjectAndStatus
void setSubjectAndStatus(const QString &subject, const Akonadi::MessageStatus &status)
This is meant to be called right after the constructor for MessageItem objects.
Definition: item.cpp:505
MessageList::Core::Model
This class manages the huge tree of displayable objects: GroupHeaderItems and MessageItems.
Definition: model.h:77
MessageList::Core::ItemPrivate::mIsViewable
bool mIsViewable
Is this item attacched to the viewable root ?
Definition: item_p.h:251
MessageList::Core::Item::setInitialExpandStatus
void setInitialExpandStatus(InitialExpandStatus initialExpandStatus)
Set the initial expand status we have to honor when attacching to the viewable root.
Definition: item.cpp:308
MessageList::Core::Item::formattedMaxDate
QString formattedMaxDate() const
A string with a text rappresentation of maxDate() obtained via Manager.
Definition: item.cpp:268
MessageList::Core::Item::Item
Item(Type type)
Creates an Item.
Definition: item.cpp:33
MessageList::Core::Item::appendChildItem
int appendChildItem(Model *model, Item *child)
Appends an Item to this item's child list.
Definition: item.cpp:521
MessageList::Core::Item::type
Type type() const
Returns the type of this item.
Definition: item.cpp:298
MessageList::Core::Item::firstChildItem
Item * firstChildItem() const
Returns the first child item, if any.
Definition: item.cpp:86
MessageList::Core::Item::useReceiver
bool useReceiver() const
Returns whether sender or receiver is supposed to be displayed.
Definition: item.cpp:467
MessageList::Core::Item::itemAboveChild
Item * itemAboveChild(Item *child)
Returns the item that is visually above the specified child if this item.
Definition: item.cpp:134
MessageList::Core::Item::hasAncestor
bool hasAncestor(const Item *it) const
Return true if Item pointed by it is an ancestor of this item (that is, if it is its parent...
Definition: item.cpp:318
MessageList::Core::Item::dump
void dump(const QString &prefix)
Debug helper.
Definition: item.cpp:543
MessageList::Core::Item::killAllChildItems
void killAllChildItems()
Kills all the child items without emitting any signal, recursively.
Definition: item.cpp:380
MessageList::Core::Item::childItem
Item * childItem(int idx) const
Returns the child item at position idx or 0 if idx is out of the allowable range. ...
Definition: item.cpp:75
MessageList::Core::Item::setParent
void setParent(Item *pParent)
Sets the parent for this item.
Definition: item.cpp:397
MessageList::Core::Manager::instance
static Manager * instance()
Definition: manager.h:111
MessageList::Core::Item::initialExpandStatus
InitialExpandStatus initialExpandStatus() const
The initial expand status we have to honor when attacching to the viewable root.
Definition: item.cpp:303
MessageList::Core::ItemPrivate::mInitialExpandStatus
Item::InitialExpandStatus mInitialExpandStatus
The expand status we have to honor when we attach to the viewable root.
Definition: item_p.h:250
manager.h
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::formattedDate
QString formattedDate() const
A string with a text rappresentation of date() obtained via Manager.
Definition: item.cpp:260
MessageList::Core::Item::InvisibleRoot
This item is just Item and it's the only InvisibleRoot per Model.
Definition: item.h:65
MessageList::Core::Item
A single item of the MessageList tree managed by MessageList::Model.
Definition: item.h:52
item.h
MessageList::Core::Item::childItems
QList< Item * > * childItems() const
Return the list of child items.
Definition: item.cpp:70
MessageList::Core::ItemPrivate::mThisItemIndexGuess
int mThisItemIndexGuess
The guess for the index in the parent's child list.
Definition: item_p.h:245
MessageList::Core::ItemPrivate::mUseReceiver
bool mUseReceiver
senderOrReceiver() returns receiver rather than sender
Definition: item_p.h:252
MessageList::Core::Item::ChildItemStats
A structure used with MessageList::Item::childItemStats().
Definition: item.h:191
MessageList::Core::Item::itemBelow
Item * itemBelow()
Returns the item that is visually below this item in the tree.
Definition: item.cpp:109
MessageList::Core::Item::maxDate
time_t maxDate() const
Returns the maximum date in the subtree originating from this item.
Definition: item.cpp:432
MessageList::Core::ItemPrivate::mSubject
QString mSubject
The subject of the message (or group subject)
Definition: item_p.h:246
MessageList::Core::Item::d_ptr
ItemPrivate *const d_ptr
Definition: item.h:399
MessageList::Core::Item::statusDescription
QString statusDescription(bool hasNepomukTag) const
Returns a string describing the status e.g: "Read, Forwarded, Important".
Definition: item.cpp:213
MessageList::Core::Item::sender
const QString & sender() const
Returns the sender associated to this item.
Definition: item.cpp:442
MessageList::Core::Model::index
virtual QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
Definition: model.cpp:545
MessageList::Core::Item::setMaxDate
void setMaxDate(time_t date)
Sets the maximum date in the subtree originating from this item.
Definition: item.cpp:437
MessageList::Core::Item::topmostNonRoot
Item * topmostNonRoot()
Returns the topmost parent item that is not a Root item (that is, is a Message or GroupHeader)...
Definition: item.cpp:192
MessageList::Core::Item::itemAbove
Item * itemAbove()
Returns the item that is visually above this item in the tree.
Definition: item.cpp:149
MessageList::Core::Item::deepestItem
Item * deepestItem()
Returns the deepest item in the subtree originating at this item.
Definition: item.cpp:123
MessageList::Core::Item::status
const Akonadi::MessageStatus & status() const
Returns the status associated to this Item.
Definition: item.cpp:402
MessageList::Core::Item::takeChildItem
void takeChildItem(Model *model, Item *child)
Removes a child from this item's child list without deleting it.
Definition: item.cpp:559
MessageList::Core::Item::parent
Item * parent() const
Returns the parent Item in the tree, or 0 if this item isn't attached to the tree.
Definition: item.cpp:392
MessageList::Core::Item::hasChildren
bool hasChildren() const
Convenience function that returns true if this item has children.
Definition: item.cpp:168
MessageList::Core::ItemPrivate::mMaxDate
time_t mMaxDate
The maximum date in the subtree.
Definition: item_p.h:240
MessageList::Core::Item::~Item
virtual ~Item()
Destroys the Item.
Definition: item.cpp:45
item_p.h
MessageList::Core::Item::initialSetup
void initialSetup(time_t date, size_t size, const QString &sender, const QString &receiver, bool useReceiver)
This is meant to be called right after the constructor.
Definition: item.cpp:482
MessageList::Core::Item::itemBelowChild
Item * itemBelowChild(Item *child)
Returns the item that is visually below the specified child if this item.
Definition: item.cpp:91
MessageList::Core::ItemPrivate::mChildItems
QList< Item * > * mChildItems
List of children, may be 0.
Definition: item_p.h:238
MessageList::Core::Item::setReceiver
void setReceiver(const QString &receiver)
Sets the sender associated to this item.
Definition: item.cpp:457
MessageList::Core::Item::indexOfChildItem
int indexOfChildItem(Item *item) const
Returns the actual index of the child Item item or -1 if item is not a child of this Item...
Definition: item.cpp:173
MessageList::Core::ItemPrivate::mSender
QString mSender
The sender of the message (or group sender)
Definition: item_p.h:243
MessageList::Core::ItemPrivate::childItemDead
void childItemDead(Item *child)
Internal handler for managing the children list.
Definition: item.cpp:604
MessageList::Core::Item::setSender
void setSender(const QString &sender)
Sets the sender associated to this item.
Definition: item.cpp:447
MessageList::Core::Item::setStatus
void setStatus(const Akonadi::MessageStatus &status)
Sets the status associated to this Item.
Definition: item.cpp:407
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