OSDN Git Service

kdeplasma: remove redundant dict applet style sheet override
authorIvailo Monev <xakepa10@gmail.com>
Fri, 7 Jul 2023 22:58:30 +0000 (01:58 +0300)
committerIvailo Monev <xakepa10@gmail.com>
Fri, 7 Jul 2023 22:58:30 +0000 (01:58 +0300)
Plasma::TextBrowser palette is already set and updated internally, the
dictionary data engine does not add links too (unless the example or
definition itself contains such)

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
kdeplasma-addons/applets/dict/dict.cpp
kdeplasma-addons/applets/dict/dict.h

index 0f5ec45..2b122ca 100644 (file)
 
 #define AUTO_DEFINE_TIMEOUT 500
 
-using namespace Plasma;
-
-
-
-// Style sheet format
-const char* translationCSS =
-    "dl {color: %1;}\n"
-    "a{color: %2}\n"
-    "a:visited{color: %3}\n";
-
 DictApplet::DictApplet(QObject *parent, const QVariantList &args)
     : Plasma::PopupApplet(parent, args)
     , m_graphicsWidget(0)
@@ -101,7 +91,7 @@ QGraphicsWidget *DictApplet::graphicsWidget()
         return m_graphicsWidget;
     }
 
-    m_wordEdit = new LineEdit(this);
+    m_wordEdit = new Plasma::LineEdit(this);
     m_wordEdit->nativeWidget()->setClearButtonShown( true );
     m_wordEdit->nativeWidget()->setClickMessage(i18n("Enter word to define here"));
     m_wordEdit->show();
@@ -109,8 +99,6 @@ QGraphicsWidget *DictApplet::graphicsWidget()
     m_defBrowser = new Plasma::TextBrowser();
     m_defBrowser->nativeWidget()->setOpenLinks(true);
     connect(m_defBrowser->nativeWidget(),SIGNAL(anchorClicked(QUrl)),this,SLOT(linkDefine(QUrl)));
-    syncTheme();
-    connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), SLOT(syncTheme()));
     m_defBrowser->hide();
 
 //  Icon in upper-left corner
@@ -165,8 +153,7 @@ QGraphicsWidget *DictApplet::graphicsWidget()
     m_graphicsWidget->setLayout(m_layout);
     m_graphicsWidget->setPreferredSize(500, 200);
 
-    Animation *zoomAnim =
-        Plasma::Animator::create(Plasma::Animator::ZoomAnimation);
+    Plasma::Animation *zoomAnim = Plasma::Animator::create(Plasma::Animator::ZoomAnimation);
     zoomAnim->setTargetWidget(m_wordEdit);
     zoomAnim->setProperty("zoom", 1.0);
     zoomAnim->setProperty("duration", 350);
@@ -175,17 +162,6 @@ QGraphicsWidget *DictApplet::graphicsWidget()
     return m_graphicsWidget;
 }
 
-void DictApplet::syncTheme()
-{
-    // Gets the color scheme from default theme
-    KColorScheme colorScheme(QPalette::Active, KColorScheme::View, Plasma::Theme::defaultTheme()->colorScheme());
-
-    m_defBrowser->nativeWidget()->document()->setDefaultStyleSheet(QString(QLatin1String( translationCSS ))
-                                                .arg(colorScheme.foreground().color().name())
-                                                .arg(colorScheme.foreground(KColorScheme::LinkText).color().name())
-                                                .arg(colorScheme.foreground(KColorScheme::VisitedText).color().name()));
-}
-
 void DictApplet::configChanged()
 {
     KConfigGroup cg = config();
index f66638b..f44ad7b 100644 (file)
@@ -57,7 +57,6 @@ class DictApplet: public Plasma::PopupApplet
         void define();
         void configAccepted();
         void focusEditor();
-        void syncTheme();
 
     protected:
         void createConfigurationInterface(KConfigDialog *parent);