[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdeedu/klettres/klettres
From: Albert Astals Cid <tsdgeos () terra ! es>
Date: 2005-01-14 23:10:34
Message-ID: 20050114231034.B34CE1CF56 () office ! kde ! org
[Download RAW message or body]
CVS commit by aacid:
Fix crash by not inserting and removing buttons from toolbar but by using a single \
KAction and changing it's text/icon Aproved by annma
M +17 -7 klettres.cpp 1.91
M +6 -0 klettres.h 1.50
--- kdeedu/klettres/klettres/klettres.cpp #1.90:1.91
@@ -91,4 +91,7 @@ KLettres::KLettres()
secondToolbar = toolBar("secondToolbar");
+ changeLookAction = new KAction(i18n("Switch to the kid look"), "kids.png", \
this, SLOT(switchLook()), actionCollection()); + changeLookAction->plug(tb);
+
//from the Read config, growup is set as default if no style
if (Prefs::style() == Prefs::EnumStyle::grownup)
@@ -229,4 +232,10 @@ void KLettres::optionsPreferences()
}
+void KLettres::switchLook()
+{
+ if (grownBool) slotGrownup();
+ else slotKid();
+}
+
void KLettres::slotGrownup()
{
@@ -241,7 +250,8 @@ void KLettres::slotGrownup()
m_action->setChecked(true);
slotMenubar();
- if (grownBool) tb->removeItem(ID_GROWNB);
- tb->insertButton ("kids.png", ID_KIDB, SIGNAL( clicked() ), this, SLOT( \
slotKid()), true, i18n("Switch to the kid look"), 9 ); + \
changeLookAction->setText(i18n("Switch to the kid look")); + \
changeLookAction->setIcon("kids.png"); kidBool=true;
+ grownBool=false;
m_view->slotGrownup();
secondToolbar->setIconSize(22);
@@ -263,7 +273,8 @@ void KLettres::slotKid()
m_action->setChecked(false);
slotMenubar();
- if (kidBool) tb->removeItem(ID_KIDB);
- tb->insertButton ("grownup.png", ID_GROWNB, SIGNAL( clicked() ), this, SLOT( \
slotGrownup()), true, i18n("Switch to the grown-up look"),10 ); + \
changeLookAction->setText(i18n("Switch to the grown-up look")); + \
changeLookAction->setIcon("grownup.png"); grownBool=true;
+ kidBool=false;
m_view->slotKid();
secondToolbar->setIconSize(32);
@@ -279,6 +290,5 @@ void KLettres::slotMenubar()
m_action->setChecked(false);
menuBar()->hide();
- if (menuBool) tb->removeItem(ID_MENUBARB);//check if it is \
already here. if yes, remove it
- tb->insertButton ("menubar.png", ID_MENUBARB, SIGNAL( \
clicked() ), this, SLOT( slotShowM()), true, i18n("Show the MenuBar"), 8 ); + \
m_action->plug(tb); menuBool=true;
break;
@@ -286,5 +296,5 @@ void KLettres::slotMenubar()
m_action->setChecked(true);
menuBar()->show();
- if (menuBool) tb->removeItem(ID_MENUBARB);
+ if (menuBool) m_action->unplug(tb);
menuBool=false;//false if no menubar button
break;
--- kdeedu/klettres/klettres/klettres.h #1.49:1.50
@@ -118,4 +118,8 @@ private slots:
void updateLevMenu(int );
/**
+ *Change from kid look to grownUp look and viceversa
+ */
+ void switchLook();
+ /**
*Switch to another language
*@param - newLanguage the index of the new language in m_languages
@@ -154,4 +158,6 @@ private:
KAction *fontAct;
+ KAction *changeLookAction;
+
KAction *timerAct;
///Second toolbar with buttons of special characters per language
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic