summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleix Pol <aleixpol@kde.org>2015-10-16 11:09:02 (GMT)
committerAleix Pol <aleixpol@kde.org>2015-10-16 11:09:02 (GMT)
commit37e960549e225994021ef43d700a0f219d3d5020 (patch)
tree9e9270af11db6abd6b544597e28c649eb9a9ed17
parent1ca60a31589b249de8300830e7099ed29639826f (diff)
Improve functionality of the Update page
Make it possible to jump to the resource when displayed. Improve the section delegate
-rw-r--r--discover/qml/PresentUpdatesPage.qml24
-rw-r--r--libmuon/UpdateModel/UpdateItem.h1
-rw-r--r--libmuon/UpdateModel/UpdateModel.cpp7
-rw-r--r--libmuon/UpdateModel/UpdateModel.h3
4 files changed, 26 insertions, 9 deletions
diff --git a/discover/qml/PresentUpdatesPage.qml b/discover/qml/PresentUpdatesPage.qml
index 781dfd3..6d2769c 100644
--- a/discover/qml/PresentUpdatesPage.qml
+++ b/discover/qml/PresentUpdatesPage.qml
@@ -1,7 +1,8 @@
-import QtQuick.Controls 1.1
+import QtQuick.Controls 1.4
import QtQuick.Layouts 1.1
import QtQuick 2.1
import org.kde.muon 1.0
+import "navigation.js" as Navigation
import org.kde.kquickcontrolsaddons 2.0
ScrollView
@@ -89,11 +90,20 @@ ScrollView
delegate: ColumnLayout {
id: col
spacing: -2
- property var currentRow: index
- Label {
- Layout.fillWidth: true
- horizontalAlignment: Text.AlignRight
- text: display
+ readonly property var currentRow: index
+ RowLayout {
+ Layout.minimumHeight: 32
+ Layout.leftMargin: 5 //GridItem.internalMargin
+ Layout.rightMargin: 5 //GridItem.internalMargin
+ anchors.margins: 100
+ Label {
+ Layout.fillWidth: true
+ text: display
+ }
+ LabelBackground {
+ text: size
+ Layout.minimumWidth: 90
+ }
}
Repeater {
model: ColumnProxyModel {
@@ -130,6 +140,8 @@ ScrollView
text: size
}
}
+
+ onClicked: Navigation.openApplication(resource)
}
}
}
diff --git a/libmuon/UpdateModel/UpdateItem.h b/libmuon/UpdateModel/UpdateItem.h
index 0f5492a..b88d946 100644
--- a/libmuon/UpdateModel/UpdateItem.h
+++ b/libmuon/UpdateModel/UpdateItem.h
@@ -67,6 +67,7 @@ public:
ItemType type() const;
int checkedItems() const;
+ AbstractResource* resource() const { return m_app; }
private:
AbstractResource *m_app;
diff --git a/libmuon/UpdateModel/UpdateModel.cpp b/libmuon/UpdateModel/UpdateModel.cpp
index 9222ea8..f666a36 100644
--- a/libmuon/UpdateModel/UpdateModel.cpp
+++ b/libmuon/UpdateModel/UpdateModel.cpp
@@ -56,8 +56,9 @@ QHash<int,QByteArray> UpdateModel::roleNames() const
{
return QAbstractItemModel::roleNames().unite({
{ Qt::CheckStateRole, "checked" },
- { VersionRole, "version" },
- { SizeRole, "size" }
+ { ResourceRole, "resource" },
+ { SizeRole, "size" },
+ { VersionRole, "version" }
} );
}
@@ -126,6 +127,8 @@ QVariant UpdateModel::data(const QModelIndex &index, int role) const
return item->version();
case SizeRole:
return KFormat().formatByteSize(item->size());
+ case ResourceRole:
+ return QVariant::fromValue<QObject*>(item->resource());
default:
break;
}
diff --git a/libmuon/UpdateModel/UpdateModel.h b/libmuon/UpdateModel/UpdateModel.h
index da61606..74d685b 100644
--- a/libmuon/UpdateModel/UpdateModel.h
+++ b/libmuon/UpdateModel/UpdateModel.h
@@ -39,7 +39,8 @@ public:
enum Roles {
VersionRole = Qt::UserRole + 1,
- SizeRole
+ SizeRole,
+ ResourceRole
};
explicit UpdateModel(QObject *parent = nullptr);