typos
[quassel.git] / src / qtui / settingspages / aliasesmodel.cpp
index a072330..251e9e2 100644 (file)
@@ -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  *
@@ -53,7 +53,9 @@ QVariant AliasesModel::data(const QModelIndex &index, int role) const {
     case 1:
       return "<b>The string the shortcut will be expanded to</b><br />"
        "<b>special variables:</b><br />"
-       " - <b>$i</b> represenents the i'th parameter.<br />"
+       " - <b>$i</b> represents the i'th parameter.<br />"
+       " - <b>$i..j</b> represents the i'th to j'th parameter separated by spaces.<br />"
+       " - <b>$i..</b> represents all parameters from i on separated by spaces.<br />"
        " - <b>$i:hostname</b> represents the hostname of the user identified by the i'th parameter or a * if unknown.<br />"
        " - <b>$0</b> the whole string.<br />"
        " - <b>$currentnick</b> your current nickname<br />"
@@ -115,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;