Fix app sig and put it at a single place.
Add support for NetPositive bookmarks, so one can for ex place a bookmark on the desktop with an http: dl link for moz with pref app set to urlwrapper. *hint* Korli :) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20831 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
fc92527647
commit
5f29df20b2
@ -26,7 +26,7 @@
|
||||
/* compile-time configuration */
|
||||
#include "urlwrapper.h"
|
||||
|
||||
const char *kAppSig = "application/x-vnd.haiku.urlwrapper";
|
||||
const char *kAppSig = APP_SIGNATURE;
|
||||
const char *kTrackerSig = "application/x-vnd.Be-TRAK";
|
||||
|
||||
#ifdef __HAIKU__
|
||||
@ -86,6 +86,7 @@ public:
|
||||
status_t SplitUrl(const char *url, BString &host, BString &port, BString &user, BString &pass, BString &path);
|
||||
status_t UnurlString(BString &s);
|
||||
status_t Warn(const char *url);
|
||||
virtual void RefsReceived(BMessage *msg);
|
||||
virtual void ArgvReceived(int32 argc, char **argv);
|
||||
virtual void ReadyToRun(void);
|
||||
private:
|
||||
@ -222,6 +223,24 @@ status_t UrlWrapperApp::Warn(const char *url)
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
void UrlWrapperApp::RefsReceived(BMessage *msg)
|
||||
{
|
||||
char buff[B_PATH_NAME_LENGTH];
|
||||
int32 index = 0;
|
||||
entry_ref ref;
|
||||
char *args[] = { "urlwrapper", buff, NULL };
|
||||
#ifdef HANDLE_BOOKMARK_FILES
|
||||
/* eat everything as bookmark files */
|
||||
while (msg->FindRef("refs", index++, &ref) == B_OK) {
|
||||
BFile f(&ref, B_READ_ONLY);
|
||||
if (f.InitCheck() == B_OK) {
|
||||
if (f.ReadAttr("META:url", B_STRING_TYPE, 0LL, buff, B_PATH_NAME_LENGTH) > 0) {
|
||||
ArgvReceived(2, args);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void UrlWrapperApp::ArgvReceived(int32 argc, char **argv)
|
||||
{
|
||||
|
@ -10,10 +10,16 @@
|
||||
* urlwrapper: compile-time configuration of supported protocols.
|
||||
*/
|
||||
|
||||
#define APP_SIGNATURE "application/x-vnd.Haiku-urlwrapper"
|
||||
|
||||
/*
|
||||
* comment out to disable handling a specific protocol
|
||||
*/
|
||||
|
||||
|
||||
/* NetPositive Bookmark file type */
|
||||
#define HANDLE_BOOKMARK_FILES
|
||||
|
||||
/* file: redirects to Tracker */
|
||||
#define HANDLE_FILE
|
||||
|
||||
|
@ -1,10 +1,14 @@
|
||||
#include "urlwrapper.h"
|
||||
|
||||
resource app_signature "application/x-vnd.haiku.urlwrapper";
|
||||
resource app_flags B_MULTIPLE_LAUNCH | B_BACKGROUND_APP | B_ARGV_ONLY;
|
||||
resource app_signature APP_SIGNATURE;
|
||||
/*resource app_flags B_MULTIPLE_LAUNCH | B_BACKGROUND_APP | B_ARGV_ONLY;*/
|
||||
resource app_flags B_MULTIPLE_LAUNCH | B_BACKGROUND_APP;
|
||||
|
||||
resource(1, "BEOS:FILE_TYPES") message
|
||||
{
|
||||
#ifdef HANDLE_BOOKMARK_FILES
|
||||
"types" = "application/x-vnd.Be-bookmark",
|
||||
#endif
|
||||
#ifdef HANDLE_FILE
|
||||
"types" = "application/x-vnd.Be.URL.file",
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user