Author Topic: Most Recently Opened Document - technical feasibilty / design discussion  (Read 14126 times)

Dariusz Piatkowski

  • Hero Member
  • *****
  • Posts: 1317
  • Karma: +26/-0
    • View Profile
Hi Martin,

Can't help you with the questions you posed, but I'd like to piggy back off of the topic you started and ask the following question: what WPS class would need to be extended/replaced in order to create a "Most Recently Opened Documents" object which literally shows a list of documents (should have a user adjustable setting to control how many are shown) there were most recently opened.

In short, I wish there was an easy way to re-open the same doc I had just looked at, withouth me having to go off fishing for it once again.

I suppose this would be a Folder like object, but it really would not have any persistent objects (the previously opened Documents) present there, instead maybe shadows could represent each one?

« Last Edit: May 04, 2021, 01:28:24 am by Martin Iturbide »

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4710
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Most Recently Opened Documents - Discussion
« Reply #1 on: May 02, 2021, 10:22:39 pm »
what WPS class would need to be extended/replaced in order to create a "Most Recently Opened Documents" object which literally shows a list of documents (should have a user adjustable setting to control how many are shown) there were most recently opened.
...that's a good question.  ;D

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Lars

  • Hero Member
  • *****
  • Posts: 1271
  • Karma: +65/-0
    • View Profile
Re: Most Recently Opened Documents - Discussion
« Reply #2 on: May 03, 2021, 02:55:08 pm »
what WPS class would need to be extended/replaced in order to create a "Most Recently Opened Documents" object which literally shows a list of documents (should have a user adjustable setting to control how many are shown) there were most recently opened.
...that's a good question.  ;D

Regards
It would most likely not be derived from WPFolder because that would mean that You'd need a REAL folder called "Most recently used documents" or so which you surely do not want to have. But maybe WPFileSystem. That is abstract as it cannot neither create a real folder not a real file.
But likely the best would be WPAbstract. A class derived from WPAbstract can save stuff in OS2.INI as a default, transparently as object properties, without writing new code.
It can create any view it deems appropriate, including a frame window with a container (listing all those most recently used files).

Andreas Schnellbacher

  • Hero Member
  • *****
  • Posts: 827
  • Karma: +14/-0
    • View Profile
Re: Most Recently Opened Documents - Discussion
« Reply #3 on: May 03, 2021, 07:55:26 pm »
[Most Recently Opened Documents]

Dariusz, the problem is not the WPS object, but the functionality.

in Windows, all apps write to the same huge registry. There exists the 'Recent File List' key that is used by many applications. I'm happy that in OS/2, all applications usually use their own ini file. But there's also no standardized way to save the recent files. Some even use text ini files. (Additionally, some apps have multiple file lists for different purposes). But to allow for such a system function, all applications must implement history or recent file lists first and the system has to know where these apps store it and how.

Even if you consider to include only apps with that feature, you have to know where the apps store this and how. The ini files could be found still easily, but the relevant ini apps and keys are app-dependent. So, no chance without a huge list with that information.

Start first with having such a feature implemented for the apps you regulary use.

Andi B.

  • Hero Member
  • *****
  • Posts: 811
  • Karma: +11/-2
    • View Profile
Re: Most Recently Opened Documents - Discussion
« Reply #4 on: May 03, 2021, 08:04:43 pm »
Thinking loud - would be intercepting DosFileClose with compare of 'known' extensions and 'last write' compare an option? Of course couldn't be done in wps context but on file system driver level?

Andreas Schnellbacher

  • Hero Member
  • *****
  • Posts: 827
  • Karma: +14/-0
    • View Profile
Re: Most Recently Opened Documents - Discussion
« Reply #5 on: May 03, 2021, 08:16:35 pm »
DosFileClose with compare of 'known' extensions and 'last write' compare
Interesting, but not all opened files are loaded into an app. Apps usually open many other files that are closed - either by the app or by the system on closing the app. And files can be opened and closed with the libc functions.

I suppose, without implementing this into an app, there won't be a chance.

Lars

  • Hero Member
  • *****
  • Posts: 1271
  • Karma: +65/-0
    • View Profile
Re: Most Recently Opened Documents - Discussion
« Reply #6 on: May 03, 2021, 08:24:05 pm »
"most recent files" is a global function. I don't see any point in making that "per application". But maybe I am lacking some phantasy.
Screwing around on file system driver level is counterproductive and completely superfluous. There already exist WPS functions that can tell you which file objects are currently active/open and there are notifications when files are changed on a file system level. Taking all that is sufficient to come up with a "most recent files" WPS class.  And if you go for only the last 20 files, then writing this info to OS2.INI is also acceptable in my point of view.
I love reusing code, I hate writing own code.
Writing your own code means testing which typically takes far more time then writing it.

Dariusz Piatkowski

  • Hero Member
  • *****
  • Posts: 1317
  • Karma: +26/-0
    • View Profile
Re: Most Recently Opened Documents - Discussion
« Reply #7 on: May 03, 2021, 08:46:32 pm »
Ahh...you guys, I think I will take that conversation to another thread, I feel bad I hi-jacked Martin's post!

High level though, my thinking is as follows:

1) Intercept any application 'Open File' action at the OS level (so literally having some kind of a daemon that watches to see what files are being opened)
- user settings would possible filter this down to only a certain sub-set of applications
- this daemon would keep track the "most recently x opened" files, as per the user's settings

2) Show the user a dynamically maintained list, where one would simply interact with the object using the default system behavious (so rely on Associations, etc.)
- the "container" object that would allow the user to select such a file would be either a purposely built own class object, or perhaps a folder where the objects themselves would be represented as SHADOWs - idea being to re-use as much of the underlying OS structure, and therefore functionality, as possible

My goal was very similiar to what Lars' thinking is: use as little NEW code as possible, rely on existing platform / OS infrastructure to handle much of the lifting.

Thus my original question: what would be best suited to serve as that "container object"? In parallel to that, what are the current APIs that I could use to monitor the current files that are opened?

Andi, maybe as you suggested that intercepting DosFileClose would allow me to build that dynamic list of files that have been opened...that list would continue to be purned as per user settings and filters, which in theory should give us a workable solution.

Use Case
======
Let's say I only care about PDF files. I have them all over the place, my NAS box in particular...and I just do not feel like going through the full directory/path navigation each and every time I need to open one up. This to me is very real you guys...I moved our documents from the OS/2 box onto the NAS some tiem ago, we now have a single centralized DOC repo for the full house...but that requires me to do a hell of a lot more mouse clicking to just get to the file I want! lol

Anyways, Martin, I'm sorry...your post TITLE was precisely what I had in mind for some time now and the ideas just needed to "come out"...lol, but let's take this to another thread, please see => https://www.os2world.com/forum/index.php?action=post;board=15.0 in Programming section.
« Last Edit: May 03, 2021, 09:39:04 pm by Dariusz Piatkowski »

Andreas Schnellbacher

  • Hero Member
  • *****
  • Posts: 827
  • Karma: +14/-0
    • View Profile
Re: Most Recently Opened Documents - Discussion
« Reply #8 on: May 03, 2021, 09:00:59 pm »
"most recent files" is a global function.
Do apps use that WPS function? (I assume that's also the one been used for reopening file objects on opening work area folders, which doesn't work for all apps.)

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4710
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Most Recently Opened Documents - Discussion
« Reply #9 on: May 04, 2021, 01:26:36 am »
Hi

I slip the topic  !!

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4710
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Most Recently Opened Documents - Discussion
« Reply #10 on: May 04, 2021, 01:27:41 am »
oops. I'm merging you post here.

Alright, this discussion is moved from the thread Martin started in the Application Forum: Desktop Enhancements for WPS.

My idea is: create a "Most Recently Opened Documents" object which literally shows a list of documents (should have a user adjustable setting to control how many are shown) there were most recently opened.
This should provide an easy way to re-open the same doc I had just looked at, withouth me having to go looking for it once again.

I suppose this could be a Folder like object, but it really would not have any persistent objects (the previously opened Documents) present there, instead maybe shadows could represent each one?

High level though, my thinking is as follows:

1) Intercept any application 'Open File' action at the OS level (so literally having some kind of a daemon that watches to see what files are being opened)
- user settings would possible filter this down to only a certain sub-set of applications
- this daemon would keep track the "most recently x opened" files, as per the user's settings

2) Show the user a dynamically maintained list, where one would simply interact with the object using the default system behavious (so rely on Associations, etc.)
- the "container" object that would allow the user to select such a file would be either a purposely built own class object, or perhaps a folder where the objects themselves would be represented as SHADOWs - idea being to re-use as much of the underlying OS structure, and therefore functionality, as possible

My goal was very similiar to what Lars' thinking is: use as little NEW code as possible, rely on existing platform / OS infrastructure to handle much of the lifting.

Thus my original question: what would be best suited to serve as that "container object"? In parallel to that, what are the current APIs that I could use to monitor the current files that are opened?

Andi, maybe as you suggested that intercepting DosFileClose would allow me to build that dynamic list of files that have been opened...that list would continue to be purned as per user settings and filters, which in theory should give us a workable solution.

Use Case
======
Let's say I only care about PDF files. I have them all over the place, my NAS box in particular...and I just do not feel like going through the full directory/path navigation each and every time I need to open one up. This to me is very real you guys...I moved our documents from the OS/2 box onto the NAS some tiem ago, we now have a single centralized DOC repo for the full house...but that requires me to do a hell of a lot more mouse clicking to just get to the file I want! lol
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Lars

  • Hero Member
  • *****
  • Posts: 1271
  • Karma: +65/-0
    • View Profile
Re: Most Recently Opened Documents - Discussion
« Reply #11 on: May 04, 2021, 09:12:10 am »
"most recent files" is a global function.
Do apps use that WPS function? (I assume that's also the one been used for reopening file objects on opening work area folders, which doesn't work for all apps.)
My understanding of that function is a collection of any files that were open on the desktop.These should be recallable and presented in a container where they can be double clicked and the default WPS action invoked on them.
For many apps that need it, an application specific list already exist. I see no need to duplicate that.
The user would invoke that function, not an application.

Andi B.

  • Hero Member
  • *****
  • Posts: 811
  • Karma: +11/-2
    • View Profile
Quote
"most recent files" is a global function. I don't see any point in making that "per application".

Agree.

Quote
Screwing around on file system driver level is counterproductive and completely superfluous.
IMHO dangerous. And maybe a performance disaster. I wouldn't risk to try it out by myself.

Quote
There already exist WPS functions that can tell you which file objects are currently active/open and there are notifications when files are changed on a file system level.
Sounds like a very elegant way. But does this also work when you f.i. open a file from cmd line in an editor which writes this file afterwards. And do you get notifications when you f.i. open a pdf by double clicking in the email client which fires up qpdfview and when do 'Save as' in qpdfview?

Andreas Schnellbacher

  • Hero Member
  • *****
  • Posts: 827
  • Karma: +14/-0
    • View Profile
Sounds like a very elegant way. But does this also work when you f.i. open a file from cmd line in an editor which writes this file afterwards. And do you get notifications when you f.i. open a pdf by double clicking in the email client which fires up qpdfview and when do 'Save as' in qpdfview?
... plus files opened via file dialog.

Dariusz Piatkowski

  • Hero Member
  • *****
  • Posts: 1317
  • Karma: +26/-0
    • View Profile
Hi Andi,

...
Quote
There already exist WPS functions that can tell you which file objects are currently active/open and there are notifications when files are changed on a file system level.
Sounds like a very elegant way. But does this also work when you f.i. open a file from cmd line in an editor which writes this file afterwards. And do you get notifications when you f.i. open a pdf by double clicking in the email client which fires up qpdfview and when do 'Save as' in qpdfview?

Hmm, I cannot see being able to get that to work reliably, here is why: those types of "Open" events typically place the actual PDF file in temp storage, so stuff is pulled out of email body/ZIP file/whatever, tossed into temp and then the default application is evoked. The problem with making this work reliably is that the temp storage may not be persistent...heck, all my TMP/TEMP settings point to a RAM drive...fast - sure, clean - sure b/c a re-boot completely wipes it clean for me.

But this could be turned into a setting that the user activates (meaning, s/he decides that YES indeed, they do want those kind of openning events tracked and listed in the MROD dynamic list).