assorted warnings patches, look and feel patches, populate the preferred application field prettily
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5977 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -4,8 +4,8 @@
|
|||||||
#include <AppTypeVersionInfoView.h>
|
#include <AppTypeVersionInfoView.h>
|
||||||
|
|
||||||
AppTypeView::AppTypeView(BRect viewFrame)
|
AppTypeView::AppTypeView(BRect viewFrame)
|
||||||
: BView(viewFrame, "AppTypeView", B_FOLLOW_ALL,
|
: BBox(viewFrame, "AppTypeView", B_FOLLOW_ALL,
|
||||||
B_FRAME_EVENTS|B_WILL_DRAW)
|
B_FRAME_EVENTS|B_WILL_DRAW, B_PLAIN_BORDER)
|
||||||
{
|
{
|
||||||
SetViewColor( ui_color(B_PANEL_BACKGROUND_COLOR) );
|
SetViewColor( ui_color(B_PANEL_BACKGROUND_COLOR) );
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
#ifndef APP_TYPE_VIEW_H
|
#ifndef APP_TYPE_VIEW_H
|
||||||
#define APP_TYPE_VIEW_H
|
#define APP_TYPE_VIEW_H
|
||||||
|
|
||||||
|
#include <Box.h>
|
||||||
#include <TextControl.h>
|
#include <TextControl.h>
|
||||||
#include <View.h>
|
|
||||||
|
|
||||||
class AppTypeAppFlagsView;
|
class AppTypeAppFlagsView;
|
||||||
class AppTypeSupportedTypesView;
|
class AppTypeSupportedTypesView;
|
||||||
class AppTypeVersionInfoView;
|
class AppTypeVersionInfoView;
|
||||||
|
|
||||||
class AppTypeView : public BView {
|
class AppTypeView : public BBox {
|
||||||
public:
|
public:
|
||||||
AppTypeView(BRect viewFrame);
|
AppTypeView(BRect viewFrame);
|
||||||
~AppTypeView();
|
~AppTypeView();
|
||||||
|
|||||||
@@ -115,12 +115,19 @@ AppTypeWindow::QuitRequested()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char * application_file_types = "BEOS:FILE_TYPES";
|
||||||
|
static const char * application_flags_name = "BEOS:APP_FLAGS";
|
||||||
|
static const char * application_large_standard_icon_name = "BEOS:L:STD_ICON";
|
||||||
|
static const char * application_median_standard_icon_name = "BEOS:M:STD_ICON";
|
||||||
|
static const char * application_signature_name = "BEOS:APP_SIG";
|
||||||
|
static const char * application_version_name = "BEOS:APP_VERSION";
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
AppTypeWindow::SaveRequested()
|
AppTypeWindow::SaveRequested()
|
||||||
{
|
{
|
||||||
status_t result = B_OK;
|
status_t result = B_OK;
|
||||||
|
|
||||||
// TODO : save new settings
|
// TODO : save new settings to all attributes and resources matching the name
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -137,4 +144,6 @@ AppTypeWindow::SetEntry(const BEntry * entry)
|
|||||||
SetTitle(strdup(title.String()));
|
SetTitle(strdup(title.String()));
|
||||||
|
|
||||||
// TODO : set old settings
|
// TODO : set old settings
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -157,7 +157,6 @@ FileTypeApp::ArgvReceived(int32 argc, const char * argv[], const char * cwd)
|
|||||||
(strcmp(argv[i],"-H") == 0) ||
|
(strcmp(argv[i],"-H") == 0) ||
|
||||||
(strcmp(argv[i],"-help") == 0) ||
|
(strcmp(argv[i],"-help") == 0) ||
|
||||||
(strcmp(argv[i],"--help") == 0)) {
|
(strcmp(argv[i],"--help") == 0)) {
|
||||||
void * item;
|
|
||||||
for (int32 i = 0 ; (i < entryList.CountItems()) ; i++) {
|
for (int32 i = 0 ; (i < entryList.CountItems()) ; i++) {
|
||||||
delete entryList.ItemAt(i);
|
delete entryList.ItemAt(i);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class FileTypeApp
|
|||||||
public:
|
public:
|
||||||
FileTypeApp();
|
FileTypeApp();
|
||||||
virtual void MessageReceived(BMessage *message);
|
virtual void MessageReceived(BMessage *message);
|
||||||
virtual void ArgvReceived(int32 argc, const char *argv[], const char * cwd);
|
void ArgvReceived(int32 argc, const char *argv[], const char * cwd);
|
||||||
virtual void RefsReceived(BMessage *message);
|
virtual void RefsReceived(BMessage *message);
|
||||||
virtual void ReadyToRun();
|
virtual void ReadyToRun();
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
#include <MenuItem.h>
|
#include <MenuItem.h>
|
||||||
|
#include <Message.h>
|
||||||
|
#include <Mime.h>
|
||||||
#include <FileTypeView.h>
|
#include <FileTypeView.h>
|
||||||
|
|
||||||
FileTypeView::FileTypeView(BRect viewFrame)
|
FileTypeView::FileTypeView(BRect viewFrame)
|
||||||
: BView(viewFrame, "FileTypeView", B_FOLLOW_ALL,
|
: BBox(viewFrame, "FileTypeView", B_FOLLOW_ALL,
|
||||||
B_FRAME_EVENTS|B_WILL_DRAW)
|
B_FRAME_EVENTS|B_WILL_DRAW, B_PLAIN_BORDER)
|
||||||
{
|
{
|
||||||
SetViewColor( ui_color(B_PANEL_BACKGROUND_COLOR) );
|
SetViewColor( ui_color(B_PANEL_BACKGROUND_COLOR) );
|
||||||
|
|
||||||
@@ -52,6 +53,50 @@ FileTypeView::SetFileType(const char * fileType)
|
|||||||
{
|
{
|
||||||
fFileType.SetTo(fileType);
|
fFileType.SetTo(fileType);
|
||||||
fFileTypeTextControl->SetText(fileType);
|
fFileTypeTextControl->SetText(fileType);
|
||||||
|
BMimeType mime(fileType);
|
||||||
|
if (mime.InitCheck() != B_OK) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
BMessage applications;
|
||||||
|
if (mime.GetSupportingApps(&applications) != B_OK) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int32 subs = 0;
|
||||||
|
if (applications.FindInt32("be:sub", &subs) != B_OK) {
|
||||||
|
subs = 0;
|
||||||
|
}
|
||||||
|
int32 supers = 0;
|
||||||
|
if (applications.FindInt32("be:super", &supers) != B_OK) {
|
||||||
|
supers = 0;
|
||||||
|
}
|
||||||
|
for (int i = fPreferredAppMenu->CountItems() ; (i > 2) ; i--) {
|
||||||
|
BMenuItem * item = fPreferredAppMenu->ItemAt(i);
|
||||||
|
fPreferredAppMenu->RemoveItem(i);
|
||||||
|
delete item;
|
||||||
|
}
|
||||||
|
bool separator = false;
|
||||||
|
for (int i = 0 ; (i < subs+supers) ; i++) {
|
||||||
|
const char * str;
|
||||||
|
if (applications.FindString("applications", i, &str) == B_OK) {
|
||||||
|
BMimeType app_mime(str);
|
||||||
|
BMessage * message = NULL;
|
||||||
|
entry_ref ref;
|
||||||
|
if (app_mime.InitCheck() == B_OK) {
|
||||||
|
if (app_mime.GetAppHint(&ref) == B_OK) {
|
||||||
|
message = new BMessage();
|
||||||
|
message->AddString("mimetype",str);
|
||||||
|
str = ref.name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (i < subs) {
|
||||||
|
separator = true;
|
||||||
|
} else if (separator) {
|
||||||
|
fPreferredAppMenu->AddSeparatorItem();
|
||||||
|
separator = false;
|
||||||
|
}
|
||||||
|
fPreferredAppMenu->AddItem(new BMenuItem(str,message));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#include <TextControl.h>
|
#include <TextControl.h>
|
||||||
#include <View.h>
|
#include <View.h>
|
||||||
|
|
||||||
class FileTypeView : public BView {
|
class FileTypeView : public BBox {
|
||||||
public:
|
public:
|
||||||
FileTypeView(BRect viewFrame);
|
FileTypeView(BRect viewFrame);
|
||||||
~FileTypeView();
|
~FileTypeView();
|
||||||
|
|||||||
@@ -44,10 +44,10 @@ FileTypeWindow::FileTypeWindow(const BList * entryList)
|
|||||||
FileTypeWindow::~FileTypeWindow()
|
FileTypeWindow::~FileTypeWindow()
|
||||||
{
|
{
|
||||||
if (fEntryList != 0) {
|
if (fEntryList != 0) {
|
||||||
void * item;
|
for (int32 i = 0 ; (i < fEntryList->CountItems()) ; i++) {
|
||||||
for (int32 i = 0 ; item = fEntryList->ItemAt(i) ; i++) {
|
delete fEntryList->ItemAt(i);
|
||||||
delete item;
|
|
||||||
}
|
}
|
||||||
|
fEntryList->MakeEmpty();
|
||||||
delete fEntryList;
|
delete fEntryList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user