KDE-Apps.org Applications for the KDE-Desktop 
 GTK-Apps.org Applications using the GTK Toolkit 
 GnomeFiles.org Applications for GNOME 
 MeeGo-Central.org Applications for MeeGo 
 CLI-Apps.org Command Line Applications 
 Qt-Apps.org OpenSource Qt Applications 
 Qt-Prop.org Qt Applications 
 Maemo-Apps.org Applications for the Maemo Plattform 
 Java-Apps.org Free Java Applications 
 eyeOS-Apps.org Free eyeOS Applications 
 Wine-Apps.org Wine Applications 
 Server-Apps.org Server Applications 
 apps.ownCloud.com ownCloud Applications 
 KDE-Look.org Artwork for the KDE-Desktop 
 GNOME-Look.org Artwork for the GNOME-Desktop 
 Xfce-Look.org Artwork for the Xfce-Desktop 
 Box-Look.org Artwork for your Windowmanager 
 E17-Stuff.org Artwork for Enlightenment 
 Beryl-Themes.org Artwork for the Beryl Windowmanager 
 Compiz-Themes.org Artwork for the Compiz Windowmanager 
 EDE-Look.org Themes for your EDE Desktop 
 Debian-Art.org Stuff for Debian 
 Gentoo-Art.org Artwork for Gentoo Linux 
 SUSE-Art.org Artwork for openSUSE 
 Ubuntu-Art.org Artwork for Ubuntu 
 Kubuntu-Art.org Artwork for Kubuntu 
 LinuxMint-Art.org Artwork for Linux Mint 
 Frugalware-Art.org Artwork for Frugalware Linux 
 Arch-Stuff.org Artwork and Stuff for Arch Linux 
 Fedora-Art.org Artwork for Fedora Linux 
 Mandriva-Art.org Artwork for Mandriva Linux 
 KDE-Files.org Files for KDE Applications 
 OpenTemplate.org Documents for OpenOffice.org
 GIMPStuff.org Files for GIMP
 InkscapeStuff.org Files for Inkscape
 ScribusStuff.org Files for Scribus
 BlenderStuff.org Textures and Objects for Blender
 VLC-Addons.org Themes and Extensions for VLC
 KDE-Help.org Support for your KDE Desktop 
 GNOME-Help.org Support for your GNOME Desktop 
 Xfce-Help.org Support for your Xfce Desktop 
openDesktop.orgopenDesktop.org:   Applications   Artwork   Linux Distributions   Documents    Linux42.org    OpenSkillz.com   
Maemo-Apps.org - Applicatons for the Maemo platform
 Aug 27 2016  
 Not logged in  
Maemo-Apps.org Home    Add App   Forum   Groups   Jobs   Register   Login 

- New questions .- Answered question .- Not answered question .- My questions .- Post your question here . 
Go back to the overview page to see other entries
Back to overview

click to vote up

Trigger my app when another one is activated

ownCloud - Feb 21 2014

I’ve written a small app that adds configuration options to owncloud included text editor (font size, search parameters, hidden characters...)

The way I've done it works, but it cannot be the right way to do it. To launch my app whenever the TextEditor is displayed, I overwrite the registered file actions that launch the text editor in apps/files_texteditor/editor.js.

Here is the piece of my code that manages the launch of my app.
In app.php:
OCP\Util::addscript('myapp', 'MyApp');

In MyApp.js:
if (typeof FileActions !== 'undefined')
FileActions.register('text', 'Edit', OC.PERMISSION_READ, '', function(filename){
showFileEditor($('#dir').val(), filename); // Down to here, it is the existing code in files_texteditor plug-in
textConfigurator.Init(); }); // This is my own piece of code
// [...Same with other file types...]

As you can see, it involves much maintenance (the function has to be checked on every Owncloud update, to match with changes in files_texteditor/editor.js) and more importantly it does not allow another app to do the same, which cannot be good.

My question is: what is the best way to load an app that depends on another app being loaded?
Should I implement a JavaScript polling that checks every so often that the other app is loaded? But if every app does the same, would there not be a risk on useless processor usage, apps being active even when not needed?

As a side note, is there a way to include my Javascripts only if the user is within the Files app where it may be needed, so as not to overload the generated .js file?

Thanks a lot for your input,

Xavier Takvorian

Answer:1) You can check if the other app is enabled and if so enable your "code"

if (\OCP\App::isEnabled('dependency')) { // checks whether or not an app is enabled
\OCP\Util::addscript('myapp', 'MyApp');

2) access $_SERVER['SCRIPT_URI'] and if it is the files app then add your code; this way it is only added when you are within the app

Edit answer

Back to overview

Add comment

Do you have a question?
Post your question here


Copyright 2006-2016 Maemo-Apps.org Team  Legal Notice
All rights reserved. Maemo-Apps.org has no liability for any content or goods on this site.
You can find our FAQ here.
All contributors are responsible for the lawfulness of their uploads.
Please send us a notice if you spot an ABUSE of the website.
Information about advertising in Maemo-Apps.org.
Developers can use our public webservice interface. More information here: public api
For further information or comments on this site, please send us a message
Maemo and the Maemo Logo are copyrighted by the Nokia Corporation
Content RSS