[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: extragear/sysadmin/kiosktool
From: Luboš Luňák <l.lunak () kde ! org>
Date: 2010-03-11 17:06:47
Message-ID: 1268327207.196344.7821.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1102041 by lunakl:
This is rather broken, page saving should not be done when switching
to another page, but when actually saving that page.
M +72 -58 kioskgui.cpp
M +1 -1 kioskgui.h
--- trunk/extragear/sysadmin/kiosktool/kioskgui.cpp #1102040:1102041
@@ -70,7 +70,7 @@
: KXmlGuiWindow(), m_profileSelectionPage(0),
m_componentSelectionPage(0), m_componentPage(0), m_profileAssignPage(0),
m_profilePropsPage(0), m_data(0),
- m_profile(0), m_componentData(0),m_page(0)
+ m_profile(0), m_componentData(0),m_page(-1)
{
m_run = new KioskRun(this);
m_view = new MainView(this);
@@ -97,7 +97,7 @@
m_profile = config.readEntry("CurrentProfile", "default");
m_component = config.readEntry("CurrentComponent");
- selectPage(PAGE_PROFILE_SELECTION, true);
+ selectPage(PAGE_PROFILE_SELECTION);
QTimer::singleShot(0, this, SLOT(slotCheckEtcSkel()));
@@ -183,17 +183,17 @@
void KioskGui::slotAddProfile()
{
- selectPage(PAGE_PROFILE_NEW, true);
+ selectPage(PAGE_PROFILE_NEW);
}
void KioskGui::slotProfileProperties()
{
- selectPage(PAGE_PROFILE_PROPS, true);
+ selectPage(PAGE_PROFILE_PROPS);
}
void KioskGui::slotProfileSetup()
{
- selectPage(PAGE_COMPONENT_SELECTION, true);
+ selectPage(PAGE_COMPONENT_SELECTION);
}
void KioskGui::slotDeleteProfile(QTreeWidgetItem *item)
@@ -224,16 +224,51 @@
void KioskGui::slotManageUsers()
{
- selectPage(PAGE_PROFILE_ASSIGN, true);
+ selectPage(PAGE_PROFILE_ASSIGN);
}
-void KioskGui::selectPage(int page, bool save)
+void KioskGui::selectPage(int page)
{
- if (save && !savePage( m_page ))
- return;
+ if( m_page == PAGE_COMPONENT_SELECTION)
+ {
+ m_component = m_componentSelectionPage->currentComponent();
+ m_componentData = m_data->m_componentData[m_component];
+ if (!m_componentData)
+ return;
+ }
+ if( m_page == PAGE_PROFILE_SELECTION )
+ {
+ m_profile = m_profileSelectionPage->listProfile->currentItem() ?
+ m_profileSelectionPage->listProfile->currentItem()->text(0) : \
QString(); +
+ KConfigGroup config( KGlobal::config(), "General");
+ config.writeEntry("CurrentProfile", m_profile);
+ config.sync();
+
+ QString description;
+ QString installDir;
+ QString installUser;
+
+ KioskRun::self()->getProfileInfo(m_profile, description, installDir, \
installUser); +
+ QStringList kdeDirs;
+ kdeDirs << installDir;
+ m_run->setKdeDirs(kdeDirs);
+ m_run->setUser(installUser);
+ }
+ if( m_page == PAGE_PROFILE_NEW )
+ {
+ m_profile = m_profilePropsPage->profile();
+ }
+ if( m_page == PAGE_PROFILE_PROPS )
+ {
+ m_profile = m_profilePropsPage->profile();
+ }
+
m_page = page;
- if (( page == PAGE_PROFILE_SELECTION) && !m_profileSelectionPage)
+
+ if (( m_page == PAGE_PROFILE_SELECTION) && !m_profileSelectionPage)
{
m_profileSelectionPage = new ProfileSelectionPageUI(m_view->widgetStack);
connect(m_profileSelectionPage->buttonDelete, SIGNAL(clicked()),
@@ -250,7 +285,7 @@
m_pageMapping[PAGE_PROFILE_SELECTION] = \
m_view->widgetStack->insertWidget(PAGE_PROFILE_SELECTION,m_profileSelectionPage); \
m_profileSelectionPage->listProfile->setFocus(); }
- else if ((page == PAGE_COMPONENT_SELECTION) && !m_componentSelectionPage)
+ else if ((m_page == PAGE_COMPONENT_SELECTION) && !m_componentSelectionPage)
{
m_data = new KioskData;
if (!m_data->load())
@@ -265,7 +300,7 @@
m_pageMapping[PAGE_COMPONENT_SELECTION] = \
m_view->widgetStack->insertWidget(PAGE_COMPONENT_SELECTION, \
m_componentSelectionPage); m_componentSelectionPage->listComponent->setFocus();
}
- else if (page == PAGE_PROFILE_NEW)
+ else if (m_page == PAGE_PROFILE_NEW)
{
delete m_profilePropsPage;
m_profilePropsPage = new ProfilePropsPage(m_view->widgetStack, QString() );
@@ -273,7 +308,7 @@
m_pageMapping[PAGE_PROFILE_NEW] = \
m_view->widgetStack->insertWidget(PAGE_PROFILE_NEW,m_profilePropsPage->widget()); \
m_profilePropsPage->setFocus(); }
- else if (page == PAGE_PROFILE_PROPS)
+ else if (m_page == PAGE_PROFILE_PROPS)
{
delete m_profilePropsPage;
m_profilePropsPage = new ProfilePropsPage(m_view->widgetStack, m_profile);
@@ -281,14 +316,14 @@
m_pageMapping[PAGE_PROFILE_PROPS] = \
m_view->widgetStack->insertWidget(PAGE_PROFILE_PROPS,m_profilePropsPage->widget()); \
m_profilePropsPage->setFocus(); }
- else if ((page == PAGE_PROFILE_ASSIGN) && !m_profileAssignPage)
+ else if ((m_page == PAGE_PROFILE_ASSIGN) && !m_profileAssignPage)
{
m_profileAssignPage = new UserManagementPage(m_view->widgetStack);
m_pageMapping[PAGE_PROFILE_ASSIGN] = \
m_view->widgetStack->insertWidget(PAGE_PROFILE_ASSIGN,m_profileAssignPage->widget()); \
m_profileAssignPage->setFocus(); }
- else if (page == PAGE_COMPONENT)
+ else if (m_page == PAGE_COMPONENT)
{
delete m_componentPage;
@@ -309,37 +344,37 @@
m_componentPage->setFocus();
}
- if( page == PAGE_PROFILE_SELECTION )
+ if( m_page == PAGE_PROFILE_SELECTION )
{
setSubCaption(i18n("Main Menu"));
setMainCaption(i18n("Main Menu"));
}
- if( page == PAGE_PROFILE_NEW )
+ if( m_page == PAGE_PROFILE_NEW )
{
setSubCaption(i18n("Add New Profile"));
setMainCaption(i18n("Add New Profile"));
}
- if( page == PAGE_PROFILE_PROPS )
+ if( m_page == PAGE_PROFILE_PROPS )
{
setSubCaption(i18n("Profile Properties"));
setMainCaption(i18n("Profile Properties"));
}
- if( page == PAGE_COMPONENT_SELECTION )
+ if( m_page == PAGE_COMPONENT_SELECTION )
{
setSubCaption(i18n("Setup Profile \"%1\"",m_profile));
setMainCaption(i18n("Setup Profile"));
}
- if( page == PAGE_COMPONENT )
+ if( m_page == PAGE_COMPONENT )
{
setSubCaption(m_componentPage->subCaption());
}
- if( page == PAGE_PROFILE_ASSIGN )
+ if( m_page == PAGE_PROFILE_ASSIGN )
{
setSubCaption(i18n("Assign Profiles"));
}
- m_view->widgetStack->setCurrentIndex(m_pageMapping[page]);
- loadPage(page);
+ m_view->widgetStack->setCurrentIndex(m_pageMapping[m_page]);
+ loadPage(m_page);
updateButtons();
}
@@ -449,33 +484,8 @@
bool KioskGui::savePage(int page)
{
- if( page == PAGE_PROFILE_SELECTION )
- {
- m_profile = m_profileSelectionPage->listProfile->currentItem() ?
- m_profileSelectionPage->listProfile->currentItem()->text(0) : \
QString();
-
- KConfigGroup config( KGlobal::config(), "General");
- config.writeEntry("CurrentProfile", m_profile);
- config.sync();
-
- QString description;
- QString installDir;
- QString installUser;
-
- KioskRun::self()->getProfileInfo(m_profile, description, installDir, \
installUser);
-
- QStringList kdeDirs;
- kdeDirs << installDir;
- m_run->setKdeDirs(kdeDirs);
- m_run->setUser(installUser);
- }
if( page == PAGE_COMPONENT_SELECTION)
{
- m_component = m_componentSelectionPage->currentComponent();
- m_componentData = m_data->m_componentData[m_component];
- if (!m_componentData)
- return false;
-
return m_componentSelectionPage->save();
}
if( page == PAGE_COMPONENT )
@@ -487,7 +497,6 @@
{
if (m_profilePropsPage)
{
- m_profile = m_profilePropsPage->profile();
return m_profilePropsPage->save();
}
}
@@ -495,7 +504,6 @@
{
if (m_profilePropsPage)
{
- m_profile = m_profilePropsPage->profile();
return m_profilePropsPage->save();
}
}
@@ -509,19 +517,25 @@
void KioskGui::finishedPage(bool save)
{
+ if( save )
+ {
+ if( !savePage( m_page ))
+ return;
+ }
if (m_page == PAGE_PROFILE_NEW)
- selectPage(PAGE_PROFILE_SELECTION, save);
+ selectPage(PAGE_PROFILE_SELECTION);
else if (m_page == PAGE_PROFILE_PROPS)
- selectPage(PAGE_PROFILE_SELECTION, save);
+ selectPage(PAGE_PROFILE_SELECTION);
else if (m_page == PAGE_PROFILE_ASSIGN)
- selectPage(PAGE_PROFILE_SELECTION, save);
- else if (m_page == PAGE_COMPONENT_SELECTION && !save)
+ selectPage(PAGE_PROFILE_SELECTION);
+ else if (m_page == PAGE_COMPONENT_SELECTION)
{
- m_componentSelectionPage->discard();
- selectPage(m_page - 1, save);
+ if( !save )
+ m_componentSelectionPage->discard();
+ selectPage(m_page - 1);
}
else if (m_page > 1)
- selectPage(m_page - 1, save);
+ selectPage(m_page - 1);
}
void KioskGui::discardPage()
@@ -531,7 +545,7 @@
void KioskGui::slotComponentSelection()
{
- selectPage(PAGE_COMPONENT, true);
+ selectPage(PAGE_COMPONENT);
}
void KioskGui::slotConfig()
--- trunk/extragear/sysadmin/kiosktool/kioskgui.h #1102040:1102041
@@ -74,7 +74,7 @@
void saveProperties(KConfigGroup &config);
void readProperties(const KConfigGroup &config);
- void selectPage(int page, bool save);
+ void selectPage(int page);
void loadPage(int page);
bool savePage(int page);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic