Turns out the "notification kit" was not actually used anywhere. So, remove it.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43157 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,52 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010, Haiku, Inc. All Rights Reserved.
|
|
||||||
* Copyright 2008-2009, Pier Luigi Fiorini. All Rights Reserved.
|
|
||||||
* Copyright 2004-2008, Michael Davidson. All Rights Reserved.
|
|
||||||
* Copyright 2004-2007, Mikael Eiman. All Rights Reserved.
|
|
||||||
* Distributed under the terms of the MIT License.
|
|
||||||
*/
|
|
||||||
#ifndef _APP_USAGE_H
|
|
||||||
#define _APP_USAGE_H
|
|
||||||
|
|
||||||
#include <map>
|
|
||||||
|
|
||||||
#include <Entry.h>
|
|
||||||
#include <Flattenable.h>
|
|
||||||
#include <Notification.h>
|
|
||||||
#include <Roster.h>
|
|
||||||
#include <String.h>
|
|
||||||
|
|
||||||
class BMessage;
|
|
||||||
class NotificationReceived;
|
|
||||||
|
|
||||||
typedef std::map<BString, NotificationReceived*> notification_t;
|
|
||||||
|
|
||||||
class AppUsage : public BFlattenable {
|
|
||||||
public:
|
|
||||||
AppUsage();
|
|
||||||
AppUsage(const char* name,
|
|
||||||
bool allow = true);
|
|
||||||
~AppUsage();
|
|
||||||
|
|
||||||
virtual bool AllowsTypeCode(type_code code) const;
|
|
||||||
virtual status_t Flatten(void* buffer, ssize_t numBytes) const;
|
|
||||||
virtual ssize_t FlattenedSize() const;
|
|
||||||
virtual bool IsFixedSize() const;
|
|
||||||
virtual type_code TypeCode() const;
|
|
||||||
virtual status_t Unflatten(type_code code, const void* buffer,
|
|
||||||
ssize_t numBytes);
|
|
||||||
|
|
||||||
const char* Name();
|
|
||||||
bool Allowed(const char* title, notification_type type);
|
|
||||||
bool Allowed();
|
|
||||||
NotificationReceived* NotificationAt(int32 index);
|
|
||||||
int32 Notifications();
|
|
||||||
void AddNotification(NotificationReceived* notification);
|
|
||||||
|
|
||||||
private:
|
|
||||||
BString fName;
|
|
||||||
bool fAllow;
|
|
||||||
notification_t fNotifications;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // _APP_USAGE_H
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010, Haiku, Inc. All Rights Reserved.
|
|
||||||
* Copyright 2008-2009, Pier Luigi Fiorini. All Rights Reserved.
|
|
||||||
* Copyright 2004-2008, Michael Davidson. All Rights Reserved.
|
|
||||||
* Copyright 2004-2007, Mikael Eiman. All Rights Reserved.
|
|
||||||
* Distributed under the terms of the MIT License.
|
|
||||||
*/
|
|
||||||
#ifndef _NOTIFICATION_RECEIVED_H
|
|
||||||
#define _NOTIFICATION_RECEIVED_H
|
|
||||||
|
|
||||||
#include <Flattenable.h>
|
|
||||||
#include <Roster.h>
|
|
||||||
#include <String.h>
|
|
||||||
|
|
||||||
class NotificationReceived : public BFlattenable {
|
|
||||||
public:
|
|
||||||
NotificationReceived();
|
|
||||||
NotificationReceived(const char* title, notification_type type,
|
|
||||||
bool enabled = true);
|
|
||||||
~NotificationReceived();
|
|
||||||
|
|
||||||
virtual bool AllowsTypeCode(type_code code) const;
|
|
||||||
virtual status_t Flatten(void *buffer, ssize_t numBytes) const;
|
|
||||||
virtual ssize_t FlattenedSize() const;
|
|
||||||
virtual bool IsFixedSize() const;
|
|
||||||
virtual type_code TypeCode() const;
|
|
||||||
virtual status_t Unflatten(type_code code, const void *buffer,
|
|
||||||
ssize_t numBytes);
|
|
||||||
|
|
||||||
const char* Title();
|
|
||||||
notification_type Type();
|
|
||||||
void SetType(notification_type type);
|
|
||||||
time_t LastReceived();
|
|
||||||
bool Allowed();
|
|
||||||
|
|
||||||
void SetTimeStamp(time_t time);
|
|
||||||
void UpdateTimeStamp();
|
|
||||||
|
|
||||||
private:
|
|
||||||
BString fTitle;
|
|
||||||
notification_type fType;
|
|
||||||
bool fEnabled;
|
|
||||||
time_t fLastReceived;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // _NOTIFICATION_RECEIVED_H
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010, Haiku, Inc. All Rights Reserved.
|
|
||||||
* Distributed under the terms of the MIT License.
|
|
||||||
*/
|
|
||||||
#ifndef _NOTIFICATIONS_H
|
|
||||||
#define _NOTIFICATIONS_H
|
|
||||||
|
|
||||||
#include <Mime.h>
|
|
||||||
|
|
||||||
#define kNotificationServerSignature "application/x-vnd.Haiku-notification_server"
|
|
||||||
|
|
||||||
// Messages
|
|
||||||
const uint32 kNotificationMessage = 'nssm';
|
|
||||||
|
|
||||||
// Settings constants
|
|
||||||
extern const char* kSettingsDirectory;
|
|
||||||
extern const char* kFiltersSettings;
|
|
||||||
extern const char* kGeneralSettings;
|
|
||||||
extern const char* kDisplaySettings;
|
|
||||||
|
|
||||||
// General settings
|
|
||||||
extern const char* kAutoStartName;
|
|
||||||
extern const char* kTimeoutName;
|
|
||||||
|
|
||||||
// General default settings
|
|
||||||
const float kDefaultAutoStart = false;
|
|
||||||
const int32 kDefaultTimeout = 10;
|
|
||||||
|
|
||||||
// Display settings
|
|
||||||
extern const char* kWidthName;
|
|
||||||
extern const char* kIconSizeName;
|
|
||||||
extern const char* kLayoutName;
|
|
||||||
|
|
||||||
// Display default settings
|
|
||||||
const float kDefaultWidth = 300.0f;
|
|
||||||
const icon_size kDefaultIconSize = B_LARGE_ICON;
|
|
||||||
|
|
||||||
#endif // _NOTIFICATIONS_H
|
|
||||||
@@ -1,193 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010, Haiku, Inc. All Rights Reserved.
|
|
||||||
* Copyright 2008-2009, Pier Luigi Fiorini. All Rights Reserved.
|
|
||||||
* Copyright 2004-2008, Michael Davidson. All Rights Reserved.
|
|
||||||
* Copyright 2004-2007, Mikael Eiman. All Rights Reserved.
|
|
||||||
* Distributed under the terms of the MIT License.
|
|
||||||
*
|
|
||||||
* Authors:
|
|
||||||
* Michael Davidson, [email protected]
|
|
||||||
* Mikael Eiman, [email protected]
|
|
||||||
* Pier Luigi Fiorini, [email protected]
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <Message.h>
|
|
||||||
|
|
||||||
#include <AppUsage.h>
|
|
||||||
#include <NotificationReceived.h>
|
|
||||||
|
|
||||||
const type_code kTypeCode = 'ipau';
|
|
||||||
|
|
||||||
|
|
||||||
AppUsage::AppUsage()
|
|
||||||
:
|
|
||||||
fName(""),
|
|
||||||
fAllow(true)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
AppUsage::AppUsage(const char* name, bool allow)
|
|
||||||
:
|
|
||||||
fName(name),
|
|
||||||
fAllow(allow)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
AppUsage::~AppUsage()
|
|
||||||
{
|
|
||||||
notification_t::iterator nIt;
|
|
||||||
for (nIt = fNotifications.begin(); nIt != fNotifications.end(); nIt++)
|
|
||||||
delete nIt->second;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
AppUsage::AllowsTypeCode(type_code code) const
|
|
||||||
{
|
|
||||||
return code == kTypeCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
AppUsage::Flatten(void* buffer, ssize_t numBytes) const
|
|
||||||
{
|
|
||||||
BMessage msg;
|
|
||||||
msg.AddString("signature", fName);
|
|
||||||
msg.AddBool("allow", fAllow);
|
|
||||||
|
|
||||||
notification_t::const_iterator nIt;
|
|
||||||
for (nIt = fNotifications.begin(); nIt != fNotifications.end(); nIt++)
|
|
||||||
msg.AddFlat("notification", nIt->second);
|
|
||||||
|
|
||||||
if (numBytes < msg.FlattenedSize())
|
|
||||||
return B_ERROR;
|
|
||||||
|
|
||||||
return msg.Flatten((char*)buffer, numBytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ssize_t
|
|
||||||
AppUsage::FlattenedSize() const
|
|
||||||
{
|
|
||||||
BMessage msg;
|
|
||||||
msg.AddString("signature", fName);
|
|
||||||
msg.AddBool("allow", fAllow);
|
|
||||||
|
|
||||||
notification_t::const_iterator nIt;
|
|
||||||
for (nIt = fNotifications.begin(); nIt != fNotifications.end(); nIt++)
|
|
||||||
msg.AddFlat("notification", nIt->second);
|
|
||||||
|
|
||||||
return msg.FlattenedSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
AppUsage::IsFixedSize() const
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
type_code
|
|
||||||
AppUsage::TypeCode() const
|
|
||||||
{
|
|
||||||
return kTypeCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
AppUsage::Unflatten(type_code code, const void* buffer,
|
|
||||||
ssize_t numBytes)
|
|
||||||
{
|
|
||||||
if (code != kTypeCode)
|
|
||||||
return B_ERROR;
|
|
||||||
|
|
||||||
BMessage msg;
|
|
||||||
status_t status = B_ERROR;
|
|
||||||
|
|
||||||
status = msg.Unflatten((const char*)buffer);
|
|
||||||
|
|
||||||
if (status == B_OK) {
|
|
||||||
msg.FindString("signature", &fName);
|
|
||||||
msg.FindBool("allow", &fAllow);
|
|
||||||
|
|
||||||
type_code type;
|
|
||||||
int32 count = 0;
|
|
||||||
|
|
||||||
status = msg.GetInfo("notification", &type, &count);
|
|
||||||
if (status != B_OK)
|
|
||||||
return status;
|
|
||||||
|
|
||||||
for (int32 i = 0; i < count; i++) {
|
|
||||||
NotificationReceived *notification = new NotificationReceived();
|
|
||||||
msg.FindFlat("notification", i, notification);
|
|
||||||
fNotifications[notification->Title()] = notification;
|
|
||||||
}
|
|
||||||
|
|
||||||
status = B_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const char*
|
|
||||||
AppUsage::Name()
|
|
||||||
{
|
|
||||||
return fName.String();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
AppUsage::Allowed(const char* title, notification_type type)
|
|
||||||
{
|
|
||||||
bool allowed = fAllow;
|
|
||||||
|
|
||||||
if (allowed) {
|
|
||||||
notification_t::iterator nIt = fNotifications.find(title);
|
|
||||||
if (nIt == fNotifications.end()) {
|
|
||||||
allowed = true;
|
|
||||||
fNotifications[title] = new NotificationReceived(title, type);
|
|
||||||
} else {
|
|
||||||
allowed = nIt->second->Allowed();
|
|
||||||
nIt->second->UpdateTimeStamp();
|
|
||||||
nIt->second->SetType(type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return allowed;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
AppUsage::Allowed()
|
|
||||||
{
|
|
||||||
return fAllow;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
NotificationReceived*
|
|
||||||
AppUsage::NotificationAt(int32 index)
|
|
||||||
{
|
|
||||||
notification_t::iterator nIt = fNotifications.begin();
|
|
||||||
for (int32 i = 0; i < index; i++)
|
|
||||||
nIt++;
|
|
||||||
|
|
||||||
return nIt->second;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int32
|
|
||||||
AppUsage::Notifications()
|
|
||||||
{
|
|
||||||
return fNotifications.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
AppUsage::AddNotification(NotificationReceived* notification)
|
|
||||||
{
|
|
||||||
fNotifications[notification->Title()] = notification;
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
SubDir HAIKU_TOP src kits notification ;
|
|
||||||
|
|
||||||
UsePrivateHeaders notification ;
|
|
||||||
|
|
||||||
StaticLibrary libnotification.a :
|
|
||||||
AppUsage.cpp
|
|
||||||
NotificationReceived.cpp
|
|
||||||
Notifications.cpp
|
|
||||||
;
|
|
||||||
@@ -1,164 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010, Haiku, Inc. All Rights Reserved.
|
|
||||||
* Copyright 2008-2009, Pier Luigi Fiorini. All Rights Reserved.
|
|
||||||
* Copyright 2004-2008, Michael Davidson. All Rights Reserved.
|
|
||||||
* Copyright 2004-2007, Mikael Eiman. All Rights Reserved.
|
|
||||||
* Distributed under the terms of the MIT License.
|
|
||||||
*
|
|
||||||
* Authors:
|
|
||||||
* Michael Davidson, [email protected]
|
|
||||||
* Mikael Eiman, [email protected]
|
|
||||||
* Pier Luigi Fiorini, [email protected]
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <Message.h>
|
|
||||||
#include <Notification.h>
|
|
||||||
#include <NotificationReceived.h>
|
|
||||||
|
|
||||||
const type_code kTypeCode = 'ipnt';
|
|
||||||
|
|
||||||
|
|
||||||
NotificationReceived::NotificationReceived()
|
|
||||||
:
|
|
||||||
fTitle(""),
|
|
||||||
fType(B_INFORMATION_NOTIFICATION),
|
|
||||||
fEnabled(false),
|
|
||||||
fLastReceived(time(NULL))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
NotificationReceived::NotificationReceived(const char* title,
|
|
||||||
notification_type type, bool enabled)
|
|
||||||
:
|
|
||||||
fTitle(title),
|
|
||||||
fType(type),
|
|
||||||
fEnabled(enabled),
|
|
||||||
fLastReceived(time(NULL))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
NotificationReceived::~NotificationReceived()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
NotificationReceived::AllowsTypeCode(type_code code) const
|
|
||||||
{
|
|
||||||
return code == kTypeCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
NotificationReceived::Flatten(void* buffer, ssize_t numBytes) const
|
|
||||||
{
|
|
||||||
BMessage msg;
|
|
||||||
msg.AddString("notify_title", fTitle);
|
|
||||||
msg.AddInt32("notify_type", (int32)fType);
|
|
||||||
msg.AddInt32("notify_lastreceived", (int32)fLastReceived);
|
|
||||||
msg.AddBool("notify_enabled", fEnabled);
|
|
||||||
|
|
||||||
if (numBytes < msg.FlattenedSize())
|
|
||||||
return B_ERROR;
|
|
||||||
|
|
||||||
return msg.Flatten((char*)buffer, numBytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ssize_t
|
|
||||||
NotificationReceived::FlattenedSize() const
|
|
||||||
{
|
|
||||||
BMessage msg;
|
|
||||||
msg.AddString("notify_title", fTitle);
|
|
||||||
msg.AddInt32("notify_type", (int32)fType);
|
|
||||||
msg.AddInt32("notify_lastreceived", (int32)fLastReceived);
|
|
||||||
msg.AddBool("notify_enabled", fEnabled);
|
|
||||||
|
|
||||||
return msg.FlattenedSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
NotificationReceived::IsFixedSize() const
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
type_code
|
|
||||||
NotificationReceived::TypeCode() const
|
|
||||||
{
|
|
||||||
return kTypeCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
NotificationReceived::Unflatten(type_code code, const void* buffer,
|
|
||||||
ssize_t numBytes)
|
|
||||||
{
|
|
||||||
if (code != kTypeCode)
|
|
||||||
return B_ERROR;
|
|
||||||
|
|
||||||
BMessage msg;
|
|
||||||
status_t error = msg.Unflatten((const char*)buffer);
|
|
||||||
|
|
||||||
if (error == B_OK) {
|
|
||||||
msg.FindString("notify_title", &fTitle);
|
|
||||||
msg.FindInt32("notify_type", (int32 *)&fType);
|
|
||||||
msg.FindInt32("notify_lastreceived", (int32 *)&fLastReceived);
|
|
||||||
msg.FindBool("notify_enabled", &fEnabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const char*
|
|
||||||
NotificationReceived::Title()
|
|
||||||
{
|
|
||||||
return fTitle.String();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
notification_type
|
|
||||||
NotificationReceived::Type()
|
|
||||||
{
|
|
||||||
return fType;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
NotificationReceived::SetType(notification_type type)
|
|
||||||
{
|
|
||||||
fType = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
time_t
|
|
||||||
NotificationReceived::LastReceived()
|
|
||||||
{
|
|
||||||
return fLastReceived;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
NotificationReceived::Allowed()
|
|
||||||
{
|
|
||||||
return fEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
NotificationReceived::UpdateTimeStamp()
|
|
||||||
{
|
|
||||||
fLastReceived = time(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
NotificationReceived::SetTimeStamp(time_t time)
|
|
||||||
{
|
|
||||||
fLastReceived = time;
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010, Haiku, Inc. All Rights Reserved.
|
|
||||||
* Distributed under the terms of the MIT License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include <Notifications.h>
|
|
||||||
|
|
||||||
|
|
||||||
// Settings constants
|
|
||||||
const char* kSettingsDirectory = "system/notifications";
|
|
||||||
const char* kFiltersSettings = "filters";
|
|
||||||
const char* kGeneralSettings = "general";
|
|
||||||
const char* kDisplaySettings = "display";
|
|
||||||
|
|
||||||
// General settings
|
|
||||||
const char* kAutoStartName = "auto-start";
|
|
||||||
const char* kTimeoutName = "timeout";
|
|
||||||
|
|
||||||
// Display settings
|
|
||||||
const char* kWidthName = "width";
|
|
||||||
const char* kIconSizeName = "icon size";
|
|
||||||
Reference in New Issue
Block a user