X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Fsettingspages%2Faliasesmodel.cpp;h=85d09aea911a31a0f03baa00d68b9c96adb4068a;hb=429b13a0af3acc0599ceb560fef61feee93b068e;hp=8df227910d1e4ca6f095c30c41cc58cfe0591504;hpb=f7eb3911860f30e6bccce3c77d03fc25e87d7f93;p=quassel.git
diff --git a/src/qtui/settingspages/aliasesmodel.cpp b/src/qtui/settingspages/aliasesmodel.cpp
index 8df22791..85d09aea 100644
--- a/src/qtui/settingspages/aliasesmodel.cpp
+++ b/src/qtui/settingspages/aliasesmodel.cpp
@@ -1,5 +1,5 @@
/***************************************************************************
- * 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 *
@@ -52,7 +52,14 @@ 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..j represenents the i'th to j'th parameter separated by spaces.
"
+ " - $i.. represenents all parameters from i on separated by spaces.
"
+ " - $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:
@@ -110,6 +117,24 @@ void AliasesModel::newAlias() {
endInsertRows();
}
+void AliasesModel::loadDefaults() {
+ AliasManager &manager = cloneAliasManager();
+
+ if(!manager.isEmpty()) {
+ beginRemoveRows(QModelIndex(), 0, rowCount() - 1);
+ for(int i = rowCount() - 1; i >= 0; i--)
+ manager.removeAt(i);
+ endRemoveRows();
+ }
+
+ AliasManager::AliasList defaults = AliasManager::defaults();
+ beginInsertRows(QModelIndex(), 0, defaults.count() - 1);
+ foreach(AliasManager::Alias alias, defaults) {
+ manager.addAlias(alias.name, alias.expansion);
+ }
+ endInsertRows();
+}
+
void AliasesModel::removeAlias(int index) {
if(index < 0 || index >= rowCount())
return;