[haiku-development] patch for FileTypes

  • From: "Jonas Sundström" <jonas@xxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sat, 09 Jun 2007 22:41:00 +0200 CEST

I'm not sure what's planned for FileTypes, but here's a patch for the 
Application Types window.

Patch and screenshots:
http://www.kirilla.com/tmp/filetypes_prefs/patch1

* List deselection left-overs corrected:
http://www.kirilla.com/tmp/filetypes_prefs/patch1/before/screen6.png

* Button added to do what invoking an item in the list does, bring up 
the "Application Type" editor. It wasn't obvious to me that the app 
editor was available from there. Double-clicking in the list does not 
work, for some reason. Enter (or was it Space?) works though.

* "Open in Tracker" replaced with "Show in Tracker".
(Ideally it would have the application file selected as well, and not 
merely open its parent folder. The application could be outside the 
viewable area. Some Tracker scripting would take care of that.)

There are two remaining issues. The first one is with the list view. If 
you hold shift and select, deselect, and select again, IIRC, you get 
this: 
http://www.kirilla.com/tmp/filetypes_prefs/patch1/remaining/screen4.png
(Selected and yet not selected.)

The other issue, small as it may be, is that Tracker is used to launch 
applications.
http://www.kirilla.com/tmp/filetypes_prefs/patch1/remaining/screen5.png
I think it would make sense to use BRoster::Launch() directly.

/Jonas.
Index: ApplicationTypesWindow.h
===================================================================
--- ApplicationTypesWindow.h    (revision 21375)
+++ ApplicationTypesWindow.h    (working copy)
@@ -53,6 +53,7 @@
 
                BButton*                fTrackerButton;
                BButton*                fLaunchButton;
+               BButton*                fEditButton;
 };
 
 #endif // APPLICATION_TYPES_WINDOW_H
Index: ApplicationTypesWindow.cpp
===================================================================
--- ApplicationTypesWindow.cpp  (revision 21375)
+++ ApplicationTypesWindow.cpp  (working copy)
@@ -51,8 +51,8 @@
 const uint32 kMsgTypeSelected = 'typs';
 const uint32 kMsgTypeInvoked = 'typi';
 const uint32 kMsgRemoveUninstalled = 'runs';
+const uint32 kMsgEdit = 'edit';
 
-
 const char*
 variety_to_text(uint32 variety)
 {
@@ -267,7 +267,7 @@
        rect = box->Frame();
        rect.top = rect.bottom + 8.0f;
        rect.bottom = rect.top + 20.0f;
-       fTrackerButton = new BButton(rect, "tracker", "Open In Tracker" 
B_UTF8_ELLIPSIS, NULL,
+       fTrackerButton = new BButton(rect, "tracker", "Show In Tracker" 
B_UTF8_ELLIPSIS, NULL,
                B_FOLLOW_RIGHT);
        fTrackerButton->ResizeToPreferred();
        fTrackerButton->MoveTo(rect.right - fTrackerButton->Bounds().Width(), 
rect.top);
@@ -279,9 +279,16 @@
        fLaunchButton->MoveTo(fTrackerButton->Frame().left - 6.0f
                - fLaunchButton->Bounds().Width(), rect.top);
        topView->AddChild(fLaunchButton);
+       
+       fEditButton = new BButton(rect, "edit", "Edit" B_UTF8_ELLIPSIS, new 
BMessage(kMsgEdit),
+               B_FOLLOW_RIGHT);
+       fEditButton->ResizeToPreferred();
+       fEditButton->MoveTo(fLaunchButton->Frame().left - 6.0f
+               - fEditButton->Bounds().Width(), rect.top);
+       topView->AddChild(fEditButton);
 
        SetSizeLimits(scrollView->Frame().right + 22.0f + 
fTrackerButton->Frame().Width()
-               + fLaunchButton->Frame().Width(), 32767.0f,
+               + fLaunchButton->Frame().Width() + 6 + 
fEditButton->Frame().Width(), 32767.0f,
                fTrackerButton->Frame().bottom + 8.0f, 32767.0f);
 
        BMimeType::StartWatching(this);
@@ -417,7 +424,7 @@
                        path.GetParent(&path);
                        fPathView->SetText(path.Path());
 
-                       // Set "Open In Tracker" message
+                       // Set "Show In Tracker" message
                        BEntry entry(path.Path());
                        entry_ref directoryRef;
                        if (entry.GetRef(&directoryRef) == B_OK) {
@@ -456,7 +463,7 @@
                }
        } else {
                fNameView->SetText(NULL);
-               fNameView->SetText(NULL);
+               fSignatureView->SetText(NULL);
                fPathView->SetText(NULL);
 
                fVersionView->SetText(NULL);
@@ -472,6 +479,7 @@
 
        fTrackerButton->SetEnabled(enabled && appFound);
        fLaunchButton->SetEnabled(enabled && appFound);
+       fEditButton->SetEnabled(enabled && appFound);
 }
 
 
@@ -519,7 +527,13 @@
                        }
                        break;
                }
-
+               
+               case kMsgEdit:
+               {
+                       fTypeListView->Invoke();
+                       break;
+               }
+               
                case kMsgRemoveUninstalled:
                        _RemoveUninstalled();
                        break;

Other related posts: