+bool GuiCompleter::uniqueCompletionAvailable() const
+{
+ if (!modelActive_)
+ return false;
+
+ size_t n = popup()->model()->rowCount();
+ if (n > 1 || n == 0)
+ return false;
+
+ // if there is exactly one, we have to check whether it is a
+ // real completion, i.e. longer than the current prefix.
+ if (completionPrefix() == currentCompletion())
+ return false;
+
+ return true;
+}
+
+
+bool GuiCompleter::completionAvailable() const
+{
+ if (!modelActive_)
+ return false;
+
+ size_t n = popup()->model()->rowCount();
+
+ // if there is exactly one, we have to check whether it is a
+ // real completion, i.e. longer than the current prefix.
+ if (n == 1 && completionPrefix() == currentCompletion())
+ return false;
+
+ return n > 0;
+}
+
+