http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/67fa7ebb/lib/cordova-blackberry/plugins/com.blackberry.utils/plugin.xml ---------------------------------------------------------------------- diff --git a/lib/cordova-blackberry/plugins/com.blackberry.utils/plugin.xml b/lib/cordova-blackberry/plugins/com.blackberry.utils/plugin.xml deleted file mode 100644 index 746fa76..0000000 --- a/lib/cordova-blackberry/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-cli/blob/67fa7ebb/lib/cordova-blackberry/plugins/com.blackberry.utils/src/blackberry10/native/device/libutils.so ---------------------------------------------------------------------- diff --git a/lib/cordova-blackberry/plugins/com.blackberry.utils/src/blackberry10/native/device/libutils.so b/lib/cordova-blackberry/plugins/com.blackberry.utils/src/blackberry10/native/device/libutils.so deleted file mode 100644 index 126d02c..0000000 Binary files a/lib/cordova-blackberry/plugins/com.blackberry.utils/src/blackberry10/native/device/libutils.so and /dev/null differ http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/67fa7ebb/lib/cordova-blackberry/plugins/com.blackberry.utils/src/blackberry10/native/simulator/libutils.so ---------------------------------------------------------------------- diff --git a/lib/cordova-blackberry/plugins/com.blackberry.utils/src/blackberry10/native/simulator/libutils.so b/lib/cordova-blackberry/plugins/com.blackberry.utils/src/blackberry10/native/simulator/libutils.so deleted file mode 100644 index 392ad33..0000000 Binary files a/lib/cordova-blackberry/plugins/com.blackberry.utils/src/blackberry10/native/simulator/libutils.so and /dev/null differ http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/67fa7ebb/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/plugin.xml ---------------------------------------------------------------------- diff --git a/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/plugin.xml b/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/plugin.xml deleted file mode 100644 index 474077e..0000000 --- a/lib/cordova-blackberry/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-cli/blob/67fa7ebb/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/Makefile ---------------------------------------------------------------------- diff --git a/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/Makefile b/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/Makefile deleted file mode 100644 index 0cc5eae..0000000 --- a/lib/cordova-blackberry/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-cli/blob/67fa7ebb/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/arm/Makefile ---------------------------------------------------------------------- diff --git a/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/arm/Makefile b/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/arm/Makefile deleted file mode 100644 index 0e22650..0000000 --- a/lib/cordova-blackberry/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-cli/blob/67fa7ebb/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/arm/so.le-v7/Makefile ---------------------------------------------------------------------- diff --git a/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/arm/so.le-v7/Makefile b/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/arm/so.le-v7/Makefile deleted file mode 100644 index 2c76089..0000000 --- a/lib/cordova-blackberry/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-cli/blob/67fa7ebb/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/arm/so.le-v7/libpimcontacts.so ---------------------------------------------------------------------- diff --git a/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/arm/so.le-v7/libpimcontacts.so b/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/arm/so.le-v7/libpimcontacts.so deleted file mode 100755 index f90047f..0000000 Binary files a/lib/cordova-blackberry/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-cli/blob/67fa7ebb/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/common.mk ---------------------------------------------------------------------- diff --git a/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/common.mk b/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/common.mk deleted file mode 100644 index 7bc06fb..0000000 --- a/lib/cordova-blackberry/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-cli/blob/67fa7ebb/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/contact_account.cpp ---------------------------------------------------------------------- diff --git a/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/contact_account.cpp b/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/contact_account.cpp deleted file mode 100644 index 3476e70..0000000 --- a/lib/cordova-blackberry/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-cli/blob/67fa7ebb/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/contact_account.hpp ---------------------------------------------------------------------- diff --git a/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/contact_account.hpp b/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/contact_account.hpp deleted file mode 100644 index 3910de8..0000000 --- a/lib/cordova-blackberry/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-cli/blob/67fa7ebb/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/device/libpimcontacts.so ---------------------------------------------------------------------- diff --git a/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/device/libpimcontacts.so b/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/device/libpimcontacts.so deleted file mode 100644 index f90047f..0000000 Binary files a/lib/cordova-blackberry/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-cli/blob/67fa7ebb/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/pim_contacts_js.cpp ---------------------------------------------------------------------- diff --git a/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/pim_contacts_js.cpp b/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/pim_contacts_js.cpp deleted file mode 100644 index 4788bd1..0000000 --- a/lib/cordova-blackberry/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-cli/blob/67fa7ebb/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/pim_contacts_js.hpp ---------------------------------------------------------------------- diff --git a/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/pim_contacts_js.hpp b/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/pim_contacts_js.hpp deleted file mode 100644 index df8bbd7..0000000 --- a/lib/cordova-blackberry/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_
