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

mailcommon

  • sources
  • kde-4.14
  • kdepim
  • mailcommon
  • tag
tag.h
Go to the documentation of this file.
1 /* Copyright 2010 Thomas McGuire <mcguire@kde.org>
2 
3  This program is free software; you can redistribute it and/or
4  modify it under the terms of the GNU General Public License as
5  published by the Free Software Foundation; either version 2 of
6  the License or (at your option) version 3 or any later version
7  accepted by the membership of KDE e.V. (or its successor approved
8  by the membership of KDE e.V.), which shall act as a proxy
9  defined in Section 14 of version 3 of the license.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19 #ifndef MAILCOMMONTAG_H
20 #define MAILCOMMONTAG_H
21 
22 #include "mailcommon_export.h"
23 
24 #include <KShortcut>
25 
26 #include <QColor>
27 #include <QFont>
28 #include <QSharedPointer>
29 #include <QUrl>
30 #include <akonadi/tag.h>
31 
32 namespace MailCommon {
33 
34 // Our own copy of the tag data.
35 // Useful in the config dialog, because the user might cancel his changes,
36 // in which case we don't write them back.
37 // Also used as a convenience class in the TagActionManager.
38 class MAILCOMMON_EXPORT Tag
39 {
40  Q_GADGET
41 public:
42 
43  typedef QSharedPointer<Tag> Ptr;
44  enum SaveFlag {
45  TextColor = 1,
46  BackgroundColor = 1 << 1,
47  Font = 1 << 2
48  };
49  typedef QFlags<SaveFlag> SaveFlags;
50 
51  // Returns true if two tags are equal
52  bool operator==( const Tag &other ) const;
53 
54  bool operator!=( const Tag &other ) const;
55 
56  static Ptr createDefaultTag( const QString &name );
57  // expects a tag with all attributes fetched
58  static Ptr fromAkonadi( const Akonadi::Tag &tag );
59 
60  Akonadi::Tag saveToAkonadi( SaveFlags saveFlags ) const;
61 
62  // Compare, based on priority
63  static bool compare( Ptr &tag1, Ptr &tag2 );
64  // Compare, based on name
65  static bool compareName( Ptr &tag1, Ptr &tag2 );
66 
67  qint64 id() const;
68  QString name() const;
69  Akonadi::Tag tag() const;
70 
71  QString tagName;
72  QColor textColor;
73  QColor backgroundColor;
74  QFont textFont;
75  QString iconName;
76  KShortcut shortcut;
77  bool inToolbar;
78  bool isImmutable;
79  // Priority, i.e. sort order of the tag. Only used when loading the tag, when saving
80  // the priority is set to the position in the list widget
81  int priority;
82 
83 private:
84  Tag()
85  : inToolbar(false),
86  isImmutable(false),
87  priority(0)
88  {
89  }
90  Akonadi::Tag mTag;
91 };
92 Q_DECLARE_OPERATORS_FOR_FLAGS(Tag::SaveFlags)
93 
94 }
95 
96 #endif
QFont
MailCommon::Tag::isImmutable
bool isImmutable
Definition: tag.h:78
MailCommon::Tag::SaveFlag
SaveFlag
Definition: tag.h:44
id
SearchRule::Function id
Definition: daterulewidgethandler.cpp:34
QFlags
QSharedPointer
Definition: collectiongeneralpage.h:30
MailCommon::Tag::SaveFlags
QFlags< SaveFlag > SaveFlags
Definition: tag.h:49
mailcommon_export.h
MailCommon::Tag
Definition: tag.h:38
MailCommon::Tag::shortcut
KShortcut shortcut
Definition: tag.h:76
QString
QColor
MailCommon::Tag::priority
int priority
Definition: tag.h:81
MAILCOMMON_EXPORT
#define MAILCOMMON_EXPORT
Definition: mailcommon_export.h:35
MailCommon::Tag::iconName
QString iconName
Definition: tag.h:75
MailCommon::Tag::tagName
QString tagName
Definition: tag.h:71
MailCommon::Tag::backgroundColor
QColor backgroundColor
Definition: tag.h:73
MailCommon::Tag::textColor
QColor textColor
Definition: tag.h:72
MailCommon::Tag::Ptr
QSharedPointer< Tag > Ptr
Definition: tag.h:43
MailCommon::Tag::inToolbar
bool inToolbar
Definition: tag.h:77
MailCommon::Tag::textFont
QFont textFont
Definition: tag.h:74
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:31:41 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

mailcommon

Skip menu "mailcommon"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

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