Fixes to Notifications preflet
* CID-1501: protect against dynamic_cast potentially returning NULL * additional style fixes * fixed all warnings and enabled -Werror git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38188 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
6137279338
commit
2655efc395
@ -1406,7 +1406,7 @@ if $(HAIKU_NO_WERROR) != 1 {
|
|||||||
EnableWerror src preferences media ;
|
EnableWerror src preferences media ;
|
||||||
EnableWerror src preferences mouse ;
|
EnableWerror src preferences mouse ;
|
||||||
EnableWerror src preferences network ;
|
EnableWerror src preferences network ;
|
||||||
# EnableWerror src preferences notifications ;
|
EnableWerror src preferences notifications ;
|
||||||
EnableWerror src preferences opengl ;
|
EnableWerror src preferences opengl ;
|
||||||
EnableWerror src preferences print ;
|
EnableWerror src preferences print ;
|
||||||
EnableWerror src preferences screen ;
|
EnableWerror src preferences screen ;
|
||||||
|
@ -17,10 +17,10 @@
|
|||||||
const int32 kEdgeOffset = 4;
|
const int32 kEdgeOffset = 4;
|
||||||
|
|
||||||
|
|
||||||
BIconItem::BIconItem(BView* owner, const char* label, BBitmap* icon)
|
BIconItem::BIconItem(BView* owner, const char* label, BBitmap* icon)
|
||||||
:
|
:
|
||||||
fIcon(icon),
|
|
||||||
fLabel(label),
|
fLabel(label),
|
||||||
|
fIcon(icon),
|
||||||
fSelected(false),
|
fSelected(false),
|
||||||
fOwner(owner)
|
fOwner(owner)
|
||||||
{
|
{
|
||||||
|
@ -146,7 +146,7 @@ BIconRule::SetSelectionMessage(BMessage* message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32
|
void
|
||||||
BIconRule::AddIcon(const char* label, const BBitmap* icon)
|
BIconRule::AddIcon(const char* label, const BBitmap* icon)
|
||||||
{
|
{
|
||||||
BIconItem* item = new BIconItem(this, label, (BBitmap*)icon);
|
BIconItem* item = new BIconItem(this, label, (BBitmap*)icon);
|
||||||
|
@ -27,7 +27,7 @@ public:
|
|||||||
BMessage* SelectionMessage() const;
|
BMessage* SelectionMessage() const;
|
||||||
void SetSelectionMessage(BMessage* message);
|
void SetSelectionMessage(BMessage* message);
|
||||||
|
|
||||||
int32 AddIcon(const char* label, const BBitmap* icon);
|
void AddIcon(const char* label, const BBitmap* icon);
|
||||||
void RemoveIconAt(int32 index);
|
void RemoveIconAt(int32 index);
|
||||||
void RemoveAllIcons();
|
void RemoveAllIcons();
|
||||||
|
|
||||||
|
@ -140,17 +140,22 @@ void
|
|||||||
NotificationsView::MessageReceived(BMessage* msg)
|
NotificationsView::MessageReceived(BMessage* msg)
|
||||||
{
|
{
|
||||||
switch (msg->what) {
|
switch (msg->what) {
|
||||||
case kApplicationSelected: {
|
case kApplicationSelected:
|
||||||
BRow *row = fApplications->CurrentSelection();
|
{
|
||||||
if (row == NULL)
|
BRow* row = fApplications->CurrentSelection();
|
||||||
return;
|
if (row == NULL)
|
||||||
BStringField* appname =
|
return;
|
||||||
dynamic_cast<BStringField*>(row->GetField(kAppIndex));
|
BStringField* appName
|
||||||
|
= dynamic_cast<BStringField*>(row->GetField(kAppIndex));
|
||||||
|
if (appName == NULL)
|
||||||
|
break;
|
||||||
|
|
||||||
appusage_t::iterator it = fAppFilters.find(appname->String());
|
appusage_t::iterator it = fAppFilters.find(appName->String());
|
||||||
if (it != fAppFilters.end())
|
if (it != fAppFilters.end())
|
||||||
_Populate(it->second);
|
_Populate(it->second);
|
||||||
} break;
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
case kNotificationSelected:
|
case kNotificationSelected:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -32,9 +32,9 @@ PrefletView::PrefletView(SettingsHost* host)
|
|||||||
// Page selector
|
// Page selector
|
||||||
fRule = new BIconRule("icon_rule");
|
fRule = new BIconRule("icon_rule");
|
||||||
fRule->SetSelectionMessage(new BMessage(kPageSelected));
|
fRule->SetSelectionMessage(new BMessage(kPageSelected));
|
||||||
(void)fRule->AddIcon(_T("General"), NULL);
|
fRule->AddIcon(_T("General"), NULL);
|
||||||
(void)fRule->AddIcon(_T("Display"), NULL);
|
fRule->AddIcon(_T("Display"), NULL);
|
||||||
//(void)fRule->AddIcon(_T("Notifications"), NULL);
|
//fRule->AddIcon(_T("Notifications"), NULL);
|
||||||
|
|
||||||
// View for card layout
|
// View for card layout
|
||||||
fPagesView = new BView("pages", B_WILL_DRAW);
|
fPagesView = new BView("pages", B_WILL_DRAW);
|
||||||
|
Loading…
Reference in New Issue
Block a user