Create jobs in locale viewmodule.

This commit is contained in:
Teo Mrnjavac 2014-08-01 16:29:19 +02:00
parent 34c5ac3182
commit 271b0945c9
5 changed files with 24 additions and 1 deletions

View File

@ -8,6 +8,7 @@ calamares_add_plugin( locale
LocaleViewStep.cpp LocaleViewStep.cpp
LocalePage.cpp LocalePage.cpp
QtWaitingSpinner.cpp QtWaitingSpinner.cpp
SetTimezoneJob.cpp
timezonewidget/timezonewidget.cpp timezonewidget/timezonewidget.cpp
timezonewidget/localeglobal.cpp timezonewidget/localeglobal.cpp
UI UI

View File

@ -19,6 +19,7 @@
#include "LocalePage.h" #include "LocalePage.h"
#include "timezonewidget/timezonewidget.h" #include "timezonewidget/timezonewidget.h"
#include "SetTimezoneJob.h"
#include <QBoxLayout> #include <QBoxLayout>
#include <QComboBox> #include <QComboBox>
@ -179,3 +180,15 @@ LocalePage::prettyStatus() const
return status; return status;
} }
QList< Calamares::job_ptr >
LocalePage::createJobs()
{
QList< Calamares::job_ptr > list;
LocaleGlobal::Location location = m_tzWidget->getCurrentLocation();
Calamares::Job* j = new SetTimezoneJob( location.region, location.zone );
list.append( Calamares::job_ptr( j ) );
return list;
}

View File

@ -19,6 +19,8 @@
#ifndef LOCALEPAGE_H #ifndef LOCALEPAGE_H
#define LOCALEPAGE_H #define LOCALEPAGE_H
#include "Typedefs.h"
#include <QWidget> #include <QWidget>
class QComboBox; class QComboBox;
@ -34,6 +36,8 @@ public:
QString prettyStatus() const; QString prettyStatus() const;
QList< Calamares::job_ptr > createJobs();
private: private:
TimeZoneWidget* m_tzWidget; TimeZoneWidget* m_tzWidget;
QComboBox* m_regionCombo; QComboBox* m_regionCombo;

View File

@ -154,13 +154,16 @@ LocaleViewStep::isAtEnd() const
QList< Calamares::job_ptr > QList< Calamares::job_ptr >
LocaleViewStep::jobs() const LocaleViewStep::jobs() const
{ {
return QList< Calamares::job_ptr >(); return m_jobs;
} }
void void
LocaleViewStep::onLeave() LocaleViewStep::onLeave()
{ {
m_jobs.clear();
m_jobs.append( m_actualWidget->createJobs() );
m_prettyStatus = m_actualWidget->prettyStatus(); m_prettyStatus = m_actualWidget->prettyStatus();
} }

View File

@ -67,6 +67,8 @@ private:
QString m_prettyStatus; QString m_prettyStatus;
QPair< QString, QString > m_startingTimezone; QPair< QString, QString > m_startingTimezone;
QList< Calamares::job_ptr > m_jobs;
}; };
#endif // LOCALEVIEWSTEP_H #endif // LOCALEVIEWSTEP_H