Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 902938 Details for
Bug 1105542
The kate editor does not retain printing preferences
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Patch to enable saving print preferences
bz-1105542.patch (text/plain), 10.71 KB, created by
Siteshwar Vashisht
on 2014-06-06 14:18:53 UTC
(
hide
)
Description:
Patch to enable saving print preferences
Filename:
MIME Type:
Creator:
Siteshwar Vashisht
Created:
2014-06-06 14:18:53 UTC
Size:
10.71 KB
patch
obsolete
>diff --git a/kate/utils/kateprinter.cpp b/kate/utils/kateprinter.cpp >index ee4b6fd..1e30ee7 100644 >--- a/kate/utils/kateprinter.cpp >+++ b/kate/utils/kateprinter.cpp >@@ -40,6 +40,7 @@ > #include <kurl.h> > #include <kuser.h> // for loginName > #include <klineedit.h> >+#include <kcombobox.h> > > #include <QtGui/QPainter> > #include <QtGui/QCheckBox> >@@ -78,7 +79,8 @@ bool KatePrinter::print (KateDocument *doc) > if ( !parentWidget ) > parentWidget=QApplication::activeWindow(); > >- QPrintDialog *printDialog = KdePrint::createPrintDialog(&printer, tabs, parentWidget); >+ QScopedPointer<QPrintDialog> printDialog(KdePrint::createPrintDialog(&printer, tabs, parentWidget)); >+ > printDialog->setOption( QAbstractPrintDialog::PrintPageRange, false); > > if ( doc->activeView()->selection() ) >@@ -672,6 +674,13 @@ KatePrintTextSettings::KatePrintTextSettings( QWidget *parent ) > cbGuide->setWhatsThis(i18n( > "<p>Print a box displaying typographical conventions for the document type, as " > "defined by the syntax highlighting being used.</p>") ); >+ >+ readSettings(); >+} >+ >+KatePrintTextSettings::~KatePrintTextSettings() >+{ >+ writeSettings(); > } > > // bool KatePrintTextSettings::printSelection() >@@ -679,6 +688,31 @@ KatePrintTextSettings::KatePrintTextSettings( QWidget *parent ) > // return cbSelection->isChecked(); > // } > >+void KatePrintTextSettings::readSettings() >+{ >+ KSharedConfigPtr config = KGlobal::config(); >+ KConfigGroup printGroup( config, "Kate Print Settings" ); >+ >+ KConfigGroup textGroup( &printGroup, "Text" ); >+ bool isLineNumbersChecked = textGroup.readEntry( "LineNumbers", false ); >+ cbLineNumbers->setChecked( isLineNumbersChecked ); >+ >+ bool isLegendChecked = textGroup.readEntry( "Legend", false ); >+ cbGuide->setChecked( isLegendChecked ); >+} >+ >+void KatePrintTextSettings::writeSettings() >+{ >+ KSharedConfigPtr config = KGlobal::config(); >+ KConfigGroup printGroup( config, "Kate Print Settings" ); >+ >+ KConfigGroup textGroup( &printGroup, "Text" ); >+ textGroup.writeEntry( "LineNumbers", printLineNumbers() ); >+ textGroup.writeEntry( "Legend", printGuide() ); >+ >+ config->sync(); >+} >+ > bool KatePrintTextSettings::printLineNumbers() > { > return cbLineNumbers->isChecked(); >@@ -826,6 +860,13 @@ KatePrintHeaderFooter::KatePrintHeaderFooter( QWidget *parent ) > leFooterRight->setWhatsThis(s + s1 ); > leFooterCenter->setWhatsThis(s + s1 ); > leFooterLeft->setWhatsThis(s + s1 ); >+ >+ readSettings(); >+} >+ >+KatePrintHeaderFooter::~KatePrintHeaderFooter() >+{ >+ writeSettings(); > } > > QFont KatePrintHeaderFooter::font() >@@ -899,6 +940,96 @@ void KatePrintHeaderFooter::setHFFont() > } > } > >+void KatePrintHeaderFooter::readSettings() >+{ >+ KSharedConfigPtr config = KGlobal::config(); >+ KConfigGroup printGroup( config, "Kate Print Settings" ); >+ >+ // Header >+ KConfigGroup headerFooterGroup( &printGroup, "HeaderFooter" ); >+ bool isHeaderEnabledChecked = headerFooterGroup.readEntry( "HeaderEnabled", true ); >+ cbEnableHeader->setChecked( isHeaderEnabledChecked ); >+ >+ QString headerFormatLeft = headerFooterGroup.readEntry( "HeaderFormatLeft", "%y" ); >+ leHeaderLeft->setText( headerFormatLeft ); >+ >+ QString headerFormatCenter = headerFooterGroup.readEntry( "HeaderFormatCenter", "%f" ); >+ leHeaderCenter->setText( headerFormatCenter ); >+ >+ QString headerFormatRight = headerFooterGroup.readEntry( "HeaderFormatRight", "%p" ); >+ leHeaderRight->setText( headerFormatRight ); >+ >+ QColor headerForeground = headerFooterGroup.readEntry( "HeaderForeground", QColor("black") ); >+ kcbtnHeaderFg->setColor( headerForeground ); >+ >+ bool isHeaderBackgroundChecked = headerFooterGroup.readEntry( "HeaderBackgroundEnabled", false ); >+ cbHeaderEnableBgColor->setChecked( isHeaderBackgroundChecked ); >+ >+ QColor headerBackground = headerFooterGroup.readEntry( "HeaderBackground", QColor("lightgrey") ); >+ kcbtnHeaderBg->setColor( headerBackground ); >+ >+ // Footer >+ bool isFooterEnabledChecked = headerFooterGroup.readEntry( "FooterEnabled", true ); >+ cbEnableFooter->setChecked( isFooterEnabledChecked ); >+ >+ QString footerFormatLeft = headerFooterGroup.readEntry( "FooterFormatLeft", QString() ); >+ leFooterLeft->setText( footerFormatLeft ); >+ >+ QString footerFormatCenter = headerFooterGroup.readEntry( "FooterFormatCenter", QString() ); >+ leFooterCenter->setText( footerFormatCenter ); >+ >+ QString footerFormatRight = headerFooterGroup.readEntry( "FooterFormatRight", "%U" ); >+ leFooterRight->setText( footerFormatRight ); >+ >+ QColor footerForeground = headerFooterGroup.readEntry( "FooterForeground", QColor("black") ); >+ kcbtnFooterFg->setColor( footerForeground ); >+ >+ bool isFooterBackgroundChecked = headerFooterGroup.readEntry( "FooterBackgroundEnabled", false ); >+ cbFooterEnableBgColor->setChecked( isFooterBackgroundChecked ); >+ >+ QColor footerBackground = headerFooterGroup.readEntry( "FooterBackground", QColor("lightgrey") ); >+ kcbtnFooterBg->setColor( footerBackground ); >+ >+ // Font >+ QFont headerFooterFont = headerFooterGroup.readEntry( "HeaderFooterFont", QFont() ); >+ lFontPreview->setFont( headerFooterFont ); >+ lFontPreview->setText( QString(headerFooterFont.family() + ", %1pt").arg( headerFooterFont.pointSize() ) ); >+} >+ >+void KatePrintHeaderFooter::writeSettings() >+{ >+ KSharedConfigPtr config = KGlobal::config(); >+ KConfigGroup printGroup( config, "Kate Print Settings" ); >+ >+ // Header >+ KConfigGroup headerFooterGroup( &printGroup, "HeaderFooter" ); >+ headerFooterGroup.writeEntry( "HeaderEnabled", useHeader() ); >+ >+ QStringList format = headerFormat(); >+ headerFooterGroup.writeEntry( "HeaderFormatLeft", format[0] ); >+ headerFooterGroup.writeEntry( "HeaderFormatCenter", format[1] ); >+ headerFooterGroup.writeEntry( "HeaderFormatRight", format[2] ); >+ headerFooterGroup.writeEntry( "HeaderForeground", headerForeground() ); >+ headerFooterGroup.writeEntry( "HeaderBackgroundEnabled", useHeaderBackground() ); >+ headerFooterGroup.writeEntry( "HeaderBackground", headerBackground() ); >+ >+ // Footer >+ headerFooterGroup.writeEntry( "FooterEnabled", useFooter() ); >+ >+ format = footerFormat(); >+ headerFooterGroup.writeEntry( "FooterFormatLeft", format[0] ); >+ headerFooterGroup.writeEntry( "FooterFormatCenter", format[1] ); >+ headerFooterGroup.writeEntry( "FooterFormatRight", format[2] ); >+ headerFooterGroup.writeEntry( "FooterForeground", footerForeground() ); >+ headerFooterGroup.writeEntry( "FooterBackgroundEnabled", useFooterBackground() ); >+ headerFooterGroup.writeEntry( "FooterBackground", footerBackground() ); >+ >+ // Font >+ headerFooterGroup.writeEntry( "HeaderFooterFont", font() ); >+ >+ config->sync(); >+} >+ > //END KatePrintHeaderFooter > > //BEGIN KatePrintLayout >@@ -913,7 +1044,7 @@ KatePrintLayout::KatePrintLayout( QWidget *parent) > KHBox *hb = new KHBox( this ); > lo->addWidget( hb ); > QLabel *lSchema = new QLabel( i18n("&Schema:"), hb ); >- cmbSchema = new QComboBox( hb ); >+ cmbSchema = new KComboBox( hb ); > cmbSchema->setEditable( false ); > lSchema->setBuddy( cmbSchema ); > >@@ -975,6 +1106,13 @@ KatePrintLayout::KatePrintLayout( QWidget *parent) > "The margin inside boxes, in pixels") ); > kcbtnBoxColor->setWhatsThis(i18n( > "The line color to use for boxes") ); >+ >+ readSettings(); >+} >+ >+KatePrintLayout::~KatePrintLayout() >+{ >+ writeSettings(); > } > > QString KatePrintLayout::colorScheme() >@@ -1006,6 +1144,49 @@ QColor KatePrintLayout::boxColor() > { > return kcbtnBoxColor->color(); > } >+ >+void KatePrintLayout::readSettings() >+{ >+ KSharedConfigPtr config = KGlobal::config(); >+ KConfigGroup printGroup(config, "Kate Print Settings"); >+ >+ KConfigGroup layoutGroup(&printGroup, "Layout"); >+ >+ QString colorScheme = layoutGroup.readEntry( "ColorScheme", KateGlobal::self()->schemaManager()->name(1) ); >+ cmbSchema->setCurrentItem( colorScheme ); >+ >+ bool isBackgroundChecked = layoutGroup.readEntry( "BackgroundColorEnabled", false ); >+ cbDrawBackground->setChecked( isBackgroundChecked ); >+ >+ bool isBoxChecked = layoutGroup.readEntry( "BoxEnabled", false ); >+ cbEnableBox->setChecked( isBoxChecked ); >+ >+ int boxWidth = layoutGroup.readEntry( "BoxWidth", 1 ); >+ sbBoxWidth->setValue( boxWidth ); >+ >+ int boxMargin = layoutGroup.readEntry( "BoxMargin", 6 ); >+ sbBoxMargin->setValue( boxMargin ); >+ >+ QColor boxColor = layoutGroup.readEntry( "BoxColor", QColor() ); >+ kcbtnBoxColor->setColor( boxColor ); >+} >+ >+void KatePrintLayout::writeSettings() >+{ >+ KSharedConfigPtr config = KGlobal::config(); >+ KConfigGroup printGroup(config, "Kate Print Settings"); >+ >+ KConfigGroup layoutGroup(&printGroup, "Layout"); >+ layoutGroup.writeEntry( "ColorScheme", colorScheme() ); >+ layoutGroup.writeEntry( "BackgroundColorEnabled", useBackground() ); >+ layoutGroup.writeEntry( "BoxEnabled", useBox() ); >+ layoutGroup.writeEntry( "BoxWidth", boxWidth() ); >+ layoutGroup.writeEntry( "BoxMargin", boxMargin() ); >+ layoutGroup.writeEntry( "BoxColor", boxColor() ); >+ >+ config->sync(); >+} >+ > //END KatePrintLayout > > #include "kateprinter.moc" >diff --git a/kate/utils/kateprinter.h b/kate/utils/kateprinter.h >index 87d6743..0705202 100644 >--- a/kate/utils/kateprinter.h >+++ b/kate/utils/kateprinter.h >@@ -32,6 +32,7 @@ class QGroupBox; > class QLabel; > class KLineEdit; > class QSpinBox; >+class KComboBox; > > class KatePrinter > { >@@ -51,7 +52,7 @@ class KatePrintTextSettings : public QWidget > Q_OBJECT > public: > explicit KatePrintTextSettings( QWidget *parent=0 ); >- ~KatePrintTextSettings(){} >+ ~KatePrintTextSettings(); > > // bool printSelection(); > bool printLineNumbers(); >@@ -61,6 +62,9 @@ class KatePrintTextSettings : public QWidget > // void enableSelection( bool ); > > private: >+ void readSettings(); >+ void writeSettings(); >+ > QCheckBox /* *cbSelection,*/ *cbLineNumbers, *cbGuide; > }; > //END Text Settings >@@ -79,7 +83,7 @@ class KatePrintHeaderFooter : public QWidget > Q_OBJECT > public: > explicit KatePrintHeaderFooter( QWidget *parent=0 ); >- ~KatePrintHeaderFooter(){} >+ ~KatePrintHeaderFooter(); > > QFont font(); > >@@ -99,6 +103,9 @@ class KatePrintHeaderFooter : public QWidget > void setHFFont(); > > private: >+ void readSettings(); >+ void writeSettings(); >+ > QCheckBox *cbEnableHeader, *cbEnableFooter; > QLabel *lFontPreview; > QGroupBox *gbHeader, *gbFooter; >@@ -127,7 +134,7 @@ class KatePrintLayout : public QWidget > Q_OBJECT > public: > explicit KatePrintLayout( QWidget *parent=0 ); >- ~KatePrintLayout(){} >+ ~KatePrintLayout(); > > QString colorScheme(); > bool useBackground(); >@@ -137,7 +144,10 @@ class KatePrintLayout : public QWidget > QColor boxColor(); > > private: >- QComboBox *cmbSchema; >+ void readSettings(); >+ void writeSettings(); >+ >+ KComboBox *cmbSchema; > QCheckBox *cbEnableBox, *cbDrawBackground; > QGroupBox *gbBoxProps; > QSpinBox *sbBoxWidth, *sbBoxMargin;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1105542
: 902938