blob: 820ead9ae577eb5ef4e34d12c6a5a8744581e23f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
--- a/src/libcalamaresui/ViewManager.h
+++ b/src/libcalamaresui/ViewManager.h
@@ -146,6 +146,8 @@
* have any pages before the current one.
*/
void back();
+
+ void goBackTo( int index );
bool backEnabled() const
{
return m_backEnabled; ///< Is the back-button to be enabled
--- a/src/libcalamaresui/ViewManager.cpp
+++ b/src/libcalamaresui/ViewManager.cpp
@@ -468,6 +468,37 @@
}
void
+ViewManager::goBackTo( int index )
+{
+ if ( !currentStepValid() || index < 0 || index >= m_currentStep )
+ {
+ return;
+ }
+ for ( int i = index; i <= m_currentStep; ++i )
+ {
+ if ( stepIsExecute( m_steps, i ) )
+ {
+ return;
+ }
+ }
+
+ ViewStep* step = m_steps.at( m_currentStep );
+ m_currentStep = index;
+ m_stack->setCurrentIndex( m_currentStep );
+ step->onLeave();
+ m_steps.at( m_currentStep )->onActivate();
+ emit currentStepChanged();
+
+ UPDATE_NEXT_BUTTON_PROPERTY( m_steps.at( m_currentStep ), m_steps.at( m_currentStep )->isNextEnabled() );
+ UPDATE_BUTTON_PROPERTY( backEnabled,
+ ( m_currentStep == 0 && m_steps.first()->isAtBeginning() )
+ ? false
+ : m_steps.at( m_currentStep )->isBackEnabled() );
+
+ updateButtonLabels();
+}
+
+void
ViewManager::back()
{
if ( !currentStepValid() )
|