Add workspace-switching and window-raising options

This commit is contained in:
Jaidyn Ann 2021-08-19 02:00:11 -05:00
parent 38e9fca3be
commit da8b0236c5
4 changed files with 15 additions and 20 deletions

View File

@ -145,6 +145,18 @@ Conversation::ImMessage(BMessage* msg)
} }
} }
// Misc. features Caya contributors planned on adding
BWindow* mainWin = ((TheApp*)be_app)->GetMainWindow();
if (win == NULL && AppPreferences::Get()->MarkUnreadWindow == true)
mainWin->SetTitle(BString(mainWin->Title()).Prepend("[!]"));
if (win == NULL && AppPreferences::Get()->MoveToCurrentWorkspace)
mainWin->SetWorkspaces(B_CURRENT_WORKSPACE);
if (win == NULL && AppPreferences::Get()->RaiseOnMessageReceived)
mainWin->Activate(true);
// If unattached, highlight the ConversationItem // If unattached, highlight the ConversationItem
if (win == NULL && mentioned == true) if (win == NULL && mentioned == true)
NotifyInteger(INT_NEW_MENTION, fNotifyMentionCount); NotifyInteger(INT_NEW_MENTION, fNotifyMentionCount);

View File

@ -35,11 +35,11 @@ AppPreferences::Load()
MoveToCurrentWorkspace = settings.GetBool("MoveToCurrentWorkpace", false); MoveToCurrentWorkspace = settings.GetBool("MoveToCurrentWorkpace", false);
RaiseOnMessageReceived = settings.GetBool("RaiseOnMessageReceived", false); RaiseOnMessageReceived = settings.GetBool("RaiseOnMessageReceived", false);
MarkUnreadWindow = settings.GetBool("MarkUnreadWindow", true); MarkUnreadWindow = settings.GetBool("MarkUnreadWindow", false);
NotifyProtocolStatus = settings.GetBool("NotifyProtocolStatus", true); NotifyProtocolStatus = settings.GetBool("NotifyProtocolStatus", true);
NotifyNewMessage = settings.GetBool("NotifyNewMessage", true); NotifyNewMessage = settings.GetBool("NotifyNewMessage", true);
NotifyContactStatus = settings.GetBool("NotifyContactStatus", false); NotifyContactStatus = settings.GetBool("NotifyContactStatus", false);
SoundOnMessageReceived = settings.GetBool("SoundOnMessageReceived", false); SoundOnMessageReceived = settings.GetBool("SoundOnMessageReceived", true);
SoundOnMention = settings.GetBool("SoundOnMention", true); SoundOnMention = settings.GetBool("SoundOnMention", true);
HideDeskbar = settings.GetBool("HideDeskbar", false); HideDeskbar = settings.GetBool("HideDeskbar", false);
DisableReplicant = settings.GetBool("DisableReplicant", true); DisableReplicant = settings.GetBool("DisableReplicant", true);

View File

@ -24,7 +24,6 @@ const uint32 kToCurrentWorkspace = 'CBcw';
const uint32 kRaiseOnMessageReceived = 'FCmr'; const uint32 kRaiseOnMessageReceived = 'FCmr';
const uint32 kRaiseUserIsTyping = 'FCit'; const uint32 kRaiseUserIsTyping = 'FCit';
const uint32 kMarkUnreadWindow = 'MKuw'; const uint32 kMarkUnreadWindow = 'MKuw';
const uint32 kHideOffline = 'HiOf';
const uint32 kDisablePrompt = 'DiPr'; const uint32 kDisablePrompt = 'DiPr';
@ -34,25 +33,17 @@ PreferencesBehavior::PreferencesBehavior()
BBox* incomingBox = new BBox("incoming"); BBox* incomingBox = new BBox("incoming");
incomingBox->SetLabel(B_TRANSLATE("On incoming" B_UTF8_ELLIPSIS)); incomingBox->SetLabel(B_TRANSLATE("On incoming" B_UTF8_ELLIPSIS));
fHideOffline = new BCheckBox("HideOfflineContacts",
B_TRANSLATE("Hide offline contacts"),
new BMessage(kHideOffline));
fHideOffline->SetEnabled(false); //not implemented as yet
fToCurrentWorkspace = new BCheckBox("ToCurrentWorkspace", fToCurrentWorkspace = new BCheckBox("ToCurrentWorkspace",
B_TRANSLATE("Move window to current workspace"), B_TRANSLATE("Move window to current workspace"),
new BMessage(kToCurrentWorkspace)); new BMessage(kToCurrentWorkspace));
fToCurrentWorkspace->SetEnabled(false); // not this either
fRaiseOnMessageReceived = new BCheckBox("FocusOnMessageReceived", fRaiseOnMessageReceived = new BCheckBox("FocusOnMessageReceived",
B_TRANSLATE("Auto-raise when a message is received"), B_TRANSLATE("Auto-raise when a message is received"),
new BMessage(kRaiseOnMessageReceived)); new BMessage(kRaiseOnMessageReceived));
fRaiseOnMessageReceived->SetEnabled(false); // nor this
fMarkUnreadWindow = new BCheckBox("MarkUnreadWindow", fMarkUnreadWindow = new BCheckBox("MarkUnreadWindow",
B_TRANSLATE("Mark unread window chat"), B_TRANSLATE("Mark unread window chat"),
new BMessage(kMarkUnreadWindow)); new BMessage(kMarkUnreadWindow));
fMarkUnreadWindow->SetEnabled(false); // of unimplemented settings!
BBox* generalBox = new BBox("general"); BBox* generalBox = new BBox("general");
generalBox->SetLabel(B_TRANSLATE("General")); generalBox->SetLabel(B_TRANSLATE("General"));
@ -70,7 +61,6 @@ PreferencesBehavior::PreferencesBehavior()
BLayoutBuilder::Group<>(incomingBox, B_VERTICAL) BLayoutBuilder::Group<>(incomingBox, B_VERTICAL)
.SetInsets(spacing, spacing * 2, spacing, spacing) .SetInsets(spacing, spacing * 2, spacing, spacing)
.Add(fHideOffline)
.Add(fToCurrentWorkspace) .Add(fToCurrentWorkspace)
.Add(fRaiseOnMessageReceived) .Add(fRaiseOnMessageReceived)
.Add(fMarkUnreadWindow) .Add(fMarkUnreadWindow)
@ -88,13 +78,11 @@ PreferencesBehavior::PreferencesBehavior()
void void
PreferencesBehavior::AttachedToWindow() PreferencesBehavior::AttachedToWindow()
{ {
fHideOffline->SetTarget(this);
fToCurrentWorkspace->SetTarget(this); fToCurrentWorkspace->SetTarget(this);
fRaiseOnMessageReceived->SetTarget(this); fRaiseOnMessageReceived->SetTarget(this);
fMarkUnreadWindow->SetTarget(this);
fDisableQuitConfirm->SetTarget(this); fDisableQuitConfirm->SetTarget(this);
fHideOffline->SetValue(
AppPreferences::Get()->HideOffline);
fToCurrentWorkspace->SetValue( fToCurrentWorkspace->SetValue(
AppPreferences::Get()->MoveToCurrentWorkspace); AppPreferences::Get()->MoveToCurrentWorkspace);
fRaiseOnMessageReceived->SetValue( fRaiseOnMessageReceived->SetValue(
@ -110,10 +98,6 @@ void
PreferencesBehavior::MessageReceived(BMessage* message) PreferencesBehavior::MessageReceived(BMessage* message)
{ {
switch (message->what) { switch (message->what) {
case kHideOffline:
AppPreferences::Get()->HideOffline
= fHideOffline->Value();
break;
case kToCurrentWorkspace: case kToCurrentWorkspace:
AppPreferences::Get()->MoveToCurrentWorkspace AppPreferences::Get()->MoveToCurrentWorkspace
= fToCurrentWorkspace->Value(); = fToCurrentWorkspace->Value();

View File

@ -19,7 +19,6 @@ public:
private: private:
BCheckBox* fHideOffline;
BCheckBox* fToCurrentWorkspace; BCheckBox* fToCurrentWorkspace;
BCheckBox* fRaiseOnMessageReceived; BCheckBox* fRaiseOnMessageReceived;
BCheckBox* fMarkUnreadWindow; BCheckBox* fMarkUnreadWindow;