Permalink
Browse files

Merge pull request #21 from ekke/master

gitignore and DialogSample (Beta 3)
  • Loading branch information...
2 parents e69d8c3 + 542d78e commit b12f8c7f7dc43874530f15d67a319013280198e2 @pelegri pelegri committed Oct 12, 2012
View
@@ -0,0 +1,26 @@
+# MAC OSX
+*.DS_Store
+
+# Compiled Object files
+*.slo
+*.lo
+*.o
+
+# Compiled Dynamic libraries
+*.so
+
+# Compiled Static libraries
+*.lai
+*.la
+*.a
+
+# Compiled Translations
+*/translations/*.qm
+
+/.settings/
+*/arm/
+*/x86/
+.metadata/*
+/.metadata/
+192.*
+169.254.0.1
View
@@ -73,12 +73,18 @@
<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>com.rim.tad.tools.qml.core.qmlFileBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
<nature>com.qnx.tools.ide.bbt.core.bbtnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
+ <nature>com.rim.tad.tools.qml.core.qmlNature</nature>
</natures>
</projectDescription>
View
@@ -10,8 +10,7 @@ BPS from Cascades.
Alert Dialogs show a title, message and buttons
Prompt Dialogs show an input title and buttons
Login Dialogs show a customizable login dialog
- File Browse Dialog shows how to browse files on the file system
- File Save Dialogs show how to prompt to save a filename
+ File Browse Dialog and File Save Dialogs are now part of Filepicker
Context Menu dialog shows how to display a context menu with buttons and icons
When a dialog is invoked it creates a thread and builds the dialog using the parameters
@@ -22,7 +21,7 @@ BPS from Cascades.
## Requirements:
- - BlackBerry Native SDK for BlackBerry 10 or later
+ - BlackBerry Native SDK for BlackBerry 10.0.9 or later
- One of the following:
- BlackBerry Alpha Device
- BlackBerry Alpha Device Simulator
@@ -18,22 +18,20 @@ import Dialog.Alert 1.0
import Dialog.ContextMenu 1.0
import Dialog.Prompt 1.0
import Dialog.Login 1.0
-import Dialog.FileBrowse 1.0
-import Dialog.FileSave 1.0
Page {
content: Container {
background : Color.Black
layout : StackLayout {
- layoutDirection : LayoutDirection.TopToBottom
+ orientation : LayoutOrientation.TopToBottom
}
Label {
id: alertDialogLabel
}
Button {
- layoutProperties : StackLayoutProperties {
- horizontalAlignment : HorizontalAlignment.Center
+ layoutProperties : StackLayoutProperties {
}
+ horizontalAlignment : HorizontalAlignment.Center
text : "Simple Alert"
onClicked: {
alertDialog.addCustomButton("Cheese","AlertDialog_Cheese");
@@ -47,8 +45,8 @@ Page {
}
Button {
layoutProperties : StackLayoutProperties {
- horizontalAlignment : HorizontalAlignment.Center
}
+ horizontalAlignment : HorizontalAlignment.Center
text : "Context Menu"
onClicked: {
contextMenu.addCustomButton("Rotate","Menu_Rotate");
@@ -60,8 +58,8 @@ Page {
Label { id: promptDialogLabel }
Button {
layoutProperties : StackLayoutProperties {
- horizontalAlignment : HorizontalAlignment.Center
}
+ horizontalAlignment : HorizontalAlignment.Center
text : "Prompt Dialog"
onClicked: {
promptDialog.show();
@@ -71,37 +69,14 @@ Page {
Label { id: loginDialogLabel }
Button {
layoutProperties : StackLayoutProperties {
- horizontalAlignment : HorizontalAlignment.Center
}
+ horizontalAlignment : HorizontalAlignment.Center
text : "Login Dialog"
onClicked: {
loginDialog.addCustomButton("Something","Login_Something");
loginDialog.show();
}
}
- Divider {}
- Label { id: filebrowseDialogLabel }
- Button {
- layoutProperties : StackLayoutProperties {
- horizontalAlignment : HorizontalAlignment.Center
- }
- text : "File Browse Dialog"
- onClicked: {
- filebrowseDialog.show();
- }
- }
- Divider {}
- Label { id: filesaveDialogLabel }
- Button {
- layoutProperties : StackLayoutProperties {
- horizontalAlignment : HorizontalAlignment.Center
- }
- text : "File Save Dialog"
- onClicked: {
- filesaveDialog.addCustomButton("delete","FileSave_delete");
- filesaveDialog.show();
- }
- }
attachedObjects: [
AlertDialog {
id: alertDialog
@@ -175,38 +150,6 @@ Page {
onCustomButton: {
loginDialogLabel.text = "index: " + index + " label: " + label + " context: " + context;
}
- },
- FileBrowseDialog {
- id: filebrowseDialog
- multiselect : true
- filters : ["*.doc","*.jpg","*.txt"]
- onSelectionCompleted: {
- if(filebrowseDialog.filepaths.length>0)
- filebrowseDialogLabel.text = filebrowseDialog.filepaths[0];
- else
- filebrowseDialogLabel.text = "no file selected";
- }
- onSelectionCancelled: {
- filebrowseDialogLabel.text = "file browse dialog was cancelled";
- }
- },
- FileSaveDialog {
- //not what you would expect, no way to browse and
- //only shows an input box by default, incomplete?
- id: filesaveDialog
- filename : "resume.doc"
- cancelButton : true
- okButton : true
- titleText : "Save file as"
- onOk: {
- filesaveDialogLabel.text = filesaveDialog.filename
- }
- onCancel: {
- filesaveDialogLabel.text = "You clicked on CANCEL button";
- }
- onCustomButton: {
- filesaveDialogLabel.text = "index: " + index + " label: " + label + " context: " + context;
- }
}
]
}
View
@@ -10,8 +10,7 @@ BPS from Cascades.
Alert Dialogs show a title, message and buttons
Prompt Dialogs show an input title and buttons
Login Dialogs show a customizable login dialog
- File Browse Dialog shows how to browse files on the file system
- File Save Dialogs show how to prompt to save a filename
+ File Browse Dialog and File Save Dialogs are now part of Filepicker
Context Menu dialog shows how to display a context menu with buttons and icons
When a dialog is invoked it creates a thread and builds the dialog using the parameters
@@ -23,7 +22,7 @@ BPS from Cascades.
========================================================================
Requirements:
- - BlackBerry Native SDK for BlackBerry 10 or later
+ - BlackBerry Native SDK for BlackBerry 10.0.9 or later
- One of the following:
- BlackBerry Alpha Device
- BlackBerry Alpha Device Simulator
@@ -1,158 +0,0 @@
-/* Copyright (c) 2012 Research In Motion Limited.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "FileBrowseDialog.hpp"
-#include <bps/bps.h>
-#include <QDebug>
-
-FileBrowseDialog::FileBrowseDialog(QObject* parent)
- : QThread(parent)
- , m_multiSelect(false)
-{
- m_filters.push_back(QString("*.*"));
-}
-
-FileBrowseDialog::~FileBrowseDialog()
-{
-}
-
-void FileBrowseDialog::show()
-{
- if (!isRunning())
- {
- m_filePaths.clear();
- start();
- }
-}
-
-QVariant FileBrowseDialog::getFilePaths() const
-{
- return m_filePaths;
-}
-
-bool FileBrowseDialog::getMultiSelect() const
-{
- return m_multiSelect;
-}
-
-void FileBrowseDialog::setMultiSelect(bool value)
-{
- m_multiSelect = value;
-}
-
-QVariant FileBrowseDialog::getFilters() const
-{
- return m_filters;
-}
-
-void FileBrowseDialog::setFilters(QVariant const& value)
-{
- m_filters = value.toList();
- qDebug() << "filter count: " << m_filters.count();
-}
-
-void FileBrowseDialog::run()
-{
- bps_initialize();
-
- //request all dialog events
- dialog_request_events(0);
- if (dialog_create_filebrowse(&m_dialog) != BPS_SUCCESS)
- {
- qDebug() << "Failed to create file browse dialog.";
- emit selectionCancelled();
- return;
- }
-
- //set the selection filters
- if (m_filters.count() > 0)
- {
- char** ext = (char**)new char[m_filters.count()*sizeof(char*)];
- int i = 0;
- for (QVariantList::iterator it = m_filters.begin(); it != m_filters.end(); ++it, ++i)
- {
- QString filter = it->toString();
- if (!filter.trimmed().isEmpty())
- {
- int length = (filter.length() + 1) * sizeof(char);
- ext[i] = new char[length];
- strncpy(ext[i], filter.toAscii(), length);
- }
- }
- if (dialog_set_filebrowse_filter(m_dialog, (const char**)ext, m_filters.count()) != BPS_SUCCESS)
- {
- qDebug() << "unable to set file browse dialog extensions";
- }
- for (i = 0; i < m_filters.count(); i++)
- {
- delete ext[i];
- }
- delete ext;
- }
-
- if (dialog_show(m_dialog) != BPS_SUCCESS)
- {
- qDebug() << "Failed to show file browse dialog.";
- dialog_destroy(m_dialog);
- m_dialog = 0;
- emit selectionCancelled();
- return;
- }
-
- bool shutdown = false;
- while (!shutdown)
- {
- bps_event_t* event = NULL;
- bps_get_event(&event, -1); // -1 means that the function waits
- // for an event before returning
-
- if (event)
- {
- if (bps_event_get_domain(event) == dialog_get_domain())
- {
- //0=ok, 1=cancel
- int selectedIndex = dialog_event_get_selected_index(event);
-
- if (selectedIndex == 1)
- {
- int count;
- char** filepaths;
- if (BPS_SUCCESS == dialog_event_get_filebrowse_filepaths(event, &filepaths, &count))
- {
- for (int i = 0; i < count; i++)
- {
- qDebug() << "selected file: " << filepaths[i];
- m_filePaths.push_back(QString(filepaths[i]));
- }
- bps_free(filepaths);
- }
- emit selectionCompleted();
- }
- else
- {
- emit selectionCancelled();
- }
-
- qDebug() << "Got file browse dialog click";
- shutdown = true;
- }
- }
- }
-
- if (m_dialog)
- {
- dialog_destroy(m_dialog);
- }
-}
Oops, something went wrong.

0 comments on commit b12f8c7

Please sign in to comment.