OSDN Git Service

>>808
authorikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Sun, 23 May 2004 09:00:28 +0000 (09:00 +0000)
committerikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Sun, 23 May 2004 09:00:28 +0000 (09:00 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/kita/kita/trunk@1101 56b19765-1e22-0410-a548-a0f45d66c51a

17 files changed:
ChangeLog
kita/src/aboneprefbase.ui
kita/src/favoritelistview.cpp
kita/src/kita.cpp
kita/src/kitaboardviewbase.ui
kita/src/kitafontprefbase.ui
kita/src/kitasubjectview.cpp
kita/src/kitasubjectview.h
kita/src/kitathreadtabwidget.cpp
kita/src/kitathreadtabwidget.h
kita/src/part/kitathreadview.cpp
kita/src/part/kitathreadview.h
kita/src/part/kitathreadviewbase.ui
kita/src/pref.cpp
kita/src/pref.h
kita/src/threadlistviewbase.ui
kita/src/uiprefbase.ui

index 875eb40..5dc3772 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2004-05-23  Hideki Ikemoto  <ikemo@users.sourceforge.jp>
+
+       * show unread/read/new thread num.
+       * open board when click the board name of the label.
+       * change font pref.
+       thanks to Toshihiko Okada <tossi@users.sourceforge.jp>
+
 2004-05-22  Hideki Ikemoto  <ikemo@users.sourceforge.jp>
 
        * refactoring. >>787>>800
index 9e38f71..9321c26 100644 (file)
     <property name="caption">
         <string>Form1</string>
     </property>
-    <widget class="QLabel">
+    <hbox>
         <property name="name">
-            <cstring>wordLabel</cstring>
+            <cstring>unnamed</cstring>
         </property>
-        <property name="geometry">
-            <rect>
-                <x>210</x>
-                <y>10</y>
-                <width>44</width>
-                <height>14</height>
-            </rect>
-        </property>
-        <property name="text">
-            <string>NG word</string>
-        </property>
-    </widget>
-    <widget class="QLabel">
-        <property name="name">
-            <cstring>nameLabel</cstring>
-        </property>
-        <property name="geometry">
-            <rect>
-                <x>110</x>
-                <y>10</y>
-                <width>29</width>
-                <height>14</height>
-            </rect>
-        </property>
-        <property name="text">
-            <string>Name</string>
-        </property>
-    </widget>
-    <widget class="QLabel">
-        <property name="name">
-            <cstring>idLabel</cstring>
-        </property>
-        <property name="geometry">
-            <rect>
-                <x>10</x>
-                <y>10</y>
-                <width>11</width>
-                <height>14</height>
-            </rect>
-        </property>
-        <property name="text">
-            <string>ID</string>
-        </property>
-    </widget>
-    <widget class="KTextEdit">
-        <property name="name">
-            <cstring>wordAboneText</cstring>
-        </property>
-        <property name="geometry">
-            <rect>
-                <x>210</x>
-                <y>30</y>
-                <width>90</width>
-                <height>170</height>
-            </rect>
-        </property>
-    </widget>
-    <widget class="KTextEdit">
-        <property name="name">
-            <cstring>nameAboneText</cstring>
-        </property>
-        <property name="geometry">
-            <rect>
-                <x>110</x>
-                <y>30</y>
-                <width>90</width>
-                <height>170</height>
-            </rect>
-        </property>
-    </widget>
-    <widget class="KTextEdit">
-        <property name="name">
-            <cstring>idAboneText</cstring>
-        </property>
-        <property name="geometry">
-            <rect>
-                <x>10</x>
-                <y>30</y>
-                <width>86</width>
-                <height>170</height>
-            </rect>
-        </property>
-    </widget>
+        <widget class="QLayoutWidget">
+            <property name="name">
+                <cstring>layout8</cstring>
+            </property>
+            <vbox>
+                <property name="name">
+                    <cstring>unnamed</cstring>
+                </property>
+                <widget class="QLabel">
+                    <property name="name">
+                        <cstring>idLabel</cstring>
+                    </property>
+                    <property name="text">
+                        <string>ID</string>
+                    </property>
+                </widget>
+                <widget class="KTextEdit">
+                    <property name="name">
+                        <cstring>idAboneText</cstring>
+                    </property>
+                </widget>
+            </vbox>
+        </widget>
+        <widget class="QLayoutWidget">
+            <property name="name">
+                <cstring>layout6</cstring>
+            </property>
+            <vbox>
+                <property name="name">
+                    <cstring>unnamed</cstring>
+                </property>
+                <widget class="QLabel">
+                    <property name="name">
+                        <cstring>wordLabel</cstring>
+                    </property>
+                    <property name="text">
+                        <string>NG word</string>
+                    </property>
+                </widget>
+                <widget class="KTextEdit">
+                    <property name="name">
+                        <cstring>wordAboneText</cstring>
+                    </property>
+                </widget>
+            </vbox>
+        </widget>
+        <widget class="QLayoutWidget">
+            <property name="name">
+                <cstring>layout7</cstring>
+            </property>
+            <vbox>
+                <property name="name">
+                    <cstring>unnamed</cstring>
+                </property>
+                <widget class="QLabel">
+                    <property name="name">
+                        <cstring>nameLabel</cstring>
+                    </property>
+                    <property name="text">
+                        <string>Name</string>
+                    </property>
+                </widget>
+                <widget class="KTextEdit">
+                    <property name="name">
+                        <cstring>nameAboneText</cstring>
+                    </property>
+                </widget>
+            </vbox>
+        </widget>
+    </hbox>
 </widget>
 <layoutdefaults spacing="6" margin="11"/>
 </UI>
index 2206b96..2c20db4 100644 (file)
@@ -19,6 +19,7 @@
 #include <qclipboard.h>
 #include <qdatetime.h>
 #include <qtoolbutton.h>
+#include <qlabel.h>
 
 #include <klocale.h>
 #include <kpopupmenu.h>
@@ -32,6 +33,7 @@ FavoriteListView::FavoriteListView( QWidget* parent, const char* name )
     subjectList->addColumn( i18n( "Board" ) );
 
     ReloadButton->hide();
+    KindLabel->hide();
 
     connect( subjectList, SIGNAL( returnPressed( QListViewItem* ) ),
              SLOT( loadThread( QListViewItem* ) ) );
index 13e8e20..bd34566 100644 (file)
@@ -105,6 +105,9 @@ KitaMainWindow::KitaMainWindow()
     connect( m_subjectTab, SIGNAL( showThreadRequested( const QString&, bool ) ),
              m_threadTab, SLOT( showThread( const QString&, bool ) ) );
 
+    connect( m_threadTab, SIGNAL( openBoardRequested( const QString&, bool ) ),
+             m_subjectTab, SLOT( loadBoard( const QString&, bool ) ) );
+
     connect( m_threadTab, SIGNAL( thread( const Kita::Thread* ) ),
              m_subjectTab, SLOT( updateThread( const Kita::Thread* ) ) );
 
@@ -511,7 +514,7 @@ void KitaMainWindow::changeCaption( const QString& text )
 
 void KitaMainWindow::setupView()
 {
-    m_mainDock = createDockWidget( "main", 0L, 0L, i18n( "main" ) );
+    m_mainDock = createDockWidget( "main", 0L, 0L, i18n( "main" ), i18n( "main" ) );
     m_threadTab = new KitaThreadTabWidget( m_mainDock );
     m_mainDock->setWidget( m_threadTab );
     m_mainDock->setDockSite( KDockWidget::DockFullSite );
@@ -522,12 +525,12 @@ void KitaMainWindow::setupView()
     ql->setResizeMode( QLayout::FreeResize );
 
 
-    m_subjectDock = createDockWidget( "subject", 0L, 0L, i18n( "subject" ) );
+    m_subjectDock = createDockWidget( "subject", 0L, 0L, i18n( "subject" ), i18n( "subject" ) );
     m_subjectTab = new KitaSubjectTabWidget( m_subjectDock );
     m_subjectDock->setWidget( m_subjectTab );
     m_subjectDock->setDockSite( KDockWidget::DockNone );
 
-    m_boardDock = createDockWidget( "board", 0L, 0L, i18n( "board" ) );
+    m_boardDock = createDockWidget( "board", 0L, 0L, i18n( "board" ), i18n( "board" ) );
     m_boardView = new KitaBoardView( m_boardDock );
     m_boardDock->setWidget( m_boardView );
     m_boardDock->setDockSite( KDockWidget::DockNone );
index 1c7dff3..ecd74ae 100644 (file)
@@ -32,6 +32,9 @@
             <property name="rootIsDecorated">
                 <bool>true</bool>
             </property>
+            <property name="fullWidth">
+                <bool>true</bool>
+            </property>
         </widget>
     </grid>
 </widget>
index 62cae68..ba1b2d8 100644 (file)
         </property>
         <widget class="QLayoutWidget">
             <property name="name">
-                <cstring>layout9</cstring>
+                <cstring>layout8</cstring>
             </property>
-            <hbox>
+            <grid>
                 <property name="name">
                     <cstring>unnamed</cstring>
                 </property>
-                <widget class="QLayoutWidget">
+                <widget class="QLabel" row="0" column="0">
                     <property name="name">
-                        <cstring>layout6</cstring>
+                        <cstring>fontLabel</cstring>
+                    </property>
+                    <property name="text">
+                        <string>set list font</string>
                     </property>
-                    <vbox>
-                        <property name="name">
-                            <cstring>unnamed</cstring>
-                        </property>
-                        <widget class="QLabel">
-                            <property name="name">
-                                <cstring>fontLabel</cstring>
-                            </property>
-                            <property name="text">
-                                <string>set list font</string>
-                            </property>
-                        </widget>
-                        <widget class="QLabel">
-                            <property name="name">
-                                <cstring>threadFontLabel</cstring>
-                            </property>
-                            <property name="text">
-                                <string>set thread font</string>
-                            </property>
-                        </widget>
-                    </vbox>
                 </widget>
-                <widget class="QLayoutWidget">
+                <widget class="QLabel" row="1" column="0">
                     <property name="name">
-                        <cstring>layout5</cstring>
+                        <cstring>threadFontLabel</cstring>
+                    </property>
+                    <property name="text">
+                        <string>set thread font</string>
                     </property>
-                    <vbox>
-                        <property name="name">
-                            <cstring>unnamed</cstring>
-                        </property>
-                        <widget class="QPushButton">
-                            <property name="name">
-                                <cstring>fontButton</cstring>
-                            </property>
-                            <property name="text">
-                                <string>set font</string>
-                            </property>
-                        </widget>
-                        <widget class="QPushButton">
-                            <property name="name">
-                                <cstring>threadFontButton</cstring>
-                            </property>
-                            <property name="text">
-                                <string>set font</string>
-                            </property>
-                        </widget>
-                    </vbox>
                 </widget>
-                <spacer>
+                <widget class="KFontRequester" row="0" column="1">
                     <property name="name">
-                        <cstring>spacer2</cstring>
+                        <cstring>FontRequester</cstring>
+                    </property>
+                    <property name="title">
+                        <string>list</string>
                     </property>
-                    <property name="orientation">
-                        <enum>Horizontal</enum>
+                    <property name="sampleText">
+                        <string></string>
                     </property>
-                    <property name="sizeType">
-                        <enum>Expanding</enum>
+                </widget>
+                <widget class="KFontRequester" row="1" column="1">
+                    <property name="name">
+                        <cstring>ThreadFontRequester</cstring>
                     </property>
-                    <property name="sizeHint">
-                        <size>
-                            <width>424</width>
-                            <height>20</height>
-                        </size>
+                    <property name="title">
+                        <string>thread</string>
                     </property>
-                </spacer>
-            </hbox>
+                </widget>
+            </grid>
         </widget>
         <spacer>
             <property name="name">
         </spacer>
     </vbox>
 </widget>
+<customwidgets>
+</customwidgets>
+<connections>
+    <connection>
+        <sender>ThreadFontRequester</sender>
+        <signal>fontSelected(const QFont&amp;)</signal>
+        <receiver>KitaFontPrefBase</receiver>
+        <slot>ThreadFontSelected(const QFont&amp;)</slot>
+    </connection>
+    <connection>
+        <sender>FontRequester</sender>
+        <signal>fontSelected(const QFont&amp;)</signal>
+        <receiver>KitaFontPrefBase</receiver>
+        <slot>FontSelected(const QFont&amp;)</slot>
+    </connection>
+</connections>
+<slots>
+    <slot>ThreadFontSelected(const QFont&amp;)</slot>
+    <slot>FontSelected(const QFont&amp;)</slot>
+</slots>
 <layoutdefaults spacing="6" margin="11"/>
+<includehints>
+    <includehint>kfontrequester.h</includehint>
+    <includehint>kfontrequester.h</includehint>
+</includehints>
 </UI>
index fa30f25..fa6f512 100644 (file)
@@ -19,6 +19,7 @@
 #include <qclipboard.h>
 #include <qapplication.h>
 #include <qdatetime.h>
+#include <qlabel.h>
 
 // kdelibs/kio
 #include <kio/slaveconfig.h>
@@ -43,6 +44,7 @@
 
 KitaSubjectView::KitaSubjectView( QWidget* parent, const char* name )
         : Kita::ThreadListView( parent, name )
+        , m_unreadNum( 0 ), m_readNum( 0 ), m_newNum( 0 )
 {
     connect( subjectList, SIGNAL( contextMenuRequested( QListViewItem*, const QPoint&, int ) ),
              SLOT( slotContextMenuRequested( QListViewItem*, const QPoint&, int ) ) );
@@ -114,6 +116,9 @@ void KitaSubjectView::loadBoard( const QString& boardURL )
     }
 
     m_boardURL = boardURL;
+    m_unreadNum = 0;
+    m_readNum = 0;
+    m_newNum = 0;
 
     KitaThreadInfo* cache = KitaThreadInfo::getInstance();
     QPtrList<Kita::Thread> threadList = Kita::Board::getThreadList( boardURL );
@@ -145,15 +150,18 @@ void KitaSubjectView::loadBoard( const QString& boardURL )
         if ( readNum > 0 && resNum != readNum ) {
             // ÃŒÂ¤Ã†Ã‰Â¤Â¢Â¤Ãª
             item->setPixmap( Col_Mark, SmallIcon( "unread" ) );
+            m_unreadNum++;
             item->setText( Col_MarkOrder, QString::number( ts_hasunread ) );
         } else if ( readNum > 0 ) {
             // Â´Ã»Ã†Ã‰
             item->setPixmap( Col_Mark, SmallIcon( "read" ) );
+            m_readNum++;
             //if( readNum > 1000) item->setText( Col_MarkOrder, "0" );
             //else item->setText( Col_MarkOrder, "3" );
             item->setText( Col_MarkOrder, QString::number( ( readNum > 1000 ) ? ts_readed : ts_read ) );
         } else if ( since.secsTo( currentdat ) < 3600 * KitaConfig::MarkTime() ) {
             item->setPixmap( Col_Mark, SmallIcon( "newthread" ) );
+            m_newNum++;
             item->setText( Col_MarkOrder, QString::number( ts_new ) );
         } else {
             item->setText( Col_MarkOrder, QString::number( ts_normal ) );
@@ -178,6 +186,16 @@ void KitaSubjectView::loadBoard( const QString& boardURL )
     }
 
     subjectList->setFocus();
+    UpdateKindLabel();
+}
+
+void KitaSubjectView::UpdateKindLabel()
+{
+    QString fmtstr;
+    fmtstr += QString( "<font color=#C50000>%1</font>" ).arg( m_unreadNum );
+    fmtstr += QString( "/<font color=#00C200>%1</font>" ).arg( m_readNum );
+    fmtstr += QString( "/<font color=#5AAAFF>%1</font>" ).arg( m_newNum );
+    KindLabel->setText( fmtstr );
 }
 
 void KitaSubjectView::setFont( const QFont& font )
@@ -195,17 +213,27 @@ void KitaSubjectView::updateThread( const Kita::Thread* updated_thread )
             item->setText( Col_Read, QString( "%1" ).arg( readNum, 4 ) );
             item->setText( Col_Unread, readNum > 0 && resNum != readNum ? QString( "%1" ).arg( resNum - readNum, 4 ) : QString( "" ) );
 
+            switch ( item->text( Col_MarkOrder ).toInt() ) {
+                case ts_readed    :
+                case ts_read      : m_readNum--; break;
+                case ts_new       : m_newNum--; break;
+                case ts_hasunread : m_unreadNum--; break;
+            }
+
             if ( readNum > 0 && resNum != readNum ) {
                 // ÃŒÂ¤Ã†Ã‰Â¤Â¢Â¤Ãª
                 item->setPixmap( Col_Mark, SmallIcon( "unread" ) );
+                m_unreadNum++;
                 item->setText( Col_MarkOrder, QString::number( ts_hasunread ) );
             } else if ( readNum > 0 ) {
                 // Â´Ã»Ã†Ã‰
                 item->setPixmap( Col_Mark, SmallIcon( "read" ) );
+                m_readNum++;
                 item->setText( Col_MarkOrder, QString::number( ts_read ) );
             } else {
                 item->setText( Col_MarkOrder, QString::number( ts_normal ) );
             }
+            UpdateKindLabel();
         }
     }
 }
index bab109d..e42d57d 100644 (file)
@@ -41,6 +41,8 @@ public slots:
 
 private:
     QString m_boardURL;
+    int m_unreadNum, m_readNum, m_newNum;
+    void UpdateKindLabel();
 
 private slots:
     void loadThread( QListViewItem* item );
index 2b375ec..d3cc8d3 100644 (file)
@@ -119,6 +119,8 @@ void KitaThreadTabWidget::connectSignals( KitaThreadView* view )
              this, SIGNAL( showThreadCompleted( const KURL& ) ) );
     connect( view, SIGNAL( thread( const Kita::Thread* ) ),
              this, SLOT( slotThread( const Kita::Thread* ) ) );
+    connect( view, SIGNAL( openBoardRequested( const QString&, bool ) ),
+             this, SIGNAL( openBoardRequested( const QString&, bool ) ) );
 }
 
 KitaThreadView* KitaThreadTabWidget::findView( const QString& threadURL )
index 091d38d..e61f102 100644 (file)
@@ -61,6 +61,7 @@ signals:
     void bookmarked( const QString& datURL, bool on );
     void showThreadCompleted( const KURL& threadUrl );
     void sigHideSubject();
+    void openBoardRequested( const QString& url, bool useTab );
 };
 
 class KitaThreadTabBar : public QTabBar
index 16c9acd..3f09630 100644 (file)
@@ -20,7 +20,8 @@
 #include <kaction.h>
 #include <kmessagebox.h>
 #include <kdebug.h>
-
+#include <kapplication.h>
+#include <ktextbrowser.h>
 
 #include <dom/html_inline.h>
 #include <dom/html_base.h>
@@ -37,6 +38,7 @@
 #include <qmessagebox.h>
 #include <qdatetime.h>
 #include <qeucjpcodec.h>
+#include <qsimplerichtext.h>
 
 #include "kitahtmlpart.h"
 #include "kitawritedialog.h"
@@ -72,6 +74,14 @@ KitaThreadView::KitaThreadView( QWidget* parent, const char* name )
     aLayout->addWidget( m_threadPart->view() );
 
     {
+        subjectLabel = new Kita::KitaSubjectLabel( Subjectframe );
+        QHBoxLayout* LBox = new QHBoxLayout( Subjectframe );
+        LBox->addWidget( subjectLabel );
+        connect( subjectLabel, SIGNAL( urlClick( const QString& ) ),
+                 SLOT( subjectlinkClicked( const QString& ) ) );
+    }
+
+    {
         SearchButton->setPixmap( SmallIcon( "find" ) );
         HighLightButton->setPixmap( SmallIcon( "idea" ) );
         ReloadButton->setPixmap( SmallIcon( "reload" ) );
@@ -167,19 +177,25 @@ void KitaThreadView::slotDOMNodeActivated( const DOM::Node& node )
     } // end of Anchor tags.
 }
 
-void KitaThreadView::setSubjectLabel( const QString& boardName, const QString& threadName )
+void KitaThreadView::setSubjectLabel( const QString& boardName, const QString& threadName, const QString boardURL )
 {
     QString disp;
     if ( boardName.isEmpty() ) {
         disp = threadName;
     } else {
-        disp = QString( "[%1] %2" ).arg( boardName ).arg( threadName );
+        disp = QString( "<a href=\"%1\">[%2]</a> %3" ).arg( boardURL ).arg( boardName ).arg( threadName );
     }
 
-    disp.truncate( MAX_LABEL_LENGTH );
+    //disp.truncate( MAX_LABEL_LENGTH );
     subjectLabel->setText( disp );
 }
 
+void KitaThreadView::subjectlinkClicked(const QString& URL )
+{
+    kdDebug() << QString("Jump board: \"%1\"").arg(URL) << endl;
+    emit openBoardRequested( URL, KitaConfig::alwaysUseTab() );
+}
+
 void KitaThreadView::updateButton()
 {
     writeButton->setEnabled( true );
@@ -340,6 +356,59 @@ void KitaThreadView::focusSearchCombo()
 namespace Kita
 {
 
+    KitaSubjectLabel::KitaSubjectLabel(QWidget* parent, const char * name )
+            : KTextBrowser(parent, name)
+    {
+        setTextFormat(Qt::RichText);
+        setVScrollBarMode(QScrollView::AlwaysOff);
+        setHScrollBarMode(QScrollView::AlwaysOff);
+        setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
+        setNotifyClick( TRUE );
+        setFrameStyle(QFrame::NoFrame);
+        paletteChanged();
+        if (kapp)
+        {
+           connect(kapp, SIGNAL(kdisplayPaletteChanged()),
+                   this, SLOT(paletteChanged()));
+        }
+    }
+
+    void KitaSubjectLabel::paletteChanged()
+    {
+       QPalette p = kapp ? kapp->palette() : palette();
+       p.setBrush(QColorGroup::Base, p.brush(QPalette::Normal, QColorGroup::Background));
+       p.setColor(QColorGroup::Text, p.color(QPalette::Normal, QColorGroup::Foreground));
+       setPalette(p);
+    }
+
+    QSize KitaSubjectLabel::minimumSizeHint() const
+    {
+       QSize ms = minimumSize();
+       if ((ms.width() > 0) && (ms.height() > 0))
+          return ms;
+
+       int w = 400;
+       if (ms.width() > 0)
+          w = ms.width();
+
+       QString txt = text();
+       QSimpleRichText rt(txt, font());
+       rt.setWidth(w - 2*frameWidth() - 10);
+       w = 10 + rt.widthUsed() + 2*frameWidth();
+       if (w < ms.width())
+          w = ms.width();
+       int h = rt.height() + 2*frameWidth();
+       if ( h < ms.height())
+          h = ms.height();
+
+       return QSize(w, h);
+    }
+
+    QSize KitaSubjectLabel::sizeHint() const
+    {
+       return minimumSizeHint();
+    }
+
     PopupTextBrowser::PopupTextBrowser( QFrame* frame )
             : QTextBrowser( frame )
     {
@@ -427,8 +496,9 @@ void KitaThreadView::setupEx( const Kita::Thread* thread, int serverTime, int mo
 
     /* If curreent mode is VIEWMODE_PREVIEW , hide buttons */
     if ( m_viewmode == VIEWMODE_PREVIEW ) {
-        KitaThreadViewBaseLayout->remove( subjectLabel );
-        KitaThreadViewBaseLayout->removeItem( layout2 );
+        QLayout* Base = layout();
+        Base->remove( Subjectframe );
+        Base->removeItem( layout2 );
     }
 
     /* m_serverTime is used for writing */
@@ -961,7 +1031,8 @@ void KitaThreadView::updateInfo(){
     setSubjectLabel(Kita::DatManager::thread_boardName(m_datURL),
                    Kita::DatManager::thread_name(m_datURL)
                    + QString( " (%1)" )
-                   .arg( Kita::DatManager::getMaxResNumber(m_datURL) ) );    
+                   .arg( Kita::DatManager::getMaxResNumber(m_datURL) ),
+                    Kita::DatManager::thread_boardURL( m_datURL ) );
     emit showThreadCompleted( Kita::DatManager::thread_url(m_datURL) );
     m_domtree->findTextInit();
     updateButton();
index 140cf8a..87d790a 100644 (file)
@@ -17,6 +17,7 @@
 #include <dom/html_base.h>
 
 #include <qtextbrowser.h>
+#include <ktextbrowser.h>
 
 #include "kita2ch.h"
 #include "libkita/thread.h"
@@ -32,6 +33,7 @@ template <class T> class QValueStack;
 namespace Kita
 {
     class Access;
+    class KitaSubjectLabel;
     class PopupTextBrowser;
     class ResPopup;
 }
@@ -81,6 +83,7 @@ public:
     void domApplyChange( QString lbstr, QString hstr, QString fstr, QString anchor, QString cmbstr );
 
 public slots:
+    void subjectlinkClicked(const QString& URL );
     void showThread( const Kita::Thread* thread );
     void setFont( const QFont& font );
     void slotReloadButton();
@@ -100,6 +103,7 @@ private:        // Private attributes
     KitaHTMLPart* m_threadPart;
     Kita::PostInfo m_postInfo;
     Kita::ResPopup* m_popup;
+    Kita::KitaSubjectLabel* subjectLabel;
 
     KitaDomTree* m_domtree;
     bool m_revsearch;
@@ -123,7 +127,7 @@ private:        // Private attributes
     void showPopup( QString innerHTML, QString imgfile );
 
     void insertSearchCombo();
-    void setSubjectLabel( const QString& boardName, const QString& threadName );
+    void setSubjectLabel( const QString& boardName, const QString& threadName, const QString boardURL );
     KitaWriteDialog* openDialog( const Kita::PostInfo& info );
     QStringList parseSearchQuery( const QString& input ) const;
     void updateButton();
@@ -158,10 +162,26 @@ signals:
     void thread( const Kita::Thread* );
     void writeSucceeded();
     void bookmarked( const QString& datURL, bool on );
+    void openBoardRequested( const QString& URL, bool useTab );
 };
 
 namespace Kita
 {
+    // reimplement KActiveLabel based KTextBrowser
+    class KitaSubjectLabel : public KTextBrowser
+    {
+
+    Q_OBJECT
+
+    public:
+        KitaSubjectLabel( QWidget *parent, const char * name = 0 );
+
+        QSize minimumSizeHint() const;
+        QSize sizeHint() const;
+    private slots:
+        void paletteChanged();
+    };
+
     class PopupTextBrowser : public QTextBrowser
     {
     public:
index 87ec7ef..a266acb 100644 (file)
         <property name="spacing">
             <number>0</number>
         </property>
-        <widget class="QLabel">
+        <widget class="QFrame">
             <property name="name">
-                <cstring>subjectLabel</cstring>
+                <cstring>Subjectframe</cstring>
             </property>
             <property name="sizePolicy">
                 <sizepolicy>
-                    <hsizetype>5</hsizetype>
-                    <vsizetype>5</vsizetype>
+                    <hsizetype>1</hsizetype>
+                    <vsizetype>1</vsizetype>
                     <horstretch>0</horstretch>
                     <verstretch>0</verstretch>
                 </sizepolicy>
             </property>
-            <property name="minimumSize">
-                <size>
-                    <width>0</width>
-                    <height>16</height>
-                </size>
-            </property>
             <property name="frameShape">
-                <enum>Box</enum>
+                <enum>NoFrame</enum>
             </property>
             <property name="frameShadow">
                 <enum>Raised</enum>
             </property>
-            <property name="lineWidth">
-                <number>0</number>
-            </property>
-            <property name="text">
-                <string></string>
-            </property>
-            <property name="alignment">
-                <set>WordBreak|AlignVCenter</set>
-            </property>
         </widget>
         <widget class="QLayoutWidget">
             <property name="name">
         <data format="XPM.GZ" length="1310">789c5dd2c972e2301006e03b4fe1821b35e5d8b22ddb353507c8be40c84e32350759928110083b81d4bcfbb8bb2530031cfcfddd965bc24775a7db6939f5a3ca7c211603e9c8be983975b51c8d36bffffcfaae547dee143f1e387ef547a5ea3ad2697f8e355cbf14d7b5d06732c0d21930125ef101fac4288d047006e4cc56b7868997003d601c70c5b13944669ef4b17949b4d573621cc501f0de50c519300226bba56e88b6b96198124f89894ff74e81696887bc23fa898f433e13139586c01152dae63550ec9ac744e631ac0aa4b4d577a2ad6ac39038374c580a7c23a64ae07327c04cd9e7f68132b27c25865e887f4a40b4a7d1210a9de15209316342023951b24c019f2c6504944865b7b021da993f76c4997b8692784d0c427a55164015d9ea3131f0a8fa85d491e20c7845cc384da5887648465442e190b786c517f809d4dcbe84b9a1597948e43ef1c430a2b3aa1125a7edc7869a38d811c758118b0d231f0db5e6c02e7237e4255133aa360d05b16568ee6d0373ae758ebc20e64ce30633641e2621cefc402cead8ec963e3591c9ff32a5f35eff301bbc0f3ffaa3834c8d3f7b93e9ac9cd5e6c3457f345b96b2d5fa6b33996e1bcd7d562c7f5c74355c7797adc6271bb8b1b9cf6aebbc78e2f614ae4d86734dcfcedd7d767179755d74dd344b59ab7ddbb99bdd9b01287b787c7a7e59bae5acfbfae6f9ac79900561c44b0781599c948fcbadfefd59f907bcf223f7</data>
     </image>
 </images>
+<slots>
+    <slot>subjectlinkClicked(const QString&amp;)</slot>
+</slots>
 <layoutdefaults spacing="6" margin="11"/>
 </UI>
index b8c010a..d21306d 100644 (file)
 #include <kpushbutton.h>
 #include <ktextedit.h>
 #include <kcolorbutton.h>
+#include <kfontrequester.h>
 
 #include <qlayout.h>
+#include <qvbox.h>
 #include <qlabel.h>
 #include <qpushbutton.h>
 #include <qlistbox.h>
@@ -42,7 +44,7 @@ KitaPreferences::KitaPreferences()
     // this is the base class for your preferences dialog.  it is now
     // a Treelist dialog.. but there are a number of other
     // possibilities (including Tab, Swallow, and just Plain)
-    QFrame * fontFrame = addPage( i18n( "Font" ), i18n( "Font" ) );
+    QVBox * fontFrame = addVBoxPage( i18n( "Font" ), i18n( "Font" ) );
     m_fontPage = new KitaFontPrefPage( fontFrame );
 
     connect( m_fontPage, SIGNAL( fontChanged( const QFont& ) ),
@@ -51,19 +53,19 @@ KitaPreferences::KitaPreferences()
     connect( m_fontPage, SIGNAL( threadFontChanged( const QFont& ) ),
              SIGNAL( threadFontChanged( const QFont& ) ) );
 
-    QFrame * colorFrame = addPage( i18n( "Color" ), i18n( "Color" ) );
+    QVBox * colorFrame = addVBoxPage( i18n( "Color" ), i18n( "Color" ) );
     m_colorPage = new KitaColorPrefPage( colorFrame );
 
-    QFrame * asciiArtFrame = addPage( i18n( "AsciiArt" ), i18n( "AsciiArt" ) );
+    QVBox * asciiArtFrame = addVBoxPage( i18n( "AsciiArt" ), i18n( "AsciiArt" ) );
     m_asciiArtPage = new Kita::AsciiArtPrefPage( asciiArtFrame );
 
-    QFrame * uiFrame = addPage( i18n( "User Interface" ), i18n( "User Interface" ) );
+    QVBox * uiFrame = addVBoxPage( i18n( "User Interface" ), i18n( "User Interface" ) );
     m_uiPage = new Kita::UIPrefPage( uiFrame );
     
-    QFrame * aboneFrame = addPage( i18n( "Abone" ), i18n( "Abone" ) );
+    QVBox * aboneFrame = addVBoxPage( i18n( "Abone" ), i18n( "Abone" ) );
     m_abonePage = new Kita::AbonePrefPage( aboneFrame );
 
-    QFrame * debugFrame = addPage( i18n( "Debug" ), i18n( "Debug" ) );
+    QVBox * debugFrame = addVBoxPage( i18n( "Debug" ), i18n( "Debug" ) );
     m_debugPage = new DebugPrefPage( debugFrame );
 
     connect( m_fontPage, SIGNAL( changed() ), SLOT( slotChanged() ) );
@@ -113,56 +115,29 @@ void KitaPreferences::slotChanged()
 KitaFontPrefPage::KitaFontPrefPage( QWidget* parent )
         : KitaFontPrefBase( parent )
 {
-    connect( fontButton, SIGNAL( clicked() ), SLOT( slotFontButtonClicked() ) );
-
-    connect( threadFontButton, SIGNAL( clicked() ),
-             SLOT( slotThreadFontButtonClicked() ) );
-
-    updateButtons();
+    FontRequester->setFont( KitaConfig::font() );
+    ThreadFontRequester->setFont( KitaConfig::threadFont() );
 }
 
 void KitaFontPrefPage::apply()
 {
-    QFont font = fontButton->font();
+    QFont font = FontRequester->font();
     KitaConfig::setFont( font );
     emit fontChanged( font );
     
-    QFont threadFont = threadFontButton->font();
+    QFont threadFont = ThreadFontRequester->font();
     KitaConfig::setThreadFont( threadFont );
     emit threadFontChanged( threadFont );
 }
 
-void KitaFontPrefPage::slotFontButtonClicked()
-{
-    QFont font = fontButton->font();
-
-    if ( KFontDialog::getFont( font, false, this ) == QDialog::Accepted ) {
-        fontButton->setText( font.family() + " " + QString::number( font.pointSize() ) );
-        fontButton->setFont( font );
-        emit changed();
-    }
-}
-
-void KitaFontPrefPage::slotThreadFontButtonClicked()
+void KitaFontPrefPage::FontSelected(const QFont&)
 {
-    QFont threadFont = threadFontButton->font();
-
-    if ( KFontDialog::getFont( threadFont, false, this ) == QDialog::Accepted ) {
-        threadFontButton->setText( threadFont.family() + " " + QString::number( threadFont.pointSize() ) );
-        threadFontButton->setFont( threadFont );
-        emit changed();
-    }
+    emit changed();
 }
 
-void KitaFontPrefPage::updateButtons()
+void KitaFontPrefPage::ThreadFontSelected(const QFont&)
 {
-    QFont font = KitaConfig::font();
-    fontButton->setText( font.family() + " " + QString::number( font.pointSize() ) );
-    fontButton->setFont( font );
-
-    QFont threadFont = KitaConfig::threadFont();
-    threadFontButton->setText( threadFont.family() + " " + QString::number( threadFont.pointSize() ) );
-    threadFontButton->setFont( threadFont );
+    emit changed();
 }
 
 KitaColorPrefPage::KitaColorPrefPage( QWidget *parent )
index 33035d6..ec4a9d1 100644 (file)
@@ -70,11 +70,8 @@ public:
     void apply();
 
 public slots:
-    void slotFontButtonClicked();
-    void slotThreadFontButtonClicked();
-
-private:
-    void updateButtons();
+    void FontSelected(const QFont&);
+    void ThreadFontSelected(const QFont&);
 
 signals:
     void fontChanged( const QFont& );
index 6133efc..829aa2b 100644 (file)
                         <string>reload board</string>
                     </property>
                 </widget>
+                <widget class="QLabel">
+                    <property name="name">
+                        <cstring>KindLabel</cstring>
+                    </property>
+                    <property name="sizePolicy">
+                        <sizepolicy>
+                            <hsizetype>5</hsizetype>
+                            <vsizetype>5</vsizetype>
+                            <horstretch>0</horstretch>
+                            <verstretch>0</verstretch>
+                        </sizepolicy>
+                    </property>
+                    <property name="alignment">
+                        <set>AlignVCenter|AlignLeft</set>
+                    </property>
+                    <property name="indent">
+                        <number>5</number>
+                    </property>
+                    <property name="toolTip" stdset="0">
+                        <string>unread/read/new threads</string>
+                    </property>
+                </widget>
                 <spacer>
                     <property name="name">
                         <cstring>spacer1</cstring>
index bfc5ced..c41f92b 100644 (file)
     <property name="caption">
         <string>Form1</string>
     </property>
-    <vbox>
+    <grid>
         <property name="name">
             <cstring>unnamed</cstring>
         </property>
-        <widget class="QLayoutWidget">
+        <spacer row="1" column="0">
             <property name="name">
-                <cstring>layout5</cstring>
+                <cstring>spacer2</cstring>
+            </property>
+            <property name="orientation">
+                <enum>Vertical</enum>
+            </property>
+            <property name="sizeType">
+                <enum>Expanding</enum>
+            </property>
+            <property name="sizeHint">
+                <size>
+                    <width>30</width>
+                    <height>180</height>
+                </size>
+            </property>
+        </spacer>
+        <widget class="QLayoutWidget" row="0" column="0">
+            <property name="name">
+                <cstring>layout4</cstring>
             </property>
-            <hbox>
+            <vbox>
                 <property name="name">
                     <cstring>unnamed</cstring>
                 </property>
+                <widget class="QCheckBox">
+                    <property name="name">
+                        <cstring>useTabCheckBox</cstring>
+                    </property>
+                    <property name="text">
+                        <string>Use new tab when opening the thread(board).</string>
+                    </property>
+                </widget>
                 <widget class="QLayoutWidget">
                     <property name="name">
-                        <cstring>layout4</cstring>
+                        <cstring>layout2</cstring>
                     </property>
-                    <vbox>
+                    <hbox>
                         <property name="name">
                             <cstring>unnamed</cstring>
                         </property>
-                        <widget class="QCheckBox">
+                        <widget class="QLabel">
                             <property name="name">
-                                <cstring>useTabCheckBox</cstring>
+                                <cstring>MarkLabel</cstring>
                             </property>
                             <property name="text">
-                                <string>Use new tab when opening the thread(board).</string>
+                                <string>Mark new thread to made:</string>
                             </property>
                         </widget>
-                        <widget class="QLayoutWidget">
+                        <spacer>
                             <property name="name">
-                                <cstring>layout2</cstring>
-                            </property>
-                            <hbox>
-                                <property name="name">
-                                    <cstring>unnamed</cstring>
-                                </property>
-                                <widget class="QLabel">
-                                    <property name="name">
-                                        <cstring>MarkLabel</cstring>
-                                    </property>
-                                    <property name="text">
-                                        <string>Mark new thread to made:</string>
-                                    </property>
-                                </widget>
-                                <spacer>
-                                    <property name="name">
-                                        <cstring>spacer6</cstring>
-                                    </property>
-                                    <property name="orientation">
-                                        <enum>Horizontal</enum>
-                                    </property>
-                                    <property name="sizeType">
-                                        <enum>Expanding</enum>
-                                    </property>
-                                    <property name="sizeHint">
-                                        <size>
-                                            <width>20</width>
-                                            <height>20</height>
-                                        </size>
-                                    </property>
-                                </spacer>
-                                <widget class="QSpinBox">
-                                    <property name="name">
-                                        <cstring>MarkTimespinBox</cstring>
-                                    </property>
-                                    <property name="prefix">
-                                        <string>within </string>
-                                    </property>
-                                    <property name="suffix">
-                                        <string> hour</string>
-                                    </property>
-                                    <property name="specialValueText">
-                                        <string>after last access</string>
-                                    </property>
-                                    <property name="maxValue">
-                                        <number>24</number>
-                                    </property>
-                                    <property name="minValue">
-                                        <number>0</number>
-                                    </property>
-                                    <property name="value">
-                                        <number>24</number>
-                                    </property>
-                                    <property name="toolTip" stdset="0">
-                                        <string></string>
-                                    </property>
-                                </widget>
-                            </hbox>
-                        </widget>
-                        <widget class="QButtonGroup">
+                                <cstring>spacer6</cstring>
+                            </property>
+                            <property name="orientation">
+                                <enum>Horizontal</enum>
+                            </property>
+                            <property name="sizeType">
+                                <enum>Expanding</enum>
+                            </property>
+                            <property name="sizeHint">
+                                <size>
+                                    <width>20</width>
+                                    <height>20</height>
+                                </size>
+                            </property>
+                        </spacer>
+                        <widget class="QSpinBox">
                             <property name="name">
-                                <cstring>buttonGroup3</cstring>
-                            </property>
-                            <property name="title">
-                                <string>Thread</string>
-                            </property>
-                            <widget class="QCheckBox">
-                                <property name="name">
-                                    <cstring>showMailCheckBox</cstring>
-                                </property>
-                                <property name="geometry">
-                                    <rect>
-                                        <x>30</x>
-                                        <y>40</y>
-                                        <width>193</width>
-                                        <height>19</height>
-                                    </rect>
-                                </property>
-                                <property name="text">
-                                    <string>Show mail address in the thread.</string>
-                                </property>
-                            </widget>
-                            <widget class="QLabel">
-                                <property name="name">
-                                    <cstring>textLabel1</cstring>
-                                </property>
-                                <property name="geometry">
-                                    <rect>
-                                        <x>10</x>
-                                        <y>20</y>
-                                        <width>270</width>
-                                        <height>16</height>
-                                    </rect>
-                                </property>
-                                <property name="text">
-                                    <string>this option affects from the next thread.</string>
-                                </property>
-                            </widget>
+                                <cstring>MarkTimespinBox</cstring>
+                            </property>
+                            <property name="prefix">
+                                <string>within </string>
+                            </property>
+                            <property name="suffix">
+                                <string> hour</string>
+                            </property>
+                            <property name="specialValueText">
+                                <string>after last access</string>
+                            </property>
+                            <property name="maxValue">
+                                <number>24</number>
+                            </property>
+                            <property name="minValue">
+                                <number>0</number>
+                            </property>
+                            <property name="value">
+                                <number>24</number>
+                            </property>
+                            <property name="toolTip" stdset="0">
+                                <string></string>
+                            </property>
                         </widget>
-                        <widget class="QButtonGroup">
+                    </hbox>
+                </widget>
+                <widget class="QButtonGroup">
+                    <property name="name">
+                        <cstring>buttonGroup3</cstring>
+                    </property>
+                    <property name="title">
+                        <string>Thread</string>
+                    </property>
+                    <vbox>
+                        <property name="name">
+                            <cstring>unnamed</cstring>
+                        </property>
+                        <widget class="QLabel">
                             <property name="name">
-                                <cstring>viewGroup</cstring>
-                            </property>
-                            <property name="title">
-                                <string>Views</string>
-                            </property>
-                            <widget class="QRadioButton">
-                                <property name="name">
-                                    <cstring>threePaneRadio</cstring>
-                                </property>
-                                <property name="geometry">
-                                    <rect>
-                                        <x>20</x>
-                                        <y>50</y>
-                                        <width>80</width>
-                                        <height>19</height>
-                                    </rect>
-                                </property>
-                                <property name="text">
-                                    <string>Three pane</string>
-                                </property>
-                                <property name="buttonGroupId">
-                                    <number>1</number>
-                                </property>
-                            </widget>
-                            <widget class="QRadioButton">
-                                <property name="name">
-                                    <cstring>twoPaneRadio</cstring>
-                                </property>
-                                <property name="geometry">
-                                    <rect>
-                                        <x>20</x>
-                                        <y>20</y>
-                                        <width>120</width>
-                                        <height>19</height>
-                                    </rect>
-                                </property>
-                                <property name="text">
-                                    <string>(pseudo) Two pane</string>
-                                </property>
-                                <property name="checked">
-                                    <bool>true</bool>
-                                </property>
-                                <property name="buttonGroupId">
-                                    <number>0</number>
-                                </property>
-                            </widget>
+                                <cstring>textLabel1</cstring>
+                            </property>
+                            <property name="text">
+                                <string>this option affects from the next thread.</string>
+                            </property>
                         </widget>
-                        <widget class="QButtonGroup">
+                        <widget class="QCheckBox">
                             <property name="name">
-                                <cstring>orderGroup</cstring>
-                            </property>
-                            <property name="title">
-                                <string>When open the board</string>
-                            </property>
-                            <widget class="QRadioButton">
-                                <property name="name">
-                                    <cstring>numOrderRadio</cstring>
-                                </property>
-                                <property name="geometry">
-                                    <rect>
-                                        <x>20</x>
-                                        <y>50</y>
-                                        <width>185</width>
-                                        <height>19</height>
-                                    </rect>
-                                </property>
-                                <property name="text">
-                                    <string>Show thread in numerical order</string>
-                                </property>
-                                <property name="buttonGroupId">
-                                    <number>1</number>
-                                </property>
-                            </widget>
-                            <widget class="QRadioButton">
-                                <property name="name">
-                                    <cstring>unreadFirstRadio</cstring>
-                                </property>
-                                <property name="geometry">
-                                    <rect>
-                                        <x>20</x>
-                                        <y>20</y>
-                                        <width>250</width>
-                                        <height>19</height>
-                                    </rect>
-                                </property>
-                                <property name="text">
-                                    <string>Show unread thread first</string>
-                                </property>
-                                <property name="checked">
-                                    <bool>true</bool>
-                                </property>
-                                <property name="buttonGroupId">
-                                    <number>0</number>
-                                </property>
-                            </widget>
+                                <cstring>showMailCheckBox</cstring>
+                            </property>
+                            <property name="text">
+                                <string>Show mail address in the thread.</string>
+                            </property>
                         </widget>
                     </vbox>
                 </widget>
-                <spacer>
+                <widget class="QButtonGroup">
                     <property name="name">
-                        <cstring>spacer11</cstring>
+                        <cstring>viewGroup</cstring>
                     </property>
-                    <property name="orientation">
-                        <enum>Horizontal</enum>
+                    <property name="title">
+                        <string>Views</string>
                     </property>
-                    <property name="sizeType">
-                        <enum>Expanding</enum>
+                    <vbox>
+                        <property name="name">
+                            <cstring>unnamed</cstring>
+                        </property>
+                        <widget class="QRadioButton">
+                            <property name="name">
+                                <cstring>twoPaneRadio</cstring>
+                            </property>
+                            <property name="text">
+                                <string>(pseudo) Two pane</string>
+                            </property>
+                            <property name="checked">
+                                <bool>true</bool>
+                            </property>
+                            <property name="buttonGroupId">
+                                <number>0</number>
+                            </property>
+                        </widget>
+                        <widget class="QRadioButton">
+                            <property name="name">
+                                <cstring>threePaneRadio</cstring>
+                            </property>
+                            <property name="text">
+                                <string>Three pane</string>
+                            </property>
+                            <property name="buttonGroupId">
+                                <number>1</number>
+                            </property>
+                        </widget>
+                    </vbox>
+                </widget>
+                <widget class="QButtonGroup">
+                    <property name="name">
+                        <cstring>orderGroup</cstring>
                     </property>
-                    <property name="sizeHint">
-                        <size>
-                            <width>285</width>
-                            <height>31</height>
-                        </size>
+                    <property name="title">
+                        <string>When open the board</string>
                     </property>
-                </spacer>
-            </hbox>
+                    <vbox>
+                        <property name="name">
+                            <cstring>unnamed</cstring>
+                        </property>
+                        <widget class="QRadioButton">
+                            <property name="name">
+                                <cstring>unreadFirstRadio</cstring>
+                            </property>
+                            <property name="text">
+                                <string>Show unread thread first</string>
+                            </property>
+                            <property name="checked">
+                                <bool>true</bool>
+                            </property>
+                            <property name="buttonGroupId">
+                                <number>0</number>
+                            </property>
+                        </widget>
+                        <widget class="QRadioButton">
+                            <property name="name">
+                                <cstring>numOrderRadio</cstring>
+                            </property>
+                            <property name="text">
+                                <string>Show thread in numerical order</string>
+                            </property>
+                            <property name="buttonGroupId">
+                                <number>1</number>
+                            </property>
+                        </widget>
+                    </vbox>
+                </widget>
+            </vbox>
         </widget>
-        <spacer>
+        <spacer row="0" column="1">
             <property name="name">
-                <cstring>spacer2</cstring>
+                <cstring>spacer11</cstring>
             </property>
             <property name="orientation">
-                <enum>Vertical</enum>
+                <enum>Horizontal</enum>
             </property>
             <property name="sizeType">
                 <enum>Expanding</enum>
             </property>
             <property name="sizeHint">
                 <size>
-                    <width>30</width>
-                    <height>180</height>
+                    <width>241</width>
+                    <height>31</height>
                 </size>
             </property>
         </spacer>
-    </vbox>
+    </grid>
 </widget>
 <layoutdefaults spacing="6" margin="11"/>
 </UI>