knode
foldertreewidget.cpp
Go to the documentation of this file.
67 return mFolderTreeWidget->style()->sizeFromContents( QStyle::CT_ItemViewItem, &opt, QSize(), mFolderTreeWidget );
70 virtual void paint( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const
96 // keeping indipendent state variables is faster than saving and restoring the whole painter state
104 QPalette::ColorGroup cg = opt.state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled;
109 QPalette::ColorRole cr = ( opt.state & QStyle::State_Selected ) ? QPalette::HighlightedText : QPalette::Text;
153 label = item->elidedLabelText( fm, textRect.width() - ( ITEM_LABEL_TO_UNREADCOUNT_SPACING + unreadWidth ) );
156 // the condition inside this call is an optimization (it's faster than simply label != item->labelText())
157 item->setLabelTextElided( ( label.length() != item->labelText().length() ) || ( label != item->labelText() ) );
174 painter->drawText( textRect, Qt::AlignLeft | Qt::TextSingleLine | Qt::AlignVCenter, unreadText );
179 // the condition inside this call is an optimization (it's faster than simply label != item->labelText())
180 item->setLabelTextElided( ( label.length() != item->labelText().length() ) || ( label != item->labelText() ) );
188 // the condition inside this call is an optimization (it's faster than simply label != item->labelText())
189 item->setLabelTextElided( ( label.length() != item->labelText().length() ) || ( label != item->labelText() ) );
199 virtual void setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const
249 setItemDelegateForColumn( mLabelColumnIndex, new FolderTreeWidgetItemLabelColumnDelegate( this ) );
415 FolderTreeWidgetItem *it = static_cast< FolderTreeWidgetItem * >( QTreeWidgetItem::child( idx ) );
504 QString sizeText = KIO::convertSize( mDataSize >= 0 ? (KIO::filesize_t)mDataSize : (KIO::filesize_t)0 );
551 if ( columnIndex!=tree->labelColumnIndex() && !tree->unreadColumnVisible() && tree->labelColumnVisible() ) {
619 QString FolderTreeWidgetItem::elidedLabelText( const QFontMetrics &metrics, unsigned int width ) const
int childrenUnreadCount() const
Returns the unread message count for the children.
Definition: foldertreewidget.h:350
int addDataSizeColumn(const QString &headerLabel)
Adds a special "DataSize" column to this view and returns its logical index.
Definition: foldertreewidget.cpp:289
void updateColumn(int columnIndex)
Triggers an update for the specified column of this item.
Definition: foldertreewidget.cpp:546
int addTotalColumn(const QString &headerLabel)
Adds a special "Total" column to this view and returns its logical index.
Definition: foldertreewidget.cpp:261
A folder tree node to be used with FolderTreeWidget.
Definition: foldertreewidget.h:225
A tree widget useful for displaying a tree of folders containing messages.
Definition: foldertreewidget.h:73
virtual QByteArray text(quint32 serialNumber) const =0
int unreadColumnIndex() const
Returns the logical index of the "Unread" column or -1 if such a column has not been added (yet)...
Definition: foldertreewidget.h:127
bool unreadColumnVisible() const
Returns true if the widget contains an "Unread" column and it's currently visible.
Definition: foldertreewidget.cpp:282
int totalColumnIndex() const
Returns the logical index of the "Total" column or -1 if such a column has not been added (yet)...
Definition: foldertreewidget.h:146
void setDataSize(qint64 s)
Sets the size in bytes of the folder to be displayed in the special "DataSize" column.
Definition: foldertreewidget.cpp:499
virtual QString elidedLabelText(const QFontMetrics &metrics, unsigned int width) const
Returns the label text that has been elided if necessary to fit into the width for the given font met...
Definition: foldertreewidget.cpp:619
void setUnreadCountColor(const QColor &clr)
Sets the color used to display the unread message count in the "Label" column.
Definition: foldertreewidget.cpp:322
bool dataSizeColumnVisible() const
Returns true if the widget contains a "DataSize" column and it's currently visible.
Definition: foldertreewidget.cpp:296
int addUnreadColumn(const QString &headerLabel)
Adds a special "Unread" column to this view and returns its logical index.
Definition: foldertreewidget.cpp:275
void setUnreadCount(int unreadCount)
Sets the unread message count to be displayed in the special "Unread" column.
Definition: foldertreewidget.cpp:453
bool updateChildrenCounts()
Gathers the counts for the children.
Definition: foldertreewidget.cpp:393
bool isColumnHidden(int logicalIndex) const
Returns true if the column specified by logicalIndex is actually hidden.
Definition: treewidget.cpp:207
FolderTreeWidget(QWidget *parent, const char *name=0)
Constructs a FolderTreeWidget instance.
Definition: foldertreewidget.cpp:216
bool totalColumnVisible() const
Returns true if the widget contains a "Total" column and it's currently visible.
Definition: foldertreewidget.cpp:268
FolderType
Folder type information Please note that this list should be kept in the order of items that one want...
Definition: foldertreewidget.h:245
qint64 dataSize() const
Returns the size in bytes of the folder, displayed in the special "DataSize" column.
Definition: foldertreewidget.h:337
void setCloseToQuotaWarningColor(const QColor &clr)
Sets the color used to display the "Label" column text when the item is marked as close to quota...
Definition: foldertreewidget.cpp:316
A basic implementation of an UI for a tree of folders.
QString protocolDescription() const
Returns a descriptive string of the folder's protocol.
Definition: foldertreewidget.cpp:364
Protocol protocol() const
Returns the protocol associated to the folder item.
Definition: foldertreewidget.h:379
int dataSizeColumnIndex() const
Returns the logical index of the "DataSize" column or -1 if such a column has not been added (yet)...
Definition: foldertreewidget.h:165
int childrenTotalCount() const
Returns the total message count for the children.
Definition: foldertreewidget.h:357
const QString & labelText() const
Returns the textual data for the "Label" column of the parent FolderTreeWidget.
Definition: foldertreewidget.h:300
int addColumn(const QString &label, int headerAlignment=Qt::AlignLeft|Qt::AlignVCenter)
Convenience function that adds a column to this tree widget and returns its logical index...
Definition: treewidget.cpp:279
void setIsCloseToQuota(bool closeToQuota)
Sets the status of the close to quota warning.
Definition: foldertreewidget.cpp:557
friend class FolderTreeWidgetItemLabelColumnDelegate
Definition: foldertreewidget.h:75
void renamed(QTreeWidgetItem *item)
This signal is emitted when the label of item has changed after an edition.
#define ITEM_LABEL_TO_UNREADCOUNT_SPACING
Definition: foldertreewidget.cpp:45
FolderTreeWidgetItem(FolderTreeWidget *parent, const QString &label, Protocol protocol, FolderType folderType)
Constructs a root-item.
Definition: foldertreewidget.cpp:334
void setLabelText(const QString &label)
Sets the textual data for the "Label" column of the parent FolderTreeWidget.
Definition: foldertreewidget.cpp:439
virtual bool operator<(const QTreeWidgetItem &other) const
Operator used for item sorting.
Definition: foldertreewidget.cpp:569
void setTotalCount(int totalCount)
Sets the total message count to be displayed in the special "Total" column.
Definition: foldertreewidget.cpp:476
int labelColumnIndex() const
Returns the logical index of the "Label" column or -1 if such a column has not been added (yet)...
Definition: foldertreewidget.h:108
qint64 childrenDataSize() const
Returns the size in bytes of the children folders displayed in the special "DataSize" column...
Definition: foldertreewidget.h:364
void updateColumnForItem(FolderTreeWidgetItem *item, int columnIndex)
Triggers an update for the specified column of the specified item.
Definition: foldertreewidget.cpp:303
void updateExpandedState()
This should be called whenever this item is expanded/collapsed.
Definition: foldertreewidget.cpp:538
bool labelColumnVisible() const
Returns true if the widget contains a "Label" column and it's currently visible.
Definition: foldertreewidget.cpp:254
int addLabelColumn(const QString &headerLabel)
Adds a special "Label" column to this view and returns its logical index.
Definition: foldertreewidget.cpp:244
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:58:36 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:58:36 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.