[CB-4292] Remove remaining plugins Their installation is now handled via depedencies
Reviewed by Bryan Higgins <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/commit/87223938 Tree: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/tree/87223938 Diff: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/diff/87223938 Branch: refs/heads/3.0.x Commit: 87223938b2b70de55823ea990bd21d12bc73d3a0 Parents: ed4b516 Author: Jeffrey Heifetz <[email protected]> Authored: Thu Jul 18 09:32:53 2013 -0400 Committer: Bryan Higgins <[email protected]> Committed: Thu Jul 18 16:50:56 2013 -0400 ---------------------------------------------------------------------- blackberry10/bin/create.js | 6 - .../plugins/com.blackberry.jpps/plugin.xml | 30 - .../src/blackberry10/native/device/libjpps.so | Bin 138046 -> 0 bytes .../blackberry10/native/simulator/libjpps.so | Bin 224392 -> 0 bytes .../plugins/com.blackberry.utils/plugin.xml | 30 - .../src/blackberry10/native/device/libutils.so | Bin 130206 -> 0 bytes .../blackberry10/native/simulator/libutils.so | Bin 183184 -> 0 bytes .../plugin.xml | 31 - .../src/blackberry10/native/Makefile | 8 - .../src/blackberry10/native/arm/Makefile | 8 - .../blackberry10/native/arm/so.le-v7/Makefile | 1 - .../native/arm/so.le-v7/libpimcontacts.so | Bin 170350 -> 0 bytes .../src/blackberry10/native/common.mk | 18 - .../src/blackberry10/native/contact_account.cpp | 74 - .../src/blackberry10/native/contact_account.hpp | 54 - .../native/device/libpimcontacts.so | Bin 170350 -> 0 bytes .../src/blackberry10/native/pim_contacts_js.cpp | 174 -- .../src/blackberry10/native/pim_contacts_js.hpp | 45 - .../src/blackberry10/native/pim_contacts_qt.cpp | 1613 ------------------ .../src/blackberry10/native/pim_contacts_qt.hpp | 148 -- .../native/simulator/libpimcontacts.so | Bin 265964 -> 0 bytes .../src/blackberry10/native/x86/Makefile | 8 - .../src/blackberry10/native/x86/so/Makefile | 1 - .../native/x86/so/libpimcontacts.so | Bin 265964 -> 0 bytes 24 files changed, 2249 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/87223938/blackberry10/bin/create.js ---------------------------------------------------------------------- diff --git a/blackberry10/bin/create.js b/blackberry10/bin/create.js index 2467d9b..d9f895e 100644 --- a/blackberry10/bin/create.js +++ b/blackberry10/bin/create.js @@ -166,11 +166,6 @@ function updateProject() { fs.writeFileSync(path.join(project_path, "project.json"), JSON.stringify(projectJson, null, 4) + "\n", "utf-8"); } -function installPlugins() { - var pluginScript = path.join(project_path, "cordova", "lib", "plugin.js"); - require(pluginScript).add(path.join(__dirname, "..", "plugins")); -} - function help() { console.log("\nUsage: create <project path> [package name [BAR filename]] \n"); console.log("Options: \n"); @@ -186,7 +181,6 @@ if ( process.argv[2] === "-h" || process.argv[2] === "--help" ) { copyJavascript(); copyFilesToProject(); updateProject(); - installPlugins(); clean(); process.exit(); } catch (ex) { http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/87223938/blackberry10/plugins/com.blackberry.jpps/plugin.xml ---------------------------------------------------------------------- diff --git a/blackberry10/plugins/com.blackberry.jpps/plugin.xml b/blackberry10/plugins/com.blackberry.jpps/plugin.xml deleted file mode 100644 index 0eec7c6..0000000 --- a/blackberry10/plugins/com.blackberry.jpps/plugin.xml +++ /dev/null @@ -1,30 +0,0 @@ -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you 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. ---> -<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0" - id="com.blackberry.jpps" - version="1.0.0"> - - <platform name="blackberry10"> - <lib-file src="src/blackberry10/native/device/libjpps.so" arch="device"/> - <lib-file src="src/blackberry10/native/simulator/libjpps.so" arch="simulator"/> - <config-file target="www/config.xml" parent="/widget"> - <feature name="com.blackberry.jpps"/> - </config-file> - </platform> -</plugin> http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/87223938/blackberry10/plugins/com.blackberry.jpps/src/blackberry10/native/device/libjpps.so ---------------------------------------------------------------------- diff --git a/blackberry10/plugins/com.blackberry.jpps/src/blackberry10/native/device/libjpps.so b/blackberry10/plugins/com.blackberry.jpps/src/blackberry10/native/device/libjpps.so deleted file mode 100644 index f0eb90d..0000000 Binary files a/blackberry10/plugins/com.blackberry.jpps/src/blackberry10/native/device/libjpps.so and /dev/null differ http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/87223938/blackberry10/plugins/com.blackberry.jpps/src/blackberry10/native/simulator/libjpps.so ---------------------------------------------------------------------- diff --git a/blackberry10/plugins/com.blackberry.jpps/src/blackberry10/native/simulator/libjpps.so b/blackberry10/plugins/com.blackberry.jpps/src/blackberry10/native/simulator/libjpps.so deleted file mode 100644 index f2c12ff..0000000 Binary files a/blackberry10/plugins/com.blackberry.jpps/src/blackberry10/native/simulator/libjpps.so and /dev/null differ http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/87223938/blackberry10/plugins/com.blackberry.utils/plugin.xml ---------------------------------------------------------------------- diff --git a/blackberry10/plugins/com.blackberry.utils/plugin.xml b/blackberry10/plugins/com.blackberry.utils/plugin.xml deleted file mode 100644 index 746fa76..0000000 --- a/blackberry10/plugins/com.blackberry.utils/plugin.xml +++ /dev/null @@ -1,30 +0,0 @@ -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you 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. ---> -<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0" - id="com.blackberry.utils" - version="1.0.0"> - - <platform name="blackberry10"> - <lib-file src="src/blackberry10/native/device/libutils.so" arch="device"/> - <lib-file src="src/blackberry10/native/simulator/libutils.so" arch="simulator"/> - <config-file target="www/config.xml" parent="/widget"> - <feature name="com.blackberry.utils"/> - </config-file> - </platform> -</plugin> http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/87223938/blackberry10/plugins/com.blackberry.utils/src/blackberry10/native/device/libutils.so ---------------------------------------------------------------------- diff --git a/blackberry10/plugins/com.blackberry.utils/src/blackberry10/native/device/libutils.so b/blackberry10/plugins/com.blackberry.utils/src/blackberry10/native/device/libutils.so deleted file mode 100644 index 126d02c..0000000 Binary files a/blackberry10/plugins/com.blackberry.utils/src/blackberry10/native/device/libutils.so and /dev/null differ http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/87223938/blackberry10/plugins/com.blackberry.utils/src/blackberry10/native/simulator/libutils.so ---------------------------------------------------------------------- diff --git a/blackberry10/plugins/com.blackberry.utils/src/blackberry10/native/simulator/libutils.so b/blackberry10/plugins/com.blackberry.utils/src/blackberry10/native/simulator/libutils.so deleted file mode 100644 index 392ad33..0000000 Binary files a/blackberry10/plugins/com.blackberry.utils/src/blackberry10/native/simulator/libutils.so and /dev/null differ http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/87223938/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/plugin.xml ---------------------------------------------------------------------- diff --git a/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/plugin.xml b/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/plugin.xml deleted file mode 100644 index 474077e..0000000 --- a/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/plugin.xml +++ /dev/null @@ -1,31 +0,0 @@ - -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you 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. ---> -<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0" - id="org.apache.cordova.blackberry10.pimlib" - version="1.0.0"> - - <platform name="blackberry10"> - <lib-file src="src/blackberry10/native/device/libpimcontacts.so" arch="device"></lib-file> - <lib-file src="src/blackberry10/native/simulator/libpimcontacts.so" arch="simulator"></lib-file> - <config-file target="www/config.xml" parent="/widget"> - <feature name="org.apache.cordova.blackberry10.pimlib"></feature> - </config-file> - </platform> -</plugin> http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/87223938/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/Makefile ---------------------------------------------------------------------- diff --git a/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/Makefile b/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/Makefile deleted file mode 100644 index 0cc5eae..0000000 --- a/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -LIST=CPU -ifndef QRECURSE -QRECURSE=recurse.mk -ifdef QCONFIG -QRDIR=$(dir $(QCONFIG)) -endif -endif -include $(QRDIR)$(QRECURSE) http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/87223938/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/arm/Makefile ---------------------------------------------------------------------- diff --git a/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/arm/Makefile b/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/arm/Makefile deleted file mode 100644 index 0e22650..0000000 --- a/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/arm/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -LIST=VARIANT -ifndef QRECURSE -QRECURSE=recurse.mk -ifdef QCONFIG -QRDIR=$(dir $(QCONFIG)) -endif -endif -include $(QRDIR)$(QRECURSE) http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/87223938/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/arm/so.le-v7/Makefile ---------------------------------------------------------------------- diff --git a/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/arm/so.le-v7/Makefile b/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/arm/so.le-v7/Makefile deleted file mode 100644 index 2c76089..0000000 --- a/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/arm/so.le-v7/Makefile +++ /dev/null @@ -1 +0,0 @@ -include ../../common.mk http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/87223938/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/arm/so.le-v7/libpimcontacts.so ---------------------------------------------------------------------- diff --git a/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/arm/so.le-v7/libpimcontacts.so b/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/arm/so.le-v7/libpimcontacts.so deleted file mode 100755 index 03efc41..0000000 Binary files a/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/arm/so.le-v7/libpimcontacts.so and /dev/null differ http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/87223938/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/common.mk ---------------------------------------------------------------------- diff --git a/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/common.mk b/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/common.mk deleted file mode 100644 index 7bc06fb..0000000 --- a/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/common.mk +++ /dev/null @@ -1,18 +0,0 @@ -ifndef QCONFIG -QCONFIG=qconfig.mk -endif -include $(QCONFIG) - -NAME=pimcontacts -PLUGIN=yes -UTILS=yes - -include ../../../../../../meta.mk - -SRCS+=pim_contacts_qt.cpp \ - pim_contacts_js.cpp \ - contact_account.cpp - -include $(MKFILES_ROOT)/qtargets.mk - -LIBS+=bbpim bbcascadespickers QtCore img http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/87223938/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/contact_account.cpp ---------------------------------------------------------------------- diff --git a/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/contact_account.cpp b/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/contact_account.cpp deleted file mode 100644 index 3476e70..0000000 --- a/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/contact_account.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 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 <webworks_utils.hpp> -#include "contact_account.hpp" - -ContactAccount& ContactAccount::GetAccountInstance() -{ - static ContactAccount ca; - return ca; -} - -ContactAccount::ContactAccount() -{ - fetchContactAccounts(); -} - -ContactAccount::~ContactAccount() -{} - -QList<bb::pim::account::Account> ContactAccount::GetContactAccounts(bool fresh) -{ - if (fresh) { - fetchContactAccounts(); - } - return _accounts; -} - -bb::pim::account::Account ContactAccount::GetAccount(bb::pim::account::AccountKey id, bool fresh) -{ - if (fresh) { - fetchContactAccounts(); - } - return _accountMap.value(id); -} - -Json::Value ContactAccount::Account2Json(const bb::pim::account::Account& account) -{ - Json::Value jsonAccount; - jsonAccount["id"] = webworks::Utils::intToStr(account.id()); - jsonAccount["name"] = account.displayName().isEmpty() ? account.provider().name().toStdString() : account.displayName().toStdString(); - jsonAccount["enterprise"] = account.isEnterprise() == 1 ? true : false; - - return jsonAccount; -} - -void ContactAccount::fetchContactAccounts() -{ - QList<bb::pim::account::Account> accounts = _accountService.accounts(bb::pim::account::Service::Contacts); - - _accounts.clear(); - _accountMap.clear(); - for (QList<bb::pim::account::Account>::const_iterator it = accounts.begin(); it != accounts.end(); ++it) { - if ((it->id() != ID_UNIFIED_ACCOUNT) && (it->id() != ID_ENHANCED_ACCOUNT)) { - _accounts.append(*it); - _accountMap.insert(it->id(), (bb::pim::account::Account)(*it)); - } - } -} - - http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/87223938/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/contact_account.hpp ---------------------------------------------------------------------- diff --git a/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/contact_account.hpp b/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/contact_account.hpp deleted file mode 100644 index 3910de8..0000000 --- a/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/contact_account.hpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 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. - */ - -#ifndef _CONTACT_ACCOUNT_HPP_ -#define _CONTACT_ACCOUNT_HPP_ - -#include <bb/pim/account/Account> -#include <bb/pim/account/AccountService> -#include <bb/pim/account/Provider> - -#include <json/value.h> -#include <QList> -#include <QDebug> - -class ContactAccount -{ -public: - static ContactAccount& GetAccountInstance(); - - // get all available accounts which provide contact service - QList<bb::pim::account::Account> GetContactAccounts(bool fresh = false); - // get the contact account with the specific id - bb::pim::account::Account GetAccount(bb::pim::account::AccountKey id, bool fresh = false); - // serialize account to json object - static Json::Value Account2Json(const bb::pim::account::Account& account); - -private: - ContactAccount(); - ~ContactAccount(); - explicit ContactAccount(ContactAccount const&); - void operator=(ContactAccount const&); - // Refresh the accounts list and map - void fetchContactAccounts(); - QMap<bb::pim::account::AccountKey, bb::pim::account::Account> _accountMap; - QList<bb::pim::account::Account> _accounts; - bb::pim::account::AccountService _accountService; - static const int ID_UNIFIED_ACCOUNT = 4; - static const int ID_ENHANCED_ACCOUNT = 6; -}; - -#endif // end of _CONTACT_ACCOUNT_HPP_ http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/87223938/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/device/libpimcontacts.so ---------------------------------------------------------------------- diff --git a/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/device/libpimcontacts.so b/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/device/libpimcontacts.so deleted file mode 100644 index 03efc41..0000000 Binary files a/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/device/libpimcontacts.so and /dev/null differ http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/87223938/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/pim_contacts_js.cpp ---------------------------------------------------------------------- diff --git a/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/pim_contacts_js.cpp b/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/pim_contacts_js.cpp deleted file mode 100644 index 4788bd1..0000000 --- a/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/pim_contacts_js.cpp +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright 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 <json/reader.h> -#include <json/writer.h> -#include <string> -#include "pim_contacts_js.hpp" -#include "pim_contacts_qt.hpp" - -PimContacts::PimContacts(const std::string& id) : m_id(id) -{ -} - -char* onGetObjList() -{ - // Return list of classes in the object - static char name[] = "PimContacts"; - return name; -} - -JSExt* onCreateObject(const std::string& className, const std::string& id) -{ - // Make sure we are creating the right class - if (className != "PimContacts") { - return 0; - } - - return new PimContacts(id); -} - -std::string PimContacts::InvokeMethod(const std::string& command) -{ - unsigned int index = command.find_first_of(" "); - - string strCommand; - string jsonObject; - Json::Value *obj; - - if (index != std::string::npos) { - strCommand = command.substr(0, index); - jsonObject = command.substr(index + 1, command.length()); - - // Parse the JSON - obj = new Json::Value; - bool parse = Json::Reader().parse(jsonObject, *obj); - - if (!parse) { - return "Cannot parse JSON object"; - } - } else { - strCommand = command; - obj = NULL; - } - - if (strCommand == "find") { - startThread(FindThread, obj); - } else if (strCommand == "save") { - startThread(SaveThread, obj); - } else if (strCommand == "remove") { - startThread(RemoveThread, obj); - } else if (strCommand == "getContact") { - std::string result = Json::FastWriter().write(webworks::PimContactsQt().GetContact(*obj)); - delete obj; - return result; - } else if (strCommand == "invokePicker") { - Json::Value result = webworks::PimContactsQt::InvokePicker(*obj); - delete obj; - - std::string event = Json::FastWriter().write(result); - NotifyEvent("invokeContactPicker.invokeEventId", event); - } else if (strCommand == "getContactAccounts") { - return Json::FastWriter().write(webworks::PimContactsQt::GetContactAccounts()); - } - - return ""; -} - -bool PimContacts::CanDelete() -{ - return true; -} - -// Notifies JavaScript of an event -void PimContacts::NotifyEvent(const std::string& eventId, const std::string& event) -{ - std::string eventString = m_id + " result "; - eventString.append(eventId); - eventString.append(" "); - eventString.append(event); - SendPluginEvent(eventString.c_str(), m_pContext); -} - -bool PimContacts::startThread(ThreadFunc threadFunction, Json::Value *jsonObj) { - webworks::PimContactsThreadInfo *thread_info = new webworks::PimContactsThreadInfo; - thread_info->parent = this; - thread_info->jsonObj = jsonObj; - thread_info->eventId = jsonObj->removeMember("_eventId").asString(); - - pthread_attr_t thread_attr; - pthread_attr_init(&thread_attr); - pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED); - - pthread_t thread; - pthread_create(&thread, &thread_attr, threadFunction, static_cast<void *>(thread_info)); - pthread_attr_destroy(&thread_attr); - - if (!thread) { - return false; - } - - return true; -} - - -// Static functions: - -void* PimContacts::FindThread(void *args) -{ - webworks::PimContactsThreadInfo *thread_info = static_cast<webworks::PimContactsThreadInfo *>(args); - - webworks::PimContactsQt pim_qt; - Json::Value result = pim_qt.Find(*(thread_info->jsonObj)); - delete thread_info->jsonObj; - - std::string event = Json::FastWriter().write(result); - thread_info->parent->NotifyEvent(thread_info->eventId, event); - delete thread_info; - - return NULL; -} - -void* PimContacts::SaveThread(void *args) -{ - webworks::PimContactsThreadInfo *thread_info = static_cast<webworks::PimContactsThreadInfo *>(args); - - webworks::PimContactsQt pim_qt; - Json::Value result = pim_qt.Save(*(thread_info->jsonObj)); - delete thread_info->jsonObj; - - std::string event = Json::FastWriter().write(result); - thread_info->parent->NotifyEvent(thread_info->eventId, event); - delete thread_info; - - return NULL; -} - -void* PimContacts::RemoveThread(void *args) -{ - webworks::PimContactsThreadInfo *thread_info = static_cast<webworks::PimContactsThreadInfo *>(args); - - webworks::PimContactsQt pim_qt; - Json::Value result = pim_qt.DeleteContact(*(thread_info->jsonObj)); - delete thread_info->jsonObj; - - std::string event = Json::FastWriter().write(result); - thread_info->parent->NotifyEvent(thread_info->eventId, event); - delete thread_info; - - return NULL; -} - http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/87223938/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/pim_contacts_js.hpp ---------------------------------------------------------------------- diff --git a/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/pim_contacts_js.hpp b/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/pim_contacts_js.hpp deleted file mode 100644 index df8bbd7..0000000 --- a/blackberry10/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/pim_contacts_js.hpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 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. - */ - -#ifndef PIM_CONTACTS_JS_H_ -#define PIM_CONTACTS_JS_H_ - -#include <json/value.h> -#include <pthread.h> -#include <string> -#include "../common/plugin.h" - -typedef void* ThreadFunc(void *args); - -class PimContacts : public JSExt -{ -public: - explicit PimContacts(const std::string& id); - virtual ~PimContacts() {} - virtual std::string InvokeMethod(const std::string& command); - virtual bool CanDelete(); - void NotifyEvent(const std::string& eventId, const std::string& event); - - static void* FindThread(void *args); - static void* SaveThread(void *args); - static void* RemoveThread(void *args); -private: - bool startThread(ThreadFunc threadFunction, Json::Value *jsonObj); - - std::string m_id; -}; - -#endif // PIM_CONTACTS_JS_H_
