• 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
  • utils
themeeditor.h
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  * Copyright 2008 Szymon Tomasz Stefanek <pragma@kvirc.net>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  *
19  *******************************************************************************/
20 
21 #ifndef __MESSAGELIST_UTILS_THEMEEDITOR_H__
22 #define __MESSAGELIST_UTILS_THEMEEDITOR_H__
23 
24 #include <messagelist/utils/optionseteditor.h>
25 #include <messagelist/core/themedelegate.h>
26 #include <messagelist/core/theme.h>
27 
28 #include <QTreeWidget>
29 #include <QLabel>
30 #include <QRect>
31 
32 #include <KDialog>
33 
34 class QPaintDevice;
35 class QCheckBox;
36 
37 class KComboBox;
38 class KIntSpinBox;
39 class KLineEdit;
40 
41 namespace MessageList
42 {
43 
44 namespace Core
45 {
46 
47 class Item;
48 class GroupHeaderItem;
49 class MessageItem;
50 class FakeItem;
51 class ModelInvariantRowMapper;
52 
53 } // namespace Core
54 
55 namespace Utils
56 {
57 
58 class ThemeColumnPropertiesDialog : public KDialog
59 {
60  Q_OBJECT
61 public:
62  explicit ThemeColumnPropertiesDialog( QWidget * parent, Core::Theme::Column * column, const QString &title );
63 
64 protected:
65  Core::Theme::Column * mColumn;
66  KLineEdit * mNameEdit;
67  QCheckBox * mVisibleByDefaultCheck;
68  QCheckBox * mIsSenderOrReceiverCheck;
69  KComboBox * mMessageSortingCombo;
70 
71 protected slots:
72  void slotOkButtonClicked();
73 };
74 
75 class ThemePreviewDelegate : public Core::ThemeDelegate
76 {
77  Q_OBJECT
78 public:
79  explicit ThemePreviewDelegate( QAbstractItemView * parent );
80  ~ThemePreviewDelegate();
81 
82 private:
83  Core::GroupHeaderItem * mSampleGroupHeaderItem;
84  Core::FakeItem * mSampleMessageItem;
85  Core::ModelInvariantRowMapper * mRowMapper; // needed for the MessageItem above to be valid
86 public:
87  virtual Core::Item * itemFromIndex( const QModelIndex &index ) const;
88 };
89 
90 class ThemePreviewWidget : public QTreeWidget
91 {
92  Q_OBJECT
93 public:
94  explicit ThemePreviewWidget( QWidget * parent );
95  ~ThemePreviewWidget();
96  void setReadOnly( bool readOnly);
97 
98 private:
99  // DnD insert position stuff
100 
104  enum RowInsertPosition
105  {
106  AboveRow,
107  InsideRow,
108  BelowRow
109  };
110 
114  enum ItemInsertPosition
115  {
116  OnLeftOfItem,
117  OnRightOfItem,
118  AsLastLeftItem,
119  AsLastRightItem,
120  AsFirstLeftItem,
121  AsFirstRightItem
122  };
123 
124 private:
125  ThemePreviewDelegate * mDelegate;
126  QTreeWidgetItem * mGroupHeaderSampleItem;
127  QRect mThemeSelectedContentItemRect;
128  Core::Theme::ContentItem * mSelectedThemeContentItem;
129  Core::Theme::Column * mSelectedThemeColumn;
130  QPoint mMouseDownPoint;
131  Core::Theme * mTheme;
132  RowInsertPosition mRowInsertPosition;
133  ItemInsertPosition mItemInsertPosition;
134  QPoint mDropIndicatorPoint1;
135  QPoint mDropIndicatorPoint2;
136  bool mFirstShow;
137  bool mReadOnly;
138 public:
139  QSize sizeHint() const;
140  void setTheme( Core::Theme * theme );
141 
142 protected:
143  virtual void dragMoveEvent( QDragMoveEvent * e );
144  virtual void dragEnterEvent( QDragEnterEvent * e );
145  virtual void dropEvent( QDropEvent * e );
146  virtual void mouseMoveEvent( QMouseEvent * e );
147  virtual void mousePressEvent( QMouseEvent * e );
148  virtual void paintEvent( QPaintEvent * e );
149  virtual void showEvent( QShowEvent * e );
150 
151 private:
152  void internalHandleDragMoveEvent( QDragMoveEvent * e );
153  void internalHandleDragEnterEvent( QDragEnterEvent * e );
154 
161  bool computeContentItemInsertPosition( const QPoint &pos, Core::Theme::ContentItem::Type type );
162 
163  void applyThemeColumnWidths();
164 
165 protected slots:
166  void slotHeaderContextMenuRequested( const QPoint &pos );
167  void slotAddColumn();
168  void slotColumnProperties();
169  void slotDeleteColumn();
170  void slotDisabledFlagsMenuTriggered( QAction * act );
171  void slotForegroundColorMenuTriggered( QAction * act );
172  void slotFontMenuTriggered( QAction * act );
173  void slotSoftenActionTriggered( bool );
174  void slotGroupHeaderBackgroundModeMenuTriggered( QAction * act );
175  void slotGroupHeaderBackgroundStyleMenuTriggered( QAction * act );
176  void slotMoveColumnToLeft();
177  void slotMoveColumnToRight();
178 
179 };
180 
181 class ThemeContentItemSourceLabel : public QLabel
182 {
183  Q_OBJECT
184 public:
185  ThemeContentItemSourceLabel( QWidget * parent, Core::Theme::ContentItem::Type type );
186  ~ThemeContentItemSourceLabel();
187 
188 public:
189  Core::Theme::ContentItem::Type type() const;
190  void startDrag();
191 
192 protected:
193  void mousePressEvent( QMouseEvent * e );
194  void mouseMoveEvent( QMouseEvent * e );
195 
196 private:
197  Core::Theme::ContentItem::Type mType;
198  QPoint mMousePressPoint;
199 };
200 
201 
202 class ThemeEditor : public OptionSetEditor
203 {
204  Q_OBJECT
205 public:
206  explicit ThemeEditor( QWidget *parent );
207  ~ThemeEditor();
208 
209 public:
215  void editTheme( Core::Theme *set );
216 
217  Core::Theme * editedTheme() const;
218 
219  void commit();
220 signals:
221  void themeNameChanged();
222 
223 private:
224  void fillViewHeaderPolicyCombo();
225 
226 protected slots:
227  void slotNameEditTextEdited( const QString &newName );
228  void slotIconSizeSpinBoxValueChanged( int val );
229 
230 private:
231  void setReadOnly( bool readOnly );
232 
233  Core::Theme * mCurrentTheme; // shallow, may be null!
234 
235  // Appearance tab
236  ThemePreviewWidget * mPreviewWidget;
237 
238  // Advanced tab
239  KComboBox * mViewHeaderPolicyCombo;
240  KIntSpinBox * mIconSizeSpinBox;
241 };
242 
243 } // namespace Utils
244 
245 } // namespace MessageList
246 
247 #endif
MessageList::Core::Theme::ContentItem
The ContentItem class defines a content item inside a Row.
Definition: theme.h:73
MessageList::Utils::ThemeColumnPropertiesDialog::mVisibleByDefaultCheck
QCheckBox * mVisibleByDefaultCheck
Definition: themeeditor.h:67
optionseteditor.h
MessageList::Utils::ThemePreviewWidget
Definition: themeeditor.h:90
MessageList::Utils::ThemeEditor::slotNameEditTextEdited
void slotNameEditTextEdited(const QString &newName)
Definition: themeeditor.cpp:1602
MessageList::Core::GroupHeaderItem
Definition: groupheaderitem.h:34
MessageList::Utils::ThemeEditor::ThemeEditor
ThemeEditor(QWidget *parent)
Definition: themeeditor.cpp:1353
MessageList::Utils::ThemeEditor::editedTheme
Core::Theme * editedTheme() const
Definition: themeeditor.cpp:1619
QTreeWidget
MessageList::Utils::ThemePreviewWidget::slotFontMenuTriggered
void slotFontMenuTriggered(QAction *act)
Definition: themeeditor.cpp:1092
MessageList::Utils::ThemePreviewWidget::slotGroupHeaderBackgroundStyleMenuTriggered
void slotGroupHeaderBackgroundStyleMenuTriggered(QAction *act)
Definition: themeeditor.cpp:1150
MessageList::Utils::ThemePreviewDelegate::ThemePreviewDelegate
ThemePreviewDelegate(QAbstractItemView *parent)
Definition: themeeditor.cpp:188
MessageList::Utils::ThemePreviewWidget::slotHeaderContextMenuRequested
void slotHeaderContextMenuRequested(const QPoint &pos)
Definition: themeeditor.cpp:1189
MessageList::Utils::ThemeContentItemSourceLabel::mousePressEvent
void mousePressEvent(QMouseEvent *e)
Definition: themeeditor.cpp:154
MessageList::Utils::ThemeEditor::editTheme
void editTheme(Core::Theme *set)
Sets the option set to be edited.
Definition: themeeditor.cpp:1550
QWidget
theme.h
MessageList::Core::ModelInvariantRowMapper
This class is an optimizing helper for dealing with large flat QAbstractItemModel objects...
Definition: modelinvariantrowmapper.h:93
KDialog
MessageList::Utils::ThemeEditor::commit
void commit()
Definition: themeeditor.cpp:1579
MessageList::Utils::ThemeColumnPropertiesDialog::mIsSenderOrReceiverCheck
QCheckBox * mIsSenderOrReceiverCheck
Definition: themeeditor.h:68
MessageList::Utils::ThemePreviewDelegate::~ThemePreviewDelegate
~ThemePreviewDelegate()
Definition: themeeditor.cpp:234
MessageList::Core::Theme::Column
The Column class defines a view column available inside this theme.
Definition: theme.h:564
MessageList::Utils::ThemePreviewWidget::slotForegroundColorMenuTriggered
void slotForegroundColorMenuTriggered(QAction *act)
Definition: themeeditor.cpp:1055
MessageList::Utils::ThemeEditor::~ThemeEditor
~ThemeEditor()
Definition: themeeditor.cpp:1546
MessageList::Utils::ThemePreviewWidget::mouseMoveEvent
virtual void mouseMoveEvent(QMouseEvent *e)
Definition: themeeditor.cpp:785
MessageList::Utils::ThemeColumnPropertiesDialog::mColumn
Core::Theme::Column * mColumn
Definition: themeeditor.h:65
MessageList::Utils::ThemeColumnPropertiesDialog::ThemeColumnPropertiesDialog
ThemeColumnPropertiesDialog(QWidget *parent, Core::Theme::Column *column, const QString &title)
Definition: themeeditor.cpp:69
MessageList::Utils::ThemePreviewWidget::slotDisabledFlagsMenuTriggered
void slotDisabledFlagsMenuTriggered(QAction *act)
Definition: themeeditor.cpp:1039
MessageList::Utils::ThemePreviewWidget::ThemePreviewWidget
ThemePreviewWidget(QWidget *parent)
Definition: themeeditor.cpp:253
MessageList::Utils::ThemeEditor::themeNameChanged
void themeNameChanged()
MessageList::Utils::ThemePreviewWidget::slotAddColumn
void slotAddColumn()
Definition: themeeditor.cpp:1267
MessageList::Utils::OptionSetEditor
The base class for the OptionSet editors.
Definition: optionseteditor.h:45
MessageList::Utils::ThemeContentItemSourceLabel::type
Core::Theme::ContentItem::Type type() const
Definition: themeeditor.cpp:148
MessageList::Utils::ThemePreviewWidget::dragEnterEvent
virtual void dragEnterEvent(QDragEnterEvent *e)
Definition: themeeditor.cpp:468
MessageList::Utils::ThemePreviewWidget::mousePressEvent
virtual void mousePressEvent(QMouseEvent *e)
Definition: themeeditor.cpp:852
MessageList::Core::Theme::ContentItem::Type
Type
The available ContentItem types.
Definition: theme.h:125
MessageList::Utils::ThemePreviewWidget::slotSoftenActionTriggered
void slotSoftenActionTriggered(bool)
Definition: themeeditor.cpp:1083
MessageList::Utils::ThemeEditor::slotIconSizeSpinBoxValueChanged
void slotIconSizeSpinBoxValueChanged(int val)
Definition: themeeditor.cpp:1610
MessageList::Utils::ThemePreviewWidget::dropEvent
virtual void dropEvent(QDropEvent *e)
Definition: themeeditor.cpp:515
MessageList::Utils::ThemeContentItemSourceLabel::mouseMoveEvent
void mouseMoveEvent(QMouseEvent *e)
Definition: themeeditor.cpp:160
MessageList::Utils::ThemeContentItemSourceLabel::startDrag
void startDrag()
Definition: themeeditor.cpp:170
MessageList::Core::Item
A single item of the MessageList tree managed by MessageList::Model.
Definition: item.h:52
MessageList::Core::FakeItem
A message item that can have a fake tag list and a fake annotation.
Definition: messageitem.h:218
MessageList::Utils::ThemePreviewWidget::slotColumnProperties
void slotColumnProperties()
Definition: themeeditor.cpp:1309
MessageList::Utils::ThemePreviewWidget::slotMoveColumnToRight
void slotMoveColumnToRight()
Definition: themeeditor.cpp:1256
MessageList::Utils::ThemeColumnPropertiesDialog::slotOkButtonClicked
void slotOkButtonClicked()
Definition: themeeditor.cpp:121
themedelegate.h
QLabel
KComboBox
MessageList::Utils::ThemeColumnPropertiesDialog
Definition: themeeditor.h:58
MessageList::Utils::ThemeContentItemSourceLabel::ThemeContentItemSourceLabel
ThemeContentItemSourceLabel(QWidget *parent, Core::Theme::ContentItem::Type type)
Definition: themeeditor.cpp:138
MessageList::Utils::ThemePreviewWidget::setTheme
void setTheme(Core::Theme *theme)
Definition: themeeditor.cpp:405
MessageList::Utils::ThemePreviewWidget::setReadOnly
void setReadOnly(bool readOnly)
Definition: themeeditor.cpp:291
MessageList::Utils::ThemePreviewWidget::showEvent
virtual void showEvent(QShowEvent *e)
Definition: themeeditor.cpp:454
MessageList::Utils::ThemePreviewWidget::sizeHint
QSize sizeHint() const
Definition: themeeditor.cpp:286
MessageList::Utils::ThemePreviewWidget::~ThemePreviewWidget
~ThemePreviewWidget()
Definition: themeeditor.cpp:282
MessageList::Utils::ThemePreviewWidget::slotMoveColumnToLeft
void slotMoveColumnToLeft()
Definition: themeeditor.cpp:1246
MessageList::Core::Theme
The Theme class defines the visual appearance of the MessageList.
Definition: theme.h:65
MessageList::Core::ThemeDelegate
The ThemeDelegate paints the message list view message and group items by using the supplied Theme...
Definition: themedelegate.h:45
MessageList::Utils::ThemeColumnPropertiesDialog::mMessageSortingCombo
KComboBox * mMessageSortingCombo
Definition: themeeditor.h:69
MessageList::Utils::ThemeContentItemSourceLabel
Definition: themeeditor.h:181
MessageList::Utils::ThemeContentItemSourceLabel::~ThemeContentItemSourceLabel
~ThemeContentItemSourceLabel()
Definition: themeeditor.cpp:144
MessageList::Utils::ThemeEditor
Definition: themeeditor.h:202
MessageList::Utils::ThemeColumnPropertiesDialog::mNameEdit
KLineEdit * mNameEdit
Definition: themeeditor.h:66
MessageList::Utils::ThemePreviewWidget::dragMoveEvent
virtual void dragMoveEvent(QDragMoveEvent *e)
Definition: themeeditor.cpp:502
MessageList::Utils::ThemePreviewWidget::paintEvent
virtual void paintEvent(QPaintEvent *e)
Definition: themeeditor.cpp:1163
MessageList::Utils::ThemePreviewWidget::slotDeleteColumn
void slotDeleteColumn()
Definition: themeeditor.cpp:1329
MessageList::Utils::ThemePreviewDelegate
Definition: themeeditor.h:75
MessageList::Utils::ThemePreviewWidget::slotGroupHeaderBackgroundModeMenuTriggered
void slotGroupHeaderBackgroundModeMenuTriggered(QAction *act)
Definition: themeeditor.cpp:1119
MessageList::Utils::ThemePreviewDelegate::itemFromIndex
virtual Core::Item * itemFromIndex(const QModelIndex &index) const
Returns the Item for the specified model index.
Definition: themeeditor.cpp:241
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