mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 06:13: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
|
||||
/cmake-build*
|
||||
.cache
|
||||
.vscode/
|
||||
|
||||
.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
|
||||
{
|
||||
return m_available;
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ class InitialStartModule : public QObject
|
|||
Q_OBJECT
|
||||
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(QQuickItem *contentItem READ contentItem WRITE setContentItem REQUIRED NOTIFY contentItemChanged)
|
||||
Q_PROPERTY(QQmlListProperty<QObject> children READ children CONSTANT)
|
||||
|
|
@ -21,6 +22,9 @@ class InitialStartModule : public QObject
|
|||
public:
|
||||
InitialStartModule(QObject *parent = nullptr);
|
||||
|
||||
QString name() const;
|
||||
void setName(QString name);
|
||||
|
||||
bool available() const;
|
||||
void setAvailable(bool available);
|
||||
|
||||
|
|
@ -30,10 +34,12 @@ public:
|
|||
QQmlListProperty<QObject> children();
|
||||
|
||||
Q_SIGNALS:
|
||||
void nameChanged();
|
||||
void availableChanged();
|
||||
void contentItemChanged();
|
||||
|
||||
private:
|
||||
QString m_name;
|
||||
bool m_available{true};
|
||||
QQuickItem *m_contentItem{nullptr};
|
||||
QList<QObject *> m_children;
|
||||
|
|
|
|||
|
|
@ -12,9 +12,10 @@ import org.kde.plasma.mm as PlasmaMM
|
|||
import org.kde.plasma.mobileinitialstart.initialstart
|
||||
|
||||
InitialStartModule {
|
||||
name: i18n("Cellular")
|
||||
available: PlasmaMM.SignalIndicator.modemAvailable
|
||||
contentItem: Item {
|
||||
id: root
|
||||
property string name: i18n("Cellular")
|
||||
|
||||
readonly property real cardWidth: Math.min(Kirigami.Units.gridUnit * 30, root.width - Kirigami.Units.gridUnit * 2)
|
||||
|
||||
|
|
@ -50,9 +51,7 @@ InitialStartModule {
|
|||
wrapMode: Text.Wrap
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: {
|
||||
if (!PlasmaMM.SignalIndicator.modemAvailable) {
|
||||
return i18n("Your device does not have a modem available.");
|
||||
} else if (PlasmaMM.SignalIndicator.needsAPNAdded) {
|
||||
if (PlasmaMM.SignalIndicator.needsAPNAdded) {
|
||||
return i18n("Please configure your APN below for mobile data, further information will be available with your carrier.");
|
||||
} else if (PlasmaMM.SignalIndicator.mobileDataSupported) {
|
||||
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
|
||||
|
||||
InitialStartModule {
|
||||
name: i18n("Complete!")
|
||||
contentItem: Item {
|
||||
id: root
|
||||
|
||||
property string name: i18n("Complete!")
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@ import org.kde.plasma.mobileinitialstart.initialstart
|
|||
|
||||
InitialStartModule {
|
||||
id: module
|
||||
name: i18n("Before we get started…")
|
||||
contentItem: Item {
|
||||
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)
|
||||
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@ import org.kde.plasma.mobileinitialstart.time 1.0 as Time
|
|||
import org.kde.plasma.mobileinitialstart.initialstart
|
||||
|
||||
InitialStartModule {
|
||||
name: i18n("Time and Date")
|
||||
contentItem: Item {
|
||||
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)
|
||||
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@ import org.kde.plasma.mobileinitialstart.wifi 1.0 as WiFi
|
|||
import org.kde.plasma.mobileinitialstart.initialstart
|
||||
|
||||
InitialStartModule {
|
||||
name: i18n("Network")
|
||||
contentItem: Item {
|
||||
id: root
|
||||
property string name: i18n("Network")
|
||||
|
||||
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
|
||||
|
||||
// pass up the property
|
||||
property string name: contentItem.name
|
||||
property string name: modelData.name
|
||||
property int currentIndex: model.index
|
||||
|
||||
function updateRootItems() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue