mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-09 05:10:05 +02:00
iceweasel: fix open urls
This commit is contained in:
@@ -116,7 +116,7 @@ BUILD()
|
||||
./mach build
|
||||
|
||||
cd tools/haiku-launcher
|
||||
gcc -o "Iceweasel Browser" Launcher.cpp -lbe
|
||||
gcc -o "Iceweasel Browser" launcher.cpp -lbe
|
||||
}
|
||||
|
||||
INSTALL()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From a949b39e3d32e9517ce92a91f83ab903fc63fb77 Mon Sep 17 00:00:00 2001
|
||||
From 3dab2a31d7a13387221b49bf3d19ba544fafcc65 Mon Sep 17 00:00:00 2001
|
||||
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
||||
Date: Wed, 2 Apr 2025 15:27:57 +1000
|
||||
Subject: Add Haiku build support
|
||||
@@ -5508,7 +5508,7 @@ index dbd9993..1431340 100644
|
||||
2.48.1
|
||||
|
||||
|
||||
From fe67c29412362d63c85ff534412759fab78ba8c9 Mon Sep 17 00:00:00 2001
|
||||
From c50ab036bba159ac86a3b8322bb097f327544523 Mon Sep 17 00:00:00 2001
|
||||
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
||||
Date: Sat, 5 Apr 2025 15:58:03 +1000
|
||||
Subject: Implement native remote server
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
From 11ae0144de9dad6ce1fc34a56841850ff85b2303 Mon Sep 17 00:00:00 2001
|
||||
From 87d14d4ef2e06f7dfeeb66aa2fac74fef2e58cc6 Mon Sep 17 00:00:00 2001
|
||||
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
||||
Date: Sat, 5 Apr 2025 15:59:34 +1000
|
||||
Date: Sun, 6 Apr 2025 10:13:00 +1000
|
||||
Subject: Add simple launcher app
|
||||
|
||||
|
||||
diff --git a/tools/haiku-launcher/Launcher.cpp b/tools/haiku-launcher/Launcher.cpp
|
||||
diff --git a/tools/haiku-launcher/launcher.cpp b/tools/haiku-launcher/launcher.cpp
|
||||
new file mode 100644
|
||||
index 0000000..1e64263
|
||||
index 0000000..86a9f22
|
||||
--- /dev/null
|
||||
+++ b/tools/haiku-launcher/Launcher.cpp
|
||||
@@ -0,0 +1,99 @@
|
||||
+++ b/tools/haiku-launcher/launcher.cpp
|
||||
@@ -0,0 +1,111 @@
|
||||
+#include <stdlib.h>
|
||||
+#include <stdio.h>
|
||||
+#include <errno.h>
|
||||
+#include <string.h>
|
||||
+
|
||||
+#include <Application.h>
|
||||
+#include <Alert.h>
|
||||
+#include <String.h>
|
||||
+#include <Resources.h>
|
||||
+#include <Roster.h>
|
||||
@@ -28,16 +29,20 @@ index 0000000..1e64263
|
||||
+ public:
|
||||
+ BrowserLauncherApp(const char *signature, int argc, char **argv);
|
||||
+ ~BrowserLauncherApp() {};
|
||||
+ void RefsReceived(BMessage *pmsg);
|
||||
+
|
||||
+ virtual void RefsReceived(BMessage *pmsg);
|
||||
+ virtual void ArgvRecieved(int32 argc, char**argv);
|
||||
+ virtual void ReadyToRun();
|
||||
+ BString GetBinPath(void);
|
||||
+
|
||||
+ private:
|
||||
+ BMessenger fTrackerMessenger;
|
||||
+ BString fCommandLine;
|
||||
+};
|
||||
+
|
||||
+BrowserLauncherApp::BrowserLauncherApp(const char *signature, int argc, char **argv)
|
||||
+ : BApplication(signature)
|
||||
+{
|
||||
+ ArgvRecieved(argc, argv);
|
||||
+}
|
||||
+
|
||||
+BString
|
||||
@@ -64,43 +69,50 @@ index 0000000..1e64263
|
||||
+void
|
||||
+BrowserLauncherApp::RefsReceived(BMessage *pmsg)
|
||||
+{
|
||||
+ if (pmsg->HasMessenger("TrackerViewToken")) {
|
||||
+ pmsg->FindMessenger("TrackerViewToken", &fTrackerMessenger);
|
||||
+ }
|
||||
+
|
||||
+ uint32 type;
|
||||
+ int32 count;
|
||||
+ status_t ret = pmsg->GetInfo("refs", &type, &count);
|
||||
+ if (ret != B_OK || type != B_REF_TYPE)
|
||||
+ return;
|
||||
+
|
||||
+ BString commandLine = GetBinPath();
|
||||
+ fCommandLine = GetBinPath();
|
||||
+
|
||||
+ entry_ref ref;
|
||||
+ for (int32 i = 0; i < count; i++) {
|
||||
+ if (pmsg->FindRef("refs", i, &ref) == B_OK)
|
||||
+ {
|
||||
+ BPath file=BPath(&ref);
|
||||
+ commandLine += " \"";
|
||||
+ commandLine += file.Path();
|
||||
+ commandLine += "\"";
|
||||
+ }
|
||||
+ for (int32 i = 0; pmsg->FindRef("refs", i, &ref) == B_OK; i++) {
|
||||
+ BPath file = BPath(&ref);
|
||||
+ fCommandLine += " \"";
|
||||
+ fCommandLine += file.Path();
|
||||
+ fCommandLine += "\"";
|
||||
+ }
|
||||
+ commandLine += " &";
|
||||
+ system(commandLine.String());
|
||||
+ Quit();
|
||||
+
|
||||
+ BString url;
|
||||
+ for (int32 i = 0; pmsg->FindString("url", i, &url) == B_OK; i++) {
|
||||
+ fCommandLine += " \"";
|
||||
+ fCommandLine += url;
|
||||
+ fCommandLine += "\"";
|
||||
+ }
|
||||
+
|
||||
+ fCommandLine += " &";
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+BrowserLauncherApp::ArgvRecieved(int32 argc, char**argv)
|
||||
+{
|
||||
+ BMessage message(B_REFS_RECEIVED);
|
||||
+ for (int i = 1; i < argc; i++) {
|
||||
+ const char* url = argv[i];
|
||||
+ BEntry entry(argv[i], true);
|
||||
+ BPath path;
|
||||
+ if (entry.Exists() && entry.GetPath(&path) == B_OK)
|
||||
+ url = path.Path();
|
||||
+ message.AddString("url", url);
|
||||
+ }
|
||||
+ RefsReceived(&message);
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+BrowserLauncherApp::ReadyToRun()
|
||||
+{
|
||||
+ BString commandLine = GetBinPath();
|
||||
+ commandLine += " &";
|
||||
+ system(commandLine.String());
|
||||
+ if (!fCommandLine.IsEmpty())
|
||||
+ system(fCommandLine.String());
|
||||
+
|
||||
+ Quit();
|
||||
+}
|
||||
+
|
||||
+
|
||||
+int main(int argc, char **argv)
|
||||
+{
|
||||
+ BrowserLauncherApp application("application/x-vnd.iceweasel-launcher", argc, argv);
|
||||
|
||||
Reference in New Issue
Block a user