messagelist
themeeditor.cpp
Go to the documentation of this file.
63 static const char * gThemeContentItemTypeDndMimeDataFormat = "application/x-kmail-messagelistview-theme-contentitem-type";
69 ThemeColumnPropertiesDialog::ThemeColumnPropertiesDialog( QWidget * parent, Theme::Column * column, const QString &title )
95 mMessageSortingCombo->setToolTip( i18n( "The sorting order that clicking on this column header will switch to." ) );
99 mVisibleByDefaultCheck->setToolTip( i18n( "Check this if this column should be visible when the theme is selected." ) );
102 mIsSenderOrReceiverCheck = new QCheckBox( i18n( "Contains \"Sender or Receiver\" field" ), base );
103 mIsSenderOrReceiverCheck->setToolTip( i18n( "Check this if this column label should be updated depending on the folder \"inbound\"/\"outbound\" type." ) );
116 ComboBoxUtils::fillIntegerOptionCombo( mMessageSortingCombo, SortOrder::enumerateMessageSortingOptions( Aggregation::PerfectReferencesAndSubject ) );
138 ThemeContentItemSourceLabel::ThemeContentItemSourceLabel( QWidget * parent, Theme::ContentItem::Type type )
197 mSampleGroupHeaderItem->setSubject( i18n( "Very long subject very long subject very long subject very long subject very long subject very long" ) );
206 mSampleMessageItem->setSubject( i18n( "Very long subject very long subject very long subject very long subject very long subject very long" ) );
211 list.append( new MessageItem::Tag( SmallIcon( QLatin1String( "feed-subscribe" ) ), i18n( "Sample Tag 1" ), QString() ) );
212 list.append( new MessageItem::Tag( SmallIcon( QLatin1String( "feed-subscribe" ) ), i18n( "Sample Tag 2" ), QString() ) );
213 list.append( new MessageItem::Tag( SmallIcon( QLatin1String( "feed-subscribe" ) ), i18n( "Sample Tag 3" ), QString() ) );
344 realWidth = ( ( hintWidth * viewport()->width() ) / totalVisibleWidthHint ) - 2; // -2 is heuristic
429 label += QString::fromLatin1( " (%1)" ).arg( i18nc( "Indicates whether or not a header label is visible", "Visible") );
489 QByteArray arry = e->mimeData()->data(QLatin1String( gThemeContentItemTypeDndMimeDataFormat ) );
530 QByteArray arry = e->mimeData()->data( QLatin1String( gThemeContentItemTypeDndMimeDataFormat ) );
550 const_cast< Theme::Column * >( mDelegate->hitColumn() )->insertMessageRow( mDelegate->hitRowIndex(), row );
552 const_cast< Theme::Column * >( mDelegate->hitColumn() )->insertGroupHeaderRow( mDelegate->hitRowIndex(), row );
560 const_cast< Theme::Column * >( mDelegate->hitColumn() )->insertMessageRow( mDelegate->hitRowIndex()+1, row );
562 const_cast< Theme::Column * >( mDelegate->hitColumn() )->insertGroupHeaderRow( mDelegate->hitRowIndex()+1, row );
590 row->rightItems().indexOf( const_cast< Theme::ContentItem * >( mDelegate->hitContentItem() ) ) : \
611 row->rightItems().indexOf( const_cast< Theme::ContentItem * >( mDelegate->hitContentItem() ) ) : \
650 bool ThemePreviewWidget::computeContentItemInsertPosition( const QPoint &pos, Theme::ContentItem::Type type )
742 // either there were some right items (so the theme delegate knows that the reported item is the closest)
743 // or there were no right items but the position is closest to the left item than the right row end
818 const_cast< Theme::Row * >( mDelegate->hitRow() )->removeRightItem( mSelectedThemeContentItem );
824 if ( mDelegate->hitRow()->rightItems().isEmpty() && mDelegate->hitRow()->leftItems().isEmpty() )
830 const_cast< Theme::Column * >( mDelegate->hitColumn() )->removeMessageRow( const_cast< Theme::Row * >( mDelegate->hitRow() ) );
836 const_cast< Theme::Column * >( mDelegate->hitColumn() )->removeGroupHeaderRow( const_cast< Theme::Row * >( mDelegate->hitRow() ) );
864 mThemeSelectedContentItemRect = mSelectedThemeContentItem ? mDelegate->hitContentItemRect() : QRect();
945 act = childmenu->addAction( i18nc("Hide a mark if the mail does not have the attribute, e.g. Important mark on a non important mail", "Hide") );
950 act = childmenu->addAction( i18nc("Keep a empty space in the list if the mail does not have the attribute, e.g. Important mark on a non important mail", "Keep Empty Space") );
953 act->setChecked( ! ( mSelectedThemeContentItem->softenByBlendingWhenDisabled() || mSelectedThemeContentItem->hideWhenDisabled() ) );
955 act = childmenu->addAction( i18nc("Show the icon softened in the list if the mail does not have the attribute, e.g. Important mark on a non important mail", "Keep Softened Icon") );
956 act->setData( QVariant( static_cast< int >( Theme::ContentItem::SoftenByBlendingWhenDisabled ) ) );
981 act = childmenu->addAction( i18nc("@action:inmenu Group header background color setting", "None") );
986 act = childmenu->addAction( i18nc("@action:inmenu Group header background color setting", "Automatic") );
991 act = childmenu->addAction( i18nc("@action:inmenu Group header background color setting", "Custom...") );
1010 for ( QList< QPair< QString, int > >::ConstIterator it = styles.constBegin(); it != end; ++it )
1015 act->setChecked( mTheme->groupHeaderBackgroundStyle() == static_cast< Theme::GroupHeaderBackgroundStyle >( ( *it ).second ) );
1049 mSelectedThemeContentItem->setHideWhenDisabled( flags == Theme::ContentItem::HideWhenDisabled );
1050 mSelectedThemeContentItem->setSoftenByBlendingWhenDisabled( flags == Theme::ContentItem::SoftenByBlendingWhenDisabled );
1073 const int result = KColorDialog::getColor( clr, mSelectedThemeContentItem->customColor(), this );
1088 mSelectedThemeContentItem->setSoftenByBlending( !mSelectedThemeContentItem->softenByBlending() );
1122 Theme::GroupHeaderBackgroundMode mode = static_cast< Theme::GroupHeaderBackgroundMode >( act->data().toInt( &ok ) );
1153 Theme::GroupHeaderBackgroundStyle mode = static_cast< Theme::GroupHeaderBackgroundStyle >( act->data().toInt( &ok ) );
1369 ThemeContentItemSourceLabel * cil = new ThemeContentItemSourceLabel( gb, Theme::ContentItem::Subject );
1505 l->setText( i18n( "Right click on the header to add or modify columns. Drag the content items and drop them on the columns in order to compose your theme. Right click on the items inside the view for more options." ) );
1565 ComboBoxUtils::setIntegerOptionComboValue( mViewHeaderPolicyCombo, (int)mCurrentTheme->viewHeaderPolicy() );
1588 (Theme::ViewHeaderPolicy)ComboBoxUtils::getIntegerOptionComboValue( mViewHeaderPolicyCombo, 0 )
void customContextMenuRequested(const QPoint &pos)
The ContentItem class defines a content item inside a Row.
Definition: theme.h:73
void setText(const QString &text)
void setFakeTags(const QList< Tag * > &tagList)
Sets a list of fake tags for this item.
Definition: messageitem.cpp:684
QCheckBox * mVisibleByDefaultCheck
Definition: themeeditor.h:67
void slotNameEditTextEdited(const QString &newName)
Definition: themeeditor.cpp:1602
QString & append(QChar ch)
QByteArray data(const QString &mimeType) const
void setMovable(bool movable)
virtual void paintEvent(QPaintEvent *event)
QPoint topRight() const
int width() const
ThemeEditor(QWidget *parent)
Definition: themeeditor.cpp:1353
void setDescription(const QString &description)
Sets the description for this option set.
Definition: optionset.h:94
const QMimeData * mimeData() const
void rawAppendChildItem(Item *child)
Appends a child item without inserting it via the model.
Definition: item.cpp:523
void setReadOnly(bool readOnly)
Definition: optionseteditor.cpp:70
Core::Theme * editedTheme() const
Definition: themeeditor.cpp:1619
void addWidget(QWidget *widget, int row, int column, QFlags< Qt::AlignmentFlag > alignment)
void setMimeData(QMimeData *data)
int right() const
void setIntegerOptionComboValue(KComboBox *combo, int value)
Sets the currently selected option in the specified combo.
Definition: comboboxutils.cpp:59
const QList< ContentItem * > & rightItems() const
Returns the list of right aligned items for this row.
Definition: theme.h:513
void slotFontMenuTriggered(QAction *act)
Definition: themeeditor.cpp:1092
void slotGroupHeaderBackgroundStyleMenuTriggered(QAction *act)
Definition: themeeditor.cpp:1150
SortOrder::MessageSorting messageSorting() const
Returns the sort order for messages that we should switch to when clicking on this column's header (i...
Definition: theme.h:732
ThemePreviewDelegate(QAbstractItemView *parent)
Definition: themeeditor.cpp:188
virtual bool hasFormat(const QString &mimeType) const
void setChecked(bool)
void slotHeaderContextMenuRequested(const QPoint &pos)
Definition: themeeditor.cpp:1189
void mousePressEvent(QMouseEvent *e)
Definition: themeeditor.cpp:154
KLineEdit * nameEdit() const
Returns the editor for the name of the OptionSet.
Definition: optionseteditor.cpp:81
QVariant data() const
QRect hitRowRect() const
Returns the rectangle of the row that was reported as hit by the previous call to hitTest()...
Definition: themedelegate.h:160
void setPixmap(const QPixmap &)
void insertColumn(int idx, Column *column)
Inserts a column to this theme at the specified position.
Definition: theme.cpp:736
The Row class defines a row of items inside a Column.
Definition: theme.h:466
QPoint bottomRight() const
const QPoint & pos() const
QPoint mapToGlobal(const QPoint &pos) const
void setSize(size_t size)
Sets the size of this item (size of the Message, mainly)
Definition: item.cpp:416
const QString & description() const
Returns a description of this option set.
Definition: optionset.h:88
void moveColumn(int idx, int newPosition)
Definition: theme.cpp:746
QPoint bottomLeft() const
void setSoftenByBlendingWhenDisabled(bool softenByBlendingWhenDisabled)
Sets the flag that causes this item to be painted "softly" when disabled.
Definition: theme.h:389
void setAlignment(QFlags< Qt::AlignmentFlag >)
QWidget * viewport() const
QAction * addAction(QAction *action)
This class is an optimizing helper for dealing with large flat QAbstractItemModel objects...
Definition: modelinvariantrowmapper.h:93
void setSubject(const QString &subject)
Sets the subject associated to this Item.
Definition: item.cpp:476
void setGroupHeaderBackgroundMode(GroupHeaderBackgroundMode bm)
Sets the group header background mode for this theme.
Definition: theme.cpp:753
Qt::MouseButtons buttons() const
GroupHeaderBackgroundStyle groupHeaderBackgroundStyle() const
Returns the group header background style for this theme.
Definition: theme.h:1005
void setFrameStyle(int style)
void drawLine(const QLineF &line)
void acceptProposedAction()
bool displaysText() const
Returns true if this item displays some kind of text.
Definition: theme.h:286
QCheckBox * mIsSenderOrReceiverCheck
Definition: themeeditor.h:68
bool isSenderOrReceiver() const
Returns true if this column is marked as "sender/receiver" and we should update its label on-the-fly...
Definition: theme.h:700
~ThemePreviewDelegate()
Definition: themeeditor.cpp:234
bool hideWhenDisabled() const
Returns true if this item should be hidden when in disabled state.
Definition: theme.h:363
void update()
void setVisibleByDefault(bool vbd)
Sets the "visible by default" tag for this column.
Definition: theme.h:719
int x() const
int y() const
The Column class defines a view column available inside this theme.
Definition: theme.h:565
void resizeSection(int logicalIndex, int size)
void setFont(const QFont &font)
Sets the custom font to be used with this item.
Definition: theme.cpp:166
width
void resize(int size)
Qt::DropAction exec(QFlags< Qt::DropAction > supportedActions)
const QColor & customColor() const
Returns the custom color set for this item.
Definition: theme.h:437
const QList< Row * > & messageRows() const
Returns the list of rows visible in this column for a MessageItem.
Definition: theme.h:774
void drawRect(const QRectF &rectangle)
void setFlags(QFlags< Qt::ItemFlag > flags)
bool isValid() const
virtual void showEvent(QShowEvent *event)
int count(const T &value) const
void append(const T &value)
void ignore()
void slotForegroundColorMenuTriggered(QAction *act)
Definition: themeeditor.cpp:1055
void setRowStretch(int row, int stretch)
void accept()
int toInt(bool *ok) const
bool isClickable() const
Returns true if clicking on this kind of item can perform an action.
Definition: theme.h:304
int top() const
virtual void mouseMoveEvent(QMouseEvent *e)
Definition: themeeditor.cpp:785
void setPen(const QColor &color)
Core::Theme::Column * mColumn
Definition: themeeditor.h:65
ThemeColumnPropertiesDialog(QWidget *parent, Core::Theme::Column *column, const QString &title)
Definition: themeeditor.cpp:69
void setEncryptionState(EncryptionState state)
Definition: messageitem.cpp:444
int left() const
Qt::MouseButton button() const
void slotDisabledFlagsMenuTriggered(QAction *act)
Definition: themeeditor.cpp:1039
Item * hitItem() const
Returns the Item that was reported as hit by the previous call to hitTest().
Definition: themedelegate.h:108
ThemePreviewWidget(QWidget *parent)
Definition: themeeditor.cpp:253
bool canUseCustomColor() const
Returns true if this ContentItem can make use of a custom color.
Definition: theme.h:279
bool isEmpty() const
bool isEmpty() const
void setItemDelegate(QAbstractItemDelegate *delegate)
void themeNameChanged()
const Theme::Column * hitColumn() const
Returns the theme column that was reported as hit by the previous call to hitTest().
Definition: themedelegate.h:125
GroupHeaderBackgroundMode
Which color do we use to paint group header background ?
Definition: theme.h:882
void slotAddColumn()
Definition: themeeditor.cpp:1267
The base class for the OptionSet editors.
Definition: optionseteditor.h:45
void setGroupHeaderBackgroundColor(const QColor &clr)
Sets the group header background color for this theme.
Definition: theme.h:997
Core::Theme::ContentItem::Type type() const
Definition: themeeditor.cpp:148
virtual void dragEnterEvent(QDragEnterEvent *e)
Definition: themeeditor.cpp:468
bool contains(const QPoint &point, bool proper) const
void setText(const QString &)
const QList< ContentItem * > & leftItems() const
Returns the list of left aligned items for this row.
Definition: theme.h:482
virtual void mousePressEvent(QMouseEvent *e)
Definition: themeeditor.cpp:852
void hide()
void fillIntegerOptionCombo(KComboBox *combo, const QList< QPair< QString, int > > &optionDescriptors)
Fills the specified KComboBox with the options available in optionDescriptors.
Definition: comboboxutils.cpp:29
QModelIndex parent() const
int hitRowIndex() const
Returns the index of the theme row that was reported as hit by the previous call to hitTest()...
Definition: themedelegate.h:151
const Theme::Row * hitRow() const
Returns the theme row that was reported as hit by the previous call to hitTest(). ...
Definition: themedelegate.h:144
void createModelInvariantIndex(int modelIndexRow, ModelInvariantIndex *invariantToFill)
Binds a ModelInvariantIndex structure to the specified CURRENT modelIndexRow.
Definition: modelinvariantrowmapper.cpp:344
ViewHeaderPolicy viewHeaderPolicy() const
Returns the currently set ViewHeaderPolicy.
Definition: theme.h:1026
void slotSoftenActionTriggered(bool)
Definition: themeeditor.cpp:1083
void setColumnCount(int columns)
void setSignatureState(SignatureState state)
Definition: messageitem.cpp:432
KTextEdit * descriptionEdit() const
Returns the editor for the description of the OptionSet.
Definition: optionseteditor.cpp:76
void slotIconSizeSpinBoxValueChanged(int val)
Definition: themeeditor.cpp:1610
virtual void dropEvent(QDropEvent *e)
Definition: themeeditor.cpp:515
void mouseMoveEvent(QMouseEvent *e)
Definition: themeeditor.cpp:160
void setAcceptDrops(bool on)
void ignore()
void setData(const QVariant &userData)
iterator end()
void startDrag()
Definition: themeeditor.cpp:170
int manhattanLength() const
bool visibleByDefault() const
Returns true if this column has to be shown by default.
Definition: theme.h:713
QRect hitContentItemRect() const
Returns the bounding rect of the content item that was reported as hit by the previous call to hitTes...
Definition: themedelegate.h:193
void setContextMenuPolicy(Qt::ContextMenuPolicy policy)
A single item of the MessageList tree managed by MessageList::Model.
Definition: item.h:52
A message item that can have a fake tag list and a fake annotation.
Definition: messageitem.h:214
bool isValid() const
void setUseCustomColor(bool useCustomColor)
Makes this item use the custom color that can be set by setCustomColor().
Definition: theme.h:341
void setCheckable(bool)
bool hitContentItemRight() const
Returns true if the hit theme content item was a right item and false otherwise.
Definition: themedelegate.h:184
bool hitTest(const QPoint &viewportPoint, bool exact=true)
Performs a hit test on the specified viewport point.
Definition: themedelegate.cpp:1173
void setChecked(bool)
void setHeaderLabels(const QStringList &labels)
GroupHeaderBackgroundMode groupHeaderBackgroundMode() const
Returns the group header background mode for this theme.
Definition: theme.h:977
int logicalIndexAt(int position) const
QTreeWidgetItem * headerItem() const
void setExpanded(bool expand)
int width() const
bool canBeDisabled() const
Returns true if this ContentItem can be in a "disabled" state.
Definition: theme.h:273
void setMessageSorting(SortOrder::MessageSorting ms)
Sets the sort order for messages that we should switch to when clicking on this column's header (if v...
Definition: theme.h:739
void slotColumnProperties()
Definition: themeeditor.cpp:1309
void setColumnStretch(int column, int stretch)
void slotMoveColumnToRight()
Definition: themeeditor.cpp:1256
const Theme::ContentItem * hitContentItem() const
Returns the theme content item that was reported as hit by the previous call to hitTest().
Definition: themedelegate.h:177
Column * column(int idx) const
Returns a pointer to the column at the specified index or 0 if there is no such column.
Definition: theme.h:947
void slotOkButtonClicked()
Definition: themeeditor.cpp:121
void setUseCustomFont(bool useCustomFont)
Makes this item use the custom font that can be set by setCustomFont().
Definition: theme.h:355
static const char * gThemeContentItemTypeDndMimeDataFormat
Definition: themeeditor.cpp:63
void setText(int column, const QString &text)
int bottom() const
QPoint topLeft() const
void setSoftenByBlending(bool softenByBlending)
Sets the flag that causes this item to be painted "softly".
Definition: theme.h:403
void setMaxDate(time_t date)
Sets the maximum date in the subtree originating from this item.
Definition: item.cpp:436
char * data()
void setTheme(const Theme *theme)
Definition: themedelegate.cpp:62
ThemeContentItemSourceLabel(QWidget *parent, Core::Theme::ContentItem::Type type)
Definition: themeeditor.cpp:138
QString fromLatin1(const char *str, int size)
const QList< Row * > & groupHeaderRows() const
Returns the list of rows visible in this column for a GroupHeaderItem.
Definition: theme.h:804
void setTheme(Core::Theme *theme)
Definition: themeeditor.cpp:405
void setReadOnly(bool readOnly)
Definition: themeeditor.cpp:291
virtual void showEvent(QShowEvent *e)
Definition: themeeditor.cpp:454
void insertLeftItem(int idx, ContentItem *item)
Adds a left aligned item at the specified position in this row.
Definition: theme.cpp:268
virtual void mousePressEvent(QMouseEvent *event)
QHeaderView * header() const
QSize sizeHint() const
Definition: themeeditor.cpp:286
~ThemePreviewWidget()
Definition: themeeditor.cpp:282
void slotMoveColumnToLeft()
Definition: themeeditor.cpp:1246
The Theme class defines the visual appearance of the MessageList.
Definition: theme.h:65
void show()
void setData(const QString &mimeType, const QByteArray &data)
const QColor & groupHeaderBackgroundColor() const
Returns the group header background color for this theme.
Definition: theme.h:990
const QPoint & pos() const
void setIsSenderOrReceiver(bool sor)
Marks this column as containing the "sender/receiver" field.
Definition: theme.h:707
void setToolTip(const QString &)
The ThemeDelegate paints the message list view message and group items by using the supplied Theme...
Definition: themedelegate.h:45
const_iterator constEnd() const
const_iterator constBegin() const
bool softenByBlendingWhenDisabled() const
Returns true if this item should be painted in a "soft" fashion when in disabled state.
Definition: theme.h:380
int getIntegerOptionComboValue(KComboBox *combo, int defaultValue)
Returns the identifier of the currently selected option in the specified combo.
Definition: comboboxutils.cpp:71
void setRootIsDecorated(bool show)
void setGroupHeaderBackgroundStyle(GroupHeaderBackgroundStyle groupHeaderBackgroundStyle)
Sets the group header background style for this theme.
Definition: theme.h:1013
bool hitRowIsMessageRow() const
Returns true if the hitRow() is a message row, false otherwise.
Definition: themedelegate.h:167
int size() const
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
virtual void mouseMoveEvent(QMouseEvent *event)
QSize sizeHintForItemTypeAndColumn(Item::Type type, int column, const Item *item=0) const
Returns a heuristic sizeHint() for the specified item type and column.
Definition: themedelegate.cpp:1592
KComboBox * mMessageSortingCombo
Definition: themeeditor.h:69
void setViewHeaderPolicy(ViewHeaderPolicy vhp)
Sets the ViewHeaderPolicy for this theme.
Definition: theme.h:1032
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
~ThemeContentItemSourceLabel()
Definition: themeeditor.cpp:144
iterator begin()
void setWordWrap(bool on)
KLineEdit * mNameEdit
Definition: themeeditor.h:66
void setEnabled(bool)
bool softenByBlending() const
Returns true if this item should be always painted in a "soft" fashion.
Definition: theme.h:396
void insertRightItem(int idx, ContentItem *item)
Adds a right aligned item at the specified position in this row.
Definition: theme.cpp:278
virtual void dragMoveEvent(QDragMoveEvent *e)
Definition: themeeditor.cpp:502
void setHideWhenDisabled(bool hideWhenDisabled)
Sets the flag that causes this item to be hidden when disabled.
Definition: theme.h:372
virtual void paintEvent(QPaintEvent *e)
Definition: themeeditor.cpp:1163
void slotDeleteColumn()
Definition: themeeditor.cpp:1329
void slotGroupHeaderBackgroundModeMenuTriggered(QAction *act)
Definition: themeeditor.cpp:1119
void setReceiver(const QString &receiver)
Sets the sender associated to this item.
Definition: item.cpp:456
const QList< Column * > & columns() const
Returns the list of columns available in this theme.
Definition: theme.h:941
virtual Core::Item * itemFromIndex(const QModelIndex &index) const
Returns the Item for the specified model index.
Definition: themeeditor.cpp:241
void setSender(const QString &sender)
Sets the sender associated to this item.
Definition: item.cpp:446
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
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.