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