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

kmail

kmmessagetag.h

Go to the documentation of this file.
00001 /*
00002  * kmail: KDE mail client
00003  * Copyright (c) 2007 Ismail Onur Filiz <onurf@su.sabanciuniv.edu>
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation; either version 2 of the License, or
00008  * (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00018  *
00019  */
00027 #ifndef KMMESSAGETAG_H
00028 #define KMMESSAGETAG_H
00029 
00030 #include <QObject>
00031 #include <QHash>
00032 #include <QColor>
00033 #include <QString>
00034 #include <QStringList>
00035 #include <QFont>
00036 #include <QList>
00037 
00038 #include <KShortcut>
00039 class KConfigGroup;
00040 
00043 class KMMessageTagDescription
00044 {
00045   /*Label and priority are not that commonly used, might be able to remove later*/
00046   public:
00053     explicit KMMessageTagDescription( const KConfigGroup &aGroup );
00054 
00069     KMMessageTagDescription( const QString &aLabel, const QString &aName,
00070                   const int aPriority = -1,
00071                   const QColor &aTextColor = QColor(),
00072                   const QColor &aBackgroundColor = QColor(),
00073                   const QFont &aTextFont = QFont(),
00074                   const bool aInToolbar = false,
00075                   const QString &aIconName = "feed-subscribe",
00076                   const KShortcut &aShortcut = KShortcut() );
00077 
00079     const QString label() const { return mLabel; }
00080     const QString name() const { return mName; }
00081     int priority() const { return mPriority; }
00082     const QColor textColor() const { return mTextColor; }
00083     const QColor backgroundColor() const { return mBackgroundColor; }
00084     const QFont textFont() const { return mTextFont; }
00085     bool inToolbar() const { return mInToolbar; }
00086     const QString toolbarIconName() const { return mIconName; }
00087     bool isEmpty() const { return mEmpty; }
00088     const KShortcut shortcut() { return mShortcut; }
00089 
00090     void setLabel( const QString & );
00091     void setName( const QString & );
00092     void setPriority( unsigned int aPriority ) { mPriority = aPriority; }
00093     void setBackgroundColor( const QColor & );
00094     void setTextColor( const QColor & );
00095     void setTextFont( const QFont & );
00096     void setInToolbar( bool aInToolbar ) { mInToolbar = aInToolbar; }
00097     void setIconName( const QString & );
00098     void setShortcut( const KShortcut & );
00099 
00101     void purify( void );
00102     void readConfig( const KConfigGroup & );
00103     void writeConfig( KConfigGroup & ) const;
00104 
00105   private:
00106     int mPriority;
00107     QString mName;
00108     QString mLabel;
00109 
00110     QColor mBackgroundColor;
00111     QColor mTextColor;
00112 
00113     QFont mTextFont;
00114 
00115     bool mInToolbar;
00116     QString mIconName;
00117 
00118     KShortcut mShortcut;
00119 
00120     bool mEmpty;
00121 };
00122 
00127 class KMMessageTagMgr : public QObject
00128 {
00129   Q_OBJECT
00130 
00131   public:
00133     KMMessageTagMgr();
00134     ~KMMessageTagMgr();
00135 
00138     void createInitialTags( void );
00141     void readConfig( void );
00143     void writeConfig( bool );
00148     const KMMessageTagDescription *find( const QString &aLabel ) const;
00151     const QHash<QString, KMMessageTagDescription*> *msgTagDict(void) const { return mTagDict; }
00153     const QList<KMMessageTagDescription *> *msgTagList(void) const { return mTagList; }
00155     bool isDirty( void ) const { return mDirty; }
00162     void fillTagsFromList( const QList<KMMessageTagDescription*> *aTagList );
00163 
00164   signals:
00166     void msgTagListChanged(void);
00167 
00168   private:
00169     //This function shouldn't be public since it doesn't emit msgTagListChanged
00170     void clear(void);
00171 
00173     void addTag( KMMessageTagDescription *aDesc, bool emitChange = true );
00174 
00175     QHash<QString,KMMessageTagDescription*> *mTagDict;
00176     QList<KMMessageTagDescription *> *mTagList;
00177     bool mDirty;
00178 };
00179 
00182 class KMMessageTagList : public QStringList
00183 {
00184   public:
00185     KMMessageTagList();
00189     explicit KMMessageTagList( const QStringList &aList );
00192     void prioritySort();
00196     static const KMMessageTagList split( const QString &aSep, const QString &aStr );
00197   private:
00198     /*Internal function that implements less than by looking at priorities.
00199       Uses the tag manager in the process*/
00200     bool compareTags( const QString &lhs, const QString &rhs );
00201 };
00202 
00203 #endif //KMMESSAGETAG_H

kmail

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

kdepim

Skip menu "kdepim"
  • akonadi
  •   clients
  •   kabc
  •   kcal
  •   kcm
  • akregator
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt
  • kdgantt1
  • kjots
  • kleopatra
  • kmail
  • kmobiletools
  • knode
  • knotes
  • kontact
  • kontactinterfaces
  • korganizer
  •   korgac
  • kpilot
  • ktimetracker
  •   doc
  • libkdepim
  • libkholidays
  • libkleo
  • libkpgp
  • maildir
Generated for kdepim by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal