View Issue Details

IDProjectCategoryView StatusLast Update
0008252ScribusOS-MacOSXpublic2011-07-07 20:30
Reporterale Assigned Tojghali  
PriorityhighSeveritytweakReproducibilityalways
Status closedResolutionfixed 
Product Version1.3.5svn 
Fixed in Version1.4.0svn 
Summary0008252: cannot open a file through double click in OSX Finder
Descriptionif i double click a .sla file in the finder:

- if scribus is closed i get to the "new document" dialog

- if scribus is already open scribus get's focus but won't open the file

- if i drag a file into the scratch space (no document already open), the file is (correctly) opened
TagsNo tags attached.
Patch

Relationships

has duplicate 0007957 closedjghali Opening SLA-file by clicking the file-icon at dektop or in finder 
has duplicate 0008354 closedjghali Impossible to open an xml file from OS X directly in Scribus 
has duplicate 0008387 closedjghali Double click doesn't open scribus files 
has duplicate 0009354 closedjghali Scribus does not open files from Finder 
has duplicate 0009612 closedjghali to open a folder .sla 
has duplicate 0009840 closedjghali can not open file with double klick (1.4.0rc1) 
has duplicate 0009900 closedjghali Starting Scribus by double-clicking .sla file does not open .sla file 

Activities

greenius

2011-06-12 18:41

reporter   ~0026373

Last edited: 2011-06-13 07:11

When opened from finder, OS X Does not pass the filename on the command line like other operqting systems. Instead it calls a delegate function openFile() on NSApplication.

Since Scribus is written with QT, this can be done by responding to QFileOpenEvent as outlined at http://doc.trolltech.com/qq/qq18-macfeatures.html#newevents

If I can work out how to build Scribus on my mac, I may have a go at fixing this.

greenius

2011-06-12 21:54

reporter  

osx_args.patch (951 bytes)   
Index: scribus/scribusapp.h
===================================================================
--- scribus/scribusapp.h	(revision 16659)
+++ scribus/scribusapp.h	(working copy)
@@ -84,6 +84,7 @@
 		\brief Instantiates the Language Manager and prints installed languages with brief instructions around
 		*/
 		void showAvailLangs();
+		bool event(QEvent *event);
 
 		QString lang;
 		QString GUILang;
Index: scribus/scribusapp.cpp
===================================================================
--- scribus/scribusapp.cpp	(revision 16659)
+++ scribus/scribusapp.cpp	(working copy)
@@ -530,3 +530,14 @@
 {
 	return QFileInfo(ScPaths::getApplicationDataDir() + ".neversplash").exists();
 }
+
+bool ScribusQApp::event(QEvent *event)
+{
+  switch (event->type()) {
+    case QEvent::FileOpen:
+      filesToLoad.append(static_cast<QFileOpenEvent*>(event)->file());
+      return true;
+    default:
+      return QApplication::event(event);
+  }
+}
osx_args.patch (951 bytes)   

greenius

2011-06-12 21:55

reporter   ~0026375

Patch (made with svn diff against latest svn: 16659) attached.

Tested on Mac OS X, 10.6.7.

jghali

2011-06-13 10:26

administrator   ~0026378

Last edited: 2011-06-13 10:27

Thanks. However that only cover the case where Scribus is not opened when trying to open document. I doubt that patch will work when trying to double click a document with Scribus already opened.

greenius

2011-06-15 21:33

reporter  

osx_finder.patch (1,198 bytes)   
Index: scribus/scribusapp.h
===================================================================
--- scribus/scribusapp.h	(revision 16659)
+++ scribus/scribusapp.h	(working copy)
@@ -84,6 +84,7 @@
 		\brief Instantiates the Language Manager and prints installed languages with brief instructions around
 		*/
 		void showAvailLangs();
+		bool event(QEvent *event);
 
 		QString lang;
 		QString GUILang;
Index: scribus/scribusapp.cpp
===================================================================
--- scribus/scribusapp.cpp	(revision 16659)
+++ scribus/scribusapp.cpp	(working copy)
@@ -530,3 +530,26 @@
 {
 	return QFileInfo(ScPaths::getApplicationDataDir() + ".neversplash").exists();
 }
+
+bool ScribusQApp::event(QEvent *event)
+{
+  switch (event->type()) 
+  {
+    case QEvent::FileOpen:
+    {
+      QString filename = static_cast<QFileOpenEvent*>(event)->file();
+      if(m_ScCore && m_ScCore->initialized())
+      {
+        ScribusMainWindow* mw = m_ScCore->primaryMainWindow();
+        mw->loadDoc(filename);
+      }
+      else
+      {
+        filesToLoad.append(filename);
+      }
+      return true;
+    }
+    default:
+      return QApplication::event(event);
+  }
+}
osx_finder.patch (1,198 bytes)   

greenius

2011-06-15 21:34

reporter   ~0026407

osx_finder.patch now also works when Scribus is already running.

jghali

2011-06-15 22:19

administrator   ~0026409

Patch committed! Thanks!

Issue History

Date Modified Username Field Change
2009-07-06 11:20 ale New Issue
2009-07-06 20:26 cbradney Severity major => tweak
2009-08-14 13:48 jghali Relationship added has duplicate 0007957
2009-08-18 20:11 jghali Relationship added has duplicate 0008354
2009-08-25 20:31 jghali Relationship added has duplicate 0008387
2010-09-11 13:02 jghali Relationship added has duplicate 0009354
2010-12-23 23:53 jghali Relationship added has duplicate 0009612
2011-03-13 22:51 jghali Relationship added has duplicate 0009840
2011-04-01 20:48 jghali Relationship added has duplicate 0009900
2011-06-12 18:41 greenius Note Added: 0026373
2011-06-12 21:54 greenius File Added: osx_args.patch
2011-06-12 21:55 greenius Note Added: 0026375
2011-06-13 07:11 greenius Note Edited: 0026373
2011-06-13 10:26 jghali Note Added: 0026378
2011-06-13 10:27 jghali Note Edited: 0026378
2011-06-15 21:33 greenius File Added: osx_finder.patch
2011-06-15 21:34 greenius Note Added: 0026407
2011-06-15 22:19 jghali Summary can't open a file through double click => cannot open a file through double click in OSX Finder
2011-06-15 22:19 jghali Note Added: 0026409
2011-06-15 22:19 jghali Status new => resolved
2011-06-15 22:19 jghali Fixed in Version => 1.4.0svn
2011-06-15 22:19 jghali Resolution open => fixed
2011-06-15 22:19 jghali Assigned To => jghali
2011-07-07 20:30 cbradney Status resolved => closed
2014-10-08 18:37 Kunda Category Mac OS => OS-MacOSX