From kde-commits Wed Feb 29 22:45:22 2012 From: Shaun Reich Date: Wed, 29 Feb 2012 22:45:22 +0000 To: kde-commits Subject: [kde-workspace/plasma/sreich/sal-qml] plasma/netbook/containments/sal: utilize gridview Message-Id: <20120229224522.90256A60C8 () git ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=133055556808407 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/ResultsV= iew.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/922b4902149804260aed2a99b3799f29fad10a= 6d diff --git a/plasma/netbook/containments/sal/CMakeLists.txt b/plasma/netboo= k/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/ResultsVie= w.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 =3D result.currentIndex: - } } - - } } } diff --git a/plasma/netbook/containments/sal/package/metadata.desktop b/pla= sma/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=3DUTF-8 Name=3DSAL (QML) +Comment=3DQML version of SAL = Icon=3Dpreferences-desktop-notification Type=3DService X-KDE-ServiceTypes=3DPlasma/Applet #,Plasma/Containment = -X-KDE-ParentApp=3Dplasma-desktop +#X-KDE-ParentApp=3Dplasma-desktop X-Plasma-API=3Ddeclarativeappletscript X-Plasma-MainScript=3Dui/main.qml X-KDE-PluginInfo-Author=3DShaun M. Reich X-KDE-PluginInfo-Email=3Dsreich@kde.org -X-KDE-PluginInfo-Name=3Dsal +X-KDE-PluginInfo-Name=3Dorg.kde.sal X-KDE-PluginInfo-Version=3D1.0 X-KDE-PluginInfo-Website=3Dhttp://plasma.kde.org/ X-KDE-PluginInfo-Category=3DWindows and Tasks X-KDE-PluginInfo-Depends=3D X-KDE-PluginInfo-License=3DGPL v2+ X-KDE-PluginInfo-EnabledByDefault=3Dtrue -X-Plasma-ContainmentCategories=3Ddesktop +#X-Plasma-ContainmentCategories=3Ddesktop diff --git a/plasma/netbook/containments/sal/shell/salcorona.cpp b/plasma/n= etbook/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 = #include +#include #include = SalCorona::SalCorona(QObject *parent) @@ -61,18 +62,6 @@ void SalCorona::init() = bool unlocked =3D immutability() =3D=3D Plasma::Mutable; = - QAction *lock =3D 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 Wid= gets")); - } - //the most important action ;) QAction *leave =3D 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 =3D containmentForScreen(desktop->primaryScreen()); if (c) { - Plasma::Applet *clock =3D Plasma::Applet::load("clock"/*, c->id()= + 1*/); + Plasma::PackageStructure::Ptr structure =3D Plasma::PackageStructu= re::load("Plasma/Generic"); + Plasma::Package *pkg =3D new Plasma::Package(QString(), "sal", str= ucture); + kDebug() << "FILEPATH: " << pkg->filePath("mainscript"); +// m_declarativeWidget->setQmlPath(m_package->filePath("mainscript"= )); + Plasma::Applet *clock =3D Plasma::Applet::load("org.kde.sal"/*, c= ->id() + 1*/); + Q_ASSERT(clock); c->addApplet(clock, QPointF(KDialog::spacingHint(), KDialog::spaci= ngHint()), true); clock->init(); clock->flushPendingConstraintsEvents(); diff --git a/plasma/netbook/containments/sal/shell/salview.cpp b/plasma/net= book/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 =3D rect(); - const QString text =3D i18n("Setup Mode - Screen is NOT locked"); - QFont f =3D font(); - f.bold(); - const QFontMetrics fm(f); - const int margin =3D 6; - const int textWidth =3D fm.width(text); - const QPoint centered(r.width() / 2 - textWidth / 2 - margin, r.y()); - const QRect boundingBox(centered, QSize(margin * 2 + textWidth, fm.hei= ght() + 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() + QPoi= nt(0, -margin * 2)); - box.lineTo(boundingBox.topRight()); - box.closeSubpath(); - - QPainter painter(viewport()); - painter.setRenderHint(QPainter::Antialiasing); - painter.setFont(f); - //kDebug() << "******************** painting from" << centered << boun= dingBox << rect() << event->rect(); - QColor highlight =3D 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)