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:
shatty
2004-01-07 10:46:20 +00:00
parent 2b2b029905
commit 42f39580d8
8 changed files with 67 additions and 14 deletions
+2 -2
View File
@@ -4,8 +4,8 @@
#include <AppTypeVersionInfoView.h>
AppTypeView::AppTypeView(BRect viewFrame)
: BView(viewFrame, "AppTypeView", B_FOLLOW_ALL,
B_FRAME_EVENTS|B_WILL_DRAW)
: BBox(viewFrame, "AppTypeView", B_FOLLOW_ALL,
B_FRAME_EVENTS|B_WILL_DRAW, B_PLAIN_BORDER)
{
SetViewColor( ui_color(B_PANEL_BACKGROUND_COLOR) );
+2 -2
View File
@@ -1,14 +1,14 @@
#ifndef APP_TYPE_VIEW_H
#define APP_TYPE_VIEW_H
#include <Box.h>
#include <TextControl.h>
#include <View.h>
class AppTypeAppFlagsView;
class AppTypeSupportedTypesView;
class AppTypeVersionInfoView;
class AppTypeView : public BView {
class AppTypeView : public BBox {
public:
AppTypeView(BRect viewFrame);
~AppTypeView();
+10 -1
View File
@@ -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
AppTypeWindow::SaveRequested()
{
status_t result = B_OK;
// TODO : save new settings
// TODO : save new settings to all attributes and resources matching the name
return result;
}
@@ -137,4 +144,6 @@ AppTypeWindow::SetEntry(const BEntry * entry)
SetTitle(strdup(title.String()));
// 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],"-help") == 0) ||
(strcmp(argv[i],"--help") == 0)) {
void * item;
for (int32 i = 0 ; (i < entryList.CountItems()) ; i++) {
delete entryList.ItemAt(i);
}
+1 -1
View File
@@ -12,7 +12,7 @@ class FileTypeApp
public:
FileTypeApp();
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 ReadyToRun();
+48 -3
View File
@@ -1,10 +1,11 @@
#include <MenuItem.h>
#include <Message.h>
#include <Mime.h>
#include <FileTypeView.h>
FileTypeView::FileTypeView(BRect viewFrame)
: BView(viewFrame, "FileTypeView", B_FOLLOW_ALL,
B_FRAME_EVENTS|B_WILL_DRAW)
: BBox(viewFrame, "FileTypeView", B_FOLLOW_ALL,
B_FRAME_EVENTS|B_WILL_DRAW, B_PLAIN_BORDER)
{
SetViewColor( ui_color(B_PANEL_BACKGROUND_COLOR) );
@@ -52,6 +53,50 @@ FileTypeView::SetFileType(const char * fileType)
{
fFileType.SetTo(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
+1 -1
View File
@@ -8,7 +8,7 @@
#include <TextControl.h>
#include <View.h>
class FileTypeView : public BView {
class FileTypeView : public BBox {
public:
FileTypeView(BRect viewFrame);
~FileTypeView();
@@ -44,10 +44,10 @@ FileTypeWindow::FileTypeWindow(const BList * entryList)
FileTypeWindow::~FileTypeWindow()
{
if (fEntryList != 0) {
void * item;
for (int32 i = 0 ; item = fEntryList->ItemAt(i) ; i++) {
delete item;
for (int32 i = 0 ; (i < fEntryList->CountItems()) ; i++) {
delete fEntryList->ItemAt(i);
}
fEntryList->MakeEmpty();
delete fEntryList;
}
}