Bug 139905 - insert '%%Title: KWord unsaved doc ($current_date)' (PostScript DSC comment) into printjobs where user didn't save files yet
Summary: insert '%%Title: KWord unsaved doc ($current_date)' (PostScript DSC comment) ...
Status: RESOLVED FIXED
Alias: None
Product: kword
Classification: Miscellaneous
Component: usability (show other bugs)
Version: unspecified
Platform: unspecified All
: LO wishlist
Target Milestone: ---
Assignee: Thomas Zander
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-11 14:51 UTC by Kurt Pfeifle
Modified: 2007-01-11 19:13 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kurt Pfeifle 2007-01-11 14:52:00 UTC
Version:            (using KDE KDE 3.5.5)
Installed from:    SuSE RPMs

(Please see also my comments number 1+2 on bug 122147 for kpdf)

KWord documents insert "%%Title:" lines into PostScript jobs if the file has a name (has been saved by the user), and/or has the "Document Information" field for "Title" filled in.

If both, filename is unknown and "Document Information/Title" info is empty, KWord PS jobfiles do not include a %%Title line at all.

PostScript %%Title: lines are evaluated by KDEPrint to display a meaningful job title to the user (f.e. in KJobViewer), by CUPS (f.e. in the http://localhost:631/jobs/ listing) and by PostScript printers as job name (f.e. on their front panel LCD display). (It even perpetuates to LCD displays of PCL printers, if CUPS had to convert the PostScript file to PCL).

In cases where both filename and "Document Information/Title" are unknown/empty, please insert a line like 

   %%Title: KWord 1.6.1 unsaved document ($current_date+time)

to help users identify their print jobs.

Please implement this feature in a similar way to all other KOffice applications.
Comment 1 Kurt Pfeifle 2007-01-11 14:59:05 UTC
Additional comment:

You don't need a real printer to test this. Just install a dummy CUPS printer. Use the "Advanced Options" tab on kprinter to set "Scheduled printing" to "Never (hold indefinitely)".

Use "kjobviewer" to see the job name used. The respective PS job file can then be found and investigated in /var/spool/cups/d*****-001 (where ***** is the job ID displayed by KJobViewer).
Comment 2 David Faure 2007-01-11 15:11:31 UTC
OK it took some time to figure out what this is about, but now I understand, this is about printer.setDocName().

> PostScript %%Title: lines are evaluated by KDEPrint to display a meaningful job title to the user

Well, rather it's: the application gives kdeprint a document name, and kdeprint gives it to qprinter, which puts it into the postscript.
Vieweing this from the PS point of view is confusing ;)

This patch should do it. But I'm not sure a new i18n() is OK for 1.6.x.

--- KoMainWindow.cpp    (revision 616244)
+++ KoMainWindow.cpp    (working copy)
@@ -32,6 +32,7 @@
 #include "kkbdaccessextensions.h"
 #include "KoSpeaker.h"

+#include <kaboutdata.h>
 #include <kprinter.h>
 #include <kdeversion.h>
 #include <kstdaction.h>
@@ -1200,6 +1201,11 @@ void KoMainWindow::print(bool quick) {

     if ( title.isEmpty() )
         title = fileName;
+    if ( title.isEmpty() ) {
+        // #139905
+        const QString programName = instance()->aboutData() ? instance()->aboutData()->programName() : instance()->instanceName();
+        title = i18n("%1 unsaved document (%2)").arg(programName).arg(KGlobal::locale()->formatDate(QDate::currentDate(), true/*short*/));
+    }
     printer.setDocName( title );
     printer.setDocFileName( fileName );
     printer.setDocDirectory( rootView()->koDocument()->url().directory() );
Comment 3 Kurt Pfeifle 2007-01-11 15:56:08 UTC
Boah!, that was quick! Thanks a lot, David! (Should I alswas rate a wishlist as "Priority: LO" in order to get it fulfilled right way?  :-)  )

Can't test it though, have no personal notebook yet to compile stuff...

Heh, for me it is confusing to view it from the Qt point of view :-)

However, the PostScript document *should* *always* have a meaningful %%Title: line, to help it being processed in a meaningful way (even after it has left the realm of KDE).

Thanks again!

Oh, and David: if you (or someone else) tested it like I outlined in my comment 1, please change this bug to FIXED.
Comment 4 David Faure 2007-01-11 19:00:25 UTC
I simply did this one because it was simple to do (and I had to reply to the report anyway since I'm sure
someone else would have closed it with "PS generation is done by Qt", given the way it was written ;)

I didn't test it (but it works ;), and I can't commit it anyway since koffice is frozen for new messages at the moment.

So it will be for 2.0 probably.
Comment 5 David Faure 2007-01-11 19:08:04 UTC
See, it works ;)

%%Title: KWord unsaved document (2007-01-11)
Comment 6 David Faure 2007-01-11 19:13:34 UTC
SVN commit 622383 by dfaure:

Better kprinter doc-name for untitled+unsaved documents
or in Kurt's terms: [Bug 139905] insert '%%Title: KWord unsaved doc ($current_date)' (PostScript DSC comment) into printjobs where user didn't save files yet
BUG: 139905


 M  +6 -0      KoMainWindow.cpp  


--- trunk/koffice/libs/kofficecore/KoMainWindow.cpp #622382:622383
@@ -32,6 +32,7 @@
 #include "kkbdaccessextensions.h"
 #include "KoDockFactory.h"
 
+#include <kaboutdata.h>
 #include <kprinter.h>
 #include <kdeversion.h>
 #include <kstandardaction.h>
@@ -1252,6 +1253,11 @@
 
     if ( title.isEmpty() )
         title = fileName;
+    if ( title.isEmpty() ) {
+        // #139905
+        const QString programName = instance()->aboutData() ? instance()->aboutData()->programName() : instance()->instanceName();
+        title = i18n("%1 unsaved document (%2)").arg(programName).arg(KGlobal::locale()->formatDate(QDate::currentDate(), true/*short*/));
+    }
     printer.setDocName( title );
     printer.setDocFileName( fileName );
     printer.setDocDirectory( rootView()->koDocument()->url().directory() );