diff --git a/application/ProtocolTemplate.cpp b/application/ProtocolTemplate.cpp index 5f0d06a..56c0d34 100644 --- a/application/ProtocolTemplate.cpp +++ b/application/ProtocolTemplate.cpp @@ -61,13 +61,11 @@ ProtocolTemplate::Load(BView* parent, BMessage* settings) { if (!parent) debugger("Couldn't build protocol's settings GUI on a NULL parent!"); - BMessage curr; - float inset = ceilf(be_plain_font->Size() * 0.7f); // Setup layout parent->SetLayout(new BGroupLayout(B_VERTICAL)); - BGroupLayoutBuilder layout(B_VERTICAL, inset); + BGroupLayoutBuilder layout(B_VERTICAL); for (int32 i = 0; fTemplate->FindMessage("setting", i, &curr) == B_OK; i++) { char temp[512]; diff --git a/application/views/TemplateView.cpp b/application/views/TemplateView.cpp index 5a5a97e..1707627 100644 --- a/application/views/TemplateView.cpp +++ b/application/views/TemplateView.cpp @@ -50,6 +50,8 @@ TemplateView::AttachedToWindow() menu = menuField->Menu(); if (menu) { + if (i == 0) + menu->MakeFocus(true); for (int32 j = 0; j < menu->CountItems(); j++) { BMenuItem* item = menu->ItemAt(j); item->SetMessage(new BMessage(kChanged)); @@ -60,16 +62,22 @@ TemplateView::AttachedToWindow() } if (textControl) { + if (i == 0) + textControl->MakeFocus(true); textControl->SetMessage(new BMessage(kChanged)); textControl->SetTarget(Window()); } if (checkBox) { + if (i == 0) + checkBox->MakeFocus(true); checkBox->SetMessage(new BMessage(kChanged)); checkBox->SetTarget(Window()); } if (textView) { + if (i == 0) + textView->MakeFocus(true); textView->SetMessage(new BMessage(kChanged)); textView->SetTarget(Window()); } diff --git a/application/windows/TemplateWindow.cpp b/application/windows/TemplateWindow.cpp index 146e926..fc83c6f 100644 --- a/application/windows/TemplateWindow.cpp +++ b/application/windows/TemplateWindow.cpp @@ -20,7 +20,6 @@ #include "TemplateView.h" -const uint32 kCancel = 'canc'; const uint32 kOK = 'save'; const uint32 kAccSelected = 'JWas'; @@ -81,9 +80,6 @@ TemplateWindow::MessageReceived(BMessage* msg) Close(); break; } - case kCancel: - Close(); - break; case kChanged: break; default: @@ -105,22 +101,23 @@ TemplateWindow::_InitInterface() fTemplateView = new TemplateView("template"); fMenuField = new BMenuField("accountMenuField", NULL, _CreateAccountMenu()); - BButton* cancel = new BButton("Cancel", new BMessage(kCancel)); BButton* fOkButton = new BButton("OK", new BMessage(kOK)); if (fAccounts.CountItems() <= 0) fOkButton->SetEnabled(false); + fOkButton->MakeDefault(true); const float spacing = be_control_look->DefaultItemSpacing(); + BLayoutBuilder::Group<>(this, B_VERTICAL) + .SetInsets(B_USE_DEFAULT_SPACING) .Add(fTemplateView) .AddGroup(B_HORIZONTAL) .Add(fMenuField) .AddGlue() - .Add(cancel) + .Add(new BButton("Cancel", new BMessage(B_QUIT_REQUESTED))) .Add(fOkButton) .End() - .AddGlue() - .SetInsets(spacing, spacing, spacing, 0); + .End(); } @@ -129,7 +126,6 @@ TemplateWindow::_LoadTemplate() { if (fAccounts.CountItems() == 0) return; -// fOkButton->SetEnabled(true); ProtocolLooper* looper = fServer->GetProtocolLooper(fAccounts.ValueAt(fSelectedAcc)); @@ -142,6 +138,8 @@ TemplateWindow::_LoadTemplate() fTemplateView->RemoveChild(fTemplateView->ChildAt(i)); fTemplate->Load(fTemplateView); + fTemplateView->AttachedToWindow(); + fTemplateView->MakeFocus(true); } diff --git a/protocols/xmpp/JabberHandler.cpp b/protocols/xmpp/JabberHandler.cpp index 28c12b1..6a6deab 100644 --- a/protocols/xmpp/JabberHandler.cpp +++ b/protocols/xmpp/JabberHandler.cpp @@ -1149,7 +1149,7 @@ JabberHandler::_SettingsTemplate(const char* username, bool serverOption) BMessage passwordText; passwordText.AddString("name", "password"); - passwordText.AddString("description", "Password"); + passwordText.AddString("description", "Password:"); passwordText.AddString("error", "You can't log into an account without a " "password.\nPlease fill in your password for the given account."); passwordText.AddInt32("type", 'CSTR'); @@ -1158,7 +1158,7 @@ JabberHandler::_SettingsTemplate(const char* username, bool serverOption) BMessage serverText; serverText.AddString("name", "server"); - serverText.AddString("description", "Server"); + serverText.AddString("description", "Server:"); serverText.AddString("error", "You can't add an account without a server.\n" "Please add a valid XMPP server."); serverText.AddInt32("type", 'CSTR'); @@ -1167,7 +1167,7 @@ JabberHandler::_SettingsTemplate(const char* username, bool serverOption) BMessage resourceText; resourceText.AddString("name", "resource"); - resourceText.AddString("description", "Resource"); + resourceText.AddString("description", "Resource:"); resourceText.AddInt32("type", 'CSTR'); resourceText.AddString("default", "Caya"); resourceText.AddString("error", "You can't add an account without a " @@ -1184,7 +1184,7 @@ JabberHandler::_RoomTemplate() BMessage stemplate('IMst'); BMessage roomIdentifier; roomIdentifier.AddString("name", "chat_id"); - roomIdentifier.AddString("description", "Room identifier"); + roomIdentifier.AddString("description", "Room identifier:"); roomIdentifier.AddString("error", "You can't create a room without a JID!\n" "Use the \"name@server\" format."); roomIdentifier.AddInt32("type", 'CSTR'); diff --git a/protocols/xmpp/JabberProtocol.cpp b/protocols/xmpp/JabberProtocol.cpp index 532d98f..6dcff17 100644 --- a/protocols/xmpp/JabberProtocol.cpp +++ b/protocols/xmpp/JabberProtocol.cpp @@ -49,7 +49,7 @@ BMessage JabberProtocol::SettingsTemplate(const char* name) { if (name == BString("account")) - return JabberHandler::_SettingsTemplate("Jabber identifier", true); + return JabberHandler::_SettingsTemplate("Jabber identifier:", true); if (name == BString("room")) return JabberHandler::_RoomTemplate(); else