Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Task Bar|Console: Dismiss unentered command to history when task bar …
…closed

Now whichever method is used for closing the task bar, the contents
of the command line are put in the command history and the command
line is cleared.
  • Loading branch information
skyjake committed Aug 5, 2013
1 parent 14291a5 commit 5daa1f2
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
7 changes: 7 additions & 0 deletions doomsday/client/include/ui/widgets/consolecommandwidget.h
Expand Up @@ -42,6 +42,13 @@ class ConsoleCommandWidget : public LineEditWidget
void focusLost();
bool handleEvent(de::Event const &event);

public slots:
/**
* Moves the current contents of the command line to the history. The
* command line contents are then cleared.
*/
void dismissContentToHistory();

protected:
void autoCompletionBegan(de::String const &prefix);
void autoCompletionEnded(bool accepted);
Expand Down
1 change: 0 additions & 1 deletion doomsday/client/src/con_main.cpp
Expand Up @@ -2749,7 +2749,6 @@ D_CMD(TaskBar)
else
{
win.taskBar().close();
win.console().commandLine().setText("");
}
return true;
}
Expand Down
8 changes: 8 additions & 0 deletions doomsday/client/src/ui/widgets/consolecommandwidget.cpp
Expand Up @@ -162,6 +162,14 @@ bool ConsoleCommandWidget::handleEvent(Event const &event)
return false;
}

void ConsoleCommandWidget::dismissContentToHistory()
{
if(!text().isEmpty())
{
d->history.enter();
}
}

void ConsoleCommandWidget::autoCompletionBegan(String const &)
{
// Prepare a list of annotated completions to show in the popup.
Expand Down
1 change: 1 addition & 0 deletions doomsday/client/src/ui/widgets/taskbarwidget.cpp
Expand Up @@ -472,6 +472,7 @@ void TaskBarWidget::close()

d->console->closeLog();
d->console->closeMenu();
d->console->commandLine().dismissContentToHistory();
d->mainMenu->close();

// Clear focus now; callbacks/signal handlers may set the focus elsewhere.
Expand Down

0 comments on commit 5daa1f2

Please sign in to comment.