[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kde-workspace/plasma/sreich/sal-qml] plasma/netbook/containments/sal: utilize gridview
From: Shaun Reich <shaun.reich () kdemail ! net>
Date: 2012-02-29 22:45:22
Message-ID: 20120229224522.90256A60C8 () git ! kde ! org
[Download RAW message or body]
Git commit 922b4902149804260aed2a99b3799f29fad10a6d by Shaun Reich.
Committed on 29/02/2012 at 23:44.
Pushed by sreich into branch 'plasma/sreich/sal-qml'.
utilize gridview
M +2 -2 plasma/netbook/containments/sal/CMakeLists.txt
M +18 -26 plasma/netbook/containments/sal/package/contents/ui/ResultsView.qml
M +4 -3 plasma/netbook/containments/sal/package/metadata.desktop
M +7 -13 plasma/netbook/containments/sal/shell/salcorona.cpp
M +0 -37 plasma/netbook/containments/sal/shell/salview.cpp
http://commits.kde.org/kde-workspace/922b4902149804260aed2a99b3799f29fad10a6d
diff --git a/plasma/netbook/containments/sal/CMakeLists.txt \
b/plasma/netbook/containments/sal/CMakeLists.txt index a7890d7..514b84d 100644
--- a/plasma/netbook/containments/sal/CMakeLists.txt
+++ b/plasma/netbook/containments/sal/CMakeLists.txt
@@ -1,8 +1,8 @@
project(sal)
install(DIRECTORY package/
- DESTINATION ${DATA_INSTALL_DIR}/plasma/plasmoids/sal)
+ DESTINATION ${DATA_INSTALL_DIR}/plasma/plasmoids/org.kde.sal)
install(FILES package/metadata.desktop DESTINATION ${SERVICES_INSTALL_DIR} RENAME \
plasma-applet-sal.desktop)
-add_subdirectory(shell)
\ No newline at end of file
+add_subdirectory(shell)
diff --git a/plasma/netbook/containments/sal/package/contents/ui/ResultsView.qml \
b/plasma/netbook/containments/sal/package/contents/ui/ResultsView.qml index \
a8d908e..ed1db4b 100644
--- a/plasma/netbook/containments/sal/package/contents/ui/ResultsView.qml
+++ b/plasma/netbook/containments/sal/package/contents/ui/ResultsView.qml
@@ -27,7 +27,7 @@ Item {
//FIXME: figure out sizing properly..
property int resultItemHeight: 70
- property alias model: repeater.model
+ property alias model: gridView.model
Flickable {
id: resultsFlickable
@@ -38,39 +38,31 @@ Item {
contentHeight: resultItemHeight * repeater.count
- Flow {
- id: flow
+ GridView {
+ id: gridView
anchors {
fill: parent
leftMargin: resultItemHeight
rightMargin: resultItemHeight
}
- spacing: 20
-
- move: Transition {
- PropertyAnimation {
- properties: "x,y"
- easing.type: Easing.InOutQuad
- }
- }
-
- Repeater {
- id: repeater
-
- Result {
- id: result
- currentText: model["label"]
- currentIcon: model["icon"]
- currentId: model["id"]
-
- onWasClickedChanged: {
- print(result.currentId)
+// move: Transition {
+// PropertyAnimation {
+// properties: "x,y"
+// easing.type: Easing.InOutQuad
+// }
+// }
+//
+ delegate: Result {
+ id: result
+ currentText: model["label"]
+ currentIcon: model["icon"]
+ currentId: model["id"]
+
+ onWasClickedChanged: {
+ print(result.currentId)
// appIndexToRun = result.currentIndex:
- }
}
-
-
}
}
}
diff --git a/plasma/netbook/containments/sal/package/metadata.desktop \
b/plasma/netbook/containments/sal/package/metadata.desktop index 084b75b..eca79a3 \
100644
--- a/plasma/netbook/containments/sal/package/metadata.desktop
+++ b/plasma/netbook/containments/sal/package/metadata.desktop
@@ -1,22 +1,23 @@
[Desktop Entry]
Encoding=UTF-8
Name=SAL (QML)
+Comment=QML version of SAL
Icon=preferences-desktop-notification
Type=Service
X-KDE-ServiceTypes=Plasma/Applet
#,Plasma/Containment
-X-KDE-ParentApp=plasma-desktop
+#X-KDE-ParentApp=plasma-desktop
X-Plasma-API=declarativeappletscript
X-Plasma-MainScript=ui/main.qml
X-KDE-PluginInfo-Author=Shaun M. Reich
X-KDE-PluginInfo-Email=sreich@kde.org
-X-KDE-PluginInfo-Name=sal
+X-KDE-PluginInfo-Name=org.kde.sal
X-KDE-PluginInfo-Version=1.0
X-KDE-PluginInfo-Website=http://plasma.kde.org/
X-KDE-PluginInfo-Category=Windows and Tasks
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL v2+
X-KDE-PluginInfo-EnabledByDefault=true
-X-Plasma-ContainmentCategories=desktop
+#X-Plasma-ContainmentCategories=desktop
diff --git a/plasma/netbook/containments/sal/shell/salcorona.cpp \
b/plasma/netbook/containments/sal/shell/salcorona.cpp index 2093c9b..7f67d58 100644
--- a/plasma/netbook/containments/sal/shell/salcorona.cpp
+++ b/plasma/netbook/containments/sal/shell/salcorona.cpp
@@ -35,6 +35,7 @@
#include <KIcon>
#include <Plasma/Containment>
+#include <Plasma/Package>
#include <plasma/containmentactionspluginsconfig.h>
SalCorona::SalCorona(QObject *parent)
@@ -61,18 +62,6 @@ void SalCorona::init()
bool unlocked = immutability() == Plasma::Mutable;
- QAction *lock = action("lock widgets");
- if (lock) {
- kDebug() << "unlock action";
- //rename the lock action so that corona doesn't mess with it
- addAction("unlock widgets", lock);
- //rewire the action so we can check for a password
- lock->disconnect(SIGNAL(triggered(bool)));
- connect(lock, SIGNAL(triggered()), this, SLOT(toggleLock()));
- lock->setIcon(KIcon(unlocked ? "object-locked" : "configure"));
- lock->setText(unlocked ? i18n("Lock Screen") : i18n("Configure Widgets"));
- }
-
//the most important action ;)
QAction *leave = new QAction(unlocked ? i18n("Leave Screensaver") : \
i18n("Unlock"), this); leave->setIcon(KIcon("system-lock-screen"));
@@ -107,7 +96,12 @@ void SalCorona::loadDefaultLayout()
// a default clock
c = containmentForScreen(desktop->primaryScreen());
if (c) {
- Plasma::Applet *clock = Plasma::Applet::load("clock"/*, c->id() + 1*/);
+ Plasma::PackageStructure::Ptr structure = \
Plasma::PackageStructure::load("Plasma/Generic"); + Plasma::Package *pkg = new \
Plasma::Package(QString(), "sal", structure); + kDebug() << "FILEPATH: " << \
pkg->filePath("mainscript"); +// \
m_declarativeWidget->setQmlPath(m_package->filePath("mainscript")); + \
Plasma::Applet *clock = Plasma::Applet::load("org.kde.sal"/*, c->id() + 1*/); + \
Q_ASSERT(clock);
c->addApplet(clock, QPointF(KDialog::spacingHint(), KDialog::spacingHint()), \
true); clock->init();
clock->flushPendingConstraintsEvents();
diff --git a/plasma/netbook/containments/sal/shell/salview.cpp \
b/plasma/netbook/containments/sal/shell/salview.cpp index a37457b..de05696 100644
--- a/plasma/netbook/containments/sal/shell/salview.cpp
+++ b/plasma/netbook/containments/sal/shell/salview.cpp
@@ -147,43 +147,6 @@ void SalView::hideWidgetExplorer()
void SalView::paintEvent(QPaintEvent *event)
{
Plasma::View::paintEvent(event);
-
-
- // now draw a little label reminding the user their screen's not quite locked
- const QRect r = rect();
- const QString text = i18n("Setup Mode - Screen is NOT locked");
- QFont f = font();
- f.bold();
- const QFontMetrics fm(f);
- const int margin = 6;
- const int textWidth = fm.width(text);
- const QPoint centered(r.width() / 2 - textWidth / 2 - margin, r.y());
- const QRect boundingBox(centered, QSize(margin * 2 + textWidth, fm.height() + \
margin * 2));
-
-// if (!viewport() || !event->rect().intersects(boundingBox)) {
-// return;
-// }
-
- QPainterPath box;
- box.moveTo(boundingBox.topLeft());
- box.lineTo(boundingBox.bottomLeft() + QPoint(0, -margin * 2));
- box.quadTo(boundingBox.bottomLeft(), boundingBox.bottomLeft() + QPoint(margin * \
2, 0));
- box.lineTo(boundingBox.bottomRight() + QPoint(-margin * 2, 0));
- box.quadTo(boundingBox.bottomRight(), boundingBox.bottomRight() + QPoint(0, \
-margin * 2));
- box.lineTo(boundingBox.topRight());
- box.closeSubpath();
-
- QPainter painter(viewport());
- painter.setRenderHint(QPainter::Antialiasing);
- painter.setFont(f);
- //kDebug() << "******************** painting from" << centered << boundingBox << \
rect() << event->rect();
- QColor highlight = palette().highlight().color();
- highlight.setAlphaF(0.7);
- painter.setPen(highlight.darker());
- painter.setBrush(highlight);
- painter.drawPath(box);
- painter.setPen(palette().highlightedText().color());
- painter.drawText(boundingBox, Qt::AlignCenter | Qt::AlignVCenter, text);
}
bool SalView::eventFilter(QObject *watched, QEvent *event)
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic