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

List:       kde-commits
Subject:    extragear/plasma/applets/notes
From:       Sebastian Kügler <sebas () kde ! nl>
Date:       2008-04-28 11:55:34
Message-ID: 1209383734.895143.5217.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 802042 by sebas:

Use a KTextEdit instead of QTextEdit, that gives us spellchecking.
Also make sure the font gets saved, and use a 'normal' method to
switch off the border around the textedit, rather than a stylesheet.

Still no font color, though. Don't know why. :/


 M  +13 -3     config.ui  
 M  +15 -4     notes.cpp  
 M  +3 -2      notes.h  


--- trunk/extragear/plasma/applets/notes/config.ui #802041:802042
@@ -5,11 +5,11 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>316</width>
-    <height>65</height>
+    <width>300</width>
+    <height>108</height>
    </rect>
   </property>
-  <layout class="QGridLayout" >
+  <layout class="QGridLayout" name="gridLayout" >
    <item row="0" column="0" >
     <widget class="QLabel" name="textFontLabel" >
      <property name="text" >
@@ -30,6 +30,16 @@
    <item row="1" column="1" >
     <widget class="KColorButton" name="textColorButton" />
    </item>
+   <item row="2" column="0" colspan="2" >
+    <widget class="QCheckBox" name="checkSpelling" >
+     <property name="text" >
+      <string>Check spelling</string>
+     </property>
+     <property name="checked" >
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
   </layout>
  </widget>
  <customwidgets>
--- trunk/extragear/plasma/applets/notes/notes.cpp #802041:802042
@@ -40,7 +40,7 @@
     setBackgroundHints(Plasma::Applet::NoBackground);
     resize(256, 256);
 
-    m_textEdit = new QTextEdit();
+    m_textEdit = new KTextEdit();
     m_layout = new QGraphicsLinearLayout();
     m_proxy = new QGraphicsProxyWidget(this);
     updateTextGeometry();
@@ -52,7 +52,8 @@
 
     m_proxy->setWidget(m_textEdit);
     m_proxy->show();
-    m_textEdit->setStyleSheet("QTextEdit { border: none }");
+    m_textEdit->setCheckSpellingEnabled(true);
+    m_textEdit->setFrameShape(QFrame::NoFrame);
     m_textEdit->setAttribute(Qt::WA_NoSystemBackground);
     m_textEdit->setTextBackgroundColor(QColor(0,0,0,0));
     m_textEdit->viewport()->setAutoFillBackground(false);
@@ -69,7 +70,8 @@
     m_textEdit->setFont(font);
     QColor textColor = cg.readEntry("textcolor", QColor(Qt::black));
     m_textEdit->setTextColor(textColor);
-
+    m_checkSpelling = cg.readEntry("checkSpelling", true);
+    m_textEdit->setCheckSpellingEnabled(m_checkSpelling);
     setLayout(m_layout);
     updateTextGeometry();
     connect(m_textEdit, SIGNAL(textChanged()), this, SLOT(saveNote()));
@@ -129,6 +131,7 @@
     connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted()));
     ui.textColorButton->setColor(m_textEdit->textColor());
     ui.textFontButton->setFont(m_textEdit->font());
+    ui.checkSpelling->setChecked(m_checkSpelling);
 }
 
 void Notes::configAccepted()
@@ -138,7 +141,7 @@
     bool changed = false;
 
     QFont newFont = ui.textFontButton->font();
-    if (m_textEdit->font() != newFont) {
+    if (m_textEdit->currentFont() != newFont) {
         changed = true;
         cg.writeEntry("font", newFont);
         m_textEdit->setFont(newFont);
@@ -152,6 +155,14 @@
         m_textEdit->setTextColor(newColor);
     }
 
+    bool spellCheck = ui.checkSpelling->isChecked();
+    if (spellCheck != m_checkSpelling) {
+        m_checkSpelling = spellCheck;
+        cg.writeEntry("checkSpelling", m_checkSpelling);
+        m_textEdit->setCheckSpellingEnabled(m_checkSpelling);
+        changed = true;
+    }
+
     if (changed) {
         emit configNeedsSaving();
     }
--- trunk/extragear/plasma/applets/notes/notes.h #802041:802042
@@ -24,8 +24,8 @@
 
 #include <QGraphicsLinearLayout>
 #include <QGraphicsProxyWidget>
-#include <QTextEdit>
 
+#include <KTextEdit>
 
 #include <Plasma/Applet>
 #include <Plasma/Svg>
@@ -57,11 +57,12 @@
         void constraintsEvent(Plasma::Constraints constraints);
 
     private:
+        bool m_checkSpelling;
         void updateTextGeometry();
         Plasma::Svg m_notes_theme;
         QGraphicsLinearLayout *m_layout;
         QGraphicsProxyWidget *m_proxy;
-        QTextEdit *m_textEdit;
+        KTextEdit *m_textEdit;
         Ui::config ui;
         //KDialog *m_dialog;
 
[prev in list] [next in list] [prev in thread] [next in thread] 

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