Accessing the WebOS clipboard From an Enyo Application - reflection

When developing a WebOS application with Enyo, is it possible to access the clipboard contents? That is, if I copy a bit of text to the clipboard on a Touchpad or Pre device , can I programmatically grab that piece of text, or programmatically replace it?
From what I've read in the SDK documents, I assume I'd need a Service to do this. Is this correct?
If so, which service? Are there a list of services available, and/or is there a way to reflect into the framework to see which services are available?
(New to WebOS development, so error on the side of speaking loudly and slowly)

I think you are looking for the getClipboard method on the enyo.dom. However, when I try:
enyo.dom.getClipboard(enyo.bind(this, "gotClipboard"));
gotClipboard: function() {
this.log(JSON.stringify(arguments));
}
I just get {"0",""}, even though I have text in the clipboard. It makes me wonder if this isn't fully baked yet. One argument will be the text in the clipboard when it works.
If I try the companion enyo.dom.setClipboard, I get a NOT_FOUND_ERR: DOM Exception 8.
Found both of these functions in here: https://developer.palm.com/content/api/reference/enyo/enyo-api-reference.html

Related

KDE Taskbar Progress

I am trying to show a progress in the taskbar of the plasma desktop using the KDE Frameworks. In short, it want to do the same thing as dolphin, when it copies files:
I'm kinda stuck, because I don't even know where to get started. The only thing I found that could be useful is KStatusBarJobTracker, but I don't know how to use it. I could not find any tutorials or examples how to do this.
So, after digging around, and thanks to the help of #leinir, I was able to find out the following:
Since Plasma 5.6 KDE supports the Unitiy DBus Launcher-API, which can be used, for example, to show progress
I found a post on AskUbuntu that explains how to use the API with Qt
The real problem is: This only works, if you have a valid desktop file in one of the standard locations! You need to pass the file as parameter of the DBus message to make it work.
Based on this information, I figured out how to use it and created a GitHub repository, that supports cross platform taskbar progress, and uses this API for the linux implementation.
However, here is how to do it anyways. It should work for KDE Plasma and the Unity desktop, maybe more (haven't tried any others):
Create a .desktop file for your application. For test purpose, this can be a "dummy" file, that could look like this:
[Desktop Entry]
Type=Application
Version=1.1
Name=MyApp
Exec=<path_to>/MyApp
Copy that file to ~/.local/share/applications/ (or wherever user specific desktop files go on your system)
In your code, all you need to do is execute the following code, to update the taskbar state:
auto message = QDBusMessage::createSignal(QStringLiteral("/com/example/MyApp"),
QStringLiteral("com.canonical.Unity.LauncherEntry"),
QStringLiteral("Update"));
//you don't always have to specify all parameters, just the ones you want to update
QVariantMap properties;
properties.insert(QStringLiteral("progress-visible"), true);// enable the progress
properties.insert(QStringLiteral("progress"), 0.5);// set the progress value (from 0.0 to 1.0)
properties.insert(QStringLiteral("count-visible"), true);// display the "counter badge"
properties.insert(QStringLiteral("count"), 42);// set the counter value
message << QStringLiteral("application://myapp.desktop") //assuming you named the desktop file "myapp.desktop"
<< properties;
QDBusConnection::sessionBus().send(message);
Compile and run your application. You don't have to start it via the desktop file, at least I did not need to. If you want to be sure your application is "connected" to that desktop file, just set a custom icon for the file. Your application should show that icon in the taskbar.
And thats basically it. Note: The system remembers the last state when restarting the application. Thus, you should reset all those parameters once when starting the application.
Right, so as it turns out you are right, there is not currently a tutorial for this. This reviewboard request, however, shows how it was implemented in KDevelop, and it should be possible for you to work it out through that :) https://git.reviewboard.kde.org/r/127050/
ps: that there is no tutorial now might be a nice way for you to hop in and help out, by writing a small, self contained tutorial for it... something i'm sure would be very much welcomed :)

DOORS: Insert OLE with explicit type (aka Show PDF as editable information)

I can insert MS Word files as OLE into a DOORS object, both manually and via DXL, but PDFs (and EPS as well) behave different: it is difficult to make those not appear as icon.
I able to insert a PDF file (showing some graphics) as OLE manually only by using the dialogue's Create New radio button with specifying the type explicitly as Adobe Acrobat Document (without the Display As Icon option). All is well in this case.
Using the radio button Create from File button leads to the same undesired behaviour as using the DXL function insertOle() to insert the object: the result is displayed as icon only.
if (oleInsert(current, "c:\\temp\\27.pdf", false))
print "Successfully embedded document\n"
else
print "Problem trying to embed document\n"
Gives me:
Double-clicking the icon opens the associated application (Acrobat Reader) and shows the embedded PDF properly. However, the OLE properties dialogue displays the type Package. Manual insertion as described above creates an OLE object with the type Adobe Acrobat Document (as specified while creating it).
Inserting a Word document via DXL instead of the PDF makes the embedded document being rendered properly -- apparently the type is determined automatically and correctly:
Apparently, I am not able to (but would have to) specify the OLE type when inserting the PDF.
I am aware of a similar problem at the IBM forum, but the code from there did not even update existing OLE objects but left my objects without any OLE content! Another thread addresses that problem too, but does not provide a detailed solution.
There are two things I would check that would cause a different result for you and your colleague:
Check if they have a full 'edit' version of Adobe Acrobat installed. Since OLE is a Microsoft standard, having Full Acrobat instead of just the Viewer installed may register components with Windows that allow the OLE to display properly for them.
If they do not have Full Acrobat installed, then perhaps they have a different version of the Viewer or a 3rd party PDF viewer that you do not have on your machine.
The DXL reference manual specifically states that An OLE package is created if a file has no associated applications that support OLE. So your system is not recognizing the association, but your colleague's is.
The root cause is still unknown, but the problem was solved eventually. My Windows user account was deleted and created from the scratch. Now it works.
Another colleague has the same problem -- maybe we will take the time and try to isolate file / setting which contained the cause.

Downloading web page in the background with wxHtmlWindow

I am using wxWidgets to download the contents of a website into a wxHtmlWindow control. This works flawlessly, except for one thing. The entire gui seems to freeze while the data is being downloaded, which is highly problematic for my application. In most other wxWidgets class methods, events continue to be processed automagicly for you even if the call in question is said to be blocking. This does not appear to be the case here, and I am wondering how I might tell wxWidgets to download the page in the background? I am currently using the LoadPage method.
I guess I could use a second thread, but with the restrictions that wxWidgets imposes on changing the state of any window through any thread other than the main one makes me hesitate to dive into this. Is there a better way? The raw http class, for instance, does not block the window while it's downloading so I don't understand why wxHtmlWindow, which surely must be using the raw http class internally, does not have the same behavior.
Unfortunately wxHtmlWindow uses synchronous sockets to fetch contents of a URL. Call hiearchy goes like this: wxHtmlWindow -> wxHtmlParser -> wxFileSystem -> wxURI -> wxHTTP -> wxHTTP::GetInputStream . The GetInputStream method will use the open a socket in blocking mode.
You will need to use a separate thread to fetch the contents of a website.

Printing in Power Builder V12 Web Application(Web Forms)

I would like to know the way of printing in Power Builder V12 Web Application(Web Forms) [Power Builder Web Application is converted to ASP.Net Web Application]
This feature is new in PowerBuilder V12 and few examples and documentation are available.
I know there is no direct way for printing as there is a need to define a virtual printer
then prepare the document to be printed and send it to that printer.
If any user tried that before or has any examples for that please send them for me.
Thanks in Advance ..
In PB Web Forms, I've identified three ways of printing. I'm going to assume you mean printing DataWindows, as that is most common in PowerBuilder applications.
First is to do nothing to your code and let PowerBuilder handle the DataWindow.Print() function calls. It creates UI elements to link to a "Print Manager" window which is generating PDFs for your user, which the user can then download from the Print Manager.
Second is to leverage the DataWindow.SaveAs (..., PDF!) functionality, and calling the DownloadFile() function on your own trigger. This achieves the same ends as the first, but allows you to manage your own UI.
Third is to show the DataWindow on a page, and use a button that calls JavaScript to fire the browser's own print command. You probably lose some formatting control with this option, but it allows an actual print function to occur instead of just a PDF generation.
And a minor FYI, Web Forms generation from PowerBuilder has been around since version 11.0. That's about the time I started using it, which is how I came up with these options. (These things take time for me.)
Good luck,
Terry.

Legacy activeX control calls DLL functions - I need help

Hint: this one might sound complicated, because I am trying to give as much info as possible, but I suspect that I just want someone to tell me "yes, you are correct".
On this legacy system, which dates from 2002, the user visits a web page and uses an RFID reader to read a tag number, which is then written to an input field on the web page.
The only s/w that comes with the reader is a custom DLL, nop .exe.
The very sparse documentation insists that only MSIE be used and that all security relating to ActiveX be disabled.
When I look into the source of the web page I see calls to functions in the DLL.
Now, here's the fun part: I know zilch about ActiveX, I have to make a minor change to the DLL *but* the VB6 source code has been lost, so I guess that I have to recreate the (seemingly very simple) DLL from scratch - this week.
Decompiling the DLL shows me the functions (locateReader, getTagVal, closeReader). However, by decompiling I can't really know the number or type of the parameters, nor the return values ... and if anyone knows the API they are refusing to share it, but basically it all seems to have been lost in the mists of time as companies went bust, were bought & sold, merged & demerged and the initial DLL might have been written by an external guy, but no one knows who.
So, can I get the function params & type from the ASP page source?
I see things like
Reader = new ActiveXObject("<dllName>.Reader");
Reader.locateReader();
tagVal = Reader.getTagVal();
Reader.closeReader();
So, I would say that none of the fn()s take parameters, that closeReader doesn't have to return anything; it looks like locateReader doesn't return anything either, so I guess that error handling will have to be in the DLL (loop forever with a popup demanding that a reader be attached; and getTagVal seems to return a string.
Does that sound about right? Any other comments (other than lessons to be learned)?
The 'code' you've put here looks like the a direct call to the device. And getTagVal() seems to get the RFID value? Since this is an COM (Active X) call can you call this in a simple .net program and see if you can access the reader? If you can then you may be able to just wrap the existing functionaliy in your wrapper.
You need to try and generate a TLB from the component:
So, if you only have a COM dll, you
need to get an idl-file from it:
Visual Studio, start it and go to the meny Tools->OLE/COM Object Viewer.
This is called oleview.exe and can also be got from the windows sdk
In that application, select meny File->View Typelib..
Select the COM dll and you will see the Typelib.
Select the meny File->Save as. Save it with an appropriate name. For
example "mycom.idl"
start midl.exe or mktyplib.exe with the idl-filname as the argument. "midl
mycom.idl"
Read MSDN for more info about midl and
mktyplib

Resources