• 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
sortorder.h
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  * Copyright 2009 Thomas McGuire <mcguire@kde.org>
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 #ifndef __MESSAGELIST_CORE_SORTORDER_H__
21 #define __MESSAGELIST_CORE_SORTORDER_H__
22 
23 #include <messagelist/core/aggregation.h>
24 
25 #include <KConfigGroup>
26 
27 namespace MessageList
28 {
29 
30 namespace Core
31 {
32 
37 class SortOrder
38 {
39  Q_GADGET
40  Q_ENUMS( GroupSorting )
41  Q_ENUMS( SortDirection )
42  Q_ENUMS( MessageSorting )
43 
44  public:
45 
51  enum GroupSorting
52  {
53  NoGroupSorting,
54  SortGroupsByDateTime,
55  SortGroupsByDateTimeOfMostRecent,
56  SortGroupsBySenderOrReceiver,
57  SortGroupsBySender,
58  SortGroupsByReceiver
59  // Never add enum entries in the middle: always add them at the end (numeric values are stored in configuration)
60  };
61 
67  enum SortDirection
68  {
69  Ascending,
70  Descending
71  };
72 
78  enum MessageSorting
79  {
80  NoMessageSorting,
81  SortMessagesByDateTime,
82  SortMessagesByDateTimeOfMostRecent,
83  SortMessagesBySenderOrReceiver,
84  SortMessagesBySender,
85  SortMessagesByReceiver,
86  SortMessagesBySubject,
87  SortMessagesBySize,
88  SortMessagesByActionItemStatus,
89  SortMessagesByUnreadStatus,
90  SortMessagesByImportantStatus
91  // Warning: Never add enum entries in the middle: always add them at the end (numeric values are stored in configuration)
92  };
93 
94  explicit SortOrder();
95 
99  GroupSorting groupSorting() const
100  { return mGroupSorting; }
101 
107  void setGroupSorting( GroupSorting gs )
108  { mGroupSorting = gs; }
109 
113  SortDirection groupSortDirection() const
114  { return mGroupSortDirection; }
115 
120  void setGroupSortDirection( SortDirection groupSortDirection )
121  { mGroupSortDirection = groupSortDirection; }
122 
126  MessageSorting messageSorting() const
127  { return mMessageSorting; }
128 
132  void setMessageSorting( MessageSorting ms )
133  { mMessageSorting = ms; }
134 
138  SortDirection messageSortDirection() const
139  { return mMessageSortDirection; }
140 
145  void setMessageSortDirection( SortDirection messageSortDirection )
146  { mMessageSortDirection = messageSortDirection; }
147 
153  static QList< QPair< QString, int > > enumerateMessageSortingOptions( Aggregation::Threading t );
154 
161  static QList< QPair< QString, int > > enumerateMessageSortDirectionOptions( MessageSorting ms );
162 
169  static QList< QPair< QString, int > > enumerateGroupSortingOptions( Aggregation::Grouping g );
170 
177  static QList< QPair< QString, int > > enumerateGroupSortDirectionOptions( Aggregation::Grouping g,
178  GroupSorting groupSorting );
179 
185  bool validForAggregation( const Aggregation *aggregation ) const;
186 
193  static SortOrder defaultForAggregation( const Aggregation *aggregation,
194  const SortOrder &oldSortOrder );
195 
199  static bool isValidMessageSorting( SortOrder::MessageSorting ms );
200 
209  void readConfig( KConfigGroup &conf, const QString &storageId,
210  bool *storageUsesPrivateSortOrder );
211 
218  void writeConfig( KConfigGroup &conf, const QString &storageId,
219  bool storageUsesPrivateSortOrder ) const;
220 
221  private:
222 
223  // Helper function to convert an enum value to a string and back
224  static const QString nameForSortDirection( SortDirection sortDirection );
225  static const QString nameForMessageSorting( MessageSorting messageSorting );
226  static const QString nameForGroupSorting( GroupSorting groupSorting );
227  static SortDirection sortDirectionForName( const QString& name );
228  static MessageSorting messageSortingForName( const QString& name );
229  static GroupSorting groupSortingForName( const QString& name );
230 
231  bool readConfigHelper( KConfigGroup &conf, const QString &id );
232 
233  MessageSorting mMessageSorting;
234  SortDirection mMessageSortDirection;
235  GroupSorting mGroupSorting;
236  SortDirection mGroupSortDirection;
237 };
238 
239 } // namespace Core
240 
241 } // namespace MessageList
242 
243 #endif // __MESSAGELIST_CORE_SORTORDER_H__
MessageList::Core::SortOrder::SortMessagesByDateTimeOfMostRecent
Sort the messages by date and time of the most recent message in subtree.
Definition: sortorder.h:82
MessageList::Core::SortOrder
A class which holds information about sorting, e.g.
Definition: sortorder.h:37
MessageList::Core::SortOrder::SortMessagesBySubject
Sort the messages by subject.
Definition: sortorder.h:86
MessageList::Core::SortOrder::SortOrder
SortOrder()
Definition: sortorder.cpp:30
MessageList::Core::Aggregation
A set of aggregation options that can be applied to the MessageList::Model in a single shot...
Definition: aggregation.h:43
MessageList::Core::SortOrder::SortGroupsByDateTime
Sort groups by date/time of the group.
Definition: sortorder.h:54
MessageList::Core::SortOrder::isValidMessageSorting
static bool isValidMessageSorting(SortOrder::MessageSorting ms)
Returns true if the ms parameter specifies a valid MessageSorting option.
Definition: sortorder.cpp:266
MessageList::Core::Aggregation::Threading
Threading
The available threading methods.
Definition: aggregation.h:83
MessageList::Core::SortOrder::setGroupSortDirection
void setGroupSortDirection(SortDirection groupSortDirection)
Sets the SortDirection for the groups.
Definition: sortorder.h:120
MessageList::Core::SortOrder::SortGroupsByReceiver
Sort groups by receiver (makes sense only with GroupByReceiver)
Definition: sortorder.h:58
MessageList::Core::SortOrder::SortDirection
SortDirection
The "generic" sort direction: used for groups and for messages If you add values here please look at ...
Definition: sortorder.h:67
MessageList::Core::SortOrder::SortMessagesByReceiver
Sort the messages by receiver.
Definition: sortorder.h:85
MessageList::Core::SortOrder::writeConfig
void writeConfig(KConfigGroup &conf, const QString &storageId, bool storageUsesPrivateSortOrder) const
Writes the sort order to a config group.
Definition: sortorder.cpp:243
MessageList::Core::SortOrder::NoGroupSorting
Don't sort the groups at all, add them as they come in.
Definition: sortorder.h:53
MessageList::Core::SortOrder::enumerateMessageSortDirectionOptions
static QList< QPair< QString, int > > enumerateMessageSortDirectionOptions(MessageSorting ms)
Enumerates the available message sorting directions for the specified MessageSorting option...
Definition: sortorder.cpp:56
MessageList::Core::SortOrder::messageSorting
MessageSorting messageSorting() const
Returns the current message sorting option.
Definition: sortorder.h:126
MessageList::Core::SortOrder::messageSortDirection
SortDirection messageSortDirection() const
Returns the current message SortDirection.
Definition: sortorder.h:138
MessageList::Core::SortOrder::MessageSorting
MessageSorting
The available message sorting options.
Definition: sortorder.h:78
aggregation.h
MessageList::Core::SortOrder::enumerateGroupSortDirectionOptions
static QList< QPair< QString, int > > enumerateGroupSortDirectionOptions(Aggregation::Grouping g, GroupSorting groupSorting)
Enumerates the group sort direction options compatible with the specified Grouping and GroupSorting...
Definition: sortorder.cpp:100
MessageList::Core::SortOrder::Descending
Definition: sortorder.h:70
MessageList::Core::SortOrder::SortMessagesBySender
Sort the messages by sender.
Definition: sortorder.h:84
MessageList::Core::SortOrder::SortGroupsBySender
Sort groups by sender (makes sense only with GroupBySender)
Definition: sortorder.h:57
MessageList::Core::SortOrder::defaultForAggregation
static SortOrder defaultForAggregation(const Aggregation *aggregation, const SortOrder &oldSortOrder)
Returns the default sort order for the given aggregation.
Definition: sortorder.cpp:154
MessageList::Core::SortOrder::readConfig
void readConfig(KConfigGroup &conf, const QString &storageId, bool *storageUsesPrivateSortOrder)
Reads the sort order from a config group.
Definition: sortorder.cpp:230
MessageList::Core::Aggregation::Grouping
Grouping
Message grouping.
Definition: aggregation.h:52
MessageList::Core::SortOrder::NoMessageSorting
Don't sort the messages at all.
Definition: sortorder.h:80
MessageList::Core::SortOrder::groupSortDirection
SortDirection groupSortDirection() const
Returns the current group SortDirection.
Definition: sortorder.h:113
MessageList::Core::SortOrder::setMessageSortDirection
void setMessageSortDirection(SortDirection messageSortDirection)
Sets the SortDirection for the message.
Definition: sortorder.h:145
MessageList::Core::SortOrder::GroupSorting
GroupSorting
How to sort the groups If you add values here please look at the implementations of the enumerate* fu...
Definition: sortorder.h:51
MessageList::Core::SortOrder::SortMessagesBySenderOrReceiver
Sort the messages by sender or receiver.
Definition: sortorder.h:83
MessageList::Core::SortOrder::Ascending
Definition: sortorder.h:69
MessageList::Core::SortOrder::SortMessagesByImportantStatus
Sort the messages By "Important" flags of status.
Definition: sortorder.h:90
MessageList::Core::SortOrder::groupSorting
GroupSorting groupSorting() const
Returns the GroupSorting.
Definition: sortorder.h:99
MessageList::Core::SortOrder::enumerateMessageSortingOptions
static QList< QPair< QString, int > > enumerateMessageSortingOptions(Aggregation::Threading t)
Enumerates the message sorting options compatible with the specified Threading setting.
Definition: sortorder.cpp:38
MessageList::Core::SortOrder::setGroupSorting
void setGroupSorting(GroupSorting gs)
Sets the GroupSorting option.
Definition: sortorder.h:107
MessageList::Core::SortOrder::SortGroupsBySenderOrReceiver
Sort groups by sender or receiver (makes sense only with GroupBySenderOrReceiver) ...
Definition: sortorder.h:56
MessageList::Core::SortOrder::SortMessagesByUnreadStatus
Sort the messages by the "Unread" flags of status.
Definition: sortorder.h:89
MessageList::Core::SortOrder::SortMessagesBySize
Sort the messages by size.
Definition: sortorder.h:87
MessageList::Core::SortOrder::SortMessagesByDateTime
Sort the messages by date and time.
Definition: sortorder.h:81
MessageList::Core::SortOrder::setMessageSorting
void setMessageSorting(MessageSorting ms)
Sets the current message sorting option.
Definition: sortorder.h:132
MessageList::Core::SortOrder::SortMessagesByActionItemStatus
Sort the messages by the "Action Item" flag of status.
Definition: sortorder.h:88
MessageList::Core::SortOrder::validForAggregation
bool validForAggregation(const Aggregation *aggregation) const
Checks if this sort order can be used in combination with the given aggregation.
Definition: sortorder.cpp:133
MessageList::Core::SortOrder::SortGroupsByDateTimeOfMostRecent
Sort groups by date/time of the most recent message.
Definition: sortorder.h:55
MessageList::Core::SortOrder::enumerateGroupSortingOptions
static QList< QPair< QString, int > > enumerateGroupSortingOptions(Aggregation::Grouping g)
Enumerates the group sorting options compatible with the specified Grouping.
Definition: sortorder.cpp:78
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