Bläddra i källkod

Add SQLite open file support

Toby Chui 1 vecka sedan
förälder
incheckning
572562005f
2 ändrade filer med 10 tillägg och 2 borttagningar
  1. 8 1
      src/web/SQLite Admin/index.html
  2. 2 1
      src/web/SQLite Admin/init.agi

+ 8 - 1
src/web/SQLite Admin/index.html

@@ -681,7 +681,8 @@ function api(params, cb) {
     });
 }
 
-// Probe SQLite availability on load; show banner and disable open button if unsupported
+// Probe SQLite availability on load; show banner and disable open button if unsupported.
+// If a file was passed in via double-click, open it once availability is confirmed.
 (function checkSQLiteAvailability() {
     api({action: 'available'}, function(err, data) {
         var unavailable = (err) ||
@@ -692,6 +693,12 @@ function api(params, cb) {
             document.getElementById('btn-open-db').disabled = true;
             document.getElementById('btn-open-db').title =
                 'SQLite is not supported on this platform';
+            return;
+        }
+        var inputFiles = ao_module_loadInputFiles();
+        if (inputFiles && inputFiles.length > 0) {
+            var vpath = inputFiles[0].filepath || inputFiles[0];
+            if (vpath) openDatabase(vpath);
         }
     });
 }());

+ 2 - 1
src/web/SQLite Admin/init.agi

@@ -6,7 +6,8 @@ var moduleLaunchInfo = {
     StartDir: "SQLite Admin/index.html",
     SupportFW: true,
     LaunchFWDir: "SQLite Admin/index.html",
-    InitFWSize: [1100, 680]
+    InitFWSize: [1100, 680],
+    SupportedExt: [".sqlite", ".sqlite3", ".db"]
 }
 
 registerModule(JSON.stringify(moduleLaunchInfo));