Modified the preferences to select if the chat window should be auto raised when a message is received or when a user is typing, or both. This fix the issue #555.
This commit is contained in:
parent
8516381043
commit
b80c9b2b11
|
@ -71,7 +71,8 @@ ContactLinker::ShowWindow()
|
|||
if (fChatWindow->IsHidden())
|
||||
fChatWindow->Show();
|
||||
|
||||
if (CayaPreferences::Item()->ActivateWindow)
|
||||
if (CayaPreferences::Item()->FocusOnMessageReceived == true
|
||||
|| CayaPreferences::Item()->FocusUserIsTyping == true)
|
||||
fChatWindow->Activate(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -313,6 +313,21 @@ Server::ImMessage(BMessage* msg)
|
|||
break;
|
||||
}
|
||||
case IM_MESSAGE_RECEIVED:
|
||||
{
|
||||
BString id = msg->FindString("id");
|
||||
if (id.Length() > 0) {
|
||||
bool found = false;
|
||||
ContactLinker* item = fRosterMap.ValueFor(id, &found);
|
||||
if (found) {
|
||||
ChatWindow* win = item->GetChatWindow();
|
||||
if (CayaPreferences::Item()->FocusOnMessageReceived)
|
||||
item->ShowWindow();
|
||||
win->PostMessage(msg);
|
||||
}
|
||||
}
|
||||
result = B_SKIP_MESSAGE;
|
||||
break;
|
||||
}
|
||||
case IM_CONTACT_STARTED_TYPING:
|
||||
case IM_CONTACT_STOPPED_TYPING:
|
||||
{
|
||||
|
@ -322,6 +337,7 @@ Server::ImMessage(BMessage* msg)
|
|||
ContactLinker* item = fRosterMap.ValueFor(id, &found);
|
||||
if (found) {
|
||||
ChatWindow* win = item->GetChatWindow();
|
||||
if (CayaPreferences::Item()->FocusUserIsTyping)
|
||||
item->ShowWindow();
|
||||
win->PostMessage(msg);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
typedef struct _CayaPreferencesData
|
||||
{
|
||||
bool MoveToCurrentWorkspace;
|
||||
bool ActivateWindow;
|
||||
bool FocusOnMessageReceived;
|
||||
bool FocusUserIsTyping;
|
||||
|
||||
bool HideCayaDeskbar;
|
||||
bool DisableReplicant;
|
||||
|
@ -23,7 +24,8 @@ typedef struct _CayaPreferencesData
|
|||
_CayaPreferencesData()
|
||||
:
|
||||
MoveToCurrentWorkspace(true),
|
||||
ActivateWindow(true),
|
||||
FocusOnMessageReceived(false),
|
||||
FocusUserIsTyping(false),
|
||||
HideCayaDeskbar(false),
|
||||
DisableReplicant(true),
|
||||
IgnoreEmoticons(false),
|
||||
|
|
|
@ -24,7 +24,8 @@
|
|||
#include "TheApp.h"
|
||||
|
||||
const uint32 kToCurrentWorkspace = 'CBcw';
|
||||
const uint32 kActivateChatWindow = 'CBac';
|
||||
const uint32 kFocusOnMessageReceived= 'FCmr';
|
||||
const uint32 kFocusUserIsTyping = 'FCit';
|
||||
const uint32 kNotifyProtocolsLogin = 'NTpl';
|
||||
const uint32 kNotifyContactStatus = 'NTcl';
|
||||
|
||||
|
@ -41,9 +42,13 @@ PreferencesBehavior::PreferencesBehavior()
|
|||
"Move window to current workspace",
|
||||
new BMessage(kToCurrentWorkspace));
|
||||
|
||||
fActivateChatWindow = new BCheckBox("ActivateChatWindow",
|
||||
"Get focus ",
|
||||
new BMessage(kActivateChatWindow));
|
||||
fFocusOnMessageReceived = new BCheckBox("FocusOnMessageReceived",
|
||||
"Get focus when a message is received",
|
||||
new BMessage(kFocusOnMessageReceived));
|
||||
|
||||
fFocusUserIsTyping = new BCheckBox("FocusUserIsTyping",
|
||||
"Get focus when user is typing",
|
||||
new BMessage(kFocusUserIsTyping));
|
||||
|
||||
fPlaySoundOnMessageReceived = new BCheckBox("PlaySoundOnMessageReceived",
|
||||
"Play sound event", NULL);
|
||||
|
@ -75,7 +80,8 @@ PreferencesBehavior::PreferencesBehavior()
|
|||
.Add(fOnIncoming)
|
||||
.AddGroup(B_VERTICAL, spacing)
|
||||
.Add(fToCurrentWorkspace)
|
||||
.Add(fActivateChatWindow)
|
||||
.Add(fFocusOnMessageReceived)
|
||||
.Add(fFocusUserIsTyping)
|
||||
.Add(fMarkUnreadWindow)
|
||||
.Add(fMarkUnreadReplicant)
|
||||
.Add(fPlaySoundOnMessageReceived)
|
||||
|
@ -98,14 +104,17 @@ void
|
|||
PreferencesBehavior::AttachedToWindow()
|
||||
{
|
||||
fToCurrentWorkspace->SetTarget(this);
|
||||
fActivateChatWindow->SetTarget(this);
|
||||
fFocusUserIsTyping->SetTarget(this);
|
||||
fFocusOnMessageReceived->SetTarget(this);
|
||||
fNotifyProtocols->SetTarget(this);
|
||||
fNotifyContactStatus->SetTarget(this);
|
||||
|
||||
fToCurrentWorkspace->SetValue(
|
||||
CayaPreferences::Item()->MoveToCurrentWorkspace);
|
||||
fActivateChatWindow->SetValue(
|
||||
CayaPreferences::Item()->ActivateWindow);
|
||||
fFocusUserIsTyping->SetValue(
|
||||
CayaPreferences::Item()->FocusUserIsTyping);
|
||||
fFocusOnMessageReceived->SetValue(
|
||||
CayaPreferences::Item()->FocusOnMessageReceived);
|
||||
fNotifyProtocols->SetValue(
|
||||
CayaPreferences::Item()->NotifyProtocolStatus);
|
||||
fNotifyContactStatus->SetValue(
|
||||
|
@ -121,9 +130,13 @@ PreferencesBehavior::MessageReceived(BMessage* message)
|
|||
CayaPreferences::Item()->MoveToCurrentWorkspace
|
||||
= fToCurrentWorkspace->Value();
|
||||
break;
|
||||
case kActivateChatWindow:
|
||||
CayaPreferences::Item()->ActivateWindow
|
||||
= fActivateChatWindow->Value();
|
||||
case kFocusOnMessageReceived:
|
||||
CayaPreferences::Item()->FocusOnMessageReceived
|
||||
= fFocusOnMessageReceived->Value();
|
||||
break;
|
||||
case kFocusUserIsTyping:
|
||||
CayaPreferences::Item()->FocusUserIsTyping
|
||||
= fFocusUserIsTyping->Value();
|
||||
break;
|
||||
case kNotifyProtocolsLogin:
|
||||
CayaPreferences::Item()->NotifyProtocolStatus
|
||||
|
|
|
@ -22,7 +22,8 @@ private:
|
|||
|
||||
BStringView* fOnIncoming;
|
||||
BCheckBox* fToCurrentWorkspace;
|
||||
BCheckBox* fActivateChatWindow;
|
||||
BCheckBox* fFocusOnMessageReceived;
|
||||
BCheckBox* fFocusUserIsTyping;
|
||||
BCheckBox* fPlaySoundOnMessageReceived;
|
||||
BCheckBox* fMarkUnreadWindow;
|
||||
BCheckBox* fMarkUnreadReplicant;
|
||||
|
|
Ŝarĝante…
Reference in New Issue