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

messagelist

  • sources
  • kde-4.14
  • 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 <KLocalizedString>
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() 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( status().isReplied() )
228  append_string( ret, i18nc( "Status of an item", "Replied" ) );
229 
230  if( status().isForwarded() )
231  append_string( ret, i18nc( "Status of an item", "Forwarded" ) );
232 
233  if( status().isSent() )
234  append_string( ret, i18nc( "Status of an item", "Sent" ) );
235 
236  if( status().isImportant() )
237  append_string( ret, i18nc( "Status of an item", "Important" ) );
238 
239  if( status().isSpam() )
240  append_string( ret, i18nc( "Status of an item", "Spam" ) );
241 
242  if( status().isHam() )
243  append_string( ret, i18nc( "Status of an item", "Ham" ) );
244 
245  if( status().isWatched() )
246  append_string( ret, i18nc( "Status of an item", "Watched" ) );
247 
248  if( status().isIgnored() )
249  append_string( ret, i18nc( "Status of an item", "Ignored" ) );
250 
251  return ret;
252 }
253 
254 QString Item::formattedSize() const
255 {
256  return KIO::convertSize( ( KIO::filesize_t ) size() );
257 }
258 
259 QString Item::formattedDate() const
260 {
261  if ( static_cast< uint >( date() ) == static_cast< uint >( -1 ) )
262  return Manager::instance()->cachedLocalizedUnknownText();
263  else
264  return Manager::instance()->dateFormatter()->dateString( date() );
265 }
266 
267 QString Item::formattedMaxDate() const
268 {
269  if ( static_cast< uint >( maxDate() ) == static_cast< uint >( -1 ) )
270  return Manager::instance()->cachedLocalizedUnknownText();
271  else
272  return Manager::instance()->dateFormatter()->dateString( maxDate() );
273 }
274 
275 bool Item::recomputeMaxDate()
276 {
277  time_t newMaxDate = d_ptr->mDate;
278 
279  if ( d_ptr->mChildItems )
280  {
281  QList< Item * >::ConstIterator end = d_ptr->mChildItems->constEnd();
282  for ( QList< Item * >::ConstIterator it = d_ptr->mChildItems->constBegin(); it != end; ++it ) {
283  if ( ( *it )->d_ptr->mMaxDate > newMaxDate )
284  newMaxDate = ( *it )->d_ptr->mMaxDate;
285  }
286  }
287 
288  if ( newMaxDate != d_ptr->mMaxDate )
289  {
290  setMaxDate( newMaxDate );
291  return true;
292  }
293  return false;
294 }
295 
296 
297 Item::Type Item::type() const
298 {
299  return d_ptr->mType;
300 }
301 
302 Item::InitialExpandStatus Item::initialExpandStatus() const
303 {
304  return d_ptr->mInitialExpandStatus;
305 }
306 
307 void Item::setInitialExpandStatus( InitialExpandStatus initialExpandStatus )
308 {
309  d_ptr->mInitialExpandStatus = initialExpandStatus;
310 }
311 
312 bool Item::isViewable() const
313 {
314  return d_ptr->mIsViewable;
315 }
316 
317 bool Item::hasAncestor( const Item * it ) const
318 {
319  return d_ptr->mParent ? ( d_ptr->mParent == it ? true : d_ptr->mParent->hasAncestor( it ) ) : false;
320 }
321 
322 void Item::setViewable( Model *model,bool bViewable )
323 {
324  if ( d_ptr->mIsViewable == bViewable )
325  return;
326 
327  if ( !d_ptr->mChildItems ) {
328  d_ptr->mIsViewable = bViewable;
329  return;
330  }
331 
332  if ( d_ptr->mChildItems->isEmpty() ) {
333  d_ptr->mIsViewable = bViewable;
334  return;
335  }
336 
337  if ( bViewable )
338  {
339  if ( model )
340  {
341  // fake having no children, for a second
342  QList< Item * > * tmp = d_ptr->mChildItems;
343  d_ptr->mChildItems = 0;
344  //qDebug("BEGIN INSERT ROWS FOR PARENT %x: from %d to %d, (will) have %d children",this,0,tmp->count()-1,tmp->count());
345  model->beginInsertRows( model->index( this, 0 ), 0, tmp->count() - 1 );
346  d_ptr->mChildItems = tmp;
347  d_ptr->mIsViewable = true;
348  model->endInsertRows();
349  } else {
350  d_ptr->mIsViewable = true;
351  }
352 
353  QList< Item * >::ConstIterator end( d_ptr->mChildItems->constEnd() );
354  for ( QList< Item * >::ConstIterator it = d_ptr->mChildItems->constBegin(); it != end ;++it )
355  ( *it )->setViewable( model, bViewable );
356  } else {
357  QList< Item * >::ConstIterator end( d_ptr->mChildItems->constEnd() );
358  for ( QList< Item * >::ConstIterator it = d_ptr->mChildItems->constBegin(); it != end ;++it )
359  ( *it )->setViewable( model, bViewable );
360 
361  // It seems that we can avoid removing child items here since the parent has been removed: this is a hack tough
362  // and should check if Qt4 still supports it in the next (hopefully largely fixed) release
363 
364  if ( model )
365  {
366  // fake having no children, for a second
367  model->beginRemoveRows( model->index( this, 0 ), 0, d_ptr->mChildItems->count() - 1 );
368  QList< Item * > * tmp = d_ptr->mChildItems;
369  d_ptr->mChildItems = 0;
370  d_ptr->mIsViewable = false;
371  model->endRemoveRows();
372  d_ptr->mChildItems = tmp;
373  } else {
374  d_ptr->mIsViewable = false;
375  }
376  }
377 }
378 
379 void Item::killAllChildItems()
380 {
381  if ( !d_ptr->mChildItems )
382  return;
383 
384  while( !d_ptr->mChildItems->isEmpty() )
385  delete d_ptr->mChildItems->first(); // this will call childDead() which will remove the child from the list
386 
387  delete d_ptr->mChildItems;
388  d_ptr->mChildItems = 0;
389 }
390 
391 Item * Item::parent() const
392 {
393  return d_ptr->mParent;
394 }
395 
396 void Item::setParent( Item *pParent )
397 {
398  d_ptr->mParent = pParent;
399 }
400 
401 const Akonadi::MessageStatus &Item::status() const
402 {
403  return d_ptr->mStatus;
404 }
405 
406 void Item::setStatus( const Akonadi::MessageStatus &status )
407 {
408  d_ptr->mStatus = status;
409 }
410 
411 size_t Item::size() const
412 {
413  return d_ptr->mSize;
414 }
415 
416 void Item::setSize( size_t size )
417 {
418  d_ptr->mSize = size;
419 }
420 
421 time_t Item::date() const
422 {
423  return d_ptr->mDate;
424 }
425 
426 void Item::setDate( time_t date )
427 {
428  d_ptr->mDate = date;
429 }
430 
431 time_t Item::maxDate() const
432 {
433  return d_ptr->mMaxDate;
434 }
435 
436 void Item::setMaxDate( time_t date )
437 {
438  d_ptr->mMaxDate = date;
439 }
440 
441 const QString &Item::sender() const
442 {
443  return d_ptr->mSender;
444 }
445 
446 void Item::setSender( const QString &sender )
447 {
448  d_ptr->mSender = sender;
449 }
450 
451 const QString &Item::receiver() const
452 {
453  return d_ptr->mReceiver;
454 }
455 
456 void Item::setReceiver( const QString &receiver )
457 {
458  d_ptr->mReceiver = receiver;
459 }
460 
461 const QString &Item::senderOrReceiver() const
462 {
463  return d_ptr->mUseReceiver ? d_ptr->mReceiver : d_ptr->mSender;
464 }
465 
466 bool Item::useReceiver() const
467 {
468  return d_ptr->mUseReceiver;
469 }
470 
471 const QString &Item::subject() const
472 {
473  return d_ptr->mSubject;
474 }
475 
476 void Item::setSubject( const QString &subject )
477 {
478  d_ptr->mSubject = subject;
479 }
480 
481 void MessageList::Core::Item::initialSetup( time_t date, size_t size,
482  const QString &sender,
483  const QString &receiver,
484  bool useReceiver )
485 {
486  d_ptr->mDate = date;
487  d_ptr->mMaxDate = date;
488  d_ptr->mSize = size;
489  d_ptr->mSender = sender;
490  d_ptr->mReceiver = receiver;
491  d_ptr->mUseReceiver = useReceiver;
492 }
493 
494 void MessageList::Core::Item::setItemId(qint64 id)
495 {
496  d_ptr->mItemId = id;
497 }
498 
499 qint64 MessageList::Core::Item::itemId() const
500 {
501  return d_ptr->mItemId;
502 }
503 
504 void Item::setParentCollectionId(qint64 id)
505 {
506  d_ptr->mParentCollectionId = id;
507 }
508 
509 qint64 Item::parentCollectionId() const
510 {
511  return d_ptr->mParentCollectionId;
512 }
513 
514 void MessageList::Core::Item::setSubjectAndStatus(const QString &subject,
515  const Akonadi::MessageStatus &status)
516 {
517  d_ptr->mSubject = subject;
518  d_ptr->mStatus = status;
519 }
520 
521 // FIXME: Try to "cache item insertions" and call beginInsertRows() and endInsertRows() in a chunked fashion...
522 
523 void Item::rawAppendChildItem( Item * child )
524 {
525  if ( !d_ptr->mChildItems )
526  d_ptr->mChildItems = new QList< Item * >();
527  d_ptr->mChildItems->append( child );
528 }
529 
530 int Item::appendChildItem( Model *model, Item *child )
531 {
532  if ( !d_ptr->mChildItems )
533  d_ptr->mChildItems = new QList< Item * >();
534  const int idx = d_ptr->mChildItems->count();
535  if ( d_ptr->mIsViewable )
536  {
537  if ( model )
538  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
539  d_ptr->mChildItems->append( child );
540  child->setIndexGuess( idx );
541  if ( model )
542  model->endInsertRows(); // THIS IS EXTREMELY UGLY, BUT IT'S THE ONLY POSSIBLE WAY WITH QT4 AT THE TIME OF WRITING
543  child->setViewable( model, true );
544  } else {
545  d_ptr->mChildItems->append( child );
546  child->setIndexGuess( idx );
547  }
548  return idx;
549 }
550 
551 
552 void Item::dump( const QString &prefix )
553 {
554  QString out = QString::fromLatin1( "%1 %x VIEWABLE:%2" ).arg(prefix).arg(d_ptr->mIsViewable ? QLatin1String( "yes" ) : QLatin1String( "no" ));
555  qDebug( out.toUtf8().data(),this );
556 
557  QString nPrefix( prefix );
558  nPrefix += QLatin1String(" ");
559 
560  if (!d_ptr->mChildItems )
561  return;
562 
563  QList< Item * >::ConstIterator end( d_ptr->mChildItems->constEnd() );
564  for ( QList< Item * >::ConstIterator it = d_ptr->mChildItems->constBegin(); it != end ;++it )
565  (*it)->dump(nPrefix);
566 }
567 
568 void Item::takeChildItem( Model *model, Item *child )
569 {
570  if ( !d_ptr->mChildItems )
571  return; // Ugh... not our child ?
572 
573  if ( !d_ptr->mIsViewable )
574  {
575  //qDebug("TAKING NON VIEWABLE CHILD ITEM %x",child);
576  // We can highly optimize this case
577  d_ptr->mChildItems->removeOne( child );
578 #if 0
579  // This *could* be done, but we optimize and avoid it.
580  if ( d->mChildItems->isEmpty() )
581  {
582  delete d->mChildItems;
583  d->mChildItems = 0;
584  }
585 #endif
586  child->setParent( 0 );
587  return;
588  }
589 
590  const int idx = indexOfChildItem(child);
591  if (idx < 0)
592  return; // Aaargh... not our child ?
593 
594  child->setViewable( model, false );
595  if ( model )
596  model->beginRemoveRows( model->index( this, 0 ), idx, idx );
597  child->setParent( 0 );
598  d_ptr->mChildItems->removeAt( idx );
599  if ( model )
600  model->endRemoveRows();
601 
602 #if 0
603  // This *could* be done, but we optimize and avoid it.
604  if ( d->mChildItems->isEmpty() )
605  {
606  delete d->mChildItems;
607  d->mChildItems = 0;
608  }
609 #endif
610 }
611 
612 
613 void ItemPrivate::childItemDead( Item *child )
614 {
615  // mChildItems MUST be non zero here, if it's not then it's a bug in THIS FILE
616  mChildItems->removeOne( child ); // since we always have ONE (if we not, it's a bug)
617 }
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:248
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:523
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:312
MessageList::Core::Item::date
time_t date() const
Returns the date of this item.
Definition: item.cpp:421
MessageList::Core::ItemPrivate::mParentCollectionId
qint64 mParentCollectionId
The Akonadi ID of collection that this particular item comes from (can be virtual collection) ...
Definition: item_p.h:247
MessageList::Core::Item::setDate
void setDate(time_t date)
Sets the date of this item.
Definition: item.cpp:426
MessageList::Core::Item::senderOrReceiver
const QString & senderOrReceiver() const
Returns the sender or the receiver, depending on the underlying StorageModel settings.
Definition: item.cpp:461
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:416
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:254
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:499
MessageList::Core::Item::receiver
const QString & receiver() const
Returns the receiver associated to this item.
Definition: item.cpp:451
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:322
MessageList::Core::Item::setSubject
void setSubject(const QString &subject)
Sets the subject associated to this Item.
Definition: item.cpp:476
MessageList::Core::Item::subject
const QString & subject() const
Returns the subject associated to this Item.
Definition: item.cpp:471
MessageList::Core::Item::ChildItemStats::mUnreadChildCount
unsigned int mUnreadChildCount
Definition: item.h:195
MessageList::Core::Item::setItemId
void setItemId(qint64 id)
Definition: item.cpp:494
MessageList::Core::Item::size
size_t size() const
Returns the size of this item (size of the Message, mainly)
Definition: item.cpp:411
MessageList::Core::Item::recomputeMaxDate
bool recomputeMaxDate()
Recompute the maximum date from the current children list.
Definition: item.cpp:275
MessageList::Core::ItemPrivate::mType
Item::Type mType
The type of this item.
Definition: item_p.h:250
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:514
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:252
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:307
MessageList::Core::Item::formattedMaxDate
QString formattedMaxDate() const
A string with a text rappresentation of maxDate() obtained via Manager.
Definition: item.cpp:267
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:530
MessageList::Core::Item::type
Type type() const
Returns the type of this item.
Definition: item.cpp:297
QList::count
int count(const T &value) const
MessageList::Core::Item::firstChildItem
Item * firstChildItem() const
Returns the first child item, if any.
Definition: item.cpp:86
QAbstractItemModel::endInsertRows
void endInsertRows()
MessageList::Core::Item::useReceiver
bool useReceiver() const
Returns whether sender or receiver is supposed to be displayed.
Definition: item.cpp:466
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
QString::isEmpty
bool isEmpty() const
QAbstractItemModel::beginRemoveRows
void beginRemoveRows(const QModelIndex &parent, int first, int last)
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:317
MessageList::Core::Item::dump
void dump(const QString &prefix)
Debug helper.
Definition: item.cpp:552
MessageList::Core::Item::killAllChildItems
void killAllChildItems()
Kills all the child items without emitting any signal, recursively.
Definition: item.cpp:379
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:396
QString
QList
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:302
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:251
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:259
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
MessageList::Core::Item::setParentCollectionId
void setParentCollectionId(qint64 id)
Definition: item.cpp:504
item.h
MessageList::Core::Item::childItems
QList< Item * > * childItems() const
Return the list of child items.
Definition: item.cpp:70
QAbstractItemModel::beginInsertRows
void beginInsertRows(const QModelIndex &parent, int first, int last)
MessageList::Core::ItemPrivate::mThisItemIndexGuess
int mThisItemIndexGuess
The guess for the index in the parent's child list.
Definition: item_p.h:249
MessageList::Core::ItemPrivate::mUseReceiver
bool mUseReceiver
senderOrReceiver() returns receiver rather than sender
Definition: item_p.h:253
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
QLatin1String
MessageList::Core::Item::maxDate
time_t maxDate() const
Returns the maximum date in the subtree originating from this item.
Definition: item.cpp:431
MessageList::Core::ItemPrivate::mSubject
QString mSubject
The subject of the message (or group subject)
Definition: item_p.h:245
MessageList::Core::Item::d_ptr
ItemPrivate *const d_ptr
Definition: item.h:402
MessageList::Core::Item::sender
const QString & sender() const
Returns the sender associated to this item.
Definition: item.cpp:441
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:436
QByteArray::data
char * data()
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
QString::fromLatin1
QString fromLatin1(const char *str, int size)
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:401
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:568
QAbstractItemModel::endRemoveRows
void endRemoveRows()
MessageList::Core::Item::statusDescription
QString statusDescription() const
Returns a string describing the status e.g: "Read, Forwarded, Important".
Definition: item.cpp:213
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:391
MessageList::Core::Item::hasChildren
bool hasChildren() const
Convenience function that returns true if this item has children.
Definition: item.cpp:168
QString::arg
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
MessageList::Core::ItemPrivate::mMaxDate
time_t mMaxDate
The maximum date in the subtree.
Definition: item_p.h:240
MessageList::Core::Item::parentCollectionId
qint64 parentCollectionId() const
Definition: item.cpp:509
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:481
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:456
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:613
MessageList::Core::Item::setSender
void setSender(const QString &sender)
Sets the sender associated to this item.
Definition: item.cpp:446
QString::toUtf8
QByteArray toUtf8() const
MessageList::Core::Item::setStatus
void setStatus(const Akonadi::MessageStatus &status)
Sets the status associated to this Item.
Definition: item.cpp:406
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:32:01 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
  • 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