OSDN Git Service

tuning stylesheet behavior.
authorikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Thu, 26 Aug 2004 15:36:55 +0000 (15:36 +0000)
committerikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Thu, 26 Aug 2004 15:36:55 +0000 (15:36 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/kita/kita/trunk@1323 56b19765-1e22-0410-a548-a0f45d66c51a

kita/src/part/kitahtmlpart.cpp

index 95abe74..cd07cb5 100644 (file)
@@ -187,27 +187,20 @@ void KitaHTMLPart::connectSignals()
 void KitaHTMLPart::createHTMLDocument()
 {
     /* style */
-#if 0
-    QString style = QString( "style=\"font-size: %1pt; "
-                             "font-family: %2; "
-                             "color: %3; "
-                             "background-color: %4; border-width: 0; \"" )
+    QString style = QString( "body { font-size: %1pt; font-family: %2; }" )
                     .arg( KitaConfig::threadFont().pointSize() )
-                    .arg( KitaConfig::threadFont().family() )
+                    .arg( KitaConfig::threadFont().family() );
+#if 0
                     .arg( KitaConfig::threadColor().name() )
                     .arg( KitaConfig::threadBackgroundColor().name() );
-
-    QString text = "<html><head></head>";
-    text += "<body " + style + "></body></html>";
-#else
-    QString style = QString( "style=\"font-size: %1pt; "
-                             "font-family: %2; \"" )
-                   .arg( KitaConfig::threadFont().pointSize() )
-                   .arg( KitaConfig::threadFont().family() );
-    QString text = "<html><head><style>";
-    text += KitaConfig::styleSheetText();
-    text += "</style></head><body " + style + "></body></html>";
 #endif
+    QString text = "<html><head><style>";
+    text += KitaConfig::defaultStyleSheetText();
+    text += style;
+    if ( KitaConfig::useStyleSheet() ) {
+        text += KitaConfig::styleSheetText();
+    }
+    text += "</style></head><body></body></html>";
 
     setJScriptEnabled( false );
     setJavaEnabled( false );
@@ -406,7 +399,20 @@ void KitaHTMLPart::slotSetStyleSheetOfHTMLPart()
         elm = collection.item(i);
        if(elm.tagName().upper() == "STYLE")
         {
-            elm.setInnerText( KitaConfig::styleSheetText() );
+            QString style = QString( "body { font-size: %1pt; font-family: %2; }" )
+                            .arg( KitaConfig::threadFont().pointSize() )
+                            .arg( KitaConfig::threadFont().family() );
+#if 0
+                            .arg( KitaConfig::threadColor().name() )
+                            .arg( KitaConfig::threadBackgroundColor().name() );
+#endif
+            QString style0 = KitaConfig::defaultStyleSheetText();
+            style0 += style;
+            if ( KitaConfig::useStyleSheet() ) {
+                style0 += KitaConfig::styleSheetText();
+            }
+
+            elm.setInnerText( style0 );
             htmlDocument().applyChanges();
            break;
        }
@@ -424,7 +430,7 @@ void KitaHTMLPart::slotSetStyleSheetOfHTMLPart()
 /*  top = centerNum - preShowNum
     bottom = centerNum + afterShowNum
     readNum = Kita::DatManager::getReadNum
+
     No.1 <- show -> No.20 <- not show -> No.(top) <- show -> No.(bottom) <- not show -> No.(readNum) */
 
 bool KitaHTMLPart::load( int centerNum )
@@ -2025,16 +2031,27 @@ namespace Kita
     void ResPopup::setText( const QString& str )
     {
 
-        QString style = QString( "style=\"font-size: %1pt; "
-                                 "font-family: %2; "
-                                 "border-width: 0; \"" )
+        QString style = QString( "body.pop {"
+                                 " font-size: %1pt; "
+                                 " font-family: %2; "
+                                 " color: %3; "
+                                 " background-color: %4; "
+                                 " border-width: 0;"
+                                 "}" )
                         .arg( KitaConfig::threadFont().pointSize() )
-                        .arg( KitaConfig::threadFont().family() );
+                        .arg( KitaConfig::threadFont().family() )
+                        .arg( KitaConfig::popupColor().name() )
+                        .arg( KitaConfig::popupBackgroundColor().name() );
 
         QString text = "<html><head><style>";
-        text += KitaConfig::styleSheetText();
-        text += "</style></head><body class=\"pop\" " + style + ">";
-        text += str + "</body></html>";
+        text += KitaConfig::defaultStyleSheetText();
+       text += style;
+        if ( KitaConfig::useStyleSheet() ) {
+            text += KitaConfig::styleSheetText();
+        }
+        text += "</style></head><body class=\"pop\">";
+       text += str;
+       text += "</body></html>";
 
         if( m_textBrowser ) m_textBrowser->setText( text );