/***************************************************************************
- * Copyright (C) 2005-08 by the Quassel Project *
+ * Copyright (C) 2005-09 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
#include <QAbstractItemModel>
#include <QPointer>
-#include "aliasmanager.h"
+#include "clientaliasmanager.h"
class AliasesModel : public QAbstractItemModel {
Q_OBJECT
inline QModelIndex parent(const QModelIndex &) const { return QModelIndex(); }
- inline int rowCount(const QModelIndex &parent = QModelIndex()) const { Q_UNUSED(parent) return aliasManager().count(); }
- inline int columnCount(const QModelIndex &parent = QModelIndex()) const { Q_UNUSED(parent) return 2; }
+ inline int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ inline int columnCount(const QModelIndex &parent = QModelIndex()) const;
inline bool configChanged() const { return _configChanged; }
+ inline bool isReady() const { return _modelReady; }
public slots:
void newAlias();
+ void loadDefaults();
void removeAlias(int index);
void revert();
void commit();
signals:
void configChanged(bool);
void modelReady(bool);
-
+
private:
- AliasManager _aliasManager;
- AliasManager _clonedAliasManager;
+ ClientAliasManager _clonedAliasManager;
bool _configChanged;
+ bool _modelReady;
const AliasManager &aliasManager() const;
AliasManager &aliasManager();
void initDone();
};
+// Inlines
+int AliasesModel::rowCount(const QModelIndex &parent) const {
+ Q_UNUSED(parent);
+ return isReady() ? aliasManager().count() : 0;
+}
+
+int AliasesModel::columnCount(const QModelIndex &parent) const {
+ Q_UNUSED(parent);
+ return isReady() ? 2 : 0;
+}
+
+
#endif //ALIASESMODEL_H