Enabled notifications using the BNotification API, including enable/disable settings. The plugins that support it are XMPP and MSN. Added another tab in the preferences window named Replicant and moved the replicant settings here.
This commit is contained in:
parent
2f417339f4
commit
8516381043
|
@ -44,6 +44,7 @@ Application Caya :
|
||||||
PreferencesDialog.cpp
|
PreferencesDialog.cpp
|
||||||
PreferencesAccounts.cpp
|
PreferencesAccounts.cpp
|
||||||
PreferencesBehavior.cpp
|
PreferencesBehavior.cpp
|
||||||
|
PreferencesReplicant.cpp
|
||||||
PreferencesChatWindow.cpp
|
PreferencesChatWindow.cpp
|
||||||
|
|
||||||
# views
|
# views
|
||||||
|
|
|
@ -289,7 +289,9 @@ MainWindow::ImMessage(BMessage* msg)
|
||||||
// Sort list view again
|
// Sort list view again
|
||||||
fListView->Sort();
|
fListView->Sort();
|
||||||
|
|
||||||
#if 0
|
if (!CayaPreferences::Item()->NotifyContactStatus)
|
||||||
|
break;
|
||||||
|
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case CAYA_ONLINE:
|
case CAYA_ONLINE:
|
||||||
case CAYA_OFFLINE:
|
case CAYA_OFFLINE:
|
||||||
|
@ -314,7 +316,6 @@ MainWindow::ImMessage(BMessage* msg)
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "ProtocolLooper.h"
|
#include "ProtocolLooper.h"
|
||||||
#include "CayaMessages.h"
|
#include "CayaMessages.h"
|
||||||
#include "CayaProtocol.h"
|
#include "CayaProtocol.h"
|
||||||
|
#include "CayaPreferences.h"
|
||||||
#include "CayaProtocolMessages.h"
|
#include "CayaProtocolMessages.h"
|
||||||
#include "ChatWindow.h"
|
#include "ChatWindow.h"
|
||||||
#include "ImageCache.h"
|
#include "ImageCache.h"
|
||||||
|
@ -343,7 +344,9 @@ Server::ImMessage(BMessage* msg)
|
||||||
return result;
|
return result;
|
||||||
if (msg->FindFloat("progress", &progress) != B_OK)
|
if (msg->FindFloat("progress", &progress) != B_OK)
|
||||||
return result;
|
return result;
|
||||||
#if 0
|
|
||||||
|
if (!CayaPreferences::Item()->NotifyProtocolStatus)
|
||||||
|
break;
|
||||||
|
|
||||||
CayaProtocolAddOn* addOn
|
CayaProtocolAddOn* addOn
|
||||||
= ProtocolManager::Get()->ProtocolAddOn(protocol);
|
= ProtocolManager::Get()->ProtocolAddOn(protocol);
|
||||||
|
@ -355,7 +358,7 @@ Server::ImMessage(BMessage* msg)
|
||||||
notification.SetContent(message);
|
notification.SetContent(message);
|
||||||
notification.SetProgress(progress);
|
notification.SetProgress(progress);
|
||||||
notification.Send();
|
notification.Send();
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IM_NOTIFICATION:
|
case IM_NOTIFICATION:
|
||||||
|
@ -374,17 +377,20 @@ Server::ImMessage(BMessage* msg)
|
||||||
if (msg->FindString("message", &message) != B_OK)
|
if (msg->FindString("message", &message) != B_OK)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
#if 0
|
if (!CayaPreferences::Item()->NotifyProtocolStatus)
|
||||||
|
break;
|
||||||
|
|
||||||
CayaProtocolAddOn* addOn
|
CayaProtocolAddOn* addOn
|
||||||
= ProtocolManager::Get()->ProtocolAddOn(protocol);
|
= ProtocolManager::Get()->ProtocolAddOn(protocol);
|
||||||
|
|
||||||
|
|
||||||
BNotification notification((notification_type)type);
|
BNotification notification((notification_type)type);
|
||||||
notification.SetGroup(BString("Caya"));
|
notification.SetGroup(BString("Caya"));
|
||||||
notification.SetTitle(title);
|
notification.SetTitle(title);
|
||||||
notification.SetIcon(addOn->Icon());
|
notification.SetIcon(addOn->Icon());
|
||||||
notification.SetContent(message);
|
notification.SetContent(message);
|
||||||
notification.Send();
|
notification.Send();
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,17 +11,24 @@ typedef struct _CayaPreferencesData
|
||||||
{
|
{
|
||||||
bool MoveToCurrentWorkspace;
|
bool MoveToCurrentWorkspace;
|
||||||
bool ActivateWindow;
|
bool ActivateWindow;
|
||||||
bool IgnoreEmoticons;
|
|
||||||
bool HideCayaDeskbar;
|
bool HideCayaDeskbar;
|
||||||
bool DisableReplicant;
|
bool DisableReplicant;
|
||||||
|
|
||||||
|
bool IgnoreEmoticons;
|
||||||
|
|
||||||
|
bool NotifyProtocolStatus;
|
||||||
|
bool NotifyContactStatus;
|
||||||
|
|
||||||
_CayaPreferencesData()
|
_CayaPreferencesData()
|
||||||
:
|
:
|
||||||
MoveToCurrentWorkspace(true),
|
MoveToCurrentWorkspace(true),
|
||||||
ActivateWindow(true),
|
ActivateWindow(true),
|
||||||
IgnoreEmoticons(false),
|
|
||||||
HideCayaDeskbar(false),
|
HideCayaDeskbar(false),
|
||||||
DisableReplicant(false)
|
DisableReplicant(true),
|
||||||
|
IgnoreEmoticons(false),
|
||||||
|
NotifyProtocolStatus(true),
|
||||||
|
NotifyContactStatus(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
} CayaPreferencesData;
|
} CayaPreferencesData;
|
||||||
|
|
|
@ -25,10 +25,8 @@
|
||||||
|
|
||||||
const uint32 kToCurrentWorkspace = 'CBcw';
|
const uint32 kToCurrentWorkspace = 'CBcw';
|
||||||
const uint32 kActivateChatWindow = 'CBac';
|
const uint32 kActivateChatWindow = 'CBac';
|
||||||
const uint32 kDisableReplicant = 'DSrp';
|
const uint32 kNotifyProtocolsLogin = 'NTpl';
|
||||||
const uint32 kPermanentReplicant ='PRpt';
|
const uint32 kNotifyContactStatus = 'NTcl';
|
||||||
const uint32 kHideCayaDeskbar = 'HCtk';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PreferencesBehavior::PreferencesBehavior()
|
PreferencesBehavior::PreferencesBehavior()
|
||||||
|
@ -60,19 +58,15 @@ PreferencesBehavior::PreferencesBehavior()
|
||||||
fMarkUnreadReplicant->SetEnabled(false);
|
fMarkUnreadReplicant->SetEnabled(false);
|
||||||
// not implemented
|
// not implemented
|
||||||
|
|
||||||
fReplicantString = new BStringView("ReplicantString", "Deskbar Replicant");
|
fNotifications = new BStringView("notifications", "Deskbar Notifications");
|
||||||
fReplicantString->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE));
|
fNotifications->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE));
|
||||||
fReplicantString->SetFont(be_bold_font);
|
fNotifications->SetFont(be_bold_font);
|
||||||
|
|
||||||
fDisableReplicant = new BCheckBox("DisableReplicant",
|
fNotifyProtocols = new BCheckBox("EnableProtocolNotify",
|
||||||
"Disable Deskbar replicant", new BMessage(kDisableReplicant));
|
"Enable protocol status notifications",new BMessage(kNotifyProtocolsLogin));
|
||||||
|
|
||||||
fPermanentReplicant = new BCheckBox("PermanentReplicant",
|
fNotifyContactStatus = new BCheckBox("EnableContactNotify",
|
||||||
"Permanent Deskbar Replicant", NULL);
|
"Enable contact status notifications",new BMessage(kNotifyContactStatus));
|
||||||
fPermanentReplicant->SetEnabled(false);
|
|
||||||
|
|
||||||
fHideCayaDeskbar = new BCheckBox("HideCayaDeskbar",
|
|
||||||
"Hide Caya field in Deskbar", new BMessage(kHideCayaDeskbar));
|
|
||||||
|
|
||||||
const float spacing = be_control_look->DefaultItemSpacing();
|
const float spacing = be_control_look->DefaultItemSpacing();
|
||||||
|
|
||||||
|
@ -87,11 +81,10 @@ PreferencesBehavior::PreferencesBehavior()
|
||||||
.Add(fPlaySoundOnMessageReceived)
|
.Add(fPlaySoundOnMessageReceived)
|
||||||
. SetInsets(spacing * 2, spacing, spacing, spacing)
|
. SetInsets(spacing * 2, spacing, spacing, spacing)
|
||||||
.End()
|
.End()
|
||||||
.Add(fReplicantString)
|
.Add(fNotifications)
|
||||||
.AddGroup(B_VERTICAL, spacing)
|
.AddGroup(B_VERTICAL, spacing)
|
||||||
.Add(fDisableReplicant)
|
.Add(fNotifyProtocols)
|
||||||
.Add(fPermanentReplicant)
|
.Add(fNotifyContactStatus)
|
||||||
.Add(fHideCayaDeskbar)
|
|
||||||
. SetInsets(spacing * 2, spacing, spacing, spacing)
|
. SetInsets(spacing * 2, spacing, spacing, spacing)
|
||||||
.End()
|
.End()
|
||||||
.AddGlue()
|
.AddGlue()
|
||||||
|
@ -106,17 +99,17 @@ PreferencesBehavior::AttachedToWindow()
|
||||||
{
|
{
|
||||||
fToCurrentWorkspace->SetTarget(this);
|
fToCurrentWorkspace->SetTarget(this);
|
||||||
fActivateChatWindow->SetTarget(this);
|
fActivateChatWindow->SetTarget(this);
|
||||||
fHideCayaDeskbar->SetTarget(this);
|
fNotifyProtocols->SetTarget(this);
|
||||||
fDisableReplicant->SetTarget(this);
|
fNotifyContactStatus->SetTarget(this);
|
||||||
|
|
||||||
fToCurrentWorkspace->SetValue(
|
fToCurrentWorkspace->SetValue(
|
||||||
CayaPreferences::Item()->MoveToCurrentWorkspace);
|
CayaPreferences::Item()->MoveToCurrentWorkspace);
|
||||||
fActivateChatWindow->SetValue(
|
fActivateChatWindow->SetValue(
|
||||||
CayaPreferences::Item()->ActivateWindow);
|
CayaPreferences::Item()->ActivateWindow);
|
||||||
fHideCayaDeskbar->SetValue(
|
fNotifyProtocols->SetValue(
|
||||||
CayaPreferences::Item()->HideCayaDeskbar);
|
CayaPreferences::Item()->NotifyProtocolStatus);
|
||||||
fDisableReplicant->SetValue(
|
fNotifyContactStatus->SetValue(
|
||||||
CayaPreferences::Item()->DisableReplicant);
|
CayaPreferences::Item()->NotifyContactStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -132,19 +125,13 @@ PreferencesBehavior::MessageReceived(BMessage* message)
|
||||||
CayaPreferences::Item()->ActivateWindow
|
CayaPreferences::Item()->ActivateWindow
|
||||||
= fActivateChatWindow->Value();
|
= fActivateChatWindow->Value();
|
||||||
break;
|
break;
|
||||||
case kHideCayaDeskbar:
|
case kNotifyProtocolsLogin:
|
||||||
CayaPreferences::Item()->HideCayaDeskbar
|
CayaPreferences::Item()->NotifyProtocolStatus
|
||||||
= fHideCayaDeskbar->Value();
|
= fNotifyProtocols->Value();
|
||||||
break;
|
break;
|
||||||
case kDisableReplicant:
|
case kNotifyContactStatus:
|
||||||
CayaPreferences::Item()->DisableReplicant
|
CayaPreferences::Item()->NotifyContactStatus
|
||||||
= fDisableReplicant->Value();
|
= fNotifyContactStatus->Value();
|
||||||
|
|
||||||
if (fDisableReplicant->Value() == true)
|
|
||||||
ReplicantStatusView::RemoveReplicant();
|
|
||||||
else
|
|
||||||
ReplicantStatusView::InstallReplicant();
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
BView::MessageReceived(message);
|
BView::MessageReceived(message);
|
||||||
|
|
|
@ -27,10 +27,9 @@ private:
|
||||||
BCheckBox* fMarkUnreadWindow;
|
BCheckBox* fMarkUnreadWindow;
|
||||||
BCheckBox* fMarkUnreadReplicant;
|
BCheckBox* fMarkUnreadReplicant;
|
||||||
|
|
||||||
BStringView* fReplicantString;
|
BStringView* fNotifications;
|
||||||
BCheckBox* fDisableReplicant;
|
BCheckBox* fNotifyProtocols;
|
||||||
BCheckBox* fPermanentReplicant;
|
BCheckBox* fNotifyContactStatus;
|
||||||
BCheckBox* fHideCayaDeskbar;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include "PreferencesAccounts.h"
|
#include "PreferencesAccounts.h"
|
||||||
#include "PreferencesBehavior.h"
|
#include "PreferencesBehavior.h"
|
||||||
#include "PreferencesChatWindow.h"
|
#include "PreferencesChatWindow.h"
|
||||||
|
#include "PreferencesReplicant.h"
|
||||||
|
|
||||||
const uint32 kApply = 'SAVE';
|
const uint32 kApply = 'SAVE';
|
||||||
|
|
||||||
|
@ -27,6 +28,7 @@ PreferencesDialog::PreferencesDialog()
|
||||||
tabView->AddTab(new PreferencesAccounts());
|
tabView->AddTab(new PreferencesAccounts());
|
||||||
tabView->AddTab(new PreferencesBehavior());
|
tabView->AddTab(new PreferencesBehavior());
|
||||||
tabView->AddTab(new PreferencesChatWindow());
|
tabView->AddTab(new PreferencesChatWindow());
|
||||||
|
tabView->AddTab(new PreferencesReplicant());
|
||||||
|
|
||||||
BButton* ok = new BButton("OK", new BMessage(kApply));
|
BButton* ok = new BButton("OK", new BMessage(kApply));
|
||||||
|
|
||||||
|
|
Ŝarĝante…
Reference in New Issue