mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
Improvements to initialstart + 1 more
This MR implements multiple things - Add `.vscode/` to .gitignore - Any files generated by Visual Studio code or its extensions will not be pushed. - Give `InitialStartModule` a required `name` property - Every `InitialStartModule` now requires a `name` property. This replaces the previous setup where a `property string name` was needed in the `contentitem` of the `InitialStartModule`. - Remove the cellular page if no modem - If the device has no modem (`PlasmaMM.SignalIndicator.modemAvailable == false`), the cellular page will no longer be shown.
This commit is contained in:
parent
b7611e58a5
commit
a54503419e
9 changed files with 29 additions and 9 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -14,6 +14,7 @@ build
|
||||||
.idea
|
.idea
|
||||||
/cmake-build*
|
/cmake-build*
|
||||||
.cache
|
.cache
|
||||||
|
.vscode/
|
||||||
|
|
||||||
.kdev4/
|
.kdev4/
|
||||||
*.kdev4
|
*.kdev4
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,20 @@ InitialStartModule::InitialStartModule(QObject *parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString InitialStartModule::name() const
|
||||||
|
{
|
||||||
|
return m_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
void InitialStartModule::setName(QString name)
|
||||||
|
{
|
||||||
|
if (m_name == name) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_name = name;
|
||||||
|
Q_EMIT nameChanged();
|
||||||
|
}
|
||||||
|
|
||||||
bool InitialStartModule::available() const
|
bool InitialStartModule::available() const
|
||||||
{
|
{
|
||||||
return m_available;
|
return m_available;
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ class InitialStartModule : public QObject
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
QML_ELEMENT
|
QML_ELEMENT
|
||||||
|
|
||||||
|
Q_PROPERTY(QString name READ name WRITE setName REQUIRED NOTIFY nameChanged)
|
||||||
Q_PROPERTY(bool available READ available WRITE setAvailable NOTIFY availableChanged)
|
Q_PROPERTY(bool available READ available WRITE setAvailable NOTIFY availableChanged)
|
||||||
Q_PROPERTY(QQuickItem *contentItem READ contentItem WRITE setContentItem REQUIRED NOTIFY contentItemChanged)
|
Q_PROPERTY(QQuickItem *contentItem READ contentItem WRITE setContentItem REQUIRED NOTIFY contentItemChanged)
|
||||||
Q_PROPERTY(QQmlListProperty<QObject> children READ children CONSTANT)
|
Q_PROPERTY(QQmlListProperty<QObject> children READ children CONSTANT)
|
||||||
|
|
@ -21,6 +22,9 @@ class InitialStartModule : public QObject
|
||||||
public:
|
public:
|
||||||
InitialStartModule(QObject *parent = nullptr);
|
InitialStartModule(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
QString name() const;
|
||||||
|
void setName(QString name);
|
||||||
|
|
||||||
bool available() const;
|
bool available() const;
|
||||||
void setAvailable(bool available);
|
void setAvailable(bool available);
|
||||||
|
|
||||||
|
|
@ -30,10 +34,12 @@ public:
|
||||||
QQmlListProperty<QObject> children();
|
QQmlListProperty<QObject> children();
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
|
void nameChanged();
|
||||||
void availableChanged();
|
void availableChanged();
|
||||||
void contentItemChanged();
|
void contentItemChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QString m_name;
|
||||||
bool m_available{true};
|
bool m_available{true};
|
||||||
QQuickItem *m_contentItem{nullptr};
|
QQuickItem *m_contentItem{nullptr};
|
||||||
QList<QObject *> m_children;
|
QList<QObject *> m_children;
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,10 @@ import org.kde.plasma.mm as PlasmaMM
|
||||||
import org.kde.plasma.mobileinitialstart.initialstart
|
import org.kde.plasma.mobileinitialstart.initialstart
|
||||||
|
|
||||||
InitialStartModule {
|
InitialStartModule {
|
||||||
|
name: i18n("Cellular")
|
||||||
|
available: PlasmaMM.SignalIndicator.modemAvailable
|
||||||
contentItem: Item {
|
contentItem: Item {
|
||||||
id: root
|
id: root
|
||||||
property string name: i18n("Cellular")
|
|
||||||
|
|
||||||
readonly property real cardWidth: Math.min(Kirigami.Units.gridUnit * 30, root.width - Kirigami.Units.gridUnit * 2)
|
readonly property real cardWidth: Math.min(Kirigami.Units.gridUnit * 30, root.width - Kirigami.Units.gridUnit * 2)
|
||||||
|
|
||||||
|
|
@ -50,9 +51,7 @@ InitialStartModule {
|
||||||
wrapMode: Text.Wrap
|
wrapMode: Text.Wrap
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
text: {
|
text: {
|
||||||
if (!PlasmaMM.SignalIndicator.modemAvailable) {
|
if (PlasmaMM.SignalIndicator.needsAPNAdded) {
|
||||||
return i18n("Your device does not have a modem available.");
|
|
||||||
} else if (PlasmaMM.SignalIndicator.needsAPNAdded) {
|
|
||||||
return i18n("Please configure your APN below for mobile data, further information will be available with your carrier.");
|
return i18n("Please configure your APN below for mobile data, further information will be available with your carrier.");
|
||||||
} else if (PlasmaMM.SignalIndicator.mobileDataSupported) {
|
} else if (PlasmaMM.SignalIndicator.mobileDataSupported) {
|
||||||
return i18n("You are connected to the mobile network.");
|
return i18n("You are connected to the mobile network.");
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,10 @@ import org.kde.kirigami 2.20 as Kirigami
|
||||||
import org.kde.plasma.mobileinitialstart.initialstart
|
import org.kde.plasma.mobileinitialstart.initialstart
|
||||||
|
|
||||||
InitialStartModule {
|
InitialStartModule {
|
||||||
|
name: i18n("Complete!")
|
||||||
contentItem: Item {
|
contentItem: Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property string name: i18n("Complete!")
|
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,9 @@ import org.kde.plasma.mobileinitialstart.initialstart
|
||||||
|
|
||||||
InitialStartModule {
|
InitialStartModule {
|
||||||
id: module
|
id: module
|
||||||
|
name: i18n("Before we get started…")
|
||||||
contentItem: Item {
|
contentItem: Item {
|
||||||
id: root
|
id: root
|
||||||
property string name: i18n("Before we get started…")
|
|
||||||
|
|
||||||
readonly property real cardWidth: Math.min(Kirigami.Units.gridUnit * 30, root.width - Kirigami.Units.gridUnit * 2)
|
readonly property real cardWidth: Math.min(Kirigami.Units.gridUnit * 30, root.width - Kirigami.Units.gridUnit * 2)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,9 @@ import org.kde.plasma.mobileinitialstart.time 1.0 as Time
|
||||||
import org.kde.plasma.mobileinitialstart.initialstart
|
import org.kde.plasma.mobileinitialstart.initialstart
|
||||||
|
|
||||||
InitialStartModule {
|
InitialStartModule {
|
||||||
|
name: i18n("Time and Date")
|
||||||
contentItem: Item {
|
contentItem: Item {
|
||||||
id: root
|
id: root
|
||||||
property string name: i18n("Time and Date")
|
|
||||||
|
|
||||||
readonly property real cardWidth: Math.min(Kirigami.Units.gridUnit * 30, root.width - Kirigami.Units.gridUnit * 2)
|
readonly property real cardWidth: Math.min(Kirigami.Units.gridUnit * 30, root.width - Kirigami.Units.gridUnit * 2)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,9 @@ import org.kde.plasma.mobileinitialstart.wifi 1.0 as WiFi
|
||||||
import org.kde.plasma.mobileinitialstart.initialstart
|
import org.kde.plasma.mobileinitialstart.initialstart
|
||||||
|
|
||||||
InitialStartModule {
|
InitialStartModule {
|
||||||
|
name: i18n("Network")
|
||||||
contentItem: Item {
|
contentItem: Item {
|
||||||
id: root
|
id: root
|
||||||
property string name: i18n("Network")
|
|
||||||
|
|
||||||
readonly property real cardWidth: Math.min(Kirigami.Units.gridUnit * 30, root.width - Kirigami.Units.gridUnit * 2)
|
readonly property real cardWidth: Math.min(Kirigami.Units.gridUnit * 30, root.width - Kirigami.Units.gridUnit * 2)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -229,7 +229,7 @@ Kirigami.Page {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
// pass up the property
|
// pass up the property
|
||||||
property string name: contentItem.name
|
property string name: modelData.name
|
||||||
property int currentIndex: model.index
|
property int currentIndex: model.index
|
||||||
|
|
||||||
function updateRootItems() {
|
function updateRootItems() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue