[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdelibs/kdeprint
From:       Michael Goffioul <kdeprint () swing ! be>
Date:       2004-03-26 8:59:50
Message-ID: 20040326085950.15BF4997E () office ! kde ! org
[Download RAW message or body]

CVS commit by goffioul: 

Re-order calls to avoid side-effect of overwriting "kde-special-command" + use \
docFileName() and docDirectory() to build-up default output file in autoConfigure() 


  M +21 -3     kmprinter.cpp   1.16
  M +2 -1      kprinter.cpp   1.81


--- kdelibs/kdeprint/kmprinter.cpp  #1.15:1.16
@@ -158,8 +158,25 @@ bool KMPrinter::autoConfigure(KPrinter *
         if (isSpecial())
         {
-                printer->setPrintProgram(option("kde-special-command"));
                 if (option("kde-special-file") == "1")
                 {
-                        KFileDialog *dialog = new KFileDialog \
(QString::fromLatin1("print.")+option("kde-special-extension"), +                     \
// build-up default filename/directory +                        QString fName = \
printer->docFileName(), ext = option( "kde-special-extension" ); +                    \
if ( fName.isEmpty() ) +                                fName = ( printer->docName() \
+ "." + ext ); +                        else
+                        {
+                                int p = fName.findRev( '.' );
+                                if ( p == -1 )
+                                        fName.append( "." ).append( ext );
+                                else
+                                {
+                                        fName.truncate( p+1 );
+                                        fName.append( ext );
+                                }
+                        }
+                        fName.prepend( "/" ).prepend( printer->docDirectory() );
+
+                        // build-up file dialog
+                        KFileDialog *dialog = new KFileDialog (fName,
                                                                 QString::null,
                                                                 parent,
@@ -169,5 +186,4 @@ bool KMPrinter::autoConfigure(KPrinter *
 
                         QString mimetype = option("kde-special-mimetype");
-                        QString ext = option("kde-special-extension");
 
                         if (!mimetype.isEmpty())
@@ -192,4 +208,6 @@ bool KMPrinter::autoConfigure(KPrinter *
                         }
                 }
+                printer->setOption( "kde-isspecial", "1" );
+                printer->setOption( "kde-special-command", option( \
"kde-special-command" ) );  }
 

--- kdelibs/kdeprint/kprinter.cpp  #1.80:1.81
@@ -874,8 +874,9 @@ void KPrinter::setPrintProgram(const QSt
         else
         {
-                setOption("kde-isspecial", "1");
                 QString s(prg);
                 if (s.find("%in") == -1)
                         s.append(" %in");
+                setOutputToFile( s.find( "%out" ) != -1 );
+                setOption("kde-isspecial", "1");
                 setOption("kde-special-command", s);
         }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic