Summary: | insert '%%Title: KWord unsaved doc ($current_date)' (PostScript DSC comment) into printjobs where user didn't save files yet | ||
---|---|---|---|
Product: | kword | Reporter: | Kurt Pfeifle <pfeifle> |
Component: | usability | Assignee: | Thomas Zander <zander> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | ||
Priority: | LO | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | All | ||
Latest Commit: | Version Fixed In: |
Description
Kurt Pfeifle
2007-01-11 14:52:00 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). 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() );
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. 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. See, it works ;) %%Title: KWord unsaved document (2007-01-11) 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() ); |