[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [skrooge/plasma-dashboard] /: Attempt at making some SKGMainPanel methods accessible in QML. Fail.
From:       Guillaume DE BURE <guillaume.debure () gmail ! com>
Date:       2013-03-10 22:17:40
Message-ID: 20130310221740.4540BA60D4 () git ! kde ! org
[Download RAW message or body]

Git commit 743a39b194af5d02f970a48d061f3d462a569d12 by Guillaume DE BURE.
Committed on 09/03/2013 at 11:19.
Pushed by gdebure into branch 'plasma-dashboard'.

Attempt at making some SKGMainPanel methods accessible in QML. Fail.

M  +9    -7    plugins/applet/account-qml/contents/ui/main.qml
M  +4    -2    skgbankgui/CMakeLists.txt
A  +37   -0    skgbankgui/skgqmlhelpers.cpp     [License: GPL (v3+)]
A  +38   -0    skgbankgui/skgqmlhelpers.h     [License: GPL (v3+)]
M  +5    -0    skrooge/main.cpp

http://commits.kde.org/skrooge/743a39b194af5d02f970a48d061f3d462a569d12

diff --git a/plugins/applet/account-qml/contents/ui/main.qml \
b/plugins/applet/account-qml/contents/ui/main.qml index 5cd77e6..05c7b35 100644
--- a/plugins/applet/account-qml/contents/ui/main.qml
+++ b/plugins/applet/account-qml/contents/ui/main.qml
@@ -12,7 +12,7 @@
  *   GNU General Public License for more details.                          *
  *                                                                         *
  *   You should have received a copy of the GNU General Public License     *
- *   along with this program. + " " +   If not, see <http://www.gnu.org/licenses/>  \
* + *   along with this program. If not, see <http://www.gnu.org/licenses/>   *
  ***************************************************************************/
 import QtQuick 1.1
 import org.kde.plasma.components 0.1 as PlasmaComponents
@@ -54,21 +54,23 @@ Item {
         section.property: "type"
         section.criteria: ViewSection.FullString
         section.delegate: Text {text:section;font.bold:true}
-
+        
         delegate: PlasmaComponents.ListItem {
-
+            
+            enabled: true
+            
             Row{
                 anchors.left: parent.left
                 anchors.right: parent.right
                 spacing: 5
                 
-                PlasmaComponents.Label {
-                    anchors.left: parent.left
-                    horizontalAlignment:Text.AlignLeft
+                PlasmaComponents.ToolButton {
+                    flat: true
                     text:name
                 }
-                
+                            
                 PlasmaComponents.Label {
+                    anchors.left: parent.left
                     anchors.right: parent.right
                     horizontalAlignment:Text.AlignRight
                     text: amount + " " + unit
diff --git a/skgbankgui/CMakeLists.txt b/skgbankgui/CMakeLists.txt
index 01f89e0..7518c2b 100644
--- a/skgbankgui/CMakeLists.txt
+++ b/skgbankgui/CMakeLists.txt
@@ -24,7 +24,7 @@ ${CMAKE_BINARY_DIR}/skgbasegui
 )
 LINK_DIRECTORIES (${LIBRARY_OUTPUT_PATH})
 
-SET(skgbankgui_SRCS
+SET(skgbankgui_SRCS 
    skgobjectmodel.cpp
    skgquerycreatordesignerplugin.cpp
    skgquerycreator.cpp
@@ -36,13 +36,15 @@ SET(skgbankgui_SRCS
    skgquerydelegate.cpp
    skgunitcombobox.cpp
    skgunitcomboboxdesignerplugin.cpp
+   skgqmlhelpers.cpp
+   
  )
 
 kde4_add_ui_files(skgbankgui_SRCS skgquerycreator.ui skgpropertyeditor.ui \
skgprocesscreator.ui)  
 KDE4_ADD_LIBRARY(skgbankgui SHARED ${skgbankgui_SRCS})
 
-TARGET_LINK_LIBRARIES(skgbankgui ${KDE4_KDEUI_LIBS} ${QT_QTXML_LIBRARY} \
skgbankmodeler skgbasemodeler skgbasegui) +TARGET_LINK_LIBRARIES(skgbankgui \
${KDE4_KDEUI_LIBS} ${QT_QTXML_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY} skgbankmodeler \
skgbasemodeler skgbasegui)  SET_TARGET_PROPERTIES( skgbankgui PROPERTIES VERSION \
${SKG_VERSION} SOVERSION ${SOVERSION} )  
 ########### install files ###############
diff --git a/skgbankgui/skgqmlhelpers.cpp b/skgbankgui/skgqmlhelpers.cpp
new file mode 100644
index 0000000..7d2c58c
--- /dev/null
+++ b/skgbankgui/skgqmlhelpers.cpp
@@ -0,0 +1,37 @@
+/*
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) 2013  Guillaume DE BURE <guillaume.debure@gmail.com>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include "skgqmlhelpers.h"
+#include <skgmainpanel.h>
+
+SKGQmlHelpers::SKGQmlHelpers(QDeclarativeItem* parent): QDeclarativeItem()
+{
+
+}
+
+SKGQmlHelpers::~SKGQmlHelpers()
+{
+
+}
+
+void SKGQmlHelpers::openPage(const QUrl& iUrl, bool iNewPage)
+{
+    SKGMainPanel* main_panel = SKGMainPanel::getMainPanel();
+    main_panel->openPage(iUrl,iNewPage);
+}
diff --git a/skgbankgui/skgqmlhelpers.h b/skgbankgui/skgqmlhelpers.h
new file mode 100644
index 0000000..4778a19
--- /dev/null
+++ b/skgbankgui/skgqmlhelpers.h
@@ -0,0 +1,38 @@
+/*
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) 2013  Guillaume DE BURE <guillaume.debure@gmail.com>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#ifndef SKGQMLHELPERS_H
+#define SKGQMLHELPERS_H
+
+#include <qdeclarativeitem.h>
+
+
+class SKGQmlHelpers : public QDeclarativeItem
+{
+
+public:
+    SKGQmlHelpers(QDeclarativeItem* parent = 0);
+    
+    virtual ~SKGQmlHelpers();
+    
+public slots:
+    void openPage(const QUrl& iUrl, bool iNewPage = true);
+};
+
+#endif // SKGQMLHELPERS_H
diff --git a/skrooge/main.cpp b/skrooge/main.cpp
index 1c39559..520f83c 100644
--- a/skrooge/main.cpp
+++ b/skrooge/main.cpp
@@ -22,11 +22,14 @@
 #include "skguniqueapplication.h"
 #include "skgdocumentbank.h"
 #include "skgtraces.h"
+#include <skgqmlhelpers.h>
 
 #include <kaboutdata.h>
 #include <kcmdlineargs.h>
 #include <KDE/KLocale>
 
+#include <QtDeclarative>
+
 /**
  * To compute the version
  */
@@ -77,6 +80,8 @@ int main(int argc, char** argv)
     options.add("+[URL]", ki18nc("Application argument", "Document to open"));
     KCmdLineArgs::addCmdLineOptions(options);
 
+    qmlRegisterType<SKGQmlHelpers>("org.kde.skrooge",1,0,"SKGQmlHelpers");
+    
     int rc = 0;
     bool started = false;
     if (!SKGServices::getenv("SKGNOTUNIQUE").isEmpty()) {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic