• Skip to content
  • Skip to link menu
KDE 4.0 API Reference
  • KDE API Reference
  • kdeutils
  • Sitemap
  • Contact Us
 

kdelirc

profileserver.h

Go to the documentation of this file.
00001 //
00002 //
00003 // C++ Interface: $MODULE$
00004 //
00005 // Description:
00006 //
00007 //
00008 // Author: Gav Wood <gav@kde.org>, (C) 2003
00009 //
00010 // Copyright: See COPYING file that comes with this distribution
00011 //
00012 //
00013 #ifndef PROFILESERVER_H
00014 #define PROFILESERVER_H
00015 
00016 #include <qpair.h>
00017 
00018 #include <q3valuelist.h>
00019 #include <QMap>
00020 #include <qxml.h>
00021 #include <q3dict.h>
00022 
00027 enum IfMulti {IM_DONTSEND, IM_SENDTOALL, IM_SENDTOTOP, IM_SENDTOBOTTOM};
00028 
00029 typedef QPair<int,int> Range;
00030 
00031 class ProfileAction;
00032 class Profile;
00033 
00034 class ProfileActionArgument
00035 {
00036     QString theComment, theType;
00037     Range theRange;
00038     QString theDefault;     // should be QVariant?
00039     const ProfileAction *parent;
00040 
00041     friend class Profile;
00042 public:
00043     const QString &comment() const { return theComment; }
00044     void setComment(const QString &a) { theComment = a; }
00045     const QString &type() const { return theType; }
00046     void setType(const QString &a) { theType = a; }
00047     const QString &getDefault() const { return theDefault; }
00048     void setDefault(const QString &a) { theDefault = a; }
00049     const Range &range() const { return theRange; }
00050     void setRange(const Range &a) { theRange = a; }
00051 
00052     const ProfileAction *action() const { return parent; }
00053     void setAction(const ProfileAction *a) { parent = a; }
00054 };
00055 
00056 class ProfileAction
00057 {
00058     QString theObjId, thePrototype, theName, theComment, theClass;
00059     float theMultiplier;
00060     const Profile *parent;
00061     bool theRepeat, theAutoStart;
00062     Q3ValueList<ProfileActionArgument> theArguments;
00063 
00064     friend class Profile;
00065 public:
00066     const QString &objId() const { return theObjId; }
00067     void setObjId(const QString &a) { theObjId = a; }
00068     const QString &prototype() const { return thePrototype; }
00069     void setPrototype(const QString &a) { thePrototype = a; }
00070     const QString &name() const { return theName; }
00071     void setName(const QString &a) { theName = a; }
00072     const QString &comment() const { return theComment; }
00073     void setComment(const QString &a) { theComment = a; }
00074     const QString &getClass() const { return theClass; }
00075     void setClass(const QString &a) { theClass = a; }
00076     const float multiplier() const { return theMultiplier; }
00077     void setMultiplier(const float a) { theMultiplier = a; }
00078     bool repeat() const { return theRepeat; }
00079     void setRepeat(bool a) { theRepeat = a; }
00080     bool autoStart() const { return theAutoStart; }
00081     void setAutoStart(bool a) { theAutoStart = a; }
00082     const Q3ValueList<ProfileActionArgument> &arguments() const { return theArguments; }
00083 
00084     const Profile *profile() const { return parent; }
00085     void setProfile(const Profile *a) { parent = a; }
00086 };
00087 
00088 class Profile : public QXmlDefaultHandler
00089 {
00090     QString theId, theName, theAuthor, theServiceName;
00091     IfMulti theIfMulti;
00092     bool theUnique;
00093     QString charBuffer;
00094 
00095     ProfileAction *curPA;
00096     ProfileActionArgument *curPAA;
00097     Q3Dict<ProfileAction> theActions;       // objid+"::"+prototype => ProfileAction
00098 
00099     friend class ProfileServer;
00100 public:
00101     bool characters(const QString &data);
00102     bool startElement(const QString &, const QString &, const QString &name, const QXmlAttributes &attributes);
00103     bool endElement(const QString &, const QString &, const QString &name);
00104 
00105     const QString &id() const { return theId; }
00106     void setId(const QString &a) { theId = a; }
00107     const QString &name() const { return theName; }
00108     void setName(const QString &a) { theName = a; }
00109     const QString &author() const { return theAuthor; }
00110     void setAuthor(const QString &a) { theAuthor = a; }
00111     const bool unique() const { return theUnique; }
00112     void setUnique(const bool a) { theUnique = a; }
00113     const IfMulti ifMulti() const { return theIfMulti; }
00114     void setIfMulti(const IfMulti a) { theIfMulti = a; }
00115     const QString &serviceName() const { if(theServiceName != QString()) return theServiceName; return theName; }
00116     void setServiceName(const QString &a) { theServiceName = a; }
00117     const Q3Dict<ProfileAction> &actions() const { return theActions; }
00118     const ProfileAction *searchClass(const QString &c) const;
00119 
00120     void loadFromFile(const QString &fileName);
00121 
00122     Profile();
00123 };
00124 
00125 class ProfileServer
00126 {
00127     static ProfileServer *theInstance;
00128     void loadProfiles();
00129     Q3Dict<Profile> theProfiles;            // id => Profile
00130 
00131 public:
00132     static ProfileServer *profileServer() { if(!theInstance) theInstance = new ProfileServer(); return theInstance; }
00133     const Q3Dict<Profile> profiles() const { return theProfiles; }
00134     const ProfileAction *getAction(const QString &appId, const QString &objId, const QString &prototype) const;
00135     const ProfileAction *getAction(const QString &appId, const QString &actionId) const;
00136     const QString &getServiceName(const QString &appId) const;
00137 
00138     ProfileServer();
00139     ~ProfileServer();
00140 };
00141 
00142 #endif

kdelirc

Skip menu "kdelirc"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members

kdeutils

Skip menu "kdeutils"
  • ark
  • kcalc
  • kcharselect
  • kdelirc
  • kdessh
  • kdf
  • kfloppy
  • kgpg
  • kjots
  • klaptopdaemon
  • kmilo
  • ksim
  • ktimer
  • kwallet
  • superkaramba
Generated for kdeutils 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