From b56a55bfcd1c3568c873b2ea06a7f69ff77bb6df Mon Sep 17 00:00:00 2001
From: Philippe Mavridis <philippe.mavridis@yandex.com>
Date: Sat, 4 Apr 2026 20:06:51 +0300
Subject: KCharSelect widget: add scrollbar

Signed-off-by: Philippe Mavridis <philippe.mavridis@yandex.com>
---
 tdeui/kcharselect.cpp | 28 ++++++++++++++++++++--------
 1 file changed, 20 insertions(+), 8 deletions(-)

diff --git a/tdeui/kcharselect.cpp b/tdeui/kcharselect.cpp
index 977afd601..016e59b78 100644
--- a/tdeui/kcharselect.cpp
+++ b/tdeui/kcharselect.cpp
@@ -53,7 +53,8 @@ public:
 class KCharSelect::KCharSelectPrivate
 {
 public:
-    TQLineEdit *unicodeLine;
+    TQLineEdit *unicodeLine = nullptr;
+    TQScrollBar *scrollBar = nullptr;
 };
 
 TQFontDatabase * KCharSelect::fontDataBase = 0;
@@ -137,7 +138,7 @@ KCharSelectTable::KCharSelectTable( TQWidget *parent, const char *name, const TQ
     setNumRows( 8 );
 
     repaintContents( false );
-    
+
     d->t = new KCharSelectTableToolTip(this);
 
     setFocusPolicy( TQWidget::StrongFocus );
@@ -242,7 +243,7 @@ void KCharSelectTable::paintCell( class TQPainter* p, int row, int col )
     }
 
     if ( c == focusItem.unicode() && hasFocus() ) {
-	style().drawPrimitive( TQStyle::PE_FocusRect, p, TQRect( 2, 2, w - 4, h - 4 ), 
+	style().drawPrimitive( TQStyle::PE_FocusRect, p, TQRect( 2, 2, w - 4, h - 4 ),
 			       colorGroup() );
 	focusPos = TQPoint( col, row );
     }
@@ -447,8 +448,6 @@ KCharSelect::KCharSelect( TQWidget *parent, const char *name, const TQString &_f
     tableSpinBox = new TQSpinBox( 0, 255, 1, bar );
     tableSpinBox->resize( tableSpinBox->sizeHint() );
 
-    connect( tableSpinBox, TQ_SIGNAL( valueChanged( int ) ), this, TQ_SLOT( tableChanged( int ) ) );
-
     TQLabel* const lUnicode = new TQLabel( i18n( "&Unicode code point:" ), bar );
     lUnicode->resize( lUnicode->sizeHint() );
     lUnicode->setAlignment( TQt::AlignRight | TQt::AlignVCenter );
@@ -465,7 +464,10 @@ KCharSelect::KCharSelect( TQWidget *parent, const char *name, const TQString &_f
 
     connect( d->unicodeLine, TQ_SIGNAL( returnPressed() ), this, TQ_SLOT( slotUnicodeEntered() ) );
 
-    charTable = new KCharSelectTable( this, name, _font.isEmpty() ? TQString(TQVBox::font().family()) : _font, _chr, _tableNum );
+    TQHBox* const box = new TQHBox(this);
+    box->setSpacing(0);
+
+    charTable = new KCharSelectTable( box, name, _font.isEmpty() ? TQString(TQVBox::font().family()) : _font, _chr, _tableNum );
     const TQSize sz( charTable->contentsWidth()  +  4 ,
                     charTable->contentsHeight() +  4 );
     charTable->resize( sz );
@@ -474,9 +476,17 @@ KCharSelect::KCharSelect( TQWidget *parent, const char *name, const TQString &_f
     charTable->setHScrollBarMode( TQScrollView::AlwaysOff );
     charTable->setVScrollBarMode( TQScrollView::AlwaysOff );
 
+    d->scrollBar = new TQScrollBar(0, 255, 1, 1, 0, TQt::Vertical, box);
+
     setFont( _font.isEmpty() ? TQString(TQVBox::font().family()) : _font );
     setTableNum( _tableNum );
 
+    connect( tableSpinBox, TQ_SIGNAL( valueChanged( int ) ), this, TQ_SLOT( tableChanged( int ) ) );
+    connect( tableSpinBox, TQ_SIGNAL( valueChanged( int ) ), d->scrollBar, TQ_SLOT( setValue( int ) ) );
+
+    connect( d->scrollBar, TQ_SIGNAL( valueChanged( int ) ), this, TQ_SLOT( tableChanged( int ) ) );
+    connect( d->scrollBar, TQ_SIGNAL( valueChanged( int ) ), tableSpinBox, TQ_SLOT( setValue( int ) ) );
+
     connect( charTable, TQ_SIGNAL( highlighted( const TQChar & ) ), this, TQ_SLOT( slotUpdateUnicode( const TQChar & ) ) );
     connect( charTable, TQ_SIGNAL( highlighted( const TQChar & ) ), this, TQ_SLOT( charHighlighted( const TQChar & ) ) );
     connect( charTable, TQ_SIGNAL( highlighted() ), this, TQ_SLOT( charHighlighted() ) );
@@ -531,6 +541,7 @@ void KCharSelect::setChar( const TQChar &_chr )
 void KCharSelect::setTableNum( int _tableNum )
 {
     tableSpinBox->setValue( _tableNum );
+    d->scrollBar->setValue( _tableNum );
     charTable->setTableNum( _tableNum );
 }
 
@@ -564,15 +575,16 @@ void KCharSelect::slotUnicodeEntered( )
     const TQString s = d->unicodeLine->text();
     if (s.isEmpty())
         return;
-    
+
     bool ok;
     const int uc = s.toInt(&ok, 16);
     if (!ok)
         return;
-    
+
     const int table = uc / 256;
     charTable->setTableNum( table );
     tableSpinBox->setValue(table);
+    d->scrollBar->setValue(table);
     const TQChar ch(uc);
     charTable->setChar( ch );
     charActivated( ch );
-- 
cgit v1.2.3

