summaryrefslogtreecommitdiffstats
path: root/kdelirc/kdelirc/modes.h
diff options
context:
space:
mode:
Diffstat (limited to 'kdelirc/kdelirc/modes.h')
-rw-r--r--kdelirc/kdelirc/modes.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/kdelirc/kdelirc/modes.h b/kdelirc/kdelirc/modes.h
new file mode 100644
index 0000000..9eabd4b
--- /dev/null
+++ b/kdelirc/kdelirc/modes.h
@@ -0,0 +1,62 @@
+//
+//
+// C++ Interface: $MODULE$
+//
+// Description:
+//
+//
+// Author: Gav Wood <gav@kde.org>, (C) 2003
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#ifndef MODES_H
+#define MODES_H
+
+#include <qstring.h>
+#include <qmap.h>
+#include <qpair.h>
+#include <qvaluelist.h>
+
+#include "mode.h"
+
+/**
+@author Gav Wood
+*/
+
+class KConfig;
+
+typedef QValueList<Mode> ModeList;
+
+class Modes : protected QMap<QString, QMap<QString, Mode> >
+{
+ void purgeAllModes(KConfig &theConfig);
+ QMap<QString, QString> theDefaults;
+
+public:
+ void loadFromConfig(KConfig &theConfig);
+ void saveToConfig(KConfig &theConfig);
+ void generateNulls(const QStringList &theRemotes);
+
+ const Mode &getMode(const QString &remote, const QString &mode) const;
+ ModeList getModes(const QString &remote) const;
+ const Mode getDefault(const QString &remote) const;
+ bool isDefault(const Mode &mode) const;
+
+ /**
+ * Call when you've changed a previously getMode'd mode and you want the changes
+ * to be recorded
+ **/
+ void updateMode(const Mode &mode) { operator[](mode.remote())[mode.name()] = mode; }
+ void setDefault(const Mode &mode) { theDefaults[mode.remote()] = mode.name(); }
+ void erase(const Mode &mode);
+ void add(const Mode &mode);
+
+ // dont use this without renaming all the modes in the actions!!!
+ void rename(Mode &mode, const QString name);
+
+ Modes();
+ ~Modes();
+};
+
+#endif