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

List:       kmail-devel
Subject:    [PATCH] Shrink quoted text
From:       Ivor Hewitt <ivor () ivor ! org>
Date:       2005-05-10 21:03:49
Message-ID: 200505102203.49855.ivor () ivor ! org
[Download RAW message or body]

Hi,
I like the way thunderbird shrinks the font size of quoted text to give it 
less visual importance.
Whilst I like the new collapsing feature I came up with this patch which 
automatically shrinks the quoted text font size by reducing the size to 
85,80,75 and 70% of original.

Does anyone see merit in this?

Cheers,

-- 
Ivor Hewitt.
http://www.ivor.it - tech | http://www.ivor.org - hedge

["kmail.diff" (text/x-diff)]

Index: csshelper.cpp
===================================================================
--- csshelper.cpp	(revision 411518)
+++ csshelper.cpp	(working copy)
@@ -97,6 +97,7 @@
       cPgpEncrF, cPgpEncrH, cPgpEncrB;
     // color of frame of warning preceding the source of HTML messages
     QColor cHtmlWarning;
+    bool mShrinkQuotes;
   };
 
   bool CSSHelper::Private::operator==( const Private & other ) const {
@@ -118,7 +119,8 @@
       cPgpOk0F == other.cPgpOk0F && cPgpOk0H == other.cPgpOk0H && cPgpOk0B == \
                other.cPgpOk0B &&
       cPgpWarnF == other.cPgpWarnF && cPgpWarnH == other.cPgpWarnH && cPgpWarnB == \
                other.cPgpWarnB &&
       cPgpErrF == other.cPgpErrF && cPgpErrH == other.cPgpErrH && cPgpErrB == \
                other.cPgpErrB &&
-      cPgpEncrF == other.cPgpEncrF && cPgpEncrH == other.cPgpEncrH && cPgpEncrB == \
other.cPgpEncrB ; +      cPgpEncrF == other.cPgpEncrF && cPgpEncrH == other.cPgpEncrH \
&& cPgpEncrB == other.cPgpEncrB && +      mShrinkQuotes == other.mShrinkQuotes;
     }
 
   namespace {
@@ -257,7 +259,9 @@
         mQuoteFont[i] = fonts.readFontEntry( key, &defaultFont );
       }
     }
-
+   
+    mShrinkQuotes = reader.readBoolEntry("ShrinkQuotes",false);
+    
     mBackingPixmapStr = pixmaps.readPathEntry("Readerwin");
     mBackingPixmapOn = !mBackingPixmapStr.isEmpty();
   }
@@ -454,6 +458,21 @@
         quoteCSS += "  font-style: italic ! important;\n";
       if ( mQuoteFont[i].bold() )
         quoteCSS += "  font-weight: bold ! important;\n";
+
+      if (mShrinkQuotes)
+      {
+          switch (i){
+              case 0:
+                  quoteCSS+="  font-size: 85%;\n"; break;
+              case 1:
+                  quoteCSS+="  font-size: 80%;\n"; break;
+              case 2:
+                  quoteCSS+="  font-size: 75%;\n"; break;
+              case 3:
+                  quoteCSS+="  font-size: 70%;\n"; break;
+          };
+      }
+      
       quoteCSS += "}\n\n";
     }
 
Index: configuredialog_p.h
===================================================================
--- configuredialog_p.h	(revision 411518)
+++ configuredialog_p.h	(working copy)
@@ -521,6 +521,7 @@
   QCheckBox *mShowEmoticonsCheck;
   QCheckBox *mShowExpandQuotesMark;
   KIntSpinBox  *mCollapseQuoteLevelSpin;
+  QCheckBox *mShrinkQuotesCheck;
   QComboBox *mCharsetCombo;
   QComboBox *mOverrideCharsetCombo;
 };
Index: kmail.kcfg
===================================================================
--- kmail.kcfg	(revision 411518)
+++ kmail.kcfg	(working copy)
@@ -399,8 +399,11 @@
         <min>0</min>
         <max>10</max>
       </entry>
-
-
+     <entry name="ShrinkQuotes" type="Bool">
+         <default>false</default>
+         <label>Reduce font sizes for quoted text</label>
+         <whatsthis>Enabling this option causes quoted text to reduce in size for \
each nested text quotation.</whatsthis> +     </entry>
     </group>
 
 </kcfg>
Index: configuredialog.cpp
===================================================================
--- configuredialog.cpp	(revision 411518)
+++ configuredialog.cpp	(working copy)
@@ -2184,6 +2184,9 @@
 static const BoolConfigEntry showExpandQuotesMark= {
   "Reader", "ShowExpandQuotesMark", I18N_NOOP("Show expand/collapse quote marks"), \
false  };
+static const BoolConfigEntry shrinkQuotes= {
+  "Reader", "ShrinkQuotes", I18N_NOOP("Shrink quoted text size"), false
+};
 
 
 QString AppearancePage::ReaderTab::helpAnchor() const {
@@ -2237,7 +2240,12 @@
 
   connect( mShowExpandQuotesMark, SIGNAL( toggled( bool ) ),
       mCollapseQuoteLevelSpin, SLOT( setEnabled( bool ) ) );
-
+  
+  populateCheckBox( mShrinkQuotesCheck = new QCheckBox( this ), shrinkQuotes );
+  vlay->addWidget( mShrinkQuotesCheck );
+  connect( mShrinkQuotesCheck, SIGNAL ( stateChanged( int ) ),
+           this, SLOT( slotEmitChanged() ) );
+  
   // Fallback Character Encoding
   hlay = new QHBoxLayout( vlay ); // inherits spacing
   mCharsetCombo = new QComboBox( this );
@@ -2319,6 +2327,7 @@
   mShowEmoticonsCheck->setChecked( GlobalSettings::showEmoticons() );
   mShowExpandQuotesMark->setChecked( GlobalSettings::showExpandQuotesMark() );
   mCollapseQuoteLevelSpin->setValue( GlobalSettings::collapseQuoteLevelSpin() );
+  mShrinkQuotesCheck->setChecked( GlobalSettings::shrinkQuotes() );
   readCurrentOverrideCodec();
 }
 
@@ -2336,6 +2345,7 @@
   saveCheckBox( mShowSpamStatusCheck, reader, showSpamStatusMode );
   GlobalSettings::setShowEmoticons( mShowEmoticonsCheck->isChecked() );
   GlobalSettings::setShowExpandQuotesMark( mShowExpandQuotesMark->isChecked() );
+  GlobalSettings::setShrinkQuotes( mShrinkQuotesCheck->isChecked() );
   
   GlobalSettings::setCollapseQuoteLevelSpin( mCollapseQuoteLevelSpin->value() );
   GlobalSettings::setFallbackCharacterEncoding(
@@ -2351,6 +2361,7 @@
   loadProfile( mShowSpamStatusCheck, reader, showSpamStatusMode );
   loadProfile( mShowEmoticonsCheck, reader, showEmoticons );
   loadProfile( mShowExpandQuotesMark, reader, showExpandQuotesMark);
+  loadProfile( mShrinkQuotesCheck, reader, shrinkQuotes );
 }
 
 



_______________________________________________
KMail developers mailing list
KMail-devel@kde.org
https://mail.kde.org/mailman/listinfo/kmail-devel


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

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