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

List:       kde-core-devel
Subject:    Empty input combo box in KInputDialog::getItem
From:       Reinhold Kainhofer <reinhold () kainhofer ! com>
Date:       2003-09-22 23:26:51
[Download RAW message or body]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Currently, there is no way to get an empty input line of the combo box in the 
KInputDialog::getItem, because it only uses KComboBox::setCurrentItem( ... ).

Currently, for all invalid indices the first entry of the QStringList is 
selected by default.

The attached patch changes this so that when the index parameter of 
getItem(...) is negative, no item is selected, and the editable combo box has 
no text.

I'd need this in KOrganizer to ask the user for the name of a template to 
save. By default there should be no selection, because then the user might 
overwrite an existing template. However, there should also the possibility to 
select an already existing template name to change it.

Any objections?

Reinhold
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/b4VATqjEwhXvPN0RAknRAKDUuIeKr/PpiX/dwbBrwB0INrSE9wCfVo+D
qCGPsLdqDBq9DaEVlON2HS4=
=rwTA
-----END PGP SIGNATURE-----

["2003-09-23_KInputDialog_EmptySelectionInComboBox.patch" (text/x-diff)]

Index: kinputdialog.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdeui/kinputdialog.cpp,v
retrieving revision 1.5
diff -u -p -3 -r1.5 kinputdialog.cpp
--- kinputdialog.cpp	15 Sep 2003 14:13:10 -0000	1.5
+++ kinputdialog.cpp	22 Sep 2003 23:17:04 -0000
@@ -150,7 +150,10 @@ KInputDialog::KInputDialog( const QStrin
   {
     d->m_comboBox = new KComboBox( editable, frame );
     d->m_comboBox->insertStringList( list );
-    d->m_comboBox->setCurrentItem( current );
+    if ( current>=0 )
+		  d->m_comboBox->setCurrentItem( current );
+		else
+		  d->m_comboBox->setCurrentText( "" );
     layout->addWidget( d->m_comboBox );
 
     connect( d->m_comboBox, SIGNAL( textChanged( const QString & ) ),


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

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