Added a method to PrefHandler to save the default settings, and used it
in TermWindow and PrefWindow. Added patch by adparadox which implements menuitem and shortcut to close the active tab (slightly modified by me). I went with COMMAND-SHIFT-W instead of COMMAND-W. This fixes bug #3898. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34176 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
92d7fb19f1
commit
411d718eec
@ -163,6 +163,15 @@ PrefHandler::Save(const char *path)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PrefHandler::SaveDefaultAsText()
|
||||
{
|
||||
BPath path;
|
||||
if (GetDefaultPath(path) == B_OK)
|
||||
SaveAsText(path.Path(), PREFFILE_MIMETYPE);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PrefHandler::SaveAsText(const char *path, const char *mimetype,
|
||||
const char *signature)
|
||||
|
@ -68,6 +68,7 @@ class PrefHandler {
|
||||
status_t Open(const char *name);
|
||||
status_t OpenText(const char *path);
|
||||
status_t Save(const char *name);
|
||||
void SaveDefaultAsText();
|
||||
void SaveAsText(const char *path, const char *minmtype = NULL,
|
||||
const char *signature = NULL);
|
||||
|
||||
|
@ -132,11 +132,8 @@ PrefWindow::_Save()
|
||||
delete fPreviousPref;
|
||||
fPreviousPref = new PrefHandler(PrefHandler::Default());
|
||||
|
||||
BPath path;
|
||||
if (PrefHandler::GetDefaultPath(path) == B_OK) {
|
||||
PrefHandler::Default()->SaveAsText(path.Path(), PREFFILE_MIMETYPE);
|
||||
fDirty = false;
|
||||
}
|
||||
PrefHandler::Default()->SaveDefaultAsText();
|
||||
fDirty = false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -166,11 +166,9 @@ TermWindow::~TermWindow()
|
||||
// TODO: Code duplication. Exterminate
|
||||
if (fPrefWindow)
|
||||
fPrefWindow->PostMessage(B_QUIT_REQUESTED);
|
||||
else {
|
||||
BPath path;
|
||||
if (PrefHandler::GetDefaultPath(path) == B_OK)
|
||||
PrefHandler::Default()->SaveAsText(path.Path(), PREFFILE_MIMETYPE);
|
||||
}
|
||||
else
|
||||
PrefHandler::Default()->SaveDefaultAsText();
|
||||
|
||||
|
||||
if (fFindPanel && fFindPanel->Lock()) {
|
||||
fFindPanel->Quit();
|
||||
@ -297,6 +295,8 @@ TermWindow::_SetupMenu()
|
||||
fFilemenu->AddItem(new BMenuItem("About Terminal" B_UTF8_ELLIPSIS,
|
||||
new BMessage(B_ABOUT_REQUESTED)));
|
||||
fFilemenu->AddSeparatorItem();
|
||||
fFilemenu->AddItem(new BMenuItem("Close Active Tab",
|
||||
new BMessage(kCloseView), 'W', B_SHIFT_KEY));
|
||||
fFilemenu->AddItem(new BMenuItem("Quit",
|
||||
new BMessage(B_QUIT_REQUESTED), 'Q'));
|
||||
fMenubar->AddItem(fFilemenu);
|
||||
@ -631,12 +631,15 @@ TermWindow::MessageReceived(BMessage *message)
|
||||
case kCloseView:
|
||||
{
|
||||
TermView* termView;
|
||||
if (message->FindPointer("termView", (void**)&termView) == B_OK) {
|
||||
int32 index = _IndexOfTermView(termView);
|
||||
if (index >= 0) {
|
||||
_RemoveTab(index);
|
||||
}
|
||||
}
|
||||
int32 index = -1;
|
||||
if (message->FindPointer("termView", (void**)&termView) == B_OK)
|
||||
index = _IndexOfTermView(termView);
|
||||
else
|
||||
index = _IndexOfTermView(_ActiveTermView());
|
||||
|
||||
if (index >= 0)
|
||||
_RemoveTab(index);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user