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

List:       kde-commits
Subject:    =?utf-8?q?=5Bcalligra/mobile-qml-shantanu=5D_mobile=3A_Add_prese?=
From:       Shantanu Tushar <jhahoneyk () gmail ! com>
Date:       2011-05-11 19:59:51
Message-ID: 20110511195951.1D9F9A60E0 () git ! kde ! org
[Download RAW message or body]

Git commit 3f911d666da8c5351d3fe08030ac2cebc8c935d6 by Shantanu Tushar.
Committed on 11/05/2011 at 21:59.
Pushed by shantanu into branch 'mobile-qml-shantanu'.

Add presentation toolbar, add back button to toolbars.
Remove blue gradient.
Remove stupid QML namespaces.
Make command line loading work, again.

M  +3    -0    mobile/qml/Doc.qml     
M  +8    -4    mobile/qml/HomeScreen.qml     
A  +41   -0    mobile/qml/PresentationToolbar.qml         [License: GPL (v2+)]
M  +1    -1    mobile/qml/RecentFiles.qml     
M  +13   -8    mobile/qml/SpreadsheetToolbar.qml     
M  +7    -22   mobile/qml/WordsToolbar.qml     
M  +3    -3    mobile/src/MainWindow.cpp     

http://commits.kde.org/calligra/3f911d666da8c5351d3fe08030ac2cebc8c935d6

diff --git a/mobile/qml/Doc.qml b/mobile/qml/Doc.qml
index 100dff8..07385c3 100644
--- a/mobile/qml/Doc.qml
+++ b/mobile/qml/Doc.qml
@@ -25,6 +25,7 @@ import CalligraMobile 1.0
 Item {
     id: docRootRect
     signal documentLoaded
+    clip: true
 
     function openDocument(path) {
         canvas.openDocument(path);
@@ -35,6 +36,8 @@ Item {
             toolbarLoader.source = "SpreadsheetToolbar.qml"
         } else if (canvas.documentType == CanvasController.TextDocument) {
             toolbarLoader.source = "WordsToolbar.qml"
+        } else if (canvas.documentType == CanvasController.Presentation) {
+            toolbarLoader.source = "PresentationToolbar.qml"
         }
     }
 
diff --git a/mobile/qml/HomeScreen.qml b/mobile/qml/HomeScreen.qml
index 60eea77..b7cbb39 100644
--- a/mobile/qml/HomeScreen.qml
+++ b/mobile/qml/HomeScreen.qml
@@ -23,7 +23,11 @@ import QtQuick 1.0
 import CalligraMobile 1.0
 
 Rectangle {
-    id: rootRect
+    id: homeScreen
+
+    function openDocument(path) {
+        doc.openDocument(path);
+    }
 
     width: 800; height: 600;
     gradient: Gradient {
@@ -34,7 +38,7 @@ Rectangle {
     DocumentTypeSelector {
         id: docTypeSelector
 
-        buttonWidth: rootRect.width/2.1; buttonHeight: 100;
+        buttonWidth: homeScreen.width/2.1; buttonHeight: 100;
         anchors.left: parent.left
         anchors.top: parent.top
         anchors.right: parent.horizontalCenter
@@ -45,7 +49,7 @@ Rectangle {
     RecentFiles {
         id: recentFiles
 
-        buttonWidth: rootRect.width/2.1; buttonHeight: 100;
+        buttonWidth: homeScreen.width/2.1; buttonHeight: 100;
         anchors.left: parent.horizontalCenter
         anchors.top: parent.top
         anchors.right: parent.right
@@ -61,7 +65,7 @@ Rectangle {
         anchors.verticalCenter: parent.verticalCenter
 
         onDocumentLoaded: {
-            rootRect.state = "doc"
+            homeScreen.state = "doc"
         }
     }
 
diff --git a/mobile/qml/PresentationToolbar.qml b/mobile/qml/PresentationToolbar.qml
new file mode 100644
index 0000000..f9fe29a
--- /dev/null
+++ b/mobile/qml/PresentationToolbar.qml
@@ -0,0 +1,41 @@
+/*
+ * This file is part of the KDE project
+ *
+ * Copyright (C) 2011 Shantanu Tushar <jhahoneyk@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 2 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+import QtQuick 1.0
+
+Item {
+    id: container
+
+    Column {
+        anchors.fill: parent
+        spacing: 10
+
+        Button {
+            id: goBack
+            text: "Back"
+            imageSource: "qrc:///images/arrow-left.png"
+            height: parent.width
+            width: parent.width
+
+            onClicked: homeScreen.state = ""
+        }
+    }
+}
diff --git a/mobile/qml/RecentFiles.qml b/mobile/qml/RecentFiles.qml
index c003faf..85c904b 100644
--- a/mobile/qml/RecentFiles.qml
+++ b/mobile/qml/RecentFiles.qml
@@ -39,7 +39,7 @@ ListView {
 
         MouseArea {
             anchors.fill: parent
-            onClicked: doc.openDocument(modelData);
+            onClicked: homeScreen.openDocument(modelData);
         }
     }
 }
\ No newline at end of file
diff --git a/mobile/qml/SpreadsheetToolbar.qml b/mobile/qml/SpreadsheetToolbar.qml
index 3ea1df1..38760ac 100644
--- a/mobile/qml/SpreadsheetToolbar.qml
+++ b/mobile/qml/SpreadsheetToolbar.qml
@@ -19,22 +19,27 @@
  * 02110-1301 USA
  */
 
-import QtQuick 1.0 as QML
+import QtQuick 1.0
 import CalligraMobile 1.0
 
-QML.Rectangle {
+Item {
     id: container
 
-    gradient: QML.Gradient {
-         QML.GradientStop { position: 0.0; color: "#0000FF" }
-         QML.GradientStop { position: 1.0; color: "#000011" }
-    }
-
-    QML.Column {
+    Column {
         anchors.fill: parent
         spacing: 10
 
         Button {
+            id: goBack
+            text: "Back"
+            imageSource: "qrc:///images/arrow-left.png"
+            height: parent.width
+            width: parent.width
+
+            onClicked: homeScreen.state = ""
+        }
+
+        Button {
             id: nextSheet
             text: "Next"
             imageSource: "qrc:///images/arrow-right.png"
diff --git a/mobile/qml/WordsToolbar.qml b/mobile/qml/WordsToolbar.qml
index 33b2021..a3498a8 100644
--- a/mobile/qml/WordsToolbar.qml
+++ b/mobile/qml/WordsToolbar.qml
@@ -19,38 +19,23 @@
  * 02110-1301 USA
  */
 
-import QtQuick 1.0 as QML
+import QtQuick 1.0
 
-QML.Rectangle {
+Item {
     id: container
 
-    gradient: QML.Gradient {
-         QML.GradientStop { position: 0.0; color: "#0000FF" }
-         QML.GradientStop { position: 1.0; color: "#000011" }
-    }
-
-    QML.Column {
+    Column {
         anchors.fill: parent
         spacing: 10
 
         Button {
-            id: scrollUp
-            text: "Up"
-            imageSource: "qrc:///images/arrow-up.png"
-            height: parent.width
-            width: parent.width
-
-            onClicked: canvas.scrollUp()
-        }
-
-        Button {
-            id: scrollDown
-            text: "Down"
-            imageSource: "qrc:///images/arrow-down.png"
+            id: goBack
+            text: "Back"
+            imageSource: "qrc:///images/arrow-left.png"
             height: parent.width
             width: parent.width
 
-            onClicked: canvas.scrollDown()
+            onClicked: homeScreen.state = ""
         }
     }
 }
\ No newline at end of file
diff --git a/mobile/src/MainWindow.cpp b/mobile/src/MainWindow.cpp
index aa846b9..4a30e3b 100644
--- a/mobile/src/MainWindow.cpp
+++ b/mobile/src/MainWindow.cpp
@@ -45,9 +45,9 @@ void MainWindow::openFile(const QString &path)
 {
     if (path.isEmpty())
         return;
-    m_view->rootContext()->setContextProperty("fileName", path);
-    m_view->setSource(QUrl::fromLocalFile(CalligraMobile::Global::installPrefix()
-                        + "/share/calligra-mobile/qml/Doc.qml"));
+
+    QObject *object = m_view->rootObject();
+    QMetaObject::invokeMethod(object, "openDocument", Q_ARG(QVariant, QVariant(path)));
 }
 
 MainWindow::~MainWindow()

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

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