[Kita-svn] [2407] - use QTextEdit instead of Q3TextEdit

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 7月 14日 (火) 23:05:47 JST


Revision: 2407
          http://sourceforge.jp/projects/kita/svn/view?view=rev&revision=2407
Author:   nogu
Date:     2009-07-14 23:05:47 +0900 (Tue, 14 Jul 2009)

Log Message:
-----------
- use QTextEdit instead of Q3TextEdit
- avoid a crash when loading a board

Modified Paths:
--------------
    kita/branches/KITA-KDE4/kita/src/boardview.cpp
    kita/branches/KITA-KDE4/kita/src/writedialogbase.ui
    kita/branches/KITA-KDE4/kita/src/writeview.cpp
    kita/branches/KITA-KDE4/kita/src/writeview.h

Modified: kita/branches/KITA-KDE4/kita/src/boardview.cpp
===================================================================
--- kita/branches/KITA-KDE4/kita/src/boardview.cpp	2009-07-13 21:43:18 UTC (rev 2406)
+++ kita/branches/KITA-KDE4/kita/src/boardview.cpp	2009-07-14 14:05:47 UTC (rev 2407)
@@ -154,11 +154,13 @@
 
         Kita::Thread* thread = i < countNew ? threadList.at(i) : oldLogList.at(i - countNew);
         KUrl datURL = thread->datURL();
-        Kita::ThreadListViewItem* item = new Kita::ThreadListViewItem();
-        subjectList->setItem(i, 0, item);
+        for (int j = 0, k = subjectList->columnCount(); j < k; j++) {
+            Kita::ThreadListViewItem* item = new Kita::ThreadListViewItem();
+            subjectList->setItem(i, j, item);
+        }
         int id = (i < countNew ? i + 1 : 0);
         int order = i + 1;
-        updateListViewItem(item, datURL, current, id, order);
+        updateListViewItem(subjectList->item(i, 0), datURL, current, id, order);
     }
 
     if (HideButton->isChecked()) {

Modified: kita/branches/KITA-KDE4/kita/src/writedialogbase.ui
===================================================================
--- kita/branches/KITA-KDE4/kita/src/writedialogbase.ui	2009-07-13 21:43:18 UTC (rev 2406)
+++ kita/branches/KITA-KDE4/kita/src/writedialogbase.ui	2009-07-14 14:05:47 UTC (rev 2407)
@@ -127,7 +127,7 @@
       </item>
       <item>
         <widget class="QTabWidget" name="qtw" >
-          <widget class="Q3TextEdit" name="bodyText" >
+          <widget class="QTextEdit" name="bodyText" >
             <attribute name="title" >
               <string>body</string>
             </attribute>

Modified: kita/branches/KITA-KDE4/kita/src/writeview.cpp
===================================================================
--- kita/branches/KITA-KDE4/kita/src/writeview.cpp	2009-07-13 21:43:18 UTC (rev 2406)
+++ kita/branches/KITA-KDE4/kita/src/writeview.cpp	2009-07-14 14:05:47 UTC (rev 2407)
@@ -125,7 +125,7 @@
 void KitaWriteView::setMessage(const QString& bodyStr)
 {
     bodyText->clear();
-    bodyText->insert(bodyStr);
+    bodyText->insertPlainText(bodyStr);
     bodyText->setFocus();
 }
 
@@ -133,7 +133,7 @@
 /* public */
 void KitaWriteView::insertMessage(const QString& str)
 {
-    bodyText->insert(str);
+    bodyText->insertPlainText(str);
     bodyText->setFocus();
 }
 
@@ -334,8 +334,9 @@
 /* private slot */
 bool KitaWriteView::slotBodyTextChanged()
 {
-    int lines = bodyText->lines();
-    int tmpln = bodyText->length();
+    QString text = bodyText->toPlainText();
+    int lines = text.count('\n') + 1;
+    int tmpln = text.length();
     int length = QTextCodec::codecForName("Shift_JIS")->fromUnicode(body()).length();
 
     /* replace '\n' -> " <br> ", '>' -> "&lt;", and etc. */

Modified: kita/branches/KITA-KDE4/kita/src/writeview.h
===================================================================
--- kita/branches/KITA-KDE4/kita/src/writeview.h	2009-07-13 21:43:18 UTC (rev 2406)
+++ kita/branches/KITA-KDE4/kita/src/writeview.h	2009-07-14 14:05:47 UTC (rev 2407)
@@ -90,7 +90,7 @@
 
     const QString body() const
     {
-      return bodyText->text();
+      return bodyText->toPlainText();
     }
 
 public slots:




Kita-svn メーリングリストの案内
Back to archive index