[haiku-commits] r40473 - haiku/trunk/src/apps/people

Author: stippi
Date: 2011-02-12 23:15:38 +0100 (Sat, 12 Feb 2011)
New Revision: 40473
Changeset: http://dev.haiku-os.org/changeset/40473

Modified:
   haiku/trunk/src/apps/people/PeopleApp.cpp
   haiku/trunk/src/apps/people/PeopleApp.h
   haiku/trunk/src/apps/people/PersonWindow.cpp
Log:
Added "Configure attributes" item to Edit menu (?). This feature invokes
FileTypes with the Person MIME type selected.


Modified: haiku/trunk/src/apps/people/PeopleApp.cpp
===================================================================
--- haiku/trunk/src/apps/people/PeopleApp.cpp   2011-02-12 22:12:21 UTC (rev 
40472)
+++ haiku/trunk/src/apps/people/PeopleApp.cpp   2011-02-12 22:15:38 UTC (rev 
40473)
@@ -23,6 +23,7 @@
 #include <fs_index.h>
 #include <Locale.h>
 #include <Path.h>
+#include <Roster.h>
 #include <Screen.h>
 #include <Volume.h>
 #include <VolumeRoster.h>
@@ -237,6 +238,26 @@
                                PostMessage(B_QUIT_REQUESTED);
                        break;
 
+               case M_CONFIGURE_ATTRIBUTES:
+               {
+                       const char* arguments[] = { "-type", B_PERSON_MIMETYPE, 
0 };
+                       status_t ret = be_roster->Launch(
+                               "application/x-vnd.Haiku-FileTypes",
+                               sizeof(arguments) / sizeof(const char*) - 1,
+                               const_cast<char**>(arguments));
+                       if (ret != B_OK && ret != B_ALREADY_RUNNING) {
+                               BString errorMsg(B_TRANSLATE("Launching the 
FileTypes "
+                                       "preflet to configure Person attributes 
has failed."
+                                       "\n\nError: "));
+                               errorMsg << strerror(ret);
+                               BAlert* alert = new BAlert(B_TRANSLATE("Error"),
+                                       errorMsg.String(), B_TRANSLATE("OK"), 
NULL, NULL,
+                                       B_WIDTH_AS_USUAL, B_STOP_ALERT);
+                               alert->Go(NULL);
+                       }
+                       break;
+               }
+
                default:
                        BApplication::MessageReceived(message);
        }

Modified: haiku/trunk/src/apps/people/PeopleApp.h
===================================================================
--- haiku/trunk/src/apps/people/PeopleApp.h     2011-02-12 22:12:21 UTC (rev 
40472)
+++ haiku/trunk/src/apps/people/PeopleApp.h     2011-02-12 22:15:38 UTC (rev 
40473)
@@ -25,9 +25,10 @@
 class BFile;
 
 enum {
-       M_NEW                   = 'newp',
-       M_SAVE_AS               = 'svas',
-       M_WINDOW_QUITS  = 'wndq'
+       M_NEW                                   = 'newp',
+       M_SAVE_AS                               = 'svas',
+       M_WINDOW_QUITS                  = 'wndq',
+       M_CONFIGURE_ATTRIBUTES  = 'catr'
 };
 
 class PersonWindow;

Modified: haiku/trunk/src/apps/people/PersonWindow.cpp
===================================================================
--- haiku/trunk/src/apps/people/PersonWindow.cpp        2011-02-12 22:12:21 UTC 
(rev 40472)
+++ haiku/trunk/src/apps/people/PersonWindow.cpp        2011-02-12 22:15:38 UTC 
(rev 40473)
@@ -92,6 +92,10 @@
        BMenuItem* selectAllItem = new BMenuItem(B_TRANSLATE("Select all"),
                new BMessage(M_SELECT), 'A');
        menu->AddItem(selectAllItem);
+       menu->AddSeparatorItem();
+       menu->AddItem(item = new BMenuItem(B_TRANSLATE("Configure attributes"), 
+               new BMessage(M_CONFIGURE_ATTRIBUTES), 'F'));
+       item->SetTarget(be_app);
        menuBar->AddItem(menu);
 
        if (ref != NULL) {


Other related posts: