X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Fsettingspages%2Faliasesmodel.cpp;h=a0723305e36f8d34f20dcf899f3319fb690fd2d6;hb=aa49f1a8d52fb95920c7b686ea2c7ae5c1532d87;hp=588673c20c2400937025685ab92312478b8e7892;hpb=6579cd49c867ce3fb6c99127851a881ea82d1b1b;p=quassel.git
diff --git a/src/qtui/settingspages/aliasesmodel.cpp b/src/qtui/settingspages/aliasesmodel.cpp
index 588673c2..a0723305 100644
--- a/src/qtui/settingspages/aliasesmodel.cpp
+++ b/src/qtui/settingspages/aliasesmodel.cpp
@@ -30,15 +30,13 @@ AliasesModel::AliasesModel(QObject *parent)
: QAbstractItemModel(parent),
_configChanged(false)
{
-// _aliasManager.addAlias("a", "aa");
-// _aliasManager.addAlias("b", "bb");
-// _aliasManager.addAlias("c", "cc");
-// _aliasManager.addAlias("d", "dd");
-
// we need this signal for future connects to reset the data;
connect(Client::instance(), SIGNAL(connected()), this, SLOT(clientConnected()));
+ connect(Client::instance(), SIGNAL(disconnected()), this, SLOT(clientDisconnected()));
if(Client::isConnected())
clientConnected();
+ else
+ emit modelReady(false);
}
QVariant AliasesModel::data(const QModelIndex &index, int role) const {
@@ -54,13 +52,19 @@ QVariant AliasesModel::data(const QModelIndex &index, int role) const {
"Example: \"foo\" can be used per /foo";
case 1:
return "The string the shortcut will be expanded to
"
- "$i represenents the i'th parameter. $0 the whole string.
"
+ "special variables:
"
+ " - $i represenents the i'th parameter.
"
+ " - $i:hostname represents the hostname of the user identified by the i'th parameter or a * if unknown.
"
+ " - $0 the whole string.
"
+ " - $currentnick your current nickname
"
+ " - $channelname the name of the selected channel
"
"Multiple commands can be separated with semicolons
"
"Example: \"Test $1; Test $2; Test All $0\" will be expanded to three separate messages \"Test 1\", \"Test 2\" and \"Test All 1 2 3\" when called like /test 1 2 3";
default:
return QVariant();
}
case Qt::DisplayRole:
+ case Qt::EditRole:
switch(index.column()) {
case 0:
return aliasManager()[index.row()].name;
@@ -192,7 +196,7 @@ void AliasesModel::commit() {
void AliasesModel::initDone() {
reset();
- emit modelReady();
+ emit modelReady(true);
}
void AliasesModel::clientConnected() {
@@ -201,3 +205,11 @@ void AliasesModel::clientConnected() {
connect(&_aliasManager, SIGNAL(initDone()), this, SLOT(initDone()));
connect(&_aliasManager, SIGNAL(updated(const QVariantMap &)), this, SLOT(revert()));
}
+
+void AliasesModel::clientDisconnected() {
+ // clear alias managers
+ _aliasManager = AliasManager();
+ _clonedAliasManager = AliasManager();
+ reset();
+ emit modelReady(false);
+}