Move file between instances

Asked by Boris

  Hi,

  The "instance" feature are the real time saver for those who have to keep a lot of files open.
 It is not possible to underestimate it. The only thing are missing for me - the ability to move
already opened file between instances. This is a handy feature because currently it works
like this: open containing folder, remember file name, close tab, switch to the opened folder,
find a file, open it again.

  If it is possible, to add say, 'File/Move to another instance...'' functionality, it would be just great.

 On the related note, for better navigation in windows, I'm using the following adjustment to
window title:

=== modified file 'sources/mainwindow.cpp'
--- sources/mainwindow.cpp 2016-04-02 16:30:04 +0000
+++ sources/mainwindow.cpp 2016-04-12 10:08:44 +0000
@@ -2587,10 +2587,10 @@

     if(s_settings->mainWindow().instanceNameInWindowTitle() && !qApp->objectName().isEmpty())
     {
- instanceName = QLatin1String(" (") + qApp->objectName() + QLatin1String(")");
+ instanceName = QLatin1String("(") + qApp->objectName() + QLatin1String(") ");
     }

- setWindowTitle(tabText + QLatin1String("qpdfview") + instanceName);
+ setWindowTitle(QLatin1String("qpdfview") + instanceName + tabText);
 }

 void MainWindow::setCurrentPageSuffixForCurrentTab()

Question information

Language:
English Edit question
Status:
Solved
For:
qpdfview Edit question
Assignee:
No assignee Edit question
Solved by:
Boris
Solved:
Last query:
Last reply:
Revision history for this message
Adam Reichold (adamreichold) said :
#1

Hello Boris,

at least using the current code from trunk, i.e. what will become version 0.4.17, one should be able to drag and drop tabs from one instance's window to another by holding Shift and dragging the tab itself, even though this will open a copy instead of "moving" the document. (It will basically pass nothing but the file path, i.e. you can also drag this into other applications but the state will not be moved.)

Using trunk revision 1999 or later, I added an action called "moveToInstance" which can be added to the document or the tab context menu using the interface tab of the settings dialog. This will ask for an instance name like '--choose-instance' does and try to communicate with that instance using D-Bus, saving any pending modifications first and closing the tab in the current instance if the document could be opened in the other instance.

To keep things simple, I am currently not passing on any state but the current page (but for example per-file settings will be saved before moving and should be restored in the other instance if enabled) and I only implemented moving to a currently running instance and not for example explicitly adjusting the instance stored in the database for the tab or starting the requested instance.

Best regards, Adam.

Revision history for this message
Boris (borisxm) said :
#2

Hi Adam,

  The moveToInstance feature works like a charm. Thank you!

  As for the drag-n-drop approach of tab title - it, unfortunately, quite useless for me,
because instances have too many open files to make tabs useful and normally display of
them are turned off.