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

List:       kde-bugs-dist
Subject:    [Bug 82006] KXMLGUI : State : Show / Hide requiered
From:       Sebastien <sebastien.laout () tuxfamily ! org>
Date:       2004-05-31 22:49:06
Message-ID: 20040531224906.30259.qmail () ktown ! kde ! org
[Download RAW message or body]

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
      
http://bugs.kde.org/show_bug.cgi?id=82006      




------- Additional Comments From sebastien.laout tuxfamily org  2004-06-01 00:49 \
------- States are too complicated and not so powerful (for me).
I now store a KAction* of all KActions I create and then do as this :

void Container::updateActions()
{
	bool isLocked             = currentBasket()->isLocked();
	bool oneSelected          = currentBasket()->numberOfSelectedItems() == 1;
	bool oneOrSeveralSelected = currentBasket()->numberOfSelectedItems() >= 1;

	m_actCheckItems->setChecked( currentBasket()->areSelectedItemsChecked() );

	m_actEditItem        ->setEnabled( !isLocked && oneSelected          );
	m_actEditItemMetaData->setEnabled( !isLocked && oneSelected          );
	m_actAddItem         ->setEnabled( !isLocked                         );
	m_actCutItem         ->setEnabled( !isLocked && oneSelected          );
	m_actCopyItem        ->setEnabled(              oneSelected          );
	m_actPaste           ->setEnabled( !isLocked                         );
	m_actDelItem         ->setEnabled( !isLocked && oneOrSeveralSelected );
	m_actOpenItem        ->setEnabled(              oneOrSeveralSelected );
	m_actOpenItemWith    ->setEnabled(              oneSelected          );
	m_actSaveItemAs      ->setEnabled(              oneSelected          );
	m_actCheckItems      ->setEnabled( !isLocked && oneOrSeveralSelected );
}

Do that by States would be too complicated.
(don't know if it is me or not, but I now see no flicker in the toolbar)
Howether, I don't like the "keep pointers to all created KActions" (yes I know I can \
access them by name, but pointers are a lot faster) and it's would be good if it \
could be done by XML. Don't know how...
I've provided you an example of application...


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

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