From da8b0236c5cefdd2a2fcac28461f4ea40e99506c Mon Sep 17 00:00:00 2001 From: Jaidyn Ann Date: Thu, 19 Aug 2021 02:00:11 -0500 Subject: [PATCH] Add workspace-switching and window-raising options --- application/Conversation.cpp | 12 ++++++++++++ application/preferences/AppPreferences.cpp | 4 ++-- .../preferences/PreferencesBehavior.cpp | 18 +----------------- application/preferences/PreferencesBehavior.h | 1 - 4 files changed, 15 insertions(+), 20 deletions(-) diff --git a/application/Conversation.cpp b/application/Conversation.cpp index f81687a..1c806d0 100644 --- a/application/Conversation.cpp +++ b/application/Conversation.cpp @@ -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 (win == NULL && mentioned == true) NotifyInteger(INT_NEW_MENTION, fNotifyMentionCount); diff --git a/application/preferences/AppPreferences.cpp b/application/preferences/AppPreferences.cpp index 2a17cf4..8bcbca4 100644 --- a/application/preferences/AppPreferences.cpp +++ b/application/preferences/AppPreferences.cpp @@ -35,11 +35,11 @@ AppPreferences::Load() MoveToCurrentWorkspace = settings.GetBool("MoveToCurrentWorkpace", false); RaiseOnMessageReceived = settings.GetBool("RaiseOnMessageReceived", false); - MarkUnreadWindow = settings.GetBool("MarkUnreadWindow", true); + MarkUnreadWindow = settings.GetBool("MarkUnreadWindow", false); NotifyProtocolStatus = settings.GetBool("NotifyProtocolStatus", true); NotifyNewMessage = settings.GetBool("NotifyNewMessage", true); NotifyContactStatus = settings.GetBool("NotifyContactStatus", false); - SoundOnMessageReceived = settings.GetBool("SoundOnMessageReceived", false); + SoundOnMessageReceived = settings.GetBool("SoundOnMessageReceived", true); SoundOnMention = settings.GetBool("SoundOnMention", true); HideDeskbar = settings.GetBool("HideDeskbar", false); DisableReplicant = settings.GetBool("DisableReplicant", true); diff --git a/application/preferences/PreferencesBehavior.cpp b/application/preferences/PreferencesBehavior.cpp index 5609cb3..aeb16a0 100644 --- a/application/preferences/PreferencesBehavior.cpp +++ b/application/preferences/PreferencesBehavior.cpp @@ -24,7 +24,6 @@ const uint32 kToCurrentWorkspace = 'CBcw'; const uint32 kRaiseOnMessageReceived = 'FCmr'; const uint32 kRaiseUserIsTyping = 'FCit'; const uint32 kMarkUnreadWindow = 'MKuw'; -const uint32 kHideOffline = 'HiOf'; const uint32 kDisablePrompt = 'DiPr'; @@ -34,25 +33,17 @@ PreferencesBehavior::PreferencesBehavior() BBox* incomingBox = new BBox("incoming"); 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", B_TRANSLATE("Move window to current workspace"), new BMessage(kToCurrentWorkspace)); - fToCurrentWorkspace->SetEnabled(false); // not this either fRaiseOnMessageReceived = new BCheckBox("FocusOnMessageReceived", B_TRANSLATE("Auto-raise when a message is received"), new BMessage(kRaiseOnMessageReceived)); - fRaiseOnMessageReceived->SetEnabled(false); // nor this fMarkUnreadWindow = new BCheckBox("MarkUnreadWindow", B_TRANSLATE("Mark unread window chat"), new BMessage(kMarkUnreadWindow)); - fMarkUnreadWindow->SetEnabled(false); // of unimplemented settings! BBox* generalBox = new BBox("general"); generalBox->SetLabel(B_TRANSLATE("General")); @@ -70,7 +61,6 @@ PreferencesBehavior::PreferencesBehavior() BLayoutBuilder::Group<>(incomingBox, B_VERTICAL) .SetInsets(spacing, spacing * 2, spacing, spacing) - .Add(fHideOffline) .Add(fToCurrentWorkspace) .Add(fRaiseOnMessageReceived) .Add(fMarkUnreadWindow) @@ -88,13 +78,11 @@ PreferencesBehavior::PreferencesBehavior() void PreferencesBehavior::AttachedToWindow() { - fHideOffline->SetTarget(this); fToCurrentWorkspace->SetTarget(this); fRaiseOnMessageReceived->SetTarget(this); + fMarkUnreadWindow->SetTarget(this); fDisableQuitConfirm->SetTarget(this); - fHideOffline->SetValue( - AppPreferences::Get()->HideOffline); fToCurrentWorkspace->SetValue( AppPreferences::Get()->MoveToCurrentWorkspace); fRaiseOnMessageReceived->SetValue( @@ -110,10 +98,6 @@ void PreferencesBehavior::MessageReceived(BMessage* message) { switch (message->what) { - case kHideOffline: - AppPreferences::Get()->HideOffline - = fHideOffline->Value(); - break; case kToCurrentWorkspace: AppPreferences::Get()->MoveToCurrentWorkspace = fToCurrentWorkspace->Value(); diff --git a/application/preferences/PreferencesBehavior.h b/application/preferences/PreferencesBehavior.h index 54fb245..6f78272 100644 --- a/application/preferences/PreferencesBehavior.h +++ b/application/preferences/PreferencesBehavior.h @@ -19,7 +19,6 @@ public: private: - BCheckBox* fHideOffline; BCheckBox* fToCurrentWorkspace; BCheckBox* fRaiseOnMessageReceived; BCheckBox* fMarkUnreadWindow;