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