Download | Plain Text | No Line Numbers


  1. --- kdebase-3.5.10.orig/konsole/konsole/konsole.h 2007-10-08 11:51:33.000000000 +0200
  2. +++ kdebase-3.5.10/konsole/konsole/konsole.h 2011-05-10 01:25:27.000000000 +0200
  3. @@ -389,6 +389,7 @@
  4. QString s_schema;
  5. QString s_kconfigSchema;
  6. QString s_word_seps; // characters that are considered part of a word
  7. + QString s_printer_path;
  8. QString pmPath; // pixmap path
  9. QString dropText;
  10. QFont defaultFont;
  11. --- kdebase-3.5.10.orig/konsole/konsole/konsole_part.h 2006-10-01 19:32:08.000000000 +0200
  12. +++ kdebase-3.5.10/konsole/konsole/konsole_part.h 2011-05-10 01:26:23.000000000 +0200
  13. @@ -172,6 +172,7 @@
  14. QString s_schema;
  15. QString s_kconfigSchema;
  16. QString s_word_seps; // characters that are considered part of a word
  17. + QString s_printer_path; // characters that are considered part of a word
  18.  
  19. bool b_framevis:1;
  20. bool b_histEnabled:1;
  21. --- kdebase-3.5.10.orig/konsole/konsole/session.h 2006-10-01 19:32:08.000000000 +0200
  22. +++ kdebase-3.5.10/konsole/konsole/session.h 2011-05-10 01:53:43.000000000 +0200
  23. @@ -89,6 +89,7 @@
  24. void setIconText(const QString& _iconText);
  25. void setAddToUtmp(bool);
  26. void setXonXoff(bool);
  27. + void setPrinterPath(const QString& _printer_path);
  28. bool testAndSetStateIconName (const QString& newname);
  29. bool sendSignal(int signal);
  30.  
  31. --- kdebase-3.5.10.orig/konsole/konsole/TEmulation.h 2006-10-01 19:32:08.000000000 +0200
  32. +++ kdebase-3.5.10/konsole/konsole/TEmulation.h 2011-05-10 01:55:37.000000000 +0200
  33. @@ -108,6 +108,7 @@
  34.  
  35. virtual void clearEntireScreen() =0;
  36. virtual void reset() =0;
  37. + virtual void setPrinterPath(const QString &_printer_path) = 0;
  38.  
  39. protected:
  40.  
  41. --- kdebase-3.5.10.orig/konsole/konsole/TEmuVt102.h 2006-10-01 19:32:08.000000000 +0200
  42. +++ kdebase-3.5.10/konsole/konsole/TEmuVt102.h 2011-05-10 14:28:16.000000000 +0200
  43. @@ -24,6 +24,8 @@
  44. #include "TEWidget.h"
  45. #include "TEScreen.h"
  46. #include "TEmulation.h"
  47. +#include <kprocess.h>
  48. +#include <qvaluelist.h>
  49. #include <stdio.h>
  50.  
  51. //
  52. @@ -73,10 +75,12 @@
  53.  
  54. void clearEntireScreen();
  55. void reset();
  56. + void setPrinterPath(const QString &_printer_path);
  57.  
  58. void onRcvChar(int cc);
  59. public slots:
  60. void sendString(const char *);
  61. + void wroteStdin(KProcess *proc);
  62.  
  63. public:
  64.  
  65. @@ -135,12 +139,16 @@
  66. void restoreCursor();
  67. void resetCharset(int scrno);
  68. void setMargins(int t, int b);
  69. + void doPrint();
  70.  
  71. CharCodes charset[2];
  72.  
  73. DECpar currParm;
  74. DECpar saveParm;
  75. bool holdScreen;
  76. + bool capture;
  77. + QString captured;
  78. + QString printer_path;
  79. };
  80.  
  81. #endif // ifndef ANSIEMU_H
  82. --- kdebase-3.5.10.orig/kcontrol/konsole/kcmkonsoledialog.ui 2005-09-10 10:25:12.000000000 +0200
  83. +++ kdebase-3.5.10/kcontrol/konsole/kcmkonsoledialog.ui 2011-05-10 01:17:29.000000000 +0200
  84. @@ -62,6 +62,43 @@
  85. </size>
  86. </property>
  87. </spacer>
  88. + <widget class="QGroupBox" row="1" column="1">
  89. + <property name="name">
  90. + <cstring>GroupBox4</cstring>
  91. + </property>
  92. + <property name="title">
  93. + <string>xterm Print</string>
  94. + </property>
  95. + <grid>
  96. + <property name="name">
  97. + <cstring>unnamed</cstring>
  98. + </property>
  99. + <widget class="QLabel" row="0" column="0">
  100. + <property name="name">
  101. + <cstring>TextLabel1_3</cstring>
  102. + </property>
  103. + <property name="text">
  104. + <string>Path to printer:</string>
  105. + </property>
  106. + <property name="buddy" stdset="0">
  107. + <cstring>printer_path</cstring>
  108. + </property>
  109. + </widget>
  110. + <widget class="QLineEdit" row="1" column="0">
  111. + <property name="name">
  112. + <cstring>printer_path</cstring>
  113. + </property>
  114. + <property name="sizePolicy">
  115. + <sizepolicy>
  116. + <hsizetype>1</hsizetype>
  117. + <vsizetype>5</vsizetype>
  118. + <horstretch>0</horstretch>
  119. + <verstretch>0</verstretch>
  120. + </sizepolicy>
  121. + </property>
  122. + </widget>
  123. + </grid>
  124. + </widget>
  125. <widget class="QGroupBox" row="1" column="0">
  126. <property name="name">
  127. <cstring>GroupBox3</cstring>
  128. @@ -99,7 +136,7 @@
  129. </widget>
  130. </grid>
  131. </widget>
  132. - <widget class="QGroupBox" row="0" column="0">
  133. + <widget class="QGroupBox" row="0" column="0" colspan="2">
  134. <property name="name">
  135. <cstring>GroupBox2</cstring>
  136. </property>
  137. --- kdebase-3.5.10.orig/kcontrol/konsole/kcmkonsole.cpp 2005-09-10 10:25:12.000000000 +0200
  138. +++ kdebase-3.5.10/kcontrol/konsole/kcmkonsole.cpp 2011-05-10 01:22:21.000000000 +0200
  139. @@ -73,6 +73,7 @@
  140. connect(dialog->matchTabWinTitleCB,SIGNAL(toggled(bool)), SLOT( changed() ));
  141. connect(dialog->silence_secondsSB,SIGNAL(valueChanged(int)), SLOT( changed() ));
  142. connect(dialog->word_connectorLE,SIGNAL(textChanged(const QString &)), SLOT( changed() ));
  143. + connect(dialog->printer_path,SIGNAL(textChanged(const QString &)), SLOT( changed() ));
  144. connect(dialog->SchemaEditor1, SIGNAL(changed()), SLOT( changed() ));
  145. connect(dialog->SessionEditor1, SIGNAL(changed()), SLOT( changed() ));
  146. connect(dialog->SchemaEditor1, SIGNAL(schemaListChanged(const QStringList &,const QStringList &)),
  147. @@ -106,6 +107,7 @@
  148. dialog->line_spacingSB->setValue(config.readUnsignedNumEntry( "LineSpacing", 0 ));
  149. dialog->silence_secondsSB->setValue(config.readUnsignedNumEntry( "SilenceSeconds", 10 ));
  150. dialog->word_connectorLE->setText(config.readEntry("wordseps",":@-./_~"));
  151. + dialog->printer_path->setText(config.readEntry("printer_path",""));
  152.  
  153. dialog->SchemaEditor1->setSchema(config.readEntry("schema"));
  154.  
  155. @@ -144,6 +146,7 @@
  156. config.writeEntry("LineSpacing" , dialog->line_spacingSB->value());
  157. config.writeEntry("SilenceSeconds" , dialog->silence_secondsSB->value());
  158. config.writeEntry("wordseps", dialog->word_connectorLE->text());
  159. + config.writeEntry("printer_path", dialog->printer_path->text());
  160.  
  161. config.writeEntry("schema", dialog->SchemaEditor1->schema());
  162.  
  163. --- kdebase-3.5.10.orig/kcontrol/konsole/kcmkonsole.cpp 2005-09-10 10:25:12.000000000 +0200
  164. +++ kdebase-3.5.10/kcontrol/konsole/kcmkonsole.cpp 2011-05-10 01:22:21.000000000 +0200
  165. @@ -73,6 +73,7 @@
  166. connect(dialog->matchTabWinTitleCB,SIGNAL(toggled(bool)), SLOT( changed() ));
  167. connect(dialog->silence_secondsSB,SIGNAL(valueChanged(int)), SLOT( changed() ));
  168. connect(dialog->word_connectorLE,SIGNAL(textChanged(const QString &)), SLOT( changed() ));
  169. + connect(dialog->printer_path,SIGNAL(textChanged(const QString &)), SLOT( changed() ));
  170. connect(dialog->SchemaEditor1, SIGNAL(changed()), SLOT( changed() ));
  171. connect(dialog->SessionEditor1, SIGNAL(changed()), SLOT( changed() ));
  172. connect(dialog->SchemaEditor1, SIGNAL(schemaListChanged(const QStringList &,const QStringList &)),
  173. @@ -106,6 +107,7 @@
  174. dialog->line_spacingSB->setValue(config.readUnsignedNumEntry( "LineSpacing", 0 ));
  175. dialog->silence_secondsSB->setValue(config.readUnsignedNumEntry( "SilenceSeconds", 10 ));
  176. dialog->word_connectorLE->setText(config.readEntry("wordseps",":@-./_~"));
  177. + dialog->printer_path->setText(config.readEntry("printer_path",""));
  178.  
  179. dialog->SchemaEditor1->setSchema(config.readEntry("schema"));
  180.  
  181. @@ -144,6 +146,7 @@
  182. config.writeEntry("LineSpacing" , dialog->line_spacingSB->value());
  183. config.writeEntry("SilenceSeconds" , dialog->silence_secondsSB->value());
  184. config.writeEntry("wordseps", dialog->word_connectorLE->text());
  185. + config.writeEntry("printer_path", dialog->printer_path->text());
  186.  
  187. config.writeEntry("schema", dialog->SchemaEditor1->schema());
  188.  
  189. --- kdebase-3.5.10.orig/konsole/konsole/konsole.cpp 2007-01-15 12:32:17.000000000 +0100
  190. +++ kdebase-3.5.10/konsole/konsole/konsole.cpp 2011-05-10 01:37:34.000000000 +0200
  191. @@ -1573,6 +1573,7 @@
  192. for (TESession *ses = sessions.first(); ses; ses = sessions.next())
  193. ses->setMonitorSilenceSeconds(monitorSilenceSeconds);
  194.  
  195. + s_printer_path = config->readEntry("printer_path","");
  196. b_xonXoff = config->readBoolEntry("XonXoff",false);
  197. b_matchTabWinTitle = config->readBoolEntry("MatchTabWinTitle",false);
  198. config->setGroup("UTMP");
  199. @@ -2924,6 +2925,7 @@
  200. s->setIconName(icon);
  201. s->setAddToUtmp(b_addToUtmp);
  202. s->setXonXoff(b_xonXoff);
  203. + s->setPrinterPath(s_printer_path);
  204.  
  205. if (b_histEnabled && m_histSize)
  206. s->setHistory(HistoryTypeBuffer(m_histSize));
  207. --- kdebase-3.5.10.orig/konsole/konsole/konsole_part.cpp 2007-05-14 09:55:49.000000000 +0200
  208. +++ kdebase-3.5.10/konsole/konsole/konsole_part.cpp 2011-05-10 01:37:53.000000000 +0200
  209. @@ -522,6 +522,7 @@
  210. else
  211. se->setHistory( HistoryTypeNone() );
  212. se->setKeymapNo( n_keytab );
  213. + se->setPrinterPath( s_printer_path );
  214.  
  215. // FIXME: Move this somewhere else...
  216. KConfig* config = new KConfig("konsolerc",true);
  217. @@ -566,6 +567,7 @@
  218. n_scroll = QMIN(config->readUnsignedNumEntry("scrollbar",TEWidget::SCRRIGHT),2);
  219. m_histSize = config->readNumEntry("history",DEFAULT_HISTORY_SIZE);
  220. s_word_seps= config->readEntry("wordseps",":@-./_~");
  221. + s_printer_path = config->readEntry("s_printer_path","");
  222.  
  223. n_encoding = config->readNumEntry("encoding",0);
  224.  
  225. @@ -635,6 +637,7 @@
  226. config->writeEntry("schema",s_kconfigSchema);
  227. config->writeEntry("scrollbar",n_scroll);
  228. config->writeEntry("wordseps",s_word_seps);
  229. + config->writeEntry("printer_path",s_printer_path);
  230. config->writeEntry("encoding",n_encoding);
  231. config->writeEntry("use_konsole_settings",m_useKonsoleSettings->isChecked());
  232. }
  233. --- kdebase-3.5.10.orig/konsole/konsole/session.cpp 2007-05-14 09:55:49.000000000 +0200
  234. +++ kdebase-3.5.10/konsole/konsole/session.cpp 2011-05-10 01:54:04.000000000 +0200
  235. @@ -595,6 +595,11 @@
  236. xon_xoff = set;
  237. }
  238.  
  239. +void TESession::setPrinterPath(const QString& _printer_path)
  240. +{
  241. + em->setPrinterPath(_printer_path);
  242. +}
  243. +
  244. void TESession::slotZModemDetected()
  245. {
  246. if (!zmodemBusy)
  247. --- kdebase-3.5.10.orig/konsole/konsole/TEmuVt102.cpp 2006-10-01 19:32:08.000000000 +0200
  248. +++ kdebase-3.5.10/konsole/konsole/TEmuVt102.cpp 2011-05-10 14:37:10.000000000 +0200
  249. @@ -78,7 +78,8 @@
  250. /*!
  251. */
  252.  
  253. -TEmuVt102::TEmuVt102(TEWidget* gui) : TEmulation(gui)
  254. +TEmuVt102::TEmuVt102(TEWidget* gui) : TEmulation(gui),
  255. + capture(false)
  256. {
  257. //kdDebug(1211)<<"TEmuVt102 ctor() connecting"<<endl;
  258. QObject::connect(gui,SIGNAL(mouseSignal(int,int,int)),
  259. @@ -146,6 +147,11 @@
  260. //kdDebug(1211)<<"TEmuVt102::reset() done"<<endl;
  261. }
  262.  
  263. +void TEmuVt102::setPrinterPath(const QString &_printer_path)
  264. +{
  265. + printer_path = _printer_path;
  266. +}
  267. +
  268. /* ------------------------------------------------------------------------- */
  269. /* */
  270. /* Processing the incoming byte stream */
  271. @@ -443,6 +449,37 @@
  272. }
  273. #endif
  274.  
  275. + if (token == TY_CSI_PS('i', 4))
  276. + capture = false;
  277. + if (capture)
  278. + {
  279. + switch(token)
  280. + {
  281. + case TY_CHR():
  282. + captured.append(p);
  283. + break;
  284. + case TY_CTL('H'):
  285. + if (captured.length() > 0)
  286. + captured.truncate(captured.length() - 1);
  287. + break;
  288. + case TY_CTL('I'):
  289. + captured.append('\t');
  290. + break;
  291. + case TY_CTL('J'):
  292. + captured.append('\n');
  293. + break;
  294. + case TY_CTL('K'):
  295. + captured.append('\n');
  296. + break;
  297. + case TY_CTL('L'):
  298. + captured.append('\n');
  299. + break;
  300. + default:
  301. + break;
  302. + }
  303. + return;
  304. + }
  305. +
  306. switch (token)
  307. {
  308.  
  309. @@ -544,6 +581,13 @@
  310. case TY_CSI_PS('h', 4) : scr-> setMode (MODE_Insert ); break;
  311. case TY_CSI_PS('h', 20) : setMode (MODE_NewLine ); break;
  312. case TY_CSI_PS('i', 0) : /* IGNORE: attached printer */ break; //VT100
  313. + case TY_CSI_PS('i', 5) :
  314. + captured.truncate(0);
  315. + capture = true;
  316. + break; //VT100
  317. + case TY_CSI_PS('i', 4) :
  318. + doPrint();
  319. + break; //VT100
  320. case TY_CSI_PS('l', 4) : scr-> resetMode (MODE_Insert ); break;
  321. case TY_CSI_PS('l', 20) : resetMode (MODE_NewLine ); break;
  322. case TY_CSI_PS('s', 0) : saveCursor ( ); break;
  323. @@ -1085,6 +1129,30 @@
  324. screen[1]->setMargins(t, b);
  325. }
  326.  
  327. +void TEmuVt102::doPrint()
  328. +{
  329. + if (printer_path.isEmpty())
  330. + return;
  331. +
  332. + KProcess *proc = new KProcess;
  333. + *proc << printer_path;
  334. + if (proc->start(KProcess::NotifyOnExit, (KProcess::Communication) (KProcess::Stdin)) == false)
  335. + {
  336. + qWarning("Unable to execute printer: %s\n", printer_path.latin1());
  337. + return;
  338. + }
  339. + connect(proc, SIGNAL(wroteStdin(KProcess *)), this, SLOT(wroteStdin(KProcess *)));
  340. + proc->writeStdin(captured.latin1(), captured.length());
  341. +}
  342. +
  343. +void TEmuVt102::wroteStdin(KProcess *proc)
  344. +{
  345. + proc->closeAll();
  346. + proc->wait();
  347. + delete proc;
  348. + captured.truncate(0);
  349. +}
  350. +
  351. /*! Save the cursor position and the rendition attribute settings. */
  352.  
  353. void TEmuVt102::saveCursor()
  354.